SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By jsnow2
#167903
I have an Arduino UNO automating a greenhouse. It takes data from sensors and adjusts the environment accordingly.

The problem is that ONLY when the lights are on, the sensor values go haywire.

Both the lights and the AC adapter for the UNO are run off the same extension chord, but when i connected the adapter to a different chord and a different outlet the problem persists.

But here's the kicker... when i connect a battery supply instead everything works fine, even with the lights on.

The lights are x6 35W florescent with two ballasts controlled by a 5v relay connected directly to the UNO.
The relay is rated for 10A
The adapter and battery voltages are both 9V.

I don't have an amp-meter or oscilloscope so i can't troubleshoot much unfortunately. Any idea what's going on here?
#167913
If the sensors are on long cables, they may be picking up electrical interference. A ground connection via the AC line will make the problem worse. Shielded cable might help, but may not be possible with some sensors. What are the sensors?
#167927
As of now there is only a Temperature/Humidity probe. It's connected to 5v, GND, and Inputs 2&3. I've tried another sensor with much shorter cables but the problem still persists.

That could be the case, but why would everything work fine with a battery supply instead?

I've done some further research and it seems people get interference on TVs from having florescent lighting running on the same breaker circuit, so this could be a similar problem. Do you think an EMI filter would help?
#167935
We really need to know more about the sensors, and see a wiring diagram / schematic showing how everything is connected. These things can be subtle. Voltage spikes / dips on the power input may be causing problems, or it could be that adding the power connection allows noise to enter on the sensor inputs.

Does the sensor use I2C for communication? If so, have you included pull-up resistors on the SCL and SDA lines? The value of these will determine how noise-sensitive the circuit is.

I've never been a big fan of Arduinos, as they provide no protection on the I/O pins, and (IIRC) no protection against spikes on the power inputs.

W
#168011
The sensor is a Digital Temperature and Humidity sensor (SEN0148).
http://www.dfrobot.com/wiki/index.php/D ... SEN0148%29
It's wired like it shows on the wiki page, except without the resistor. The instructions I originally followed didn't include it.
It uses a modified I2C communication.

I've disconnected the relays so the problem is isolated between the lights, the UNO, and the sensor.

Thanks for the help so far!

EDIT: To clarify, the lights are now directly plugged into the wall outlet and do not pass through the UNO.
#168024
jsnow2 wrote:The sensor is a Digital Temperature and Humidity sensor (SEN0148).
http://www.dfrobot.com/wiki/index.php/D ... SEN0148%29
It's wired like it shows on the wiki page, except without the resistor.
Try adding the resistor - pullup resistors can be critical for these types of interfaces. The weak pullup in the Arduino (if it is even enabled) may be too high a value to prevent noise from being injected.