Homekit LED Strip Using 3 “standard” Modules

by Achim Pieters in Circuits > Apple

5136 Views, 35 Favorites, 0 Comments

Homekit LED Strip Using 3 “standard” Modules

image.png

I have already written several blogs about ESP Homekit. For the more experienced makers this is not a problem. But for starters or starting makers or hobbyists it may not be so easy. 

That’s why in this blog I’m going to make a LED strip using 3 “standard” modules. This should make it possible for everyone to make their own Homekit LED strip.


Supplies

image.png
image.png
image.png
image.jpeg

Before we start our project we have to gather the Hardware. I will sum-up the hardware and add a optional link where you can buy it.


ESP8266-01S

Many modules have been made around the ESP8266 chip. The ESP01 combines a small size with standard 2.54mm headers. Conversely, only 2 GPIO pins are available, along with the serial RX and TX pins. For example, the module is widely used as a serial WiFi/internet bridge between two microcontrollers. All WiFi and TCP/IP functionality is already built in. The original blue ESP-01 modules had 512KB of memory, the newer black modules – also known as ESP01S – have1MB of memory.


Relay

The SRD-05VDC-SL-C relay has three high voltage terminals (NC, C, and NO) which connect to the device you want to control. The other side has three low voltage pins (Ground, Vcc, and Signal) which connect to the ESP8266-01S. Inside the relay is a 120-240V switch that’s connected to an electromagnet. When the relay receives a HIGH signal at the signal pin, the electromagnet becomes charged and moves the contacts of the switch open or closed.


MP2307 buck converter

The ‘Mini 360‘ DC-DC Buck Converter Power Module use integrally molded power inductor and synchronous rectifier control chip, smaller and more efficient. This Module can be use as a DIY mobile power, monitor power supply, power buggies, camera power supply, car power, communications equipment supply, various right size and weight for demanding applications such as aviation models, etc.


LED Strip

The LED strip can in principle be any strip, except for a color LED strip, because in this case we only have an on and off switch. In this example we use a 12 Volt white LED strip, also suitable for outdoor use, IP67 certified.

Circuit Diagram Example

image.png

First we have a look at what we are going to build. We start at the 12 Volt adapter. We have to convert it to 3.3V for the ESP8266-01S Module. Herefore we use a P2307 buck converter. Then We have a SRD-05VDC-SL-C relay by which we control te power of the Led strip.


Writing the ESP8266

Flashing a program to the ESP8266 is a bit more difficult than flashing an Arduino. When flashing the Arduino, all you have to do is press the reset button and release while you upload a program (or even not doing anything if you have FTDI such as in Arduino UNO, NANO, MICRO, etc.) and the Arduino will start uploading. With the ESP8266 you have to reset the micro-controller and start it in flashing mode using the GPIO0-to-Ground.

ESP8266-01S Program Scheme

image.png
image.png

The sketch shows the ESP8266 connected to FTDI Programmer with a voltage regulator onboard.

NOTE: Be Sure that you have the Jumper placed on the 3.3V setting and not the 5V setting because this will destroy your ESP module!

As you can see two buttons have been added. The Left button, when pressed, connects the RESET pin to the ground and when it is released, connects the RESET pin to the VCC through a pull-up resistor.

Software Preparation

image.gif
image.png
image.png
image.png
image.png
image.png

We have to install esptool.py on our Mac in order to be able to flash our ESP module. To work with esptool.py, you’ll need Python 3.9 or a newer Python installation on your system. We recommend using the latest Python version, so go to Python’s website and install it in your computer.

With Python installed, open a Terminal window and install the latest stable esptool.py release with pip:

pip install esptool

Note: with some Python installations that command may not work and you’ll receive an error. If that’s the case, try to install esptool.py with:

pip3 install esptool
python -m pip install esptool
pip2 install esptool

After installing, you will have esptool.py installed into the default Python executables directory and you should be able to run it with the command esptool.py. In your Terminal window, run the following command:

esptool.py

With esptool.py installed in your computer, you can easily flash your ESP32 or ESP8266 boards with the firmware.


ESP OS Preparation

To run our ESP HomeKit device we need to install LifeCycle Manager 2 And Open RTos.


Life Cycle Manager 2 (LCM)

Initial install, WiFi settings and over the air firmware upgrades for any ESP-open-RTos repository on GitHub.


ESP-open-RTos

A community developed open source FreeRTOS-based framework for ESP8266 WiFi-enabled microcontrollers. Intended for use in both commercial and open source projects.Originally based on, but substantially different from, the Espressif IOT RTOS SDK.

Bin Files

At first you need to download three bin files otaboot.bin, rboot.bin and blank_config.bin. The OTAboot.bin contains the Lifce Cycle Manager part. The rboot.bin contains the bootloader for the ESP8266. The blank_config.bin in just a blank config file. Now connect your device to your FTDI adapter in flash-mode.

LATESTRELEASE

File nameotaboot.bin

Version: 2.1.2

File namerboot.bin

Version: 1.4.2

File nameblank_config.bin

Version: 1.4.2


Installing Life Cycle Manger 2

The Right button, when pressed, connects the PROGRAM pin to the ground and when it is released, connects the PROGRAM pin to the VCC through a pull-up resistor.

I also added A LED when the ESP is in PROGRAMMING STATE  state the LED is ON. When The ESP is in “NORMAL” state the LED is OFF. Using this two buttons you can do all the tasks you need with the ESP8266:

  • Working on NORMAL mode – Both buttons are released.
  • RESETTING the ESP8266 – Press the RESET button and release.
  • Start in FLASH MODE – Press both buttons, release the RESET button and then release the PROGRAM button.

PUTTING DEVICE INTO FLASH MODE

To enable ESP8266 firmware flashing GPIO0 pin must be pulled low before the device is reset. Conversely, for a normal boot, GPIO0 must be pulled high or floating. Start in FLASH MODE – Press both buttons, release the RESET button and then release the PROGRAM button.

Go to the directory you made where you put the previously downloaded (e.g. Downloads) Root.bin, Blank_config.bin and Otaboot.bin files.

Use esptool.py to flash it in your device. First, erase flash memory from your ESP module:

esptool.py erase_flash


Normally, your ESPPort will be something like (e.g /dev/cu.usbserial-A50285BI). Then, set your device in flash-mode again, and flash the new firmware:

esptool.py -p /dev/cu.usbserial-A50285BI --baud 115200 write_flash -fs 1MB -fm dout -ff 40m 0x0 rboot.bin 0x1000 blank_config.bin 0x2000 otaboot.bin

Connecting to Life Cycle Manger 2

image.png
image.png
image.png
image.png
image.png
image.png

You must configure WiFi network and OTA repository. To configure WiFi settings, device generates its own WiFi in AP mode. You must connect to it in order to setup your WiFi network. Before you connect to Life Cycle Manger 2, reset your module by pressing the reset button.

Simply click the Wifi Icon on your Mac, and search a SSID with LCM-XXXXXX , connect to it, and wait a few seconds until a captive portal appears showing you all WiFi networks that the device has found.

Then select your WiFi Network you want to connect to.

Then enter your WiFi passwordDo not click Join yet!

Setting a value for a led_pin visual feedback is possible. This is done by selecting in the pulldown menu a GPIO pin, where your led is connected (Default 2 on your ESP Chip). 

Then place a tick after If active on ‘1’. 

Now you can enter the OTA repository ( this is your previously made GitHub name followed by your repository name):

AchimPieters/ESP8266-HomeKit-Essentials-Lightstrip

OTA binary file:

main.bin


To finish initial setup, click Join button and wait about 7 minutes until process finish (While installation is working, device doesn’t show anything, and buttons don’t work). After that, LED turns on for a couple of seconds and you will be able to add your accessory to your HomeKit ecosystem using Home App. Life Cycle Manger 2 will install your HomeKit device on your ESP.

Connecting With Homekit

image.png

Now you can add your HomeKit Outlet by scanning the QR code below. To make the connection between your ESP8266-01S – HomeKit Lightstrip and the Homekit app.

Lets Start Building

image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png

Now that we have programmed our ESP8266-01S, we can get our hardware ready. We start by soldering A red wire to the VCC pin, a Black wire to the GND Pin, A white wire to GPIO0 and a 10KΩ om the CH_PD Pin.

Bent the unsolder leg to the VCC Pin And solder it.

To make sure noting can touch the pins we use a Heat shrink tubing.

Place the Heat shrink tubing carefully around the pins, resistor and cables.

Not everybody has a heating gun, but you can shrink the tube with the heat of your soldering iron.

On the back of your ESP8266-01S Module I used some double sided tape.

Paste the ESP8266-01S module on top on the Really Module lik the image below.

Now we take the MP2307 buck converter module and solder a red wire to the VCC output pin, a Black wire to the GND output Pin. on the other side we also solder two wires.

We paste the MP2307 buck converter wit double sided tape to the Relay module as shown below.

Connect the VCC Out wire to the middle of the screw terminal of the Relay module. Also add an extra wire.

Solder the VCC red wire to the VCC Pin of the Relay and the Black GND wire to the GND Pin of the Relay Module. Connect the 12 Volt Wire of the LED ledstrip to The screw terminal of the really module.

Now solder the Middle wire of the Relay screw terminal to the VCC of the powerplug. Then Solder the GND Wire of the LED Strip and the GND wire of the MP2307 buck converter module and connect it to the GND pin of the PowerPlug.

NOTE: DO NOT CONNECT THE RED VCC AND BLACK GND WIRES TO THE ESP8266-01S MODULE YET!

Before we can connect the MP2307 buck converter module and the ESP8266-01S module we have to change the output voltage of the MP2307 buck converter module. Connect the 12 Volt Power adapter to you PowerPlug en connect your multimeter to the Output wires. Then turn the Pot-resistor until you have 3.3V.

Once you have calibrated the MP2307 buck converter module solder the Red wire to the VCC Pin of the Really module. And the Black wire to the GND pin of the Really Module. Plugin the 12 Volt power supply and you can use your own made Homekit Led strip!


Want to make more awesome Homekit Accessories or another project visit my site at: https://www.studiopieters.nl