The goal of this instructable is to construct a connected lamp in a flower form (a tulip). The lamp is most made of MDF 3mm and acrylic. This project was originally an excuse to learn Android app and the connection with a microcontroller.
After some research, I found than a NodeMCU is a good alternative for a wifi compatible microcontroller especially when I found this REST API.
So let's do it !
Step 1: Electronic Part
The list is simple:
- a NodeMCU v3
- some LEDs (in my case a LED strip cut)
- 3 Mosfet N-channel
- a 5v DC DC stepper down
- a female power jack
- a 12v power supply (amperage depend on the number of LED)
- various cables and a solder set
The connection are made according to the picture. I chose to keep the NodeMCU intact in order to use it in a futur project if my lamp is not useful anymore.
For the ESP8266 code, I used the Arduino IDE and used the file that you can find here.
Step 2: Androïd App
The REST stack which run on the nodeMCU respond to GET request. Depending on the type of the request, it will activate a different action. We need for this application to send a variable for each color to control the intensity through the output PWM.
In the example of the API, it's possible to have a callback function if the GET request has the form : http://adressip/led?params=0. In this case the variable 0 is sent as parameter to the callback function link to led.
Now we know what we need but how do we build this application? I chose an easy way by using the MIT app inventor. It allows me to develop a 2 pages app that sends the correct request depending on the value of 3 sliders. A page checks the connection to avoid too many request without destination.
I didn't publish the application yet but you can download the APK.
Step 3: Wood Part
This part requires a laser cutter but if you have access to one it's easy. Take some 3mm MDF and cut it using the SVG.
To put it together, you just need to glue the button. On the side, it sticks in place without glue. This trick allows to open the lamp to do something inside.
Step 4: Final Assembly
The final assembly is simple: throw everything inside... More specifically, put the power jack at the bottom of the flower, put two cardboard cross spacers to hold the LED and hot glue the electronics inside. I added a sanded plexiglass diffuser on the top to smooth the light.
Now your lamp is ready :). Find a nice place and enjoy.
I hope this instructable gave you some ideas.
You can follow more projects on my french blog.