logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Attempting to upgrade the electrical installation with a control module.

przeqpiciel 1920 19
Best answers

Can I use a Raspberry Pi to switch off most of a flat’s 230V/16A installation when no occupants are detected, and what relay or contactor should I use?

Yes, but use a contactor or relay socket with a 5V, 12V, or 24V coil instead of trying to drive a 16A load directly from a GPIO; 16A contactors were described as delicate, so a socket/contactor solution was preferred [#14973226] Drive the coil from the Raspberry Pi through a transistor and a flyback diode, not directly from the GPIO pin [#14973226][#14973723] A GPIO-controlled relay example was linked in the thread, and a BC817 transistor was suggested as a suitable choice [#14973723] If transistor datasheet voltages are confusing, the “45–50 V” value for a BC337 is its maximum voltage rating, not the operating voltage you need [#14990483]
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 14973045
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    Welcome,

    This will be my first post in this section. I am looking to find out if there is any chance of my fancy ideas coming to fruition. I'm getting ready to renovate my flat, where the plan is to upgrade the power installation - from aluminium to copper.
    I would like to add a mechanism to this installation that would check for the presence of occupants in the flat and, if not detected, switch off the power.

    I would like to realise this with the help of a developer board ( RPi ) connected to the ICT network in the flat. The question is whether there is a relay that accepts 3V on the control and is capable of switching 230V at a maximum of 16A.

    Something like THE
  • ADVERTISEMENT
  • Helpful post
    #2 14973226
    michcior
    Level 30  
    Posts: 1132
    Help: 159
    Rate: 462
    First of all, it's better to use a socket; 16A contactors are delicate devices, which can break down, and I don't know what kind of load you're expecting.
    Attempting to upgrade the electrical installation with a control module.

    There are contactors for such sockets for 5V, 12V, 24V.
    You need to have 5V for the Tiny, so not a problem. Rather powering directly from a pin is asking for trouble. You need a transistor + diode, e.g. like this:

    https://www.elektroda.pl/rtvforum/topic1323874.html
  • #3 14973534
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    I don't know what sockets you are writing about. Could you stick a link to an example?
  • ADVERTISEMENT
  • #4 14973542
    michcior
    Level 30  
    Posts: 1132
    Help: 159
    Rate: 462
    Well, the picture I pasted is just such a socket, the contactor is that bright white cube.
  • #5 14973550
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    Ok, so it is possible to connect the 5V RPi to such a socket and, by changing the state on the GPIO pins, switch the socket on/off so that the 230V power supply is switched on or off?
  • #6 14973556
    michcior
    Level 30  
    Posts: 1132
    Help: 159
    Rate: 462
    Yes, only it has to be a transistor as I wrote, don't power the contactor coil directly from the GPIO.
  • #7 14973673
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    i honestly don't get it. Is this how it's supposed to work? Attempting to upgrade the electrical installation with a control module.
  • ADVERTISEMENT
  • #9 14973735
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    I can see I'm in for a wade through the basics of electronics -.-' and I thought it would be so easy :)
  • #10 14973877
    TvWidget
    Level 39  
    Posts: 4403
    Help: 472
    Rate: 694
    How do you freeze detect the "presence of residents in the flat" ? This compared to relay control is not a trivial problem.
  • ADVERTISEMENT
  • #11 14973919
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    TvWidget wrote:
    How do you freeze detect the "presence of occupants in the flat" ? This compared to relay control is not a trivial problem.


    Simpler than you think. The problem is that we are in the 21st century. The young population is not up to speed with gadgets either. What I mean exactly is that RPi can ping smartphones. And you know - when you leave home, you take your phone with you.

    So I ping the defined IP addresses of the smartphones, which also respond when they are at rest. There is a ping - there is a person, no ping - no person.
  • #12 14974003
    michcior
    Level 30  
    Posts: 1132
    Help: 159
    Rate: 462
    And it's fair to ask what you want to disconnect? Any special device, lighting?
  • #13 14974087
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    Generally everything except the fridge and gas cooker.

    EDIT. the fridge and kitchen + router with RPi will be on the same circuit without the relay
  • #14 14974137
    michcior
    Level 30  
    Posts: 1132
    Help: 159
    Rate: 462
    In my case, it probably wouldn't work. My phone often gets discharged at night, or I forget to charge it. I also turn off WiFi when I don't need it.
    Do you plan to set times when the mechanism works? E.g. weekdays from 8am to 5pm or something like that?
  • #15 14974155
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    I do not plan to. However, I do not see a problem to program such dependencies. On principle:

    LastCheck = is person
    HoursNight => lastCheck && hoursNight = do not change state

    As for unloading the phone, the problem does not concern me.
  • #16 14974245
    TvWidget
    Level 39  
    Posts: 4403
    Help: 472
    Rate: 694
    Are you sure that a sleeping phone will respond to pings ?
    Mine is no longer responding after about 30 seconds after turning off the screen backlight.
  • #17 14974498
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    I have checked several times. And I haven't noticed that my phones or girlfriends don't want to respond while I'm 'sleeping'. However, before the overhaul - today/tomorrow in total - I will try to upload a script on the RPi that will check attendance and save the results to a database to later verify if it is as I would like it to be.
  • #18 14990329
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    Welcome back,

    Gentlemen, I review datasheet of transistor BC337 and please confirm or deny. For the operation of this electronic component I need - in my case - AS much as 45V ?!

    If this is true, is anyone able to suggest which transistor model on the collector needs 5V, base 3V and emitter 5V ?
  • Helpful post
    #19 14990483
    pafciowaw
    Automation specialist
    Posts: 2439
    Help: 480
    Rate: 364
    45-50 is the MAX voltage!
  • #20 14991072
    przeqpiciel
    Network and Internet specialist
    Posts: 2499
    Help: 285
    Rate: 238
    OK, I asked because it didn't want to work as expected. However, now "dry" the buzzer shows that the relay is working according to the GPIO of the RPi.

    I'll try to add the database structure and scripts I've prepared for further electrical upgrades in the near future.

    One more beginner question - the emitter of the transistor is connected to GND ?
ADVERTISEMENT