Pages: [1]   Go Down
Author Topic: Debugging Weatther Station  (Read 537 times)
0 Members and 1 Guest are viewing this topic.
Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
Trying to get humidity to work on my weather station, temp works fine.  Using 2 Xbee , the Xbee library and humidity sensor HIH 4030.  http://www.sparkfun.com/products/9569
 With one coordinator hooked to an Arduino and an lcd and one end device. Sensor seems to work fine and is giving me a value of 435 which is about 44% humidity.  Reading the sensor in place, connected to the Xbee I get a value of 435, which is correct.
When I read the value received on the Xbee coordinator I get a value of 845, which is almost double what it should be.
I've double check it is connected to the correct pin.
What is the range limit of values the Xbee can transmit, is it 0 - 1045?
Anyone have any hints on what to look for or debug?

Thanks.

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
With one coordinator hooked to an Arduino and an lcd and one end device. Sensor seems to work fine and is giving me a value of 435 which is about 44% humidity.
The sensor is connected to the Arduino or the XBee? Which Arduino (what voltage)?

Quote
Reading the sensor in place, connected to the Xbee I get a value of 435, which is correct.
So, now the sensor is connected to the XBee? How do you know what reading you are getting?

Quote
When I read the value received on the Xbee coordinator I get a value of 845, which is almost double what it should be.
Read it how?

Quote
What is the range limit of values the Xbee can transmit, is it 0 - 1045?
That upper limit doesn't look right. I'd expect a power of 2 (2, 4, 8, 16, ..., 256, 512, 1024, 2048, etc.).

Also, the value is a ratio based on the voltage read vs. the reference voltage. The reference voltage on the XBee is 3.3, while on the Arduino it is typically 5V or 3.3V, though other values can be used.

Quote
Anyone have any hints on what to look for
I'm looking for more details on how the sensor is connected/powered, and how the XBees are configured. And, which XBees they are.
Logged

Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks PaulS.  All good questions.  The end device Xbee is a series two and set to sleep for 2 seconds, then wake up and take 3 analog samples. If I connect the sensor to an arduino (Picoduino) at 3.3 v I get a reading of 435 .  If I then hook it up to the Xbee and and have the arduino also take a reading from the output pin at the same time, I still get a reading of 435.  I am running the sensor at 3.3 v.  If I then unhook the arduino and just have the sensor connected to the Xbee, I get a different reading on the coordinator Xbee.

When I read the humidity on the coordinator, I am using the xbee library and the following code and get a value of 845.
Code:
humid = (ioSample.getAnalog(2));

This is how I am calculating the actual humidity
Code:
void calcHumid()
{
//RH (relative humiity) is a global variable.
//f arenheit is calculated earlier.

humid = (ioSample.getAnalog(2));
 val=humid;
 my_room_temperature = (farenheit); // If you have temperature reading, put it here (farenhit!)
 max_voltage = (3.27-(0.00372549*my_room_temperature)); // The max voltage value drops down 0.00372549 for each degree F over 32F. The voltage at 32F is 3.27 (corrected for zero precent voltage)
 RH = ((((val/1023)*5) - 0.8)/max_voltage)*100;
 RH=RH/2;
 if (RH<=0)
 {
  RH=0;
 }
}
Logged

Montreal
Online Online
Faraday Member
**
Karma: 27
Posts: 2566
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How you power up sensor? It requires :
Quote
Voltage applied to the supply pins should be within 4-5.8VDC, and optimally at 5V.
And what of the model of XBee?
I discovered this in the manual for Xbee-Pro (155 pages doc.):
Quote
Analog samples are returned as 10-bit values. The analog reading is scaled such that 0x0000 represents 0V, and
0x3FF = 1.2V. (The analog inputs on the module cannot read more than 1.2V.) Analog samples are returned in order
starting with AIN0 and finishing with AIN3, and the supply voltage. Only enabled analog input channels return data
as shown in the figure below.
To convert the A/D reading to mV, do the following:
AD(mV) = (A/D reading * 1200mV) / 1024
You can verify if it is true hooking up a pot and DMM, see if upper limit 1.2 V
Logged

Boston
Offline Offline
God Member
*****
Karma: 3
Posts: 575
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Magician.  Good to know that.  I need to do more testing.  The radios seem to be working fine.
 Might be how I have wired the sensor. I have one side to gnd, one to 3.v and the out pin connect to gnd through a 68k resistor and to the Xbee pin.

---------------| -----------V+------
   HIH 4030  |--------- 68k --------- out to Xbee
---------------|------gnd | ---------

     |
I'm using  XBee 2mW Chip Antenna - Series 2 (ZB)
Logged

Pages: [1]   Go Up
Jump to: