relay on shift register

Posted on
  • Hi everyone!

    I want to control several 8-channel-relais from the espruino without using up all the pins on the board.

    Thats why I connected a shift register (74HC595) where I can control each pin. I've successfully tested this with LEDs on all the outputs.

    Now I have connected a single channel relais for testing on one of the shift registers output and it immediately turns on and won't turn off, no matter if there is a signal on the registers output.

    The relais VCC is connected to the espruino 5V, the control PIN (IN) to the register and the GND to the espruinos GND. The register on the other hand gets its power from the 3.3V.

    Is it possible that somebody points me into the right direction on how to figure this out?

    Thank you,
    Mario

  • What are he specs of the relays?... I'm not sure that you can drive relays directly from a 74HC595 output. Spec says: +-6mA @ 5V. It is a good idea to use a shift register to save pins... you can then even cascade the shift registers and this way you can control almost any number of channels - with just 4 pins. Especially nice is that you have control over latching and output enable.

    Even the TTL 74LS596 - which has same functionality as CMOS 74HC595 - AND HAS open collector outputs can sink maximum 55mA - Icc, sum of all pins - before going up in flames.

    You can go with a 74HC595 but need to add a (darlington) driver array, for example, ULN2803 - it may look as an overkill - 500mA, but I'm not aware of something in between.

    I'd go for a test, because the spec says ILN2803 needs 3.5V - either TTL or CMOS - for driving it - it has all the network init, such as resistors and clamping diodes. Driving the inputs from a 74HC595 on 3.6V may not be good enough, so you need to run the 74HC595 also on 5V.

  • I think Favo might have one of those relay modules with the drivers built in?

    My guess is that the relay module is sensitive enough that it gets turned on by the voltage difference between the 5v power supply and the 3.3v logic output of the register.

    You could try:

    • Powering the shift register from 5v
    • OR power the relays from 3.3v
    • OR put a diode (or two) between each pin of the shift register and the relay module. This should drop the voltage enough that the relays won't turn on unless you turn them on with the shift register
  • Thanks a lot, both of you, for taking time to give me some help! :)

    This looks like the relay I am using:
    http://i00.i.aliimg.com/wsphoto/v0/69186­7674/Best-price-10pcs-1-relay-module-5V-­relay-drive-all-the-way-module.jpg

    Before I left for work this morning, I quickly tested the register with 5v input and it shuts off the relay whenever I give a signal on it. I will try the other two options tonight.

    I am not so experienced in the technical details, so excuse the following question:

    When I control the relay directly via a pin on the board, the relay is turned off whenever I turn the signal off. Why is it the other way around on the register? Shouldn't it also turn off when the signal drops?

    Thank you and have a great start into this week,
    Mario

  • I think the 5v shift register is probably the best option for you.

    I'm not 100% sure why it works on Espruino, but it may be that the Espruino has a much wider output voltage range (very close to 0-3.3v). If you measure the output voltage from the 74HC595 you may find that it is only 2.7v or so.

  • From the pic, the relays module is a 1xu - which means, (usually) the middle contact is the feed and the outer contacts are switched from on and off in (relays) unpowered mode - input connected to low or ground - to off and on in (relays) powered mode - input connected to high or 5V. Some mudules have a 3 pronged jumper to reverse that. Btw, what is on the print on the other side of the module - starting with HL- ?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

relay on shift register

Posted by Avatar for favo @favo

Actions