# Weather/Security system using SNMP.

J

#### jh

I’m building a weather station and home security system based on open systems, open architecture, and network based standards. (Yes, I know I can get off the shelf weather stations and security units for one third the price and none of the effort, but they are closed systems).

For the purpose of this project, It’s important to be able to take readings every 30 seconds, and place data into a MySQL database. All readings and interrogation will be a standard network management server interrogating an Ethernet I/O server using SNMP. Once the data is in the database, it is simple for me to post this to a web page and post real time results. Currently, I have the Ethernet I/O controller happily posting to the Network Management Server simple things like Contact open/Close, counting closures etc. and the Management Server is happily sending out Emails/text messages when programmable thresholds have been reached. In addition, all the appropriate red light/green light eye candy stuff is occurring on the management server reflecting the status of the Ethernet I/O controller in near real time.

There are two pieces missing from my project;
1: Anemometer
2: Wind Direction.

I am an IT guy, not a controls guy, so I understand everything right up to the point where I actually attach a sensor to the I/O server. The Ethernet I/O server has analog input options for:
0-20ma
4-20ma
0-150mv
0-500mv
0-5v
0-10v

I’ve figured out how to report back to the NMS using a 9 volt battery and a potentiometer, with the analog I/O setting on 0-10v. From that process I figured out that a J type thermocouple with a transmitter for 4-20ma conversion is the way to go to record temperature. Unbelievable amount of time researching and figuring out I need a transmitter for the thermocouple, but that’s another story.

I’m not stumped on the anemometer or wind direction, but I’m seeing myself building 9VDC generators and getting bearings from a child’s motorized toy car. It will require much trial and error and weather proofing. I would like to short circuit this process with something more robust than scraps I’ve picked from a toy store. My question is;

Is there a short cut solution to the anemometer and wind vane problem knowing the analog input specifications I have to deal with? I’m thinking that process control guys deal with this simple problem every day, but for me, it’s a real pain to think about.

C

#### curt wuollet

For the anemometer, I would use a sensor that triggers once per revolution and a 555 timer set up as a one shot with the time set so that the output would be always on at the highest likely wind speed. In other words the one shot time would be 1/pps at the highest wind speed. Then a large resistor and say, a 1uF capacitor would integrate the pulses into a dc voltage that represents the average speed. This should be as accurate and linear as it needs to be and the 555 will run on convenient voltages. This is a standard PWM setup. Check on any of the many 555 application sites for ckts. For the wind direction, a pot or slidewire setup is really the way to go without special equipment. Removing the stop from a high quality pot should get you a fairly good readout and you can face the small dead spot towards the least common wind direction. If just ordinal points are adequate, one way would be sensors and resistors that form a crude D/A which you can handle with your DC inputs.

Regards

cww An itinerant automation and controls guy.

W

#### Wassim Daoud

hello,

Are you using OPC? OPC is an open standard, i am really curious about your system architect.

http://www.matrikonopc.com/resources/opc-tutorials.aspx

Looking forward to hearing from you

Thanks,
Wassim Daoud
Global Solutions Architect
MatrikonOPC

J

#### jh

Wasim,

The system architect is me. If I had to retrofit into legacy applications I may think about OPC. However, I’m reasonably encyclopedic on server/web/database/SNMP technologies, and IP networks are so ubiquitous, that dealing with another layer of abstraction is painful. If the manufacturers of Ethernet I/O systems came up with a product line of common plug n play sensors for the analog inputs, the average IT guy like myself would not be too uncomfortable building control logic with a network management system, and proceed to control objects with that information. There are many free open source Network Management Systems that faithfully log all data, save it in a SQL/ODBC database, allow web access, and allow user defined logic to control (Stop/Start/Attentuate) SNMP compatible ethernet I/O controllers.

The only painful part for me is getting the information into the SNMP compatible Ethernet I/O controller. My knowledge of sensors and hardware compared to that of the others on this forum is infantile at best. I'm still getting over the fact that i need a transmitter to get my thermocouple device to talk 4-20ma so i can calibrate my ethernet I/O controller so I can log the temperature. I would have thought that stuff would be plug and play...I live and learn.

John

J

#### jh

Curt,

Thanks much. Hardware/silicon is not my area of expertise. I did google the 555 timer chip (never heard of it before) and am amazed by the number of projects that exist for it. Based on what I’ve seen, I think I can breadboard something together, and solder a magnet to the anemometer axle to produce the pulse. Calibration of the object will be to drive down the street on a windless day at known speeds and note the output. I suspect sizing the resistor and capacitor to output between 0-10vdc for me at least will be trial and error.

