Hi guys, I have an arduino uno that I am using to turn a 12v solenoid valve on and off with a relay. When I turn it on i have no issues but when I turn it off i.e closing the valve, it restarts the board. I assume it has to do with the EMF produced and I read that you have to put in a capacitor and resistor somewhere but not sure exactly where and what size so thought I would ask you guys for the details of what and where. Thanks in advance.
Not necessarily. If the power supply is not properly decoupled, large current draw by the solenoid will cause the Arduino supply voltage to drop, resetting the Arduino.
Please post a hand drawn wiring diagram, with links to the solenoid, solenoid power supply and solenoid driver (or post the manufacturer's specifications for those items).
I wouldn't say it's a voltage drop as it's only a small solenoid and only restarts the board when it is turned off, it does not restart when i turn it on. Also I have tested this as I powered the arduino from a completely different battery all together so I doubt it's that unless I'm mistaken.
I will draw up a diagram and post it shortly.
The diagram is useless.
For informed help, please read and follow the directions in the "How to get the best out of this forum" post.
How is this useless as this diagram is exactly how it is wired up. I have no idea the model of solenoid just know that it is a 12v solenoid and the arduino is a uno as mentioned above and i have found and attached the data sheet for the relay board. I know for a fact that the relay board and the uno work fine and know from testing that the solenoid valve is what's causing the problem and I assume it's the back EMF so all I was asking is how do I stop the back EMF.
XC4418-dataSheetMain.pdf (541.3 KB)
Thank you for posting the requested link to the relay board.
Back EMF from the solenoid is unlikely to be a problem for the Arduino, is it will primarily damage the relay contacts. If you disconnect the solenoid, does the problem go away?
Sorry you didn't actually ask for the information about the relay board just the solenoid hense when I didn't suppy it in the first place
Here is what I asked for:
Please post a hand drawn wiring diagram, with links to the solenoid, solenoid power supply and solenoid driver (or post the manufacturer's specifications for those items).
The relay isn't a power supply. The battery powering the relay is a power supply.
Glad you caught on to the fact that the relay is not a power supply!
The relay is a solenoid driver.
But I tire of this, so good luck with the project.
Is there any specific size to use? Like is there a calculator to work it out as I am unsure what capacitor and resistor to use.
Cheers anyway. Just be a little more specific and a little less abrupt next time and I would have been much more help in providing the information you required to help.
Very important question that BrenCar12 didn't answer.
The outcome could solve the problem.
I have read several threads over the years where a kickback diode across the load solved the problem. OP should have posted a picture of the setup.
Leo..
Yes the problem goes away when I disconnect the solenoid. Only just test this. Made up the diagram straight away then forgot about testing that. It is in a very tight spot and impossible to take a photo plus there is a lot of other wires around so would have been more confusing than helpful. After watching the video someone provided I learnt that relays have diodes in them and I have a feeling I stuffed the relay because when I first made the circuit everything worked fine for a while then I started breaking arduinos but thought it was a bad connection until I started doing testing and discovered it restarts the board. So if I put in a new relay board and a diode across the solenoid it should hopefully fix the problem??
I think you missed the point.
Some relays have buit-in diodes, but most of them don't.
The relay board has the diodes across the relay coils included.
Don't worry about that relay board.
Your problem is no diodes across the solenoids.
Add a 1N4004 across each solenoid, with the cathode/ring towards 12volt.
Leo..
Sounds like a plan. Thank you