Thursday, September 22, 2011
Emily has updated the equipment information section of her blog ( http://myweatherblog.wordpress.com/equipment-4/ ) to reflect the recent sensor array changes - a full pdf download report with lots more pix, circuit diags and source code will be along shortly...
Saturday, September 17, 2011
Weekly graphs added
Weekly graph data has now been added to Emily's sensor project - http://myweatherblog.wordpress.com/livedata
Tuesday, September 13, 2011
Arduino - HTF3223 Humidity Sensor
Over the past six months or so I have been helping my daughter with a remote mounted sensors project to supplement the info from her weather station on her blog. Light and temperature sensing via the analogue ports has presented no problems (LDR and TMP36), but when it comes down to humidity sensing its a bit more complex.
Although you can buy some inexpensive resistive humidity sensors, these are not suitable for DC reading and have to be read using an AC waveform at a few KHz to avoid eventual damage to the devices.
There are ready made humidity sensor system which use SPI/I2C bus communication which give very good results, but looking at them,they tend to be a little pricey and the required source code is a bit beyond the level of Arduino coding Emily is happy with.
After a LOT of digging I came up with the Humirel HTF3223 Sensor.
Unlike other sensors, it provides an analogue value out which is linear with the relative humidity, but rather than a voltage it outputs a variable frequency square wave at between 8 and 10KHz.
So - how are we going to convert frequency to something useful??
Well there is a frequency counter lib available, but for a top frequency of around 10KHz its a bit like using a sledgehammer to crack a nut.
After a bit of googling I found several examples of using the pulsein function. The following code gives a very quick example of reading the frequency from the humidity module, and using a simple conversion formula, convert it to relative humidity.
/*
Humidity sensor test for HTF3223 humidity sensor
By G7NBP - Chris Williams
V0.0.1 28th - May 2011
The inexpensive HTF3223 sensor (ebay etc) provides good accuracy relative humidity
sensor readings (typically +/- 5%) and has a simple linear output.
Its output however is in the form of a variable frequency proportionate to the humidity.
The formula for convertion is RH = (9740/Freq)/18
Although it is possible to use the frequency library to collect the frequency, this
is somewhat overkill as the freq is not expected to be above 10KHz.
Instead the pulseIn function is used and frequency averaged over 4096 counts.
connect H pin on HTF3223 to digital pin 7
*/
const int hpin = 7; // the sensor pin
void setup() {
Serial.begin(9600);
pinMode(hpin, INPUT);
}
void loop() {
long sensorValue = getFrequency(hpin); // get the raw sensor frequency
long humidity = convertToRH(sensorValue); // convert it to RH%
Serial.print("S:");
Serial.print(sensorValue, DEC);
Serial.print(" H:");
Serial.print(humidity, DEC);
Serial.println("%");
delay(3000);
}
long getFrequency(int pin){
#define SAMPLES 4096
long freq = 0;
for(unsigned int j=0; j<SAMPLES; j++) freq+= 500000/pulseIn(pin, HIGH, 250000);
return freq / SAMPLES;
}
long convertToRH(long sensorValue){
long rh = (9740-sensorValue)/18;
return rh;
}
Although you can buy some inexpensive resistive humidity sensors, these are not suitable for DC reading and have to be read using an AC waveform at a few KHz to avoid eventual damage to the devices.
There are ready made humidity sensor system which use SPI/I2C bus communication which give very good results, but looking at them,they tend to be a little pricey and the required source code is a bit beyond the level of Arduino coding Emily is happy with.
After a LOT of digging I came up with the Humirel HTF3223 Sensor.
Unlike other sensors, it provides an analogue value out which is linear with the relative humidity, but rather than a voltage it outputs a variable frequency square wave at between 8 and 10KHz.
So - how are we going to convert frequency to something useful??
Well there is a frequency counter lib available, but for a top frequency of around 10KHz its a bit like using a sledgehammer to crack a nut.
After a bit of googling I found several examples of using the pulsein function. The following code gives a very quick example of reading the frequency from the humidity module, and using a simple conversion formula, convert it to relative humidity.
Humidity sensor test for HTF3223 humidity sensor
By G7NBP - Chris Williams
V0.0.1 28th - May 2011
The inexpensive HTF3223 sensor (ebay etc) provides good accuracy relative humidity
sensor readings (typically +/- 5%) and has a simple linear output.
Its output however is in the form of a variable frequency proportionate to the humidity.
The formula for convertion is RH = (9740/Freq)/18
Although it is possible to use the frequency library to collect the frequency, this
is somewhat overkill as the freq is not expected to be above 10KHz.
Instead the pulseIn function is used and frequency averaged over 4096 counts.
connect H pin on HTF3223 to digital pin 7
*/
const int hpin = 7; // the sensor pin
void setup() {
Serial.begin(9600);
pinMode(hpin, INPUT);
}
void loop() {
long sensorValue = getFrequency(hpin); // get the raw sensor frequency
long humidity = convertToRH(sensorValue); // convert it to RH%
Serial.print("S:");
Serial.print(sensorValue, DEC);
Serial.print(" H:");
Serial.print(humidity, DEC);
Serial.println("%");
delay(3000);
}
long getFrequency(int pin){
#define SAMPLES 4096
long freq = 0;
for(unsigned int j=0; j<SAMPLES; j++) freq+= 500000/pulseIn(pin, HIGH, 250000);
return freq / SAMPLES;
}
long convertToRH(long sensorValue){
long rh = (9740-sensorValue)/18;
return rh;
}
Sunday, September 11, 2011
Can you guess what it is yet - the update
Well the more astute visitors to the site correctly identified the mystery object as Emilys weather sensor array project.
The device designed and built mainly by Emily is an ethernet connected sensor array, measuring Light, Temperature and Relative Humidity.
There is of course, an Arduino lurking in there as the main device, along with the ethernet shield. Sensors are TMP36 for temperature, A simple LDR for light and an HF3223 Humidity sensor. All of these live in the top enclosure.
The lower enclosure and antenna system were added when it was discovered that the TMP36 sensors were somewhat prone to false readings when subjected to local high RF fields (the array is not too far away from my R7000 HF and UHF collinear antennas). Inside the enclosure is a modified RF pre-amp followed by a simple diode rectifier circuit feeding one of the analog inputs on the arduino - giving a relative filed strength measurement. This allows data which may be subject to false levels to be dropped when processing the data.
Data is collected via one of our servers every 60 seconds by making an http request (scripted in phpcli) to the ethernet shield on the arduino - results are returned from the sensors as a simple comma separated string. The phpcli script then saves the data - including the RF levels to a MySQL database.
The resulting livedata, and historical data is then processed using php and the GD image libs along with JPgraph to produce dynamic images in her blog site:
see : http://myweatherblog.wordpress.com/livedata/
There will be a full writeup with photos, hardware diagrams, networking info, description of making a "power over ethernet cable", arduino code, php and mysql etc on Emilys blog site shortly. I will post a crosslink when its finished
Congratulations to Emily on this fine piece of work - almost all the hardware, software, networking and database work was done by Emily herself. Brilliant effort and a great project over the summer holiday.
The device designed and built mainly by Emily is an ethernet connected sensor array, measuring Light, Temperature and Relative Humidity.
There is of course, an Arduino lurking in there as the main device, along with the ethernet shield. Sensors are TMP36 for temperature, A simple LDR for light and an HF3223 Humidity sensor. All of these live in the top enclosure.
The lower enclosure and antenna system were added when it was discovered that the TMP36 sensors were somewhat prone to false readings when subjected to local high RF fields (the array is not too far away from my R7000 HF and UHF collinear antennas). Inside the enclosure is a modified RF pre-amp followed by a simple diode rectifier circuit feeding one of the analog inputs on the arduino - giving a relative filed strength measurement. This allows data which may be subject to false levels to be dropped when processing the data.
Data is collected via one of our servers every 60 seconds by making an http request (scripted in phpcli) to the ethernet shield on the arduino - results are returned from the sensors as a simple comma separated string. The phpcli script then saves the data - including the RF levels to a MySQL database.
The resulting livedata, and historical data is then processed using php and the GD image libs along with JPgraph to produce dynamic images in her blog site:
see : http://myweatherblog.wordpress.com/livedata/
There will be a full writeup with photos, hardware diagrams, networking info, description of making a "power over ethernet cable", arduino code, php and mysql etc on Emilys blog site shortly. I will post a crosslink when its finished
Congratulations to Emily on this fine piece of work - almost all the hardware, software, networking and database work was done by Emily herself. Brilliant effort and a great project over the summer holiday.
Thursday, September 01, 2011
Can you guess what it is yet?
Another bit of kit has gone up @ the g7nbp qth, can you guess what? All will be revealed shortly :)
Subscribe to:
Posts (Atom)