Previous Posts:
Epidode 1: Forget Me Not: Application
Episode 2: Forget Me Not: The Best Laid Plans ...
Episode 3: Forget Me Not: Setup EnOcean with openHAB
Episode 4: Forget Me Not: Medication System
Episode 5A: Forget Me Not: Using Notify My Android with OpenHab
Problems to Date:
- Newark does not carry the STM 320U, so if I really need it I'll have to purchase it from Digikey on my own dime.
- I placed my first order on August 4th, but there are delays. I compensated for this by working on my design and the medication reminder system
The Idea
Let me start by describing how my plant watering should work. The sensor of Figure 1 will be placed in the soil of a potted plant on my patio. I purchased this one from DX.com. This sensor will be interfaced to the Raspberry Pi. When a certain low threshold is reached the system will activate a sump pump to water the plant until a high threshold is reached. Simple right?
Figure 1: Soil Moisture Sensor (Picture from DX.com)
Functional Diagram
Figure 2 shows the functional diagram of the plant watering system. I will be building this system with the components I receive from Newark. I've also purchased a few prototyping boards from Amazon to put the comparator circuit on.
Figure 2: Watering System Functional Block Diagram.
120 VAC - The mains voltage in North America.
LS5012 – Lambda-Tek power supply. 12 VDC out.
USB to 5 VDC - Standard Pi Power Supply unit. MWS158-0502200UC
RASPBERRY PI - Model B+
12 to 5 VDC - LT1529CT-5
FUSE - 2A fuse to protect the sump pump. It's in water after all.
COMPARATOR CIRCUIT - Circuit to determine when the soil is at the low and high thresholds.
SUMP PUMP - Estone DC 3.5V - 9V 3W USB Submersible Water Pump Aquarium Fish Tank Fountain Pond Pump (Amazon)
SENSOR - Funduino soil moisture sensor.
The Comparator Logic
The sensor will be powered by 3.3 Volts. The output swings from 0V to 2.3V, where 2.3 Volts is when the sensor is in water. Since the Raspberry Pi does not have a built-in ADC, we'll have to be a bit creative in reading the sensor output. I'm not concerned with the with the exact moisture level, just whether or not it is above or below set thresholds. My proposed system involves a dual comparator with a low threshold on one comparator and a high threshold on the other. The logic of the system can be deduced from Figure 3.
Figure 3: Comparator circuit logic
The soil moisture signal appears on both non-inverting inputs of the two comparators. The high and low thresholds are set through resistive dividers and placed on the two inverting inputs. The two outputs, High and Low, will be logic level signals that I can read with the Raspberry Pi, which means no ADC is required.
Suppose the low and high soil moisture thresholds are set at 20% and 80% respectively and the soil has a moisture reading of 50%. As the moisture drops to below 20% the raspberry pi will read a ‘0’ on the outputs of the comparators and trigger the sump pump to periodically water the plant until 80% soil moisture is reached. At this point the raspberry pi will read a ‘1’ on each output of the comparators. The plant will not be watered again until the soil moisture goes below 20%.
The Circuit
Figure 4 shows the complete circuit for my add-on to the Raspberry Pi. The new 40 pin header appears in the upper right corner. Input connections, power supplies, and decoupling appear on the left. Finally, the dual op-amp appears in the lower right corner.
Figure 5: The Raspberry Pi Comparator Board Add-on
Conclusion
The circuitry is quite simple and shouldn’t take very long to build. It will be my first task when I receive my parts. If the delay continues, I will write the Raspberry Pi code assuming my circuit will work. That’s all for this post!
Top Comments