⚠️ This forum has been restored as a read-only archive so the knowledge shared by the community over many years remains available. New registrations and posting are disabled.

All times are UTC + 8 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Oct 7th, '13, 02:29 
Newbie
Newbie

Joined: Sep 19th, '13, 02:49
Posts: 30
Gender: Male
Are you human?: YES
Location: Utrecht, Netherlands
Has anyone ever automated the monitoring of the water level in the growbed with an Arduino or a Raspberry PI?

I just set up my aquaponics system with a single growbed and tank using a bell siphon mechanism. While the bell siphon seems to work pretty dependably, I had a situation the other day where the media guard got clogged up and the growbed started to over flow. While I think I have rectified the problem, I was thinking of creating some sort of mechanism that would allow me to monitor/measure the cycles.

While looking on the web, I came across this liquid level sensor device: https://www.sparkfun.com/products/10221 which seemed like it would do exactly what I wanted. Has anybody ever tried using this liquid level sensor before?

I currently have a Raspberry PI in my greenhouse on which the Motion package is running to take a photo of the growbed every hour to use for later time-lapse videos. While adjusting the USB camera, and listening to a couple of flush cycles, it occurred to me that I could also take a 15 second dB sample and write some code to detect irregularities. The actual flush/drain part of the cycle makes a lot of noise. As there is a microphone in the webcamera it seemed like a potential cheap way to monitor this....

Has anybody tried any other method to automate to counting/monitoring growbed flush cycles using an Arduino or Raspberry PI?


Many thanks,

Mark


Top
 Profile  
Reply with quote  
    Advertisement
 
PostPosted: Oct 8th, '13, 17:30 
Newbie
Newbie

Joined: Sep 19th, '13, 02:49
Posts: 30
Gender: Male
Are you human?: YES
Location: Utrecht, Netherlands
After doing a bit more research, I think I have found a solution to verifying auto-siphon cycles using a Raspberry PI and the mic on my web cam. The highlight is that there is a clear audio trend of the flushing process taking place every 9-10 minutes. I recorded 60 minutes of sound inside the greenhouse last night and then put the wav file in Audacity which looks as follows:

Image

I then wrote a simple script that takes a 1 second sound measurement and returns the noise level between 0 and 99. My plan is to write this all to a Xively feed when I get the chance. In the meantime, here is a log of what I did to get this working:

1. Review article at http://www.g7smy.co.uk/?p=283. This tells you everything you need to know about the Linux ALSA suite.

2. Verify that the USB Webcam device is running:
$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 046d:0809 Logitech, Inc. Webcam Pro 9000
Bus 001 Device 005: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

3. Run the alsamixer program to find the location of the microphone. In my case I pressed F6 to view the sound cards and selected the "1 USB Device" entry with the matching address (046d:0809) above.
$ alsamixer

4. I then set this device as the default.
$ sudo alsactl store 1

5. Because there was not a lot of noise being captured, I turned up the gain to 16 (100%).
$ amixer -c 1 cset numid=2,iface=MIXER,name='Mic Capture Volume' 16

6. Finally, I came up with a bash script that returns a numeric value of the current noise level. It is actually an average of around 8000 samples so the spikes are not so obvious. In my particular environment, a value under 13 indicates a trickle of water coming out the standpipe. A value over 20 indicates a flush taking place.
$ arecord -D plughw:1 --duration=1 -vvv /tmp/1sec.wav 2> /dev/null | egrep '\%$' | cut -c 58-59 | awk '{ total+=$1; count+=1} END {print total/count}'


Clearly some more tuning with the mic gain and the averaging of the 8000 (1 second) sound samples can help make both parts of the cycle more clear.

Any comments on this experiment related to improvements are appreciated!

Mark


Top
 Profile  
Reply with quote  
PostPosted: Oct 8th, '13, 19:05 
People luv to hear their siphons suck... :lol:


Top
  
Reply with quote  
PostPosted: Oct 9th, '13, 00:36 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
It's an interesting approach.

I like it :)

and this from the half baked department...

It might be also worth adding a minimum water level by dropping two stainless steel probes into the water so they end at the desired depth, and then sampling for at least some conductivity. No conductivity means no water and time to freak out.

I remember seeing an FM remote rain water tank monitoring electronics kit for sale. It had several lengths of stainless wire that you could cut to whatever lengths you required, and would beep out the level every few minutes. I'm guessing it just added the values from each wire and beeped for each one that was submerged. 3 beeps equals 3 feet deep, or 3 metres, or whatever.

I've been thinking along the lines of using one input pin to run each wire, but now that I type about it, I think it could be done with just one pin if you just add the readings of however many wires you need for whatever resolution you want.

I might try something along these lines....You could have 10 stainless wires hanging into the sump all spaced evenly from an earth wire. So perhaps arranged in a circle, with the earth wire in the centre. Cut the wires so they range in length from 1 to 10 inches, tie the 10 wires to an input pin and as you fill the sump, you should see resistance values changing as each new wire is submerged. But I'd do a test in a coffee cup first, because I notoriously have no idea about electrons and their ways.

If you just expose different water levels to two parallel probes, does the resistance change depending on how much of the probes are submerged.

Perhaps some things to watch out for with using sound, is that it might be possible for the sound of water dumping to the ground being detected as the system working properly.

Or a regular increase in ambient noise giving a false reading that everything was working properly. Say buses driving past every 10 minutes.

It's 3am and all this looks a little vague when I re-read it.


Top
 Profile  
Reply with quote  
PostPosted: Oct 12th, '13, 05:54 
Newbie
Newbie

Joined: Sep 19th, '13, 02:49
Posts: 30
Gender: Male
Are you human?: YES
Location: Utrecht, Netherlands
Thanks for the feedback bullwinkell.

I had not thought about the idea of using water conductivity to measure this. makes me want to get out my electrical meter and test the resistance of water!

I just got the installation up on the web at http://paago.org/aquaponics. Check out the Xively link in the upper right-hand-corner. While the siphon sound patterns are not exact, i can at least see that they are happening every 10 minutes with high confidence.

This weekend i will hopefully have time to get my 3 temperature probes working. they use the I2C interface so it will be something new to figure out.

Regards,

Mark


Top
 Profile  
Reply with quote  
PostPosted: Jan 18th, '14, 12:03 
Newbie
Newbie

Joined: Jan 6th, '14, 21:22
Posts: 20
Gender: Male
Are you human?: only after coffee
Location: South Australia
That is a very clever implementation, using the mic and some python to do the detection. I agree that noise has to be considered to prevent false triggering, and that having some water level probes in would be a good idea so you can detect a critical condition. Keep up the good work, I'm very interested to see where this goes! :thumbright:

Cheers
KS


Top
 Profile  
Reply with quote  
PostPosted: Jan 18th, '14, 12:50 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
Is your pH meter always in the water?

Does it get effected by a slime layer buildup over time?


Top
 Profile  
Reply with quote  
PostPosted: Jan 31st, '14, 06:57 
Newbie
Newbie

Joined: Sep 19th, '13, 02:49
Posts: 30
Gender: Male
Are you human?: YES
Location: Utrecht, Netherlands
Thanks kingsapper. I have not attempted to write any software to try and predict abnormal behavior. I just have a nervous tick of looking at my Xively feed 2-3 time per day to make sure that everything is working. It drives my wife and daughters crazy. :)

BullwinkleII: I am not using a ph meter. I just measure all of the chemistry values about once every week or two and upload the data into my Xively feeds. I investigated this at one time but it would have cost me around $200. As it turns out, the chemistry has been VERY stable over the past 6 months. I have around 40 goldfish in the system. All still alive and it is clear that they have grown.

I am counting the days until spring equinox here in the Northern hemisphere!

Mark


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 8 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group
Portal by phpBB3 Portal © phpBB Türkiye
[ Time : 0.042s | 14 Queries | GZIP : Off ]