PDA

View Full Version : bs2 analog I/O



Bullwinkle
01-06-2006, 08:02 AM
Kicking around ideas for a rain sensor for my irrigation controller. Would it be possible to rig up a resistive pair of tin foil plates, say, and supply it with +5v and have the stamp read the voltage on the other side?

If the voltage is zero, the the plates are dry, but if the voltage is 0.25v (say) then that plates are wet, therefore it is raining, or has rained recently?

In other words is there an analog input on the stamp somewhere that I could read the 0.25v ( or whatever ) voltage from. Or would I somehow have to convert this to a digital (TTL level) input?

Thanks.

Bullwinkle
01-06-2006, 08:06 AM
D'oh - found my answer in the FAQ!

RTFM!!! http://forums.parallax.com/images/smilies/smile.gif

What can I use the I/O pins for?
The BASIC Stamp’s I/O pins are perfectly suited for digital input and output with TTL/CMOS level (0 to 5 volt)
signals. However, you can use some special commands and techniques to input and output limited analog signals.
For example, the RCTIME and PWM commands can be used to read a variable resistance or output a variable
voltage from 0 to 5 volts. The I/O pins can not be used to read analog voltages by themselves, however, but this
can be done by interfacing the I/O pins to an A to D converter chip.

Robert Kubichek
01-06-2006, 08:30 AM
Bullwinkle said...
Kicking around ideas for a rain sensor for my irrigation controller. Would it be possible to rig up a resistive pair of tin foil plates, say, and supply it with +5v and have the stamp read the voltage on the other side?

If the voltage is zero, the the plates are dry, but if the voltage is 0.25v (say) then that plates are wet, therefore it is raining, or has rained recently?

In other words is there an analog input on the stamp somewhere that I could read the 0.25v ( or whatever ) voltage from. Or would I somehow have to convert this to a digital (TTL level) input?

Thanks.


The links below are great for a personal weather station, which you should need in order to set up an accurate irrigation controller.

Here is a link to a 1-wire weather station;
www.maxim-ic.com/products/ibutton/solutions/product.cfm?id=11 (http://www.maxim-ic.com/products/ibutton/solutions/product.cfm?id=11 )

Here is a link to 1-wire I-button site, with very good links towards bottom of page (humidity sensor, rain gauge);
www.maxim-ic.com/products/ibutton/weather/index.cfm#humid (http://www.maxim-ic.com/products/ibutton/weather/index.cfm#humid )

Here is a web page that is titled " An instrumentation network for weather data on the Web ":
www.javaworld.com/javaworld/jw-05-1999/jw-05-javadev.html (http://www.javaworld.com/javaworld/jw-05-1999/jw-05-javadev.html )

This info should get you going, besides interfacing to the stamp, it can also be interfaced to a PC, or the PINK module...http://forums.parallax.com/images/smilies/yeah.gif

Bob N9LVU http://forums.parallax.com/images/smilies/scool.gif

Bullwinkle
01-06-2006, 08:55 AM
Thanks Robert!

Some great ideas in those links. I love the seesaw rain gauge idea. Since all I want to do is detect rain, I can probably build a much simpler device based on the same principle, and it's digital - which solves another problem right there!

My idea at this stage is to have the software poll the rain sensor at regular intervals and add to a counter each time the sensor is detected as being "on". Then, once the rain sensor returns to the "off" position, start decrementing the counter every x cycles until it reaches zero once again. If the counter is non-zero then disable all watering events. Calibrating the counter decrement rate will take some trial-and-error.

This is GREAT. I'm having fun already! http://forums.parallax.com/images/smilies/smile.gif

Bean
01-06-2006, 09:00 AM
Bullwinkle,
If you use the BS2px you could use the built-in comparitor to do what you want.
Bean.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-VideoˇModule" Now available from Parallax for only $28.95

http://www.parallax.com/detail.asp?product_id=30012

"SX-Video OSD module" Now available from Parallax for onlyˇ$49.95
http://www.parallax.com/detail.asp?product_id=30015

Product web site: www.sxvm.com (http://www.sxvm.com)

"I hope the goonwave is not vaporware"
ˇ

Bullwinkle
01-06-2006, 09:13 AM
Thanks Bean!

An analog comparitor! That's fantastic. These little guys can do just about anything.

Robert Kubichek
01-06-2006, 09:46 AM
Bullwinkle said...
Thanks Robert!

Some great ideas in those links. I love the seesaw rain gauge idea. Since all I want to do is detect rain, I can probably build a much simpler device based on the same principle, and it's digital - which solves another problem right there!

My idea at this stage is to have the software poll the rain sensor at regular intervals and add to a counter each time the sensor is detected as being "on". Then, once the rain sensor returns to the "off" position, start decrementing the counter every x cycles until it reaches zero once again. If the counter is non-zero then disable all watering events. Calibrating the counter decrement rate will take some trial-and-error.

This is GREAT. I'm having fun already! http://forums.parallax.com/images/smilies/smile.gif


If you calibrate the rain sensor, take the total for say a"24hr time period" store the amount, and subtract that amount from your "daily" plant requirement.
The remainder will be the amount that you need to "make up".....
You don't need to figure the ramp up/down that way....
Plus you will have a baseline as to cost of "water pumped" and a great record of "rainfall, humidity, temp, wind" and don't forget RECEIVED SUNLIGHT.... http://forums.parallax.com/images/smilies/tongue.gif

Bob N9LVU http://forums.parallax.com/images/smilies/scool.gif

Genesis
01-06-2006, 11:32 AM
A simple possibility for a rain sensor is to use a darlington transistor and two metal plates which are close-spaced and will be bridged by rain.ˇ Make sure you use appropriate resistors to limit the bias and collector currents and also protect the Stamp in the event you accidentally try to drive the "input" pin in your code.

I've used this with great success for a "wet" or "touch" sensor in the past; it works very well.

The only potential "gotcha" with this arrangement is the possibility of "gunk" bridging the contacts.ˇ To get around this you could use a pair of reed switches and a tipping-bucket range gauge, and look for the tips - if the switches are cycling, its raining.....

As was mentioned you can also count the actual rain amount with the tipping bucket gauge, and then calculate how much irrigation you actually need.ˇ This is even better!

Bullwinkle
01-06-2006, 02:06 PM
So many good ideas, so little time. I can't wait!

"Received Sunlight" is not a problem - I live in inland Australia (Canberra). It's sunny (and hot) here most days when I'd want to be irrigating anyway.

Depending on memory I may add a "fully auto" mode to my controller where it irrigates based on a table of values depending on the month. That way it will automatically ramp up as summer really bites hard in late January/early February, then easy down until it does not need to run at all between late autumn and early spring.

Designing the user interface will be fun. I plan to use a 4x20 LCD screen and a few momentary contact switches on the front panel. Maybe an ethernet interface (wireless?) later on - the Rolls Royce edition. http://forums.parallax.com/images/smilies/smile.gif

Tracy Allen
01-07-2006, 01:01 AM
Corrosion gunk can build up if DC currents flow across a wet metal grid. Pulse the grid briefly and infrequently (from one Stamp pin as an output while another Stamp pin is an input). Or, better yet, use AC excitation of the grid. Here are a couple of links:
[urlhttp://www.emesys.com/OL2mhos.htm
www.emesys.com/lwet_dat.htm (http://www.emesys.com/lwet_dat.htm)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com (http://www.emesystems.com)

Philip Gamblin
01-10-2006, 11:04 AM
Just to take a different tack, you could use a small container sitting on a mirco switch. Vessel collects water, then toggles switch.

Paul Baker
01-10-2006, 09:36 PM
Bullwinkle said...
Thanks Robert!

ˇI love the seesaw rain gauge idea.
I love shishi-odoshis, especially when they are tuned to musical notes and the water is timed so they make improvisationalˇmusic. (I know its not quite the same, but its the same principle)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
ˇ1+1=10