logo elektroda
logo elektroda
X
logo elektroda

Raspberry Pi home control - how to avoid interference from relays?

goldie83 3873 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 13145627
    goldie83
    Level 2  
    Posts: 3
    Hi,
    i'm making a second attempt to control a (supposedly smart) house.

    First a description of the electrical solution.
    I have a couple of crossover boxes in the attic which contain:
    - relays controlled from the main cabinet,
    - inputs from all the switches are collected, sent to the main cabinet.
    Everything goes on wires.
    A total of about 64 inputs and 64 outputs - I plan to possibly expand with other peripherals.

    The first approach was based on an arduino, a couple of 74HC595, 4021, 4N25 ground and finder relays (24V coil). The control system was in the main cabinet. I have two power supplies in the cabinet - 5 and 24 volts.
    I picked up my knowledge of these circuits from the arduino helps somewhere.
    Problems I encountered:
    - optocouplers couldn't control relay coils - at first I had a lot of relays with more sensitive coils, then the situation changed.
    - interference from relays (total lack of knowledge of how to deal with this), then I just got the idea to use at least rectifier diodes;
    - long start-up time - I struggled for a long time with the software in the arduino. I went too much into trying to hook up the software to the internet at the beginning, instead of focusing more on handling the ICs. ;)
    After which the project wasn't finished and at one point I gave up on the control and wired everything up in the main cabinet and it works too.

    Since I have a raspberry lying around in my drawer - I want to start the fun all over again:
    - first of all I need help in preparing the right circuits - and for this I need knowledge and your help.

    One thing I won't change - the relays with 24V coil and the wiring already laid.

    1. How do I design/select the circuit so that I can control the relays stably and without major disturbances? (Relay: electromagnetic; SPDT; Coils :24VDC; 16A/250VAC, FINDER 40.61.7.024 or similar) - of course I want to galvanically isolate the control system from the relays.
    2. What ICs should I use to stage the outputs and collect the inputs? As my soldering skills are not top class I prefer DIP enclosures. I2C preferred.
    3. Software. Does anyone have experience with any open source projects? I am most comfortable with a python/php combination.
  • ADVERTISEMENT
  • #2 13697716
    betoven
    Level 12  
    Posts: 108
    Rate: 8
    It seems to me that if the relay control is well designed then it won't need to be specifically separated from the RPi circuits. You can't do without some kind of coil control circuit, e.g. ULN2003. It's best not to invent on your own if you have no experience, because it's a waste of money and time. You can take a look here:
    http://hapcan.com/devices/universal/univ_3/univ_3-2-3-x/univ_3-2-3-x_b.pdf

    There is 12V there, but I think 24V can also be connected, you have to ask google :)

    As for the RPi, buy expanders and you're done, e.g:
    http://www.abelectronics.co.uk/products/3/Ras...32-Channel-Port-Expander-for-the-Raspberry-Pi

    of course you have to look in Poland ...
  • ADVERTISEMENT
  • #3 13867033
    goldie83
    Level 2  
    Posts: 3
    Thanks for the hint with the port expander. I've decided to use MCP23S17 (SPI - raspberry-pi gives 2 CS to start with, so I can connect even sixteen dice) and ULN2003.
    As for opto - I'll probably take some ISP521-4 type kit to have fewer dice.

    For the moment, I have prepared myself a schematic. In the schematic I have prepared one input and one output each. The output is not galvanically isolated - I wonder if it is needed. This is where I would need advice.
    E.g. why does http://hapcan.com/devices/universal/univ_3/univ_3-2-3-x/univ_3-2-3-x_b.pdf use 0R at the relay coil?
    I prefer to leave the diode at the relay coil - as there will be a long distance between the ULN2003 and the relays.

    Am I going in the right direction with this schematic?
    Raspberry Pi home control - how to avoid interference from relays?
  • ADVERTISEMENT
  • #4 13867873
    betoven
    Level 12  
    Posts: 108
    Rate: 8
    Diagram rather ok, but I'm also an amateur, so I probably shouldn't comment.
    As for that 0R it is indeed something strange. I have no idea what it is doing there. You could ask the author.

    I wonder why the galvanic separation. I don't think anyone does it that way because it's not worth it. Each optotriak costs money and when you have 30-40 inputs in a module, it's easier to replace the processor if something happens. See for yourself in this project they have added a protection diode - a transil. It's a special diode that can take on surges if one were to occur.

    I have 3.3V logic at my place and I plan to make switches: open/closed to ground and I'm worried that it might not work if something is induced in the cables.... We'll see in the wash.
  • #5 13901564
    Jacek Rutkowski
    Level 28  
    Posts: 1330
    Help: 69
    Rate: 274
    The 0Ω resistors were probably used so that the paths on the PCB could be routed more conveniently or a lower voltage relay could be used.
ADVERTISEMENT