One Control Multi LED Strips

by samsungite in Circuits > Arduino

2478 Views, 3 Favorites, 0 Comments

One Control Multi LED Strips

Ambient
20190930_075400.jpg
20190930_075422.jpg
20190930_075340.jpg
20190918_203510.jpg

I have 5 pieces of furniture in which I wanted to install LED strip lights.

The LEDs had to be remote controlled with an option for Alexa ON/OFF. ALL LEDS had to power on & change colour in sync with only one press of the romote control. They also had to remember the last chosen colour at power off.

The optional Alexa ON/OFF is controlled by an ESP8266, the remote control is achieved using an infra red controller and the colour information is distributed useing the extremely cheap 433 MHz transmitter and receivers.

I have an identical setup for my under cabinet lighting in my kitchen but I used 315 MHz transmitter and receiver as I did not want any interaction between the two.

Components

20190902_200828.jpg
20190902_195324.jpg
20190902_193137.jpg
20190903_115625.jpg
20190930_101031.jpg

As per most of my projects component count is small and most of the work is done in the software.

The remote control came with a cheap RGB LED strip (eBay).

Programable neopixel LED strips (NOT RGB)

Arduino pro mini (though any Arduino will do)

Infra red receiver

433MHz transmitter

4 x 433MHz receivers

OPTIONAL ESP8266 for Alexa ON/OFF only (NOT Colour control)

All units are powered by standard phone chargers.

The ESP8266 is powered by a 5v to 3v regulator fed by a standard phone charger.

How It Works

20190930_101218.jpg
20190930_101150.jpg

There are 3 parts to theis project

1) The master unit

2) The slave units

3) Optional Alexa switch.

The master unit comprises of an Arduino, an Infra red receiver, a 433MHz transmitter and a LED strip

The infra red code is received and decoded by the Arduino which in turn controls the neopixel led strip.

When the colours are set on the master unit, the information is then sent to the slave units via the 433MHz transmitter.

The slave units comprise of an Arduino, a 433MHz receiver and a neopixel LED strip.

When the code is received from the master unit, the LED strips on all of the slaves is set to the same colour.

NOTE:

I was going to use RGB LED strips BUT there was a conflict with the LED strips and the 433MHz receivers !

It was due to the Arduinos internal timers, Using PWM on too many pins while the receiver was enabled was the issue which is why I opted for the programmable LED strips - Lots of control on just one PWM pin.

The optional Alexa switch is just an ESP2866-12e with 3 switches and 2 pulsed outputs.

See the Software Step for more detailed information.

Saying Alexa "Lights On" (user programmable) pulses pin 10 of the Arduino HIGH which sends the same code as the IR transmiers ON button. Lights Off pulses pin 11 HIGH sending the same code as the IR transmiter OFF button. The switch does not control the colours !

IMPORTANT NOTE.

If the Alexa option is not used, BOTH Arduino pins 10 and 11 MUST be shorted to ground otherwise the LEDs will just flash !!

The Software

phone1.jpg
phone2.jpg

There are 3 parts to the software.

1)The master unit (leddir433-V2_RXTX.ino)

2) The slave units (IR_rxarduino_V2.ino)

3} The optional Alexa switch software. The remaining 6 files should be copied into a single folder before uploading to the ESP8266.

The master unit

Pin 2 on the master unit is connected to the IR receiver.

Pin 6 is connected to the Data in on the LED strip.

Pin 12 is connected to the 433MHz transmitter.

There is an array which holds the code from the IR receiver, the R G & B levels (0 - 255, I'm only running them at about 20% brightness) and the last parameter (1 or 0) is used as a flag to remember (1) or to forget (0) the last code received. This is so when the LEDs are switched on, the last colour selected is used. I do not want to remember the ON & OFF buttons codes, just the colour codes.

NOTE: If the Alexa option is not used Pins 10 & 11 of the Arduino MUST be connected to 0v.

The slave units

The receive pin of the 433MHz receiver is connected to pin 2 of the arduino.

The LED strip is connected to pin 6.

The LED strips are set to the colour of the code received.

NOTE:

I added a new LED strip behind my sofa so I wanted the LEDs brighter than those in the cabinets.

I just modified the BOLD line to multiply the received values by 2, the *2 is normally omitted !

void setstrip(int r,int g,int b)
{

for (int n=0;n < N_LEDS ;n++)

{ // Serial.println(n);

strip.setPixelColor(n, r*2, g*2, b*2); // strip.setPixelColor(n, r, g, b);

}

strip.show();

inString="";

msg=" ";

}

The Alexa switch

I have made (and use) 8 Alexa switches. The circuit is simple and all of the work is done in the software.

I cannot take any credit for the code, I just modified the outputs.

Its the usual setup for programming the ESP8266 and there are tons of 'How To' on the web.

On initial power up, the ESP checks to see if it has been connected to an access point previously. If it hasn't or the previous access point is no longer available, it, itself sets up as an access point with a web page to enable you to put in your router credentials and an Alexa phrase, eg 'Ambient Lights' or 'Table Lamp' etc.

The Alexa phrase MUST end with an '*' eg Table Lamp*.

Pin 4 of the ESP goes to pin 10 of the Arduino

Pin 12 of the ESP goes to to Pin 11 of the Arduino

Pin 5 is an optional output for an LED with resistor to show wifi connected (I do not use this)

If Pin 13 of the ESP is grounded (0v) during power on, the Alexa phrase and last router credentials are erased.

Inital setup or setup after pin 13 grounded (parameter reset).

After programming the ESP8266 or parameter reset, the following should be seen on the Arduino serial monitor :-

*WM: Configuring access point...
*WM: AutoConnectAP

*WM: AP IP address:

*WM: 192.168.4.1

*WM: HTTP server started.

Now, on a PC or mobile device, go to wifi settings and select the AutoConnectAP

Open a browser and in the address bar type 192.168.4.1 (See pictures)

Select 'Configure Wifi'

Select your router from the list and enter your password and Alexa phrase - DON'T forget the *

Now, RESET the ESP.

Go to the Alexa app or ask her to discover devices, the new device should be discovered.

Alexa can now be used to turn the lights on and off.