Level and distance gauge with alarm function [140209-I]

This project achieves a measuring instrument with the following functions:
This project achieves a measuring instrument with the following functions:
- Measurement of liquid levels
- Level monitoring function with relay output and LED alarm indicator
- Programmable min/max alarm levels
- Storage of min/max calibration values for 10 different containers or tanks
- Distance measurement
- Intuitive menu guidance via LCD display
Many of us are aware of this problem: The lawn mower requires gasoline and we don't know how much petrol in the petrol tank is left. The shake test provides only vague results. Or we want to find out the level of an oil tank or rainwater cistern. Another practical example: We fill a big container with the garden hose with water, but we don’t want to observe this process until the container is full. Here the water supply can be interrupted by a solenoid valve automatically when the desired level is reached. Or you would like to simply gauge the distance between two objects. Read the attached documents and you can realize a low-cost instrument with a high utility value.
Revision 1
English and german documentation corrected
Revision 1.1
English and german documentation expanded
Revision 1.2
Schematic figure for calibrating empty level corrected in english and german documentation
Revision 1.3
Some indefinite descriptions and translation mistakes corrected
Revision 1.4
Bug in menu navigation resolved - new software version added
English and german documentation expanded
Revision 1.5
English and german documentation corrected
Revision 1.6
Component change: Regulator LT 1086 CT-5 replaced with type LM2940CT-5 because of lower dropout voltage.
English and german documentation corrected
Revision 1.7
Code optimization and comments added
Revision 1.8
Code optimization and comments added
Revision 1.9
Hardware change: 2.2 KOhm (R4) resistor added to pulldown the ECHO-port.
Some US-modules need this resistor to work properly.
Circuit diagram, english and german documentation corrected
Revision 2.0
Weblink added to english and german documentation
Revision 2.1
Code correction: If no echo signal should be received an error message will be displayed now.
Revision 2.2
Code correction: If no echo signal should be received the software may hang in a loop when using the module DYP-ME007. To prevent this problem a watchdog logic is implemented now. Does not occur when using module HC-SR04, because this module has a hardware timeout.
Revision 2.3
Code correction: Logic for mode 'Level Watchdog' corrected - was defect since last update. ASCII-value for displaying level as bargraph changed for using lcd MC41605A6WK.
Revision 2.4
Code correction: Software timeout handling for US-modules without hardware timeout corrected.
Discussie (5 opmerking(en))
ClemensValens 10 jaar geleden
Hi,
Do you think it is wise to drive the relay directly from the MCU? I don't know which kind of relay you use, but typical 5V ones I usually encounter start at some 40mA. The ATmega8 datasheet lists this value as the absolute maximum value for an I/O pin. Furthermore, at 40mA the I/O pin output voltage drops to 4V. The hold current for the relay will be lower, still it feels a bit risky. Since you don't clearly specify the relay, people may use anything they have lying around. What does it cost to add a transistor to drive the relay? It would make the circuit more robust.
Regards,
Clemens
JoergT 9 jaar geleden
giant 9 jaar geleden
JoergT 10 jaar geleden
JoergT 10 jaar geleden
Lucky 10 jaar geleden
Some minor software issues to be solved, hardware works OK.
The LCD we chose -Midas MC41605A6WK-SPTLY, to be more precise- has an on-board resistor for its LED backlight. This means the backlight can be directly connected to +5V without additional current limiting, so we could have omitted the anode resistor (R3) on the PCB. However, if another brand or type of LCD is used this resistor can be handy, or the connections of R3 can be used to add an ON/OFF switch to the backlight to save energy when the circuit is battery powered. But of course R3 can also be replaced by a jumper wire when our type of LCD is used.
pcb-top.jpg (63kb)
pcb-bottom.jpg (63kb)
Lucky 10 jaar geleden
JoergT 10 jaar geleden
Lucky 10 jaar geleden
Not too difficult to solder and the hardware isn't too complicated, so I didn't expect much issues. However, I was unpleasently surprised by the LCD I ordered (Powertip PC1604LRU-AWB-H), which appeared to need a negative voltage on the contrast pin (VO on pin 3) to get readable text on the display. For the time being this was solved with the good-old diode trick (schematic) to get one end of the contrast potmeter at -0.7V. The result is not really encouraging, but I can still use this LCD before I get a more modern LCD in stead.
Negative contrast voltage on LCD modules was quite common 'in the old days', but I hadn't seen one for years!
JoergT 10 jaar geleden
Lucky 10 jaar geleden
JoergT 10 jaar geleden
Lucky 10 jaar geleden
Lucky 10 jaar geleden
JoergT 10 jaar geleden
Lucky 10 jaar geleden
JoergT 10 jaar geleden
Lucky 10 jaar geleden
Hi Joerg,
I've started working on the project, schematic design in Altium Designer is nearly finished, PCB design will begin soon.
Some comments on the schematics though, I hope you don't mind. First I'd rather use the LM2940T than the -CT version (temperature range to -40 instead of 0 degrees). I also added a 47u capacitor to the output (see datasheet), and some decoupling for the LCD supply.
Maybe I just overlooked, but I didn't find details on the relay, can you please help?
Best regards,
Luc
JoergT 10 jaar geleden
Lucky 10 jaar geleden
JoergT 10 jaar geleden
Lucky 11 jaar geleden
Hi Joerg,
I really like this project :-) Did you make a PCB layout or did you take a piece of veroboard to build the circuit?
Regards,
Luc
Lucky 11 jaar geleden
JoergT 11 jaar geleden
Lucky 11 jaar geleden
JoergT 11 jaar geleden