I have this sainsmart 4 relay board, it's supposedly optoisolated, but I guess the traces cross too much and EMI is getting into the arduino Vcc or digital pins (controlling the opto).
I basically just have the digital pins hooked up to the IN pins on the relay board, the arduino 5V hooked up to Vcc... and the power for the relay control coil, and what the relay is controlling are completely separate from the arduino.
If the relay schematic on amazon.com isn't lying, my arduino is not hooked up to the fan at all. Though like I said, when the fan turns on the sensor readings fail.
I'm gonna try increasing the length of the wires between the arduino and relay board... any other ideas?
What type of sensors ? and how are they hooked up.
If I look at the schematics, and your explanation the Jumper on the board is not set, so the "JD-VCC"is not connected to the arduino?. (mayby you can upload a picture of the schematics to tinypic.com or similar site, so we can refer to is)
Post a schematic and a photo of your setup. My guess is that you do not have the ground wire of the AM2302 connected correctly, or you have a bad ground connection somewhere.
Astrofrostbyte, I mentioned the sensor in the title, AM2302. You are right in thinking I have disconnected the jumper, Vcc is not the same as JD-Vcc, according to the schematic these shouldn't be connected if I don't want the coil to interfere with the microcontroller. Regardless of that, it's still interfering
here's another pic including the fan with heater inside, the AC to AC transformer (for another device i want to switch with the relay) the AC to DC 12V supply for the fan and heater (and I have an LM317 I'm gonna power the relay coils with from this too if I can get the interference cleared up)
It's a little hard to tell, but from the second picture it looks to me that the 3 wires between the Arduino and the sensor run close to the AC-AC adaptor and relay board. You need to route those sensor wires well away from the high power circuitry.
dc42:
It's a little hard to tell, but from the second picture it looks to me that the 3 wires between the Arduino and the sensor run close to the AC-AC adaptor and relay board. You need to route those sensor wires well away from the high power circuitry.
What is supplying 5V to the relay board?
That was just in this pic, no matter how I arrange the items my sensor readings drop when the fan turns on. Also the AC-AC adaptor isn't plugged in now, so that's not the issue.
I was giving the relay 5V from a bench power supply, the Arduino is powered via USB from my laptop
i changed the sensor from running off the 3.3V line to the 5V line, and finally to Vin (USB I'm assuming)
Sensor readings got better after this, but now it seems like it stops working when a relay turns off that isn't the fan (it's the one connected to the hot wire of the AC-AC converter, which isn't plugged in)
You should connect the +ve supply lead of the sensor to the 5V pin, not the Vin pin.
If it stops working when the other relay turns off, do you mean that the whole Arduino stops working until you reset it? The relay contacts are probably arcing (because you are turning off the current to an inductive load), and that is probably inducing a voltage in the Arduino and/or the sensor wires. Keep the relay contact wiring and AC adapter well away from the Arduino, and consider fitting a snubber network across the relay contacts.
dc42:
You should connect the +ve supply lead of the sensor to the 5V pin, not the Vin pin.
If it stops working when the other relay turns off, do you mean that the whole Arduino stops working until you reset it? The relay contacts are probably arcing (because you are turning off the current to an inductive load), and that is probably inducing a voltage in the Arduino and/or the sensor wires. Keep the relay contact wiring and AC adapter well away from the Arduino, and consider fitting a snubber network across the relay contacts.
I guess it's not the relay turning off that's the problem... that's simply what my code does for that relay when it can't get a reading. The fan stays on during this time.
It was working OK for a while, until I added a second fan to the 12V power supply, it's just a simple computer case fan, now the sensor readings are even worse