Electronic – arduino – Interference beetween ADC samples with XBee and photoresistor

adcarduinosamplingsensorxbee

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:

schematic

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

Best Answer

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.