📜 ⬆️ ⬇️

Programmable Wi-Fi night light bulb on ESP8266

image

There is nothing unusual in controlling LEDs with a microcontroller. Even as strange as ESP8266. However, I wanted to make a finished product. Something that would not be like a spider from wires and radio components.

I note that I am a novice radio amateur, so I probably did something not very good. I would be glad if someone tells you what is wrong and why it should be done differently.
')
There are a number of features associated with the ESP8622 controller, with transistors, with powerful RGB LEDs, with 3D printing in general and modeling in particular, and programming all this happiness. This is a review article, where I will briefly show you what happened and how, and if you want, I will reveal more detailed topics requested in separate articles.

The ESP module is very voracious. When it starts, it takes up to 300 mA, which makes it impossible to power it, for example, from the Arduino. He needs his power source. Moreover, the power supply at 3.3V. This is problem. The world is full of kopek power sources at 5V, but three-volt bulky and expensive. Fortunately, there is such a thing as a voltage regulator AMS1117-3.3.

Nutrition


I took the base of the bulb, the Chinese five-watt USB charging, the voltage regulator with a smoothing capacitor, the Schottky diode (just in case) and got:

image

At 3.3 it is not very similar, but this is because there is a pair of capacitors. However, under load everything is fine.

Controller


My favorite is ESP-07, with the ability to connect an external antenna and a metal screen-heatsink.
Firmware: nodemcu , primarily because there is support for PWM (PWM) and the ability to change the code on the fly.

image

Assembled circuit


Then, I fixed a three-watt RGB-LED on top, connected BC547 transistors ( common emitter circuit ) to it, plugged the power supply and board with an electrical tape and sealed it with double-sided tape. On the other side of the board, I attached the microcontroller, put the power on, added resistance to each channel of the LED, and connected it to 5 volts.

image

Housing


The final choice is a cylindrical body with a hole in the bottom under the base, grooves for the board and a notch on top for fixing the decoration. A little tinkercad , two hours of printing and the result:

image

Final product


image

Check


Some JS, some LUA, some Perl and ...

image

How it works


When turned on, the light bulb connects to the home network and requests a file with a lua script from the home server. If it works, it saves and runs. If it did not work, it launches the previous saved one. Usually the inclusion takes about 2-3 seconds.

Underwater rocks


Where do without them?

First, you cannot use a transistor connection circuit with a common collector. ESP is a surprisingly tenacious thing, albeit a very capricious one. He begins to brutally warm up from five volts, but after he cools down - he returns to normal.

Secondly, you cannot use GPIO0, because at the start it turns out to be shorted to ground and ESP enters the firmware mode. And you cannot use GPIO2, because if it is at the start "on the ground", then the Wi-Fi module does not start. GPIO15 is also better not to touch. My choice: 4,5,12.

Thirdly, you need to set the maximum speed for data exchange, otherwise, when you receive data, the program PWM starts flickering noticeably.

Fourthly, ABS plastic is flammable, it must be taken into account, remembering the Chinese power supply.

Fifth, in the next version you need to make the cylinder narrower at the base, cutting the board. Because not all cartridges allow to twist a lamp with such a wide base. In addition - it was possible to save a centimeter of height.

Incorrigible improvements


I plan to add a midi-squeaker for all kinds of holidays, an application for Android, in order to choose a color not in the browser, an automatic mode in which the lamp would receive the weather forecast and choose its color depending on the result and, probably, the next option should be collected by etching the board. Interesting suggestions are welcome.

Source: https://habr.com/ru/post/257779/


All Articles