I dont have access to my code at the moment, i will post it as well as pictures of my setup later... I am just too perplexed to delay asking here. (i know, poor form)
I have an arduino setup on a perf board that takes input from 2 buttons, and is then connected to a JBtek 8channel optically isolated relay board. This relay board then powers 120v pneumatic solenoid valves. The normally closed and normally open side of the relay board corresponds to two solenoid valves to control the in and out of pistons. The relay board and arduino are powered from a 12v (15v actual) power supply brick. I drop the arduino down to 12v with a power regulator and power it via the VIN, and i drop the relay board VCC down with a 5v voltage regulator. I do not have capacitors on the voltage regulators.
When i set up and bench tested my system, i used a 5v supply current through the relay board. Everything functioned perfectly and as expected. Today i wired my system up in the enclosure with the 120v supply and everything went erratic. The serial monitor (And behavior of my program) told me that button presses were being detected even when they were not being touched. I checked everything for ground-shorts, pin-pin jumps, etc. It all passed.
My initial research on this is showing i may have a problem with De-Coupling, but i don't quite understand how to fix it?
The way i understood it, the optical-isolation should be preventing most of this problem since whatever happens on the relays should be completely separate from the pins that go back to the arduino.
I will post pictures and code in a little bit, but i dont think i have a problem with my code (well, actually i do, but i think it is separate from this issue! gremlins... always the gremlins...)
Are the buttons wired to connect the input pin to Gnd when pressed, with
pinMode (buttonPin, INPUT_PULLUP);
the internal pullup resistor enabled so the pin s HIGH when not pressed?
Then:
if (digitalRead(buttonPin) == LOW){
// button is pressed, do something
}
Plug the solenoid power into a different outlet circuit than the one you have your arduino brick plugged into (if possible , a different circuit breaker) . Don't ask why. Just try it. Get an extension cord if necessary.
JBtek 8channel optically isolated relay board.
Post a link to the vendor that sold you the board so we can look at the specs.
and i drop the relay board VCC down with a 5v voltage regulator
Why ? Why are you running the relay board on 5V ?
Your 5V regulator may not have enough current for the relays. Did you measure the current from the relay board ?
I do not have capacitors on the voltage regulators.
Then put them on immediately. I once had several thousand pounds worth of set top box fail and had to be scrapped because the voltage regulator manufacturer was changes and the capacitors on the design were insufficient to make them work correctly.
Hi,
I agree with Grumpy_Mike, the caps around the regulators are essential, they help with response to load and also to how the regulator starts up, one or both could be oscillating.
Please fit caps as per the data sheet for the respective regulators.
I added the caps as noted in the testing section of the TI datasheet for the respective regulators. There is no diagram, you need to search for "capacitor" to find the paragraph where it says what to use.
It is about 20% better when running from the same outlet, and about 75% better when running from a separate extension cord but from the same powerstrip. Ultimately, this will all have to be fed off the same power supply i think. If you look at the relay board there is the strip of input-in's bounded by GND and VCC. I am using the arduino for these. On the right side there is a GND/VCC which is what i am using the regulator for. Bench testing it did not seem to run when using the regulator to power both the input strip and the power supply pins. I am wondering if i should add a capacitor for the GND and VCC on the input strip?
The relay board requires a 5v VCC. I supply the 5v from the powerpack supply of 15v reduced down with a regulator (now capped). I am not using the arduino's 5v pin since even on the bench this caused erratic errors.
When a solenoid is plugged in to the relay but not the common, it works. When the common is plugged in but not the solenoid, it works. When both are plugged in, it sometimes works. I tried using different solenoids, same deal.
Give the Arduino it's own 9volt regulated wall wart supply on the DC jack.
A 5volt regulate phone charger with USB socket will also work. Plug Arduino's USB lead into that.
Connect Arduino's 5volt to VCC on the relay pinstrip.
Connect the relevant output pints to the relevant relay-in pins. DON'T connect Arduino ground to relay board ground.
Remove the VCC-JDVCC jumper.
Use a separate 5volt supply with at least 8x75mA = 600mA capability for the relay board.
Connect to relay ground and JDVCC.
A 15volt supply and 7805 is a bad choice. It will get hot.
Uhh, did I mention: DON'T connect Arduino ground to relay board ground.
If you do that, you are NOT using opto isolation.
Leo..
Uhh, did I mention: DON'T connect Arduino ground to relay board ground.
If you do that, you are NOT using opto isolation.
May I remind you that you are the one who first mentioned that the so-called opto isolated relay boards were not really isolated. I didn't believe it until I finally found a photo that allowed a closeup inspection of all the interface connections and sure enough , there was only ONE ground. (unlike the opto isolator board I linked in the other post about the video mixer. ) The opto board there (it was only optos, no relays) had separate grounds for input and output. While the board you are discussing in this post allows isolation of Vcc, it still only has ONE ground so it is not truly isolated (as you pointed out months ago).
The reason I point this out is that since the input leds are powered from the relay module Vcc, with or without the jumper the circuit is "Ground isolated" (since the relay opto input ground is actually the input signal) but not "Vcc isolated". This is , of course better than nothing , but the $4 opto isolator module is so cheap and offers 100% isolation, I think it is a better solution.
hehh. wups. Makes sense on the ground circuit. Shouldn't take too much work to separate it all out.
At some point i need over 12v, which is why i am using a 15v (marked as 12) supply. In large part i was trying to simplify the 110 part of the circuit. I think im ok with the heat - there is plenty of space for air cooling or a fan if needed. I should also have space for a heatsink.
Thanks for the help. I;ll report back probably next week. Hopefully this will be useful for others in the future... I can't be the only one to have made things over complicated by trying to simplify it?
So i separated the circuits. I checked continuity to make sure there was no connection between the 5v or GND of the terminals, the capacitors, the regulator, the input pins, or the connection pins. Note that this board does have two grounds, one on the input strip and one on the power supply strip (pictured with a jumper). Bench test was fine (no AC applied to relays). Came in today and it is 90% of where it needs to be, maybe 1 in 12 detects a STOP button push even though it isnt even plugged in (yes it is using an INPUT_PULLUP). Maybe i should just add a timer to the button so that it needs to be pushed for 500ms to initiate the conditional... I'd rather fix the issue, though.
I did just notice that i never reconnected the ground of the input side capacitor for the 5v supply for the relay board - im sure that's not helping.
I am using a delay for debounce so that buttons do not get sensed twice - but that obviously doesn't do anything if the signal blips for whatever reason. Again, at this stage the stop button is not even plugged in to my board. . It works 100/100 on a bench test in its current setup.
edit:
Yes, i did continuity checks, with a focus on the VCC/GND for the supply (since i had to do a lot of desoldering/rerouting). The GND on the input rail is completely disconnected from everything. It is in fact connected to the other ground on the supply power pins. Maybe i should route that to the input power ground?. the 5v VCC on the input rail is going to the 5v pin on the arduino.
Wawa:
Uhh, did I mention: DON'T connect Arduino ground to relay board ground.
If you do that, you are NOT using opto isolation.
Leo..
I have a 'clone' of that relay board and will make these points.
Do supply the relay board with its own 5 volt supply.
DO connect the arduino ground and the relay board ground... (on mine the grounds are connected between the ten pin and three pin headers)
2a. To turn on the led in the 817c optocoupler it needs to see the output of the Arduino in relation to the Arduino's ground.
The optocoupler is what is providing the isolation between the Arduino, the relay coil, and the relay's contacts. ( although I admit technically the relay's ground is connected to the Arduino, the relay board has an emf diode on the coils to check the voltage)
I use the 5v relay board and had to remove all the LEDs and short the connection. The forward voltage drop on the led is sometimes causing the opto coupler to not have enough voltage to switch the relay. Everything now works 100% after I replaced the LEDs with a jumper.
doughboy:
I use the 5v relay board and had to remove all the LEDs and short the connection. The forward voltage drop on the led is sometimes causing the opto coupler to not have enough voltage to switch the relay. Everything now works 100% after I replaced the LEDs with a jumper.
Some boards are (accidently?) fitted with 10k (103) smd resistors.
They need to be replaced with 1k resistors (102) for the LED and opto to work properly.
You can just piggy-back a 1k smd resistor on top of the 10k.
Leo..
Honestly, I know you guys have more patience than I do but really , Reply#16 ? ( and STILL no schematic or code) . No wonder your not getting any traction. Personnally, I would have gone with a 9V regulator ( or ebay dc-dc switching converter) to reduce the Arduuno Ext. dc barreljack inout voltage. The USB is earth grounded and not floating sobI don't know if that is a factor..
I've noticed (after almost 10,000 posts) that OPs posting for electronics related problems and OPs who don't know how to draw a schematic tend to wind up being OPs with little or no electronics experience doing a lot of guessing and trial and error because at the end of the day they are people who don't have the patience to do any research or documentation and are doing everything in their head. I usually test the water by trying to get a schematic and if that fails assume the worst (everything is just one big "clusterfxxk".
Yeah, I know what you're thinking: "like you have a lot of patience ?"
So we have proof once again that most relay boards available are silly and poorly designed. There is no need for an opto isolator on ANY relay boards as it is the job of the relay contacts to provide complete isolation. There is no need for an LED indicator since you are controlling the relay driver and clearly know when the coil should be energized or not.
I would agree with you if it were not for the fact that it is just too cheap snd easy to use an ebay off the shelf relay bd even thoygh most of them only havd one GND. The Vcc- JDVcc jumper allows you to have 2 Vccs. The opto then allows you to control if with an arduino while powering the relays from a separate power source. Besides, let's face it. Some people just can't solder. Other than that, you have a point.