element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Pi IoT
  • Challenges & Projects
  • Design Challenges
  • Pi IoT
  • More
  • Cancel
Pi IoT
Blog Pi IoT - Simone - #1 - Light Controller
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: bosc
  • Date Created: 15 Aug 2016 2:46 PM Date Created
  • Views 551 views
  • Likes 3 likes
  • Comments 3 comments
Related
Recommended

Pi IoT - Simone - #1 - Light Controller

bosc
bosc
15 Aug 2016

<Work in progress, the attachments can be changed when the controller is done>

 

The idea for this part is to have a way to control the lights in the house from your phone, PC, or through a web address. Also the system let's you receive information about the current state of the light.

An important part is to leave the possibility to control the lights from the wall switches as before.

 

The whole controller for the switches should be as small as possible. To make it fit I had to dig a small hole in the wall below the switch to fit the relays, but the controller actually fits behind the switches.

 

Previous posts

Pi IoT - Simone - Introduction

 

To make this component the system is separated in:

- Main server

- Relay switches

- Lights controller

- Ammeter

 

Main Server

The main server is hosted on the raspberry PI and it is a C++ application that ensures the communication through I2C to the other components throughout the house, it keeps the current state of things and also provides the interface for communication through WebSockets for the phone to connect to.

This system will be covered in a later post as it is not fully functional at the moment and also it is a component on it's own in this project.

 

Relay Switches

To leave the possibility to control the lights in the old way I used a staircase switch connected to the relays board. The relays are RM50-3011-85-1005 which actually works as a staircase switch by changing the connection from the main pin to one of the two out pins. Here are some explanation of how to connect the switches: StairCase Wiring Circuit Diagram. Electrical Technolg

 

The relay board is supposed to be controlled by an Atmel Chip which cannot provide the power for the relays to function so I used a simple transistor system to digitally control them.

 

image

 

The schema is for three switches.

 

Lights controller

 

The lights controllers use a AT Tiny micro controller to ensure the connection to the main system through I2C and control the switches.

image

The component also has a voltage regulator because the ATTiny chip works on 5 volts and I sent 20 Volts through the cable to ensure that it provides a necessary 5 volts to all the components and also if needed it can have more power for motors for example.

The controller has two in pins for the I2C communication, three pins for the light switches and an IN pin for the ammeter.

 

The code for the controller is attached to the post.

Besides the actual control functions the component also have a ping and an identify function.

The ping is used for the main system to identify when a component has a notification and also that it has connection to the whole system. Because the I2C is a Master/Slave communication system and the ATTiny controller are not very fast, for notifications the main system pings all the known devices and checks if there are notifications to be communicated. The light controller does not have an alerting system nor does it need one but it seemed better the have the same interface working for all the components.

The Identification function is used by the main system to know how to control the component. The idea is to be able to connect one now controller to the system without actually "telling" the server on the Raspberry that you did so and how to control it. The identification is a simple string that has the I2C address, how many switches it controls and what type of a controller it is.

 

Ammeter

The issue with the system is actually the part where normal functions should be provided to the user, so the system can switch lights through the phone but the user can also use the actual switches on the wall which are not digital, but normal ones. This way if there is an error the light can still be switched on and also it lets visitors turn on the lights even if they do not have permissions to control the devices. I think an important part for the system is to make life easier and not change it all together.

When the light is turned on from the switch and not from the device the system needs to know so it can tell you if it is on or off. Also the relays can switch between two positions. If the light is on the switch will turn it off and vice versa.

Taking into consideration that if you have multiple switches, the possibility for them to control the same power consumption is very low. So I am building an ammeter to calculate which lights are on and which are off. So I will try to calculate the power consumption on the mail cable that goes to the switch and after that calculate which lights are on and which are off. If there are changes in the system a simple calibration process can be made where the user is asked to turn on the lights one by one and the component gets the data for each switch. This is what I am trying at the moment as a basic low cost ammeter:

image

 

This component is not ready yet. At this moment I am building this schema and I will test it. If everything works tomorrow I should be able to continue this post and have a working system for the light switches. If there is anyone who has a better idea please leave it in the comments.

Attachments:
Light_Controller.zip
Eagle.zip
  • Sign in to reply

Top Comments

  • DAB
    DAB over 9 years ago +1
    Nice start. I will keep and eye on your posts, they look like they will be interesting to follow. DAB
  • jc2048
    jc2048 over 9 years ago

    Have a look at this blog for a safer way to measure a mains current

     

    https://www.element14.com/community/groups/arduino/blog/2015/12/10/3-aardenergy-current-and-voltage-transformers

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • volly
    volly over 9 years ago

    bosc I fully share DAB's sentiment. This is actually something really useful and could be implemented as a DIY as an alternate to the more expensive commercially available products.

    Further, it could easily be extended to a fully automated home system.

    YV

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 9 years ago

    Nice start.

     

    I will keep and eye on your posts, they look like they will be interesting to follow.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube