Connect with us

Automatic Lighting with Raspberry PI

Discussion in 'Microcontrollers, Programming and IoT' started by Damcios2509, Jun 13, 2016.

Scroll to continue with content
  1. Damcios2509


    Jun 13, 2016
    Hi guys,

    I was thinking about making the lights in my appartement work on either wireless or
    wired but controllable from a raspberry pi.
    From what I can gather, my lights are all on a single circuit, so I can't just place one switch
    and make it do the work.
    I don't want to do for a full make-over as the appartement is only two years old, and
    I'd like to keep the budget relativelly low if possible.

    I was thinking of using something like this :
    But I have no idea if it would be doable to open the controllers, change the manual switch to an electronic one and
    place them all somewhere in a box.
    Or maybe it would be better to switch the wall switches to electronic ones.

    I'm looking for general ideas, afterwards I'll work out a project and post it as well.
    Any ideas or suggestions ?
  2. donkey


    Feb 26, 2011
    there are options available check out to get started and hopefully from there they can direct you to the right user end software for the pi
  3. Mark2019


    Jul 7, 2019

    You ideally want to decide where you are going to switch this from If you want all the lights on then you are looking at doing this from the consumer unit in which case you use Rs485 protocol

    I'm assuming you want to still use the RPI although you can also do this via ESP8266 , ordinary arduino although Im not 100% sure of how stable this is

    How ever taking the above points into account you then need to decide on the following

    Network connection type , wireless , power line , hardwired via cat5 , Zigbee or other

    Conversion from one protocol to another TCP-IP To Rs232 to RS485 I would think in your case

    Type of hardware required for interfacing
    Safety systems , battery back up what do you do in event of power going down start up sequence etc etc

    Back up systems , UPS battery , etc

    Controller interface

    This might be mobile phone , web interface , Infra red remote , LCD touch screen , desktop / tablet application

    Software your going to use
    Encryption if any although that could be entirely your own

    Here is one such example you can view on face book that I've been experimenting with for demonstration purposes using UDP , Serial ports , Arduino Uno simply to drive leds I could change this to independent relays , Triacs if you prefer solid state

    I could also add to this or change this to PWM for lighting dimming sequences similar to DALI Lighting protocol

    Or You could implement that yourself on RPI

    You can watch the video from this address below

    Unfortunately for some unknown reason there does not seem to be facility to upload videos directly for you or I could make this very interesting and write a full blown article this too

    Alas I am awaiting on one of your site managers eedam or similar to contact me with reference to writing such articles with suitable mutually agreeable arrangements although I have left a few message so far

    Never the less here is the outline of what ive been experimenting with myself

    I have done similar with Bluetooth modules , Android , Java with Arduino as well which really does work well and is reliable

    From RS232 and then you only need add RS485 conversion module

    Here is the rest of the code you can play with
    **** Here is this code at git hub ******

    This is the code for the Arduino
    Right at the bottom of this comment is address for code at github for the UDP Receiver

    There are also two photo's for those who would like to try this out showing connections connections to Arduino

    byte byteRead;

    void setup()
    DDRD = B11110000 ; // make all upper nibble port d Outputs
    DDRC= B00001111 ;



    void outPorts(byte val)
    byte lowNibble = 0x00 ;
    byte hiNibble = 0x00 ;
    lowNibble = val & 0x0F ;
    hiNibble = val & 0XF0 ;
    PORTD = hiNibble ;
    PORTC = lowNibble ;


    void loop()

    if (Serial.available() > 0) {
    // read the incoming byte:
    byteRead = Serial.parseInt();
    outPorts(byteRead) ;
    The address for the code at github for the udp client as below

    I've included layouts for this simple project plus schematic for you to experiment with


    Attached Files:

    Last edited: Jul 20, 2019
  4. Bluejets


    Oct 5, 2014
    This is an OLD post and i doubt the Op is still around.
    hevans1944 likes this.
  5. hevans1944

    hevans1944 Hop - AC8NS

    Jun 21, 2012
    Yet another "drive by" poster looking for a quick answer. Not finding one, off to another forum perhaps...
  6. Mark2019


    Jul 7, 2019
    Does this get an better than this lol
  7. hevans1944

    hevans1944 Hop - AC8NS

    Jun 21, 2012
    Oh, yeah. Some of them hang around, ask questions but obviously pay no attention to our replies, and never explain just WTF they are really trying to DO. It is sometimes really difficult to distinguish this activity from trolling, but either one can best be handled by refusing to reply, the sooner the better, and moving on to more productive thread dialogs.
    davenn likes this.
  8. davenn

    davenn Moderator

    Sep 5, 2009

    Just some advice, Mark, in noting you have done this several times.
    Before you post, check the date of the last post, in this thread 20 June 2016

    As a generalisation, if the last post is more than around 10 - 12 months old or older, don't bother responding :)
    this thread was started just over 3 years ago

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day