Shop OBEX P1 Docs P2 Docs Learn Events
Interfacing with a rain gauge w/12v signal — Parallax Forums

Interfacing with a rain gauge w/12v signal

dharwooddharwood Posts: 12
edited 2011-07-11 11:30 in Accessories
Hello,

Newbie question.

I am doing a project that requires me to read a rain gauge. The rain gauge sends a signal every 0.01" of rain detected. The specs for the device indicate that the output signal is 12v. The rain gauge has it's own 12v input power source. I am using a Propeller dev board to do the project and am currently using 3.3v.

How do I connect the rain gauge output to the dev board? Do I use a 3.3v Voltage Regulator? Or is a Resistor all I need?

Can I interface a device and the dev board that are on seperate circuits?

Thanks,
Dan

Comments

  • kwinnkwinn Posts: 8,697
    edited 2011-07-04 20:42
    A 20K or 22K resistor should be all you need, but I would add clamping diodes to ground and 3.3V or a 3V zener to ground near the propeller input pin.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-07-04 21:48
    Remember that the Propeller's ground has to be connected to the rain gauge's ground.

    You can also make a voltage divider like this:
    Rain gauge output ---------- 10K ---------- 3.3K ----------- Rain gauge ground
                                        |                                 |
                                    Propeller Pin                  Propeller ground
    
    This will provide about 3V to the Propeller Pin which is fine.
  • FranklinFranklin Posts: 4,747
    edited 2011-07-05 12:46
    Depending on the gauge it may just be a switch that is closed and the input voltage is pulsed to the output (mine works that way) Can you provide a link to the page for this gauge?
  • dharwooddharwood Posts: 12
    edited 2011-07-05 13:07
    Thanks for all the repsonses. I have some reading up to do on clamping diodes, zener diodes and voltage dividers!

    kwinn - I think I understand what you are suggesting, but am confused on both a clamping diode and a zener diode? Don't they kinda do the same thing (different, but similiar). Is this a cover your bases approach? Also I didn't understand what you meant by putting them to the ground AND near the input pin. This is probably my NEWBIE shinning through, but those seem to be different to me. An explanation of the connection order would help me greatly! (like Mike did).

    Mike - Thanks! I will likely try your suggestion first, since it is straight forward. Thanks also for steering me towards connecting the grounds. I knew I would have to do something of this nature, but wasn't sure how to ask the question. I'm glad you picked up on that! I would still like to try kwinn's suggestion, since I can imagine that if I continue to interface with sensors that are not 3.3v/5v, sooner or later I will need to learn how to "clamp" the inputs to ensure stability.

    Franklin - You hit the nail on the head. This is a pulsed output. The device is an optical rain sensor that "emulates" a tipping bucket sensor as a drop-in replacement. It isn't as accurate, but is much lower maintenance and cheaper than most tipping bucket gauges. Accuracy isn't important in my application, so I thought it was a good choice. I just need to know if it rained "a little" or "a lot".

    The device can be found on this link: http://www.rainsensors.com/how_it_works.php
    The specs can be found on this link: http://www.rainsensors.com/docs/rg-11_instructions.pdf

    As I eluded to, I am using it in Tipping Bucket mode, however the "Drop Dectector" mode seems really cool too, but alas....I must learn to walk...before I run.

    Thanks again for the help. I am looking forward to trying these suggestions, and will reply with the results!
  • FranklinFranklin Posts: 4,747
    edited 2011-07-05 13:56
    There is no voltage on the contacts you will be connecting to the micro so you can provide 3.3v and read that with a pin. You still need to provide the 12v for the coil though.
  • dharwooddharwood Posts: 12
    edited 2011-07-05 15:34
    Again I have to show my NEWBIE colors...

    I don't understand why I don't need to be concerned about the voltage. The specs indicate that the output is "Relay closure, Normally Open and Normally Closed contacts. Max load 1A, 24 VDC". Some modes support 24v, however I am using the mode that only requires providing 12v, therefore wouldn't the contact pulse be "potentially" 12v at 1 amp?

    I am sure I am missing something in what you are saying, so let me explain what I did. What I am doing to power this is using a CAT5 cable and a POE (Power Over Ethernet) injector. I have combined and connected the blue wires to the DC+ and the brown wires to the DC-. I then combined and connected the orange and the green to the COM and NO contacts.

    I really appreciate your help!

    Thanks,
    Dan
  • kwinnkwinn Posts: 8,697
    edited 2011-07-05 18:31
    The attached diagrams show what you seem to have on the rain gage, a diode clamping circuit and a zener diode circuit for use with higher voltage signals.

    The NO/NC circuit is simple. The resistor connected to the input pin pulls that pin up to 3.3volts when the relay is open. When the relay closes it connects the input pin to ground. The only gotcha is that the contacts may bounce open and closed several times so the software needs to de-bounce it.

    The second circuit is the clamping diode circuit. when the input voltage gets about 0.7V higher than the 3.3V supply the top diode starts to conduct and "clamps" the input voltage. If the input voltage drops to about 0.7V lower than the ground the lower diode starts to conduct and clamps the input voltage.

    The third circuit is the zener. The input signal will not be higher than the rated voltage of the zener diode, or lower than about -0.7V with respect to ground.

    With a NO/NC contact you have the clamping circuits are not required. The power for the rain gage is still needed.
  • dharwooddharwood Posts: 12
    edited 2011-07-05 20:40
    OK, I think my brain is finally processing the information. I was "blocking" due to a pre-conceived notion that the device was "sending" a signal at a specified voltage (12v), which seemed logical to me since I was powering the device at 12v. I now understand that the device is simply closing the circuit that I provide 3.3v (or whatever) to.

    Thank you kwinn for the schematics on the various configuration options. That is extremely helpful to me. I intend to try all three so I can become more familar with these concepts and their application.

    As for de-bouncing the simple approach, I think this will be straightforward in the mode that I intend to use, since the contact should not close more that once every couple of seconds (extreme worse case), so I should be able to process the closure and ignore any false-positives for a specified interval of milliseconds.

    I have confirmed the device is working and will connect it to my dev board now that you have given me the confidence that I won't fry anything :)

    This is just a first step in a much bigger project that "hopefully" will include the ability to retrieve the rainfall data remotely over the web and ultimately remotely/automatically drive a sprinkle system based on actual rainfall amounts.

    I will undoubtely be posting more questions on these forums to accomplish all this, but have to say that I have been monitoring these forums for some time and am impressed on how willing everyone is to help folks of all abilities, without making it painful when those of us that are "less informed' need guidance.

    Thanks again!
  • kwinnkwinn Posts: 8,697
    edited 2011-07-05 22:33
    Do keep in mind that the clamping diodes and Zener circuits are only useful if the signal voltage is higher than 3.3V. I suppose you could connect the relay common to the 12V supply (not that I recommend that) to try the other circuits out. That would give you a 12V signal. I would suggest using a simple CMOS gate for experimenting rather than risk your prop dev board.

    Your ultimate goal and even more are well within the capability of the prop. A complete weather and ground moisture measurement station has been built with a propeller protoboard, and that communicates with a second protoboard that controls an irrigation system for a nursery. One protoboard could have carried out both functions but it was more cost effective to use two due to the location of the irrigation pumps and controls.

    As to people on this forum helping folks of all abilities without making it painful, I couldn't agree more. It was one of the things that made me join. We were all new to this at some point, and I believe the person helping gains from it as much as the person being helped.

    Good luck with your project, and feel free to ask for help or answers any time.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2011-07-06 09:09
    That's an interesting rain gage. Thanks for pointing it out.

    It does require the 9 to 30 Vdc power for the internal circuitry, but the rain gage contacts appear to be an isolated spdt relay. I'm a little surprised that that the output is a mechanical relay, instead of a solid state one, especially for the rain gage emulator. I'd expect some kind of opto-relay there. Can you actually hear it clicking when it detects rain? Standard rain gages usually use a long-life dry contact reed relay and the tipping bucket has a magnet that closes the relay every time the bucket tips.

    If this gage does use a mechanical relay it will probably bounce when it closes, as others have said. (not a problem if it is solid state). If there is bounce, here is another circuit that can help to pre-filter.
    rain_circuit.png

    The gage rapidly discharges the 1000pF capacitor through 220Ω, but the capacitor takes longer to charge back up through the 10kΩ, thus smoothing out some of the bounce. The 220Ω limits current through the switch, because you don't want to wear it out with a spark from the capacitor discharge. The 5V zener is protection from high voltages, as a rain gage out on a cable is a magnet for lighting induced voltage surges. The 1kΩ is additional protection for the CPU input pin.

    In this circuit, the CPU has to poll the pin often enough so as not to miss a pulse. Rain pulses can be infrequent and frequent polling may be a waste of CPU resources. Another technique is to use the capacitor as a storage element. Remove the 10kΩ pullup resistor. Instead, the CPU charges up the capacitor to +3.3 V, as a high output, then turns the pin around to be an input. At a later time, it comes back, and if it finds that the pin is low, that means that a raindrop has occured in the interim. It counts that and in any case refreshes the high level on the capacitor. Using that technique, the CPU does not have to pay so much attention to the rain gage. That is important with the BASIC Stamp, but not so much an issue with the Propeller.
    433 x 207 - 8K
  • dharwooddharwood Posts: 12
    edited 2011-07-10 17:53
    I'm not sure if it is a mechanical relay or not. The relay part number is: TSC-105L3H. It is a decent sized component, so maybe it is mechanical. As far as whether it has an audible click...maybe... I have to run water over it to get it to trigger, so it is hard to test in a "quiet" environment, however I thought I heard a click when the light flashed.

    The overall quality of the device is very good IMHO. The dome has a heft to it, that makes it feel substantial. It has rubber o-rings to seal it against the elements. Overall small and easy to mount out of the way.

    I was looking at tipping bucket devices, but found that most are pretty expensive (up to $600). The average price was around $300. I found one for $75, but it looked really cheap (all plastic). While I admit that I would like the accuracy of a tipping bucket device, I really don't require it.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2011-07-11 11:30
    You can find the data sheet for that part# at Digikey.com. It is mechanical, rated for 5 million mechanical operations at no load, and 10000 electrical at full load (24Vdc/1A). That should last quite a long time in the rain gage! I'll be interested to hear how it works out.

    The Davis Instruments tipping bucket rain gage ($75) is actually well made. They bring the cost down through their volume of sales. It is made of a UV resistant polyethylene and it holds up outdoors through years of exposure. The funnel does have to be kept frees of debris.
Sign In or Register to comment.