Hi guys, I have connected a raspberry pi to a relay board with eight relays. I can get the leds on the board to work, but can’t get the actual relays to operate, hence not turn my connected 12 volt light to work, any suggestions?. Also are there any raspberry pi programming persons in South Australia who can help me . I have followed stuff online and in the book but am unable to get my ideas to work. For example turn all eight leds on at same time for about 5 seconds and then off again?
What relay board model are you using? Some relay board require a higher drive current to operate. Can you post a picture or provide a link to the relay board you have
I suggest that you tinker with the relay board without the raspberry pi.
What is the voltage of the relays?
The relay used in this example requires 5V to drive the solenoid (SRD-05VDC-SL-C).
If your relays state 12VDC then you will need a 12V supply.
Connect the Vcc to the rated voltage supply.
Connect GND to ground.
Connect the signal pin to 5V and then GND to latch and delatch the relay and make sure it is working properly. Keep in mind that some relays latch when signal is HIGH and others latch when signal is LOW.
Use a 3.3v supply (this can be the Raspberry Pi, makke sure that the GND’s are tied together) and repeat the above to make sure that the relay behaves as expected.
If all above is working then test your code with your pins running LED’s instead of the relay board (remember to use an appropriate resistor).
If this works as expected then put it all back together but make sure that you are supplying Vcc with what the relays expect, ie 5V, 12V, etc.
Hope this helps.
I Mostly agree with SeanM,
But i would not recommend using the pi’s 3.3v supply
If your relay board looks like this one:
Then you should provide 12vdc to the vcc of the relay board and tie the gnds together between the relay board and the raspberry pi
I agree with supplying power to the relay’s from pi’s 3.3v would not be recomended but using the 3.3v supply for the logic testing should be fine. An external supply like this one:
from litlebird would be preferable if you have one.
Thank guys, I will give it a try
Hi SeanM , thanks for your help on the relay, I have now gotten that to operate which has overcome one major problem. I would now like someone who knows coding as to how to turn all outputs on and then off at the same time
Before we can really help you and avoid frying your board, we need to know the components that you are using.
What is the relay module that you are using, a clear photo would be great.
You have to be careful of how much current you draw from the Pi.
Going back to driving the relay board without the Pi. Put an Ammeter (Multimeter on current setting) and measure how much current is going through both the signal supply and the Vcc.
Using a breadboard, tie all the relay inputs together, test again using a power and signal supply other than the Pi and again measure the current going into all the signal inputs together and at Vcc. Play around with resistor values (start high then work down) to see what the lowest signal current that reliably triggers the relay is.
With regards to driving the relay from the Pi, you should be using a transistor or similar switching device to isolate the Pi and to supply a higher voltage (again, do not know the specs of your relay). Have a look at this thread.
If you can make the Pi blink a LED then you can make it signal a relay.
have a look at this guide.
Get what you want want to happen working with an LED then connect the input of the led to the base of the transistor form the previous thread.
I think a simple way of controlling the raspberry pi that does not rely on heavy coding would be to use scratch. With scratch you can control the io graphically with code blocks