As for the wind direction, I could build a crude A-D unit but that would consume 8 DI’s. I think I’d be better trying my luck with a good potentiometer. Knowing that my choices of input are 0-20ma, 4-20ma, 0-150mv, 0-500mv, 0-5v, 0-10v, is there any specific type and value of rotary POT that you can recommend? I can Macgyver it from there.

Thanks,
John

M

#### M Griffin

Different sensors have different physical characteristics, so you need signal conditioning if you want to go into a common type of analogue input. There are analogue inputs which take thermocouples directly, but then those can't be physically compatible with your 4-20ma or 0-10V devices. That's just the laws of physics.

What I/O hardware are you using that uses SNMP? That is somewhat unusual. There is a lot of hardware which uses Modbus/TCP, which is the closest thing we have to a common open standard in industry. A lot of hardware in industry however uses proprietary protocols, which has created a big market for software and hardware to convert between them.

I realize that you already have your hardware, but for future reference you might want to look at an open source project that I have at: "http://sourceforge.net/projects/mblogic/". That includes Mobus/TCP drivers written in Python, and various servers and clients which use web and AJAX techniques.

As far as voltage versus current inputs is concerned, voltage inputs are for when the distance between the sensors and the analogue inputs is fairly short. If you have to go a considerable distance (e.g. tens of meters), then voltage drop and electrical interference can become a problem. That is what 4-20ma are meant to deal with. Generally, voltage inputs are easier to deal with, while current loops are more complex designs but inherently compensate for voltage drop and are less susceptible to noise.

If you are going to hack together your own sensors though, I think you are going to want to try to stick with voltage readings if at all possible.

As for using switches for wind direction, I believe that Curt mentioned D/A not A/D. Look up "binary weighted DAC" to see how this works. This gives you an analogue signal. You would need a magnet (or magnets) on the rotating element of the wind vane, and a series of hall effect (or reed) switches on the stationary part.

6 to 8 bits of resolution is the maximum you can get out of this sort of thing. If you had for example 6 sensors then you could turn on 1 or 2 sensors at a time (2 would be on when half way between sensors) and be able to resolve a dozen positions. So, that would be 30 angular degrees of resolution.

The advantage of this over a pot is that there is no friction, so it wouldn't wear out and it would work better with a small vane in light winds.

C

#### curt wuollet

Intuitively, I'd say find a quality conductive plastic element linear taper pot and remove the stop. But, you mistook my intent on the D/A idea. It would not take 8 inputs if you had say 8 switches and each switch had a different value resistor that it switched to a summing junction or simply another resistor to ground. By selecting your resistors, you could have each ordinal present a different voltage to a single analog input. Lets say you had 12 volts. With a 1k summing resistor, a 200 ohm resistor would give you 10 V for N, A 333 ohm resistor would give you 9 V for NE, a 500 ohm 8 V for E, etc, etc. If you can overlap the switches, you could even interpret the values with two adjacent switches on. Or you could do a R/2R network with binary switching, but that might be overkill. :^)

Regards,
cww An itinerant automation and controls guy.

C

#### curt wuollet

Oh, And by the way, DigiKey and the usual suspects sell small cheap rotary encoders that are used with the resistor idea in place of pots these days. I don't know if they make an 8 bit/rev model, but it's something to think about.

Regards,
cww

J

#### jh

Now you all have me thinking. 4 years ago I was asked to present temperature read outs and airflow status from roof top handling units, and present the data on the LCD of Cisco 7900 series telephones. I was told at the time that the info was controlled through BACNET/Alerton and info was presented real time on a web page. Initially I thought I could screen scrape HTML code off the web server, but when I tried to put this into practice, the Alerton HMI software was just a JAVA blob, rendering it unscrapable. If I had to do that over again, I believe the MBlogic project at sourceforge would have been a great place to start. Unfortunately, other projects took over, and that phone project fell by the wayside. That looks like a great project and should keep many independent consultants employed.

Having paid attention to the wise people of this forum, I have ordered a selection of silicon, and also a windvane with the mechanical parts of an anemometer built in, which includes a reed switch. Now I don't have to worry about the mechanical problems of bearings, weather proofing, robust qualities etc.

T

#### TK

There actually are a few people using SNMP for remote I/O monitoring although it isn't terribly common. The telecom industry is mostly where you will find it. Our company makes a remote I/O and data logger device that optionally communicates via SNMP as well as Modbus, and I know we aren't the only ones.

I agree that Modbus is definitely more standard and usually easier to use, unless like this guy you are already well versed in NMS, in which case SNMP is pretty nice since the vendor provides the register map (MIB) already pre-written for you and all you have to do is import the vendor supplied MIB file into your NMS to start getting usable data from the device. Imagine if vendors started supplying Modbus register maps that could be directly imported into Wonderware or other HMIs - the HMI users would love it.