Project in progress
SMART Home LED Lighting System and More

SMART Home LED Lighting System and More

A touchscreen in the wall that allows you to control each and every LED light in your ceiling independently and phone controllable!

  • 25 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

I have 8 dimmable LED lights in my ceiling I have installed. I currently have them hooked up to an AC dimmable module. This is hooked into an Arduino Uno. I can control the brightness of all of the LED lights by the Arduino. The Arduino has a Bluetooth module hooked up into it which allows me to control the lights by the phone. My plan is to remove the AC dimmable module and replace it with a 8 channel AC dimmable module so I can control each light independently. I will also remove the switch from the room and replace it with a touchscreen that is hooked into the Arduino. I will also have to create a DC power supply as the main AC line will go through the Arduino and the dimmable board. I plan on writing the software to control the lights from the phone and any device in my home that has Bluetooth. When everything is tested and good, a raspberry pi will come into play as a mini server that will host a site that I can access in home by the router and an IP. Anything in my home will be able to be controlled by connecting an a relay or dimmable AC module to it and Bluetooth through Arduino.

-----------------------------Update 6/23/2018

The 8 channel AC dimmer module has been implemented into the project and Arduino code has been written to make the module work. There was no working code for this module online so it took a full day to get this to work with multiple TRIAC'S. Next step is to design a PCB that will act as a central unit for all components to hook into, including having a PSU on the board to drive the Arduino. This unit will sit inside the wall, so it will take 110 AC voltage straight in.

I have drawn the conclusion that a large touchscreen will be easiest to implement with the Raspberry Pi. I have ordered a Raspberry Pi 7" touchscreen that will act as a central unit to change the values on the dimmers. Eventually a server will be setup and host a website that will be ran that controls all the units in my house including this light project. This will be the next step after the dimmer system is complete.

Also to note, I will be designing enclosures in Autodesk Fusion360 and 3D printing them on my 3D printers. This should help make sure that short circuits don't occur or fire hazards. Insulation and other items are in my ceiling. I want to avoid any occurrences of anything touching the PCBs, short circuiting, and creating fires.

-----------------------------Update 7/3/2018

I have a raspberry pi 3 working with an element14 7" touchscreen. I am currently working on the server and client side UI that will display on the screen. This has been a battle as I have had to learn nodejs. The real problem was getting this project to work on windows in visual studio. I could not get some libraries to load through NPM in visual studio. After 2 days of battling it, I gave up so I would not waste any more time on it. I am writing all my code in Visual studio and then transferring it over to the raspi to see what the UI looks like. This is time consuming but gets me closer to the project goals. Once I have the server/ui finalized, I will be able to hop back on the electronics side. I have my pcb's that I designed ready to be tested. Hopefully I have no roadblocks with it and I can skim through the electronics side straight to the 3d design and printing of enclosures. I will keep you all updated as I move along.


Place this code into an arduino ino file. Must reference the TimerOne library. Link in the code.
/*AC Light Control FOR 8 CHANNEL UNIT

Updated by Joey Pongallo

Revised code from Robert Twomey who Adapted from Ryan McLaughlin  


#include  <TimerOne.h>			  // Avaiable from
volatile int i = 0;               // Variable to use as a counter volatile as it is in an interrupt
volatile int i2 = 0;
volatile boolean zero_cross = 0;  // Booleans to store a "switch" to tell us if we have crossed zero
volatile boolean zero_cross2 = 0;

int channel1 = 4;                // Output to Opto Triac / Channels
int channel2 = 5;
int channel3 = 6;
int channel4 = 7;
int channel5 = 8;
int channel6 = 9;
int channel7 = 10;
int channel8 = 11;

int dim = 0;                    // Dimming level (0-128)  0 = on, 128 = 0ff
int dim2 = 0;
int dim3 = 0;
int dim4 = 0;
int dim5 = 0;
int dim6 = 0;
int dim7 = 0;
int dim8 = 0;

int freqStep = 65;    // This is the delay-per-brightness step in microseconds.
					  // For 60 Hz it should be 65
					  // It is calculated based on the frequency of your voltage supply (50Hz or 60Hz)
					  // and the number of brightness steps you want. 
					  // Realize that there are 2 zerocrossing per cycle. This means
					  // zero crossing happens at 120Hz for a 60Hz supply or 100Hz for a 50Hz supply. 
					  // To calculate freqStep divide the length of one full half-wave of the power
					  // cycle (in microseconds) by the number of brightness steps. 
					  // (120 Hz=8333uS) / 128 brightness steps = 65 uS / brightness step
					  // (100Hz=10000uS) / 128 steps = 75uS/step

void setup() {                                    
	pinMode(channel1, OUTPUT);                          // Set the Triac pins as output
	pinMode(channel2, OUTPUT);
	attachInterrupt(1, zero_cross_detect, RISING);    // Attach an Interupt to Pin 2 (interupt 0) for Zero Cross Detection
	Timer1.initialize(freqStep);                      // Initialize TimerOne library for the freq we need
	Timer1.attachInterrupt(dim_check, freqStep);
	// Use the TimerOne Library to attach an interrupt
	// to the function we use to check to see if it is 
	// the right time to fire the triac.  This function 
	// will now run every freqStep in microseconds.    

void zero_cross_detect() {
	zero_cross = true;               // set the boolean to true to tell our dimming function that a zero cross has occured
	zero_cross2 = true;
	i = 0;
	i2 = 0;
	digitalWrite(channel1, LOW);       // turn off TRIAC (and AC)
	digitalWrite(channel2, LOW);

// Turn on the TRIAC at the appropriate time
void dim_check() {
	if (zero_cross == true) {

		if (i >= dim) {
			digitalWrite(channel1, HIGH); // turn on light       
			i = 0;  // reset time step counter                         
			zero_cross = false; //reset zero cross detection
		else {
			i++; // increment time step counter                     

	if (zero_cross2 == true) {
		if (i2 >= dim2) {
			digitalWrite(channel2, HIGH); // turn on light       
			i2 = 0;  // reset time step counter                         
			zero_cross2 = false; //reset zero cross detection
		else {
			i2++; // increment time step counter                     


void loop() {

/*if (dim >= 199)
	dim = 199;
if (dim <= 5)
	dim = 5;*/

	if (Serial.available() > 0) {

		//char data =; // reading the data received from the bluetooth module
		int value = Serial.parseInt();

		if (value > 1000 && value < 2000) {

			dim = value - 1000;
			dim = filterDimmingValue(dim);
			Serial.println("Channel1: " + dim);

		if (value > 2000 && value < 3000) {
			dim2 = value - 2000;
			dim2 = filterDimmingValue(dim2);
			Serial.println("Channel2: " + dim);

		// Turn all lights off
		if (value == 0) {
			dim = 128;
			dim2 = 128;

		// Turn all lights on max
		if (value == 9999) {
			dim = 5;
			dim2 = 5;



int filterDimmingValue(int value) {
	if (value > 128)
		value = 128;
	if (value < 5)
		value = 5;
	return value;


8Channel dimmer working on arduino with bluetooth
This is just a teaser image of the arduino hooked up to the bluetooth and 8 channel dimmer module. It is currently operating successfully.
20180623 163211 fzpkkbv39d
Client side UI sample 7/3/2018
This is my progress so far with the UI that will appear on the touchscreen. I have bluetooth search functions built in.
Capture pjfjrd3qkn


Similar projects you might like

The hydroMazing Smart Garden System

Project tutorial by Cory Potter

  • 195 respects

Arduino Controlled Smart Hydroponic Modular System

Project in progress by Luis Antonio Martin Nuez

  • 159 respects

Automatic LED Stairs Lighting Arduino Shield

Project tutorial by Aivaredze

  • 37 respects

The PerfectAutomatic Lighting System Using Arduino + LDR ...

Project tutorial by Smart Technology

  • 18 respects

Home Smart Home

Project tutorial by Syed Sanoor

  • 253 respects
Add projectSign up / Login