I'm using an XBee serie 2 module for sampling the values of three sensors, a photoresistor (LDR) a moisture sensor and a temperature sensor (LM35). When there is no brightness the photoresistor has the maximum value (1023), but if the environment is very very dark the value is the same 1023, but the other sensors begin to be instable giving values ​​greater than normal. Maybe an XBee ADC sampling problem? or could be a circuit problem?

The XBee module I'm using for sampling, use a cyclic sleep mode: it wakes for 100ms and stay sleep for 3 minutes.. I tried to use a greater wake time like 1s but the problem is always there.

This is the scheme:


simulate this circuit – Schematic created using CircuitLab

This is a picture: https://dl.dropboxusercontent.com/u/9029111/IMG_4712.JPG

I think it's a power problem, because if I put a 1Kohm resistence near R2 the moisture sensor is ok, and the temperature varies very little to vary the brightness

  • \$\begingroup\$ Are all three sensors sharing a common ADC via a multiplexer? If so, try sampling the different inputs with a bigger time-gap between them \$\endgroup\$ – Andy aka Apr 28 '13 at 15:42
  • \$\begingroup\$ Please be more accurate than giving values ​​greater than normal \$\endgroup\$ – jippie Apr 28 '13 at 19:43
  • \$\begingroup\$ jippie, I mean that when there is brightness i have values like this: brightness=300, temperatur=440, umidity=150; and this is right; but when there is no brightness i have values like: brightness=1023, and temperatur=990 and umidity=1005. brightness is right because when it is dark the value is at maximum, but temperatur and umidity should stay with their original value \$\endgroup\$ – Nicola Apr 29 '13 at 8:58
  • \$\begingroup\$ Andy aka, I don't know; im'using only an XBee module for sampling; i have only linked the sensors to the D0, D1 and D2 pin of the XBee module. \$\endgroup\$ – Nicola Apr 29 '13 at 9:02
  • \$\begingroup\$ Please add a picture of your setup and a circuit diagram (hit Ctrl-M while editing your question). \$\endgroup\$ – jippie Apr 29 '13 at 9:14

Check the datasheet for the ATmega that is on your Arduino for 'ADC Noise Reduction mode`.

To enter any of the six sleep modes, the SE bit in SMCR must be written to logic one and a SLEEP instruction must be executed. The SM2, SM1, and SM0 bits in the SMCR Register select which sleep mode (Idle, ADC Noise Reduction, Power-down, Power-save, Standby, or Extended Standby) will be activated by the SLEEP instruction.

Unfortunately, as far as I can see, you will have to write your own alternative for analogRead(); as the standard library seems not to support that the sleep command.

Check this article on arduino.cc for details on sleep.

  • \$\begingroup\$ Thankyou jippie, but for sampling i'm not using Arduino but only XBee module.. this module send the values to an Arduino with an XBee Shield; do you think the problem should be into the Arduino? \$\endgroup\$ – Nicola Apr 29 '13 at 9:04
  • \$\begingroup\$ Sorry, I misunderstood then. \$\endgroup\$ – jippie Apr 29 '13 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.