-
Posts
45,326 -
Joined
-
Last visited
-
Days Won
120
Content Type
Profiles
Forums
Gallery
Events
Blogs
Posts posted by Gina
-
-
I thought of doing that - may have to.Would it be that hard to take the code for one of the existing libraries and modify it for the DS2413?
James
-
I'm now looking into accessing the 1-wire devices. The DS2423 (counter), DS2450 (4 line ADC) and DS2438 (battery sensor - voltage, current, temperature) are no problem - I've found and installed libraries for them but the DS2413 ( 2 channel switch) is a problem, I can't find any source of a library for this decice for the Arduino. I may have to change my circuitry unless anyone knows where I can fine the DS2413 Arduino library.
The DS2413 is used to enable the LEDs used when reading the wind vane direction.
-
Now have the barometer working and logging to SD file The module also reads temperature so I've included that too (called Temp2). However the temperature does not seem very accurate being a degree C or so high. The DHC22 is accurate to half a degree so I'll use that and ignore the BMP085 temperature.
Here are serial display and SD file contents.
-
-
Fixed the time - wanted time to be UTC (alias GMT). Changing the clocks for British Summer Time (Daylight Saving Time in the US) in the weather data causes all sorts of problems so all my weather data is going to be in GMT/UTC. Having looked at doing it it code I thought of a much simpler idea Simply turned off "Daylight Saving Time" in Win 7 then ran clock setting sketch again. Then put Win 7 clock back to normal. I've added a "Z" to the date/time data to conform with the ISO standard for UTC but might find this isn't wanted.
-
Very nice start
-
-
-
Change of plan... This makes more sense to me Sensor & data I/O list :-
- Wind Speed - 1-wire - pin 2
- Wind Direction - 1-wire - pin 2
- Light Level - 1-wire - pin 2
- Rainfall - 1-wire - pin 2
- Barometric Pressure - I2C - pins A4 & A5
- Inside Temperature & Humidity - pin 3
- Outside Temperature & Humidity - pin 4
- RTC - I2C - pins A4 & A5
- SD card CS - pin10
- SD card MOSI - pin 11
- SD card MISO - pin 12
- SD card CLK - pin 13
- Red LED - pin 5
- Green LED - pin 6
- Wind Speed - 1-wire - pin 2
-
Sensor & data I/O list :-
- Wind Speed - 1-wire - pin 4
- Wind Direction - 1-wire - pin 4
- Light Level - 1-wire - pin 4
- Rainfall - 1-wire - pin 4
- Barometric Pressure - I2C - pins A4 & A5
- Inside Temperature & Humidity - pin 5
- Outside Temperature & Humidity - pin 6
- RTC - I2C - pins A4 & A5
- SD card CS - pin10
- SD card MOSI - pin 11
- SD card MISO - pin 12
- SD card CLK - pin 13
- Red LED - pin 2
- Green LED - pin 3
That leaves Digital pins 5 to 9 and Analog A0 to A3 free ATM. This is using the data logger sield but not the Ethernet ATM - I'll look into that later.
- Wind Speed - 1-wire - pin 4
-
Thanks doc I will indeed post info as I get it
-
It's alright - got the answer. It's a bus like 1-wire with device IDs but using 2 wires instead of 1. It's also much more limited for range - just a metre they say whereas the 1-wire bus will go hundreds of metres.
So I can run both the RTC and pressure devices off the A4 & A5 pins. The I2C can be used for communication between 2 Arduinos - that could be useful.
Looks like I should have sufficient I/O on the Arduino Uno.
-
Now I'm looking at the sensors - how many and which pins they require. Everything 1-wire goes on one single digital pin, which takes care of wind speed & direction, light level and rain gauge. Temperature/humidity can use DHT22 and one pin but for both indoor and outdoor, that's two. Then we come to the barometric pressure for which I'm thinking of the BMP085 breakout board :- http://www.ebay.co.u...=item4ab97f69cc
This uses I2C and and Analog pins 4 & 5. Now the data logger shield also uses I2C and pins A4 & A5. Is it possible to run more than one I2C device off the one bus?
-
I now have date/time plus a some random data successfully logging to files on the SD card.
-
Code for logging date/time to SD card file :-
// fetch the time
now = RTC.now();
// log time
logfile.print(now.year(), DEC);
logfile.print("-");
logfile.print(now.month(), DEC);
logfile.print("-");
logfile.print(now.day(), DEC);
logfile.print("T");
logfile.print(now.hour(), DEC);
logfile.print(":");
logfile.print(now.minute(), DEC);
logfile.print(":");
logfile.print(now.second(), DEC); -
Sorting out the RTC reading (and setting) and the data logging code.
The data logging shield uses the Dallas DS1307 RTC chip which uses I2C and Analog pins 4 & 5 to talk to the Arduino. Info on this and more is on the appropriate web page :- http://www.ladyada.n...shield/rtc.html
This provides links to the required library and how to install it plus code to set the clock and read the time.
Setting the time is simply :-
RTC.adjust(DateTime(__DATE__, __TIME__));which takes the time from the computer on compilation and writes it to the RTC when it's run.
Reading the clock is just as simple :-
DateTime now = RTC.now();
Serial.print(now.year(), DEC);
Serial.print('-');
Serial.print(now.month(), DEC);
Serial.print('-');
Serial.print(now.day(), DEC);
Serial.print('T');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();This shows displaying the RTC time on the computer but the logging to SD file works similarly. I have converted the code to use the ISO standard (up to the seconds).
-
Some amendments to the data format :-
- Date/time - yyyy-mm-dd hh:mm:ss
- Wind speed gust - dd.d
- Wind speed average - dd.d
- Current Wind Direction - dd (0 - 15)
- Predonimant Wind Direction (average over a period) - dd (0 - 15)
- Light Level - ddd
- Outside Temperature - dd.d
- Outside Humidity - dd
- Rainfall - ddd
- Atmospheric Pressure - dddd
- Inside Temperature - dd.d
- Inside Humidity - dd
The "Inside" temperature and humidity will be for the obsy, scope room or warm room, as that is where I plan to install the weather station main unit (with Arduino).
- Date/time - yyyy-mm-dd hh:mm:ss
-
You run Linux don't you James? That's an ideal OS to do what you wantGiven the time, I would like to set up some sort of brokering system on a central computer with all this sort of data being passed through it such that other applications can say "I'm interested in data of type X" and when a data item of that type arrives it gets passed to that application as well as being stored in a database. The aim eventually being to add bits of automation software that can do different things based on the data that various sensors are collecting or the actions that other applications are taking.
James
-
Currently, my weather station software doesn't broadcast the indoor temperature and humidity as to my thinking it isn't of any interest to anyone outside the house. But I may take the temperature and humidity values in the scope room or warm room depending on where I put the unit.
-
To reduce the data logging rate I might do some data processing anyway. Many data values change very slowly while some such as wind speed can change quite quickly. I might, for instance, take the wind speed and calculate average and gust values. I might average wind direction to even out what's left of the short-term variations.
-
Thoughts so far on the data format (as CSV file - maybe one file per day) :-
- Record number (index)
- Date/time - yyyy/mm/dd hh:mm:ss
- Wind speed - dd.d
- Wind Direction - LLL (N ENE NE etc.)
- Light Level - ddd
- Outside Temperature - dd.d
- Outside Humidity - dd
- Rainfall - ddd
- Atmospheric Pressure - dddd
- Inside Temperature - dd.d
- Inside Humidity - dd
That is the basic raw data. If I make it FO compatible I may do some data processing to make the data into the same format. Things like wind gust and wind average speed, rain in last period and total rain, atmospheric pressure and pressure trend...
- Record number (index)
-
I'm working out some details of the data format and logging interval and such like. The new station will be able to hold far more data than the FO station. The FO logger can hold 4080 entries or lines. With 10m logging interval that represents about a fortnight's worth of data - with 1m interval it's only a couple of days. I can't remember how many bytes it uses per record but it would be something like a hundred or so making the FO data memory around half a megabyte. Now I shall be using gigabytes of data storage in either SD or micro SD cards. The data logger shield takes SD cards and I have 8 and 16GB cards on hand and the Ethernet shield takes micro SD cards. I have 2GB micro SD cards. Even the 2GB card is 8,000 times the FO memory! So my memory will take several years of data
-
Yes, 10m high isn't practical. You need planning permission to erect a mast of that height if it has guy wires to hold it up. An unguyed mast doesn't as long as it isn't too high - I forget how high ATM. I currently have a 6.5m high unsupported mast carrying my Maplin anemometer and wind vane. The 1-wire one was 5m high supported on the corner of the goat shed with it's bottom end about 2m above ground level. The 6.5m mast will be replaced when I get round to it as it is a slight obstruction to the NE for my scope - though only once have I been imaging in that direction. That was erected long before I built my obsy.
I think I'll give up on the Maplin/FO weather station once I get my new home made station up and running. The FO station is not very reliable and there have been all sorts of interference problems, particularly from a nearby electric fence. I've added all sorts of extra circuits and screening to attempt to reduce this with some success but I still get occasional huge spikes in the temperature data. The wind instruments stop sending data every so often for no reason that I can determine. I've not had any real problems with the radio link from the Tx unit, but then again it's a fairly short distance with line-of-sight propagation path (through a window).
I'm currently planning to use wired comms rather than the radio link used in the FO and other commercial weather stations. That means there are no problems with making everything as low power as possible. However, another Arduino project I have in hand does use radio comms and transmitter in a handheld remote control and that will need minimal power for the battery powered handset. Experience with this project could rub off onto the weather station project and I might be able to produce a "wireless weather station" later on.
-
That's avery good point James I've copied the Fine Offset (versions sold by many companies including Maplin) commercially made anemometer dimensions and their conversion factor. Calibration depends on many factors including height of anemometer and surrounding obstructions. Standard MET Office figures are for a height of 10m in a clear area of ground (as in the middle of a field). In the domestic environment these perfect conditions are rarely met and a compromise has to be made. This generally results in a lower wind speed reading. By how much is a guess.
Arduino Based Weather Station
in DIY Astronomer
Posted
There's a library for the DS2408 which is an 8 channel switch whereas the DS2413 is a 2 channel switch. Should be similar but I'll have to look at the details in the data sheets.