ESP8266 Controlling LED Mini Light Set

I found a Battery Operated LED Mini Light Sets on sale at Big Lots and thought I might be able to control them with an ESP8266 (ESP-01).  I want to use the same power supply for both the ESP-01 and LEDs.  The unit is marked for indoor use only, but the box appears to be weather resistant, with a rubber seal for lid, button, and wire exit point.

Cool white battery-operated LED mini light set with 3-way function button, depress for Timer-On, Steady-On, and Off.

Power Source is three “AA” Type Batteries.

I plan to connect the esp-01 to the batteries using a mini 1.8V 3V 3.7V 5V to 3.3V Boost & Buck Low Noise Regulated Charge Pump DC/DC Converter, and control the off and on of the lights using a 2N3904 NPN General Purpose Transistor.

 Image result for 3.3v regulated charge pump schematic
3.3V Regulated Charge Pump DC/DC Converter

Image result for 2n3904 npn general purpose transistor image

2N3904 NPN General Purpose Transistor

Image result for esp8266 3904

switch circuit

Raspberry Pi controlling 64 relays

img_0072I wanted to set up a Christmas light display using LED Lights.  The LED Lights would require less power, allowing the use of a single 15 amp circuit. Using a Raspberry Pi was an easy decision, given the amount of information available on the internet and the low purchase price (under $30 at Micro Center).

The initial design was to control 32 strands of lights, but with the Christmas tree taking up 16 strands and the leaping lights taking up another 16 strands, I decided to increase the total number of relays to 64.


Simply using GPIO pins would not allow me to control that many relays, so  I begin to investigate my options and discovered the wiringpi website.  The site provided the necessary information to move the project forward Using i2c with a 16 input/output port expander was the first step in my solution.

You can attach multiple MCP23017s to the two i2c pin

s on the Raspberry Pi to obtain 16 general purpose pins per chip. Using four MCP23017 expansion chips, I could add 64 additional pins to the raspberry.

I found the IO Pi Plus, manufactured by AB Electronics in the UK, using an internet search. It is a 32 channel digital expansion board designed for the Raspberry Pi.  A pair of MCP23017 chips are on the board allowing you to connect up to 32 digital inputs or outputs.  Using two of the boards gave me the 64 pins required.

IO Pi Plus

Having all the relays on at the same time raised the concern of how much power the relay circuit would require, and could the MCP23017 handle the total demand.  Some additional research was required after I damaged one IO Pi Plus board in a 32 relay test.

The 16 channel relays I selected used opto-isolation and indicated that each relay would require 15-20mA Driver Current; therefore, the worst case was 320mA per board.  The MCP23017 has a maximum output of 150mA.

Finding the “ULN BOB” 16 Channel Darlington Driver IC Breakout Board was the solution to this potential problem.  It allowed me to have all 64 relays turn on at the same time. The Darlington can handle 500mA per output.

16 Ch. Darlington Driver PCB Arduino, RaspPi,  PLC

Another extender card that I found was the  JeeLabs Output Plug, which is a small board that contains an 8-bit I/O expander plus an NPN darlington array. An I2C bus, with all the power and signal lines, are available on the other side of the board to allow daisy-chaining with other I2C conformant boards.


Putting it all together in a compact space required some creativity.  The one thing that was an oversight in the final design was access to the SD card on the Raspberry Pi.  I would recommend an SD extension cable to allow you to move the SD card to a location that can be accessed more easily.

Further reading:

Pocket Guide

Pocket Guide

The ‘Pocket Guide’ blog provides reference material for Do It Yourself (DIY) projects that involve the Raspberry Pi, ESP-8266, and related technologies (hardware and software).   Every attempt will be made to list the sources for information gathered and shared in each blog posting.