G+_Kyle Boyington Posted December 26, 2016 Share Posted December 26, 2016 I have a Raspberry Pi driving a SainSmart 12v relay. Whenever I power the relay with a load on it, and then turn off the power, the RPi crashes. I am using a 12v 100w power supply for the relay. Should there be a diode somewhere on the relay, to prevent power back to the RPi? I thought that the SainSmart relay would prevent that from happening? Link to comment Share on other sites More sharing options...
G+_David Peach Posted December 26, 2016 Share Posted December 26, 2016 I think what you are looking for can be answered by the JD-VCC VCC GND jumper. I don't remember how all of it works, but that jumper (either on, or removed) should take care of your issue. I just don't remember what the setting should be. But do some googling along the lines of the JD-VCC jumper and you should find your answer. Hope that helps. Link to comment Share on other sites More sharing options...
G+_Carlton Dodd Posted December 26, 2016 Share Posted December 26, 2016 Yes, you should definitely have a diode to prevent a reverse spike when the coil's field collapses. You should probably have a transistor driving the relay, anyway. Link to comment Share on other sites More sharing options...
G+_David Dennis Posted December 27, 2016 Share Posted December 27, 2016 I don't quite understand how you are driving a 12v relay using a Pi. But Carlton is correct. The diode should be across the coil of the relay with the cathode of that diode tied to the +12v side of the coil. Anode of the diode tied to the other side of the coil. Link to comment Share on other sites More sharing options...
G+_Kyle Boyington Posted December 31, 2016 Author Share Posted December 31, 2016 David Dennis I am using the SainSmart Relay so the pi just sends a signal through GPIO, but the board is powered separately. I dont really get where to put the diode. Here is the relay: https://smile.amazon.com/SainSmart-101-70-101-4-Channel-Relay-Module/dp/B0057OC5O8?sa-no-redirect=1 Link to comment Share on other sites More sharing options...
G+_Kyle Boyington Posted December 31, 2016 Author Share Posted December 31, 2016 Carlton Dodd Wouldn't using one of the RPI type relays do all this for me? LIke here: amazon.com - Amazon.com: SainSmart 4-Channel Relay Module: Cell Phones & Accessories Link to comment Share on other sites More sharing options...
G+_Kyle Boyington Posted December 31, 2016 Author Share Posted December 31, 2016 David Peach Thanks for your input, still a little over my head. But thanks! Link to comment Share on other sites More sharing options...
G+_David Peach Posted January 2, 2017 Share Posted January 2, 2017 Kyle Boyington, what are you switching on and off with this relay? As I'm studying about this for my own purposes, I see that I am making an assumption that may not be true. I'v only switched on and off 110V mains with my relays. Is that what you are doing, or are you switching on and off the 12V that is attached? Link to comment Share on other sites More sharing options...
G+_Kyle Boyington Posted January 2, 2017 Author Share Posted January 2, 2017 David Peach It is a 12v linear motor. But it is being powered by its own power supply. And today I actually did what you said about the jumper, no effect. The Pi still dies. I dont really know what to do now! Link to comment Share on other sites More sharing options...
G+_David Peach Posted January 2, 2017 Share Posted January 2, 2017 Ok. I think I have it now. I thought your 12V comment was an extra power supply going into the relay. What you need is to remove the jumper from the JD-VCC / VCC pin and use an additional 5V supply. +5V to the JD-VCC side and ground to GND (if your board has that in the same header). You are done and can test. However, if your board is like the one you linked to at Amazon, there is not a second GND header pin. (And this is where I am not completely confident). From what I understand is that you will removed your Pi's GND from the GND on the main header and plug the new 5V supply's ground to that single GND pin. The JD-VCC power supply input is what is needed to run the optocoupler in the relay module. This will give your Pi complete separation from what is happening inside the relays (i.e., creation and collapsing of the magnetic field). Hope this helps. Link to comment Share on other sites More sharing options...
G+_David Peach Posted January 2, 2017 Share Posted January 2, 2017 Kyle Boyington, this thread in an Arduino forum helped me understand the JD-VCC + extra power supply + GND. forum.arduino.cc - Safely connecting a relay board to external power supply Especially read (and understand) what KenF and TerryKing228 have to say. Link to comment Share on other sites More sharing options...
G+_Carlton Dodd Posted January 3, 2017 Share Posted January 3, 2017 Kyle Boyington Yes, most of those boards have the components I mentioned. Might want to check yours to be sure (because, China). Link to comment Share on other sites More sharing options...
G+_Kyle Boyington Posted January 3, 2017 Author Share Posted January 3, 2017 David Peach Thanks for the in depth answer. I think that is exactly what I did, and I am still having problems. I am going to go home and troubleshoot some more tonight and make sure everything is working properly. Ill let you know if I figure it out! Link to comment Share on other sites More sharing options...
Recommended Posts