Bed Headboard LED Stripe Lamp With ESP8266-01

by jalzatep in Circuits > Arduino

590 Views, 2 Favorites, 0 Comments

Bed Headboard LED Stripe Lamp With ESP8266-01

IMG_20200413_171155328.jpg

This a very easy project I neglected a long time ago, but because the quarantine, I did something different with the parts I have at hand.

The idea was to have a dimmerizable light, which could be controlled by simple TCP commands or by a manual switch.

Because the lack of parts, the improvisation became the main point of the project. First, I lacked of a logic level MOSFET, and only had a high current switching MOSFET, so a small driver was needed (not the best design possible by the way), then a panel pulse switch was missing, so I took a spare microwave door-lock security switch for the push button.

Ihope you learn something and have fun with this project.

Supplies

  • 3 m of White LED stripe. When I bought it included a 12 V power supply
  • ESP8266-01S x 1
  • 2N3904 NPN transistor x1
  • 2N3906 PNP transistor x 1
  • IRF3205 MOSFET x 1
  • AMS1117-3.3 regulator x 1
  • 3.3 K resistor x 2
  • 1 K resistor x 1
  • 1.5 K resistor x 1
  • 120 resistor x 1
  • 10 k resistor x 1
  • 10 uF 16 V electrolytic capacitor x 1
  • 100 nF ceramic o polyester capacitor x 1
  • Socket header connectors 1x6 (two units). Even better if you have a proper 2x4 female connector for the ESP.
  • Terminal connectors for supply and LED output
  • A generic plastic box
  • Basic electronics tools (soldering iron, wire cutter, pliers, etc)
  • Arduino IDE with ESP8266 support installed.
  • USB to 3.3 V UART Serial Converter or if not available, any Arduino UNO or Nano with the configuration showed here https://www.electronicshub.org/esp8266-pwm-tutorial-led-fading/ (by the way, the linked page is very good PWM tutorial for the ESP)

Schematic

schematic_ESP8266_instructables.png

The circuit consists of a PWM controlled MOSFET at GPIO2. The driver circuit is needed because the IRF3205 needs at minimum 10 V in order to reach its Rds(on) of 8 miliohms, and the ESP only gives 3.3 V.

The 3.3 V regulator allows to power up the ESP from the same supply as the LED stripe, and the additional caps improve the supply stability.

Finally, the push button at GPIO0, goes through a brightness cycle with each click. On my case, three brightness steps and light off.

Circuit Assembly

IMG_20200413_171346431.jpg
IMG_20200413_171403733.jpg
IMG_20200413_171354749.jpg
IMG_20200413_171419463.jpg
IMG_20200413_171501428.jpg

It is a (not so) quick and (really) dirty project. The best surprise was how good the interlock switch worked as a pulser.

Please, don't look at the wiring :P

LED Stripe Installation

IMG_20200413_171300291.jpg

Measure and cut the three segments, then solder the wires. Finally, peel of the adhesive and press against the back of the headboard.

In my case I cheated and used wide sticking tape over the LED stripe, because the adhesive was weakened somehow.

Finally, screw the wires at the terminals and check the connections.

.

Programming

arduino setup.png

The code needs a lot of improvement like fix the string parsing, support of fixed IP address, setup mode, saving environment variables to EPROM, reading environment variables from EPROM at boot, and so on.

For the firmware load, I used Arduino with the ESP community library version 2.5.0. This is important because the ESP program load fails with the newer versions, maybe is a thing with the ESP8266-01, maybe because I use an Arduino UNO as loader, I just don't know.

Remember to add http://arduino.esp8266.com/stable/package_esp8266... to your Arduino preferences in order to get the ESP board support.

https://www.electronicshub.org/esp8266-pwm-tutoria... has a good tutorial on the ESP8266 PWM. Also, I used their Arduino to USB serial converter to load the program into the ESP.

Testing

TCP socket test.png

Do a quick wiring check first, and insert the ESP8266 into the circuit before power on.

Pushing the button Should alternate between low bright, medium bright, max bright and light off.

For the TCP test, I used Socket Test but any other similar software will do the job http://sockettest.sourceforge.net/.