Introduction: Pixel
Hi everyone, this is my first instructable. I was always fascinated by the awesomeness of LED's ,when I was a kid (Before I came to know about white LED on Nokia phone) once I asked my father if we keep red green and blue light pointed at same spot it would give white color can't we do the same with LED and make a TV? Well now its a reality. So now I wanted to take out a single Pixel out from the display, and change it color anywhere in the world. Once I have made this I will be able to control its color by lots of tools and devices. So Let's make this thing and get it connected to the internet (Internet of Things).
To make vibrant colors I used 5050 RGB SMD LEDs for better color blending. So if you don't have it no worries, use normal 5mm RGB LEDs or separate R G B LEDs with proper diffuser, Even at my place its hard to find RGB SMD led so I savaged it from LED Strip. (I got 12v 5 meter RGB 5050 led strip for $9 or ₹550 in India). For communication I have used ESP8266 12E ($3 or aprox ₹200 from a local store) or you can use a Node MCU. I personally wanted to try SMD (Surface Mount Devices "Tiny components") for this project even through hole component will do just fine, and i wanted it to work in 5v so connecting a power bank could make it portable and many of us can't afford a Philips Hue Go. But you can make one similar.
Step 1: Grab the Things
Materials Required
Plan A
- ESP8266 12E
- 5050 RGB SMD LED * 8
- NPN Transistors (BC847 ) * 8
- Resistors (10K* 13 , 470Ohm * 2 , 330 Ohm * 2 ,150 Ohm *4) 1206 SMD Package
- Capacitors (22uF * 2)
- 1117 3.3v Regulator
- Berg Strip Male 6 Pins
- USB Type B Socket
- Acrylic Sheet & Cyanoacrylate Glue or chloroform
- Copper Clad and Ferric Chloride for PCB
If can't find these material, buy these things (Plan B)
- NodeMCU (Contains USB to serial converter)
- RGB LED Strip (LED and Resistors are inbuilt) (Still if you cant find? Lets make one using seperate R,G,B LEDs See Image)
- ULN2003 or ULN2803 (Instead of transistors)
- 7805 voltage regulator, 10uF 16v capacitor ,DC Jack and Adaptor (If you are powering from 12 V)
- Good white thin plastic container which light can pass.(See Images)
Step 2: This Is the Overall Plan
Since we can program ESP8266 and it has WiFi in it everything is packed into one. So we will be using MQTT Protocol for this, for those who don't know what MQTT is i will explain in simple terms. You have to know about three things Publisher (One who gives in data ,here its color), Subscriber (One who listens to data) and Broker (Manages data from Publisher to Subscriber). Next thing you need to know is "Topic" its like channel on TV so if we subscribe to a certain channel we receives programs regarding to that channel, while considering publisher I am sending data related to that topic. So our pixel will be continuously listening to a topic for color in hex format like #RRGGBB. as soon as the controller gets it, it split the data into Red Green and Blue components. and generate PWM.
For beginner I recommend to use io.adafruit.com it has dashboard and color picker :) . Their are lots of brokers available,once you feel confident try them. To test this you can use MQTT Dashboard Android App ,IFTTT supports adafruit IO as well. Once everything is working you can integrate it with Alexa , Facebook, Twitter possibility is endless.
How does the circuit work?
Its so simple! PWM (Pulse Width Modulation is a technique for getting analog results with digital means.) but the GPIO pins on ESP8266 can't provide sufficient current to drive all the LEDs. So we called in some guys called transistor for help. Transistor multiplies current what we provide to one of its terminal (base). so if we connect LED to transistor it will allow led to draw higher current depending on PWM signal. So by varying PWM duty cycle we are also controlling brightness of LED thus we can achieve vibrant colors depending on ratio of mixture.
In the PCB which am gonna make consist of auto reset circuit for ESP8266 which is inbuilt in NodeMCU along with voltage regulator. So if you are using NodeMCU just connect common anode RGB led strip to ULN2003 or ULN2803 and interconnect it. For more brightness you might want to tinker with the collector resistance but if you are using LED strip then you don't need to worry about it.
Step 3: Let's Make PCB
You can skip this step if you are using NodeMCU module.
So I decided to make a box of dimension of 10cm x 10cm x 10cm and the PCB to be exactly fit in those. The PCB I designed is single layer and everything on top layer ,SMD and compact. You can find lots of instructable an instruction how to make a pcb at home.
- Mark dimension on copper clad and cut it.
- Print the PCB layout on glossy paper and use a hot Iron to transfer toner to copper clad
- Remove the paper by water (Be careful toner should remain on copper clad)
- Dip this into ferric chloride and shake it to dissolve copper into solution.
- Once you start to see PCB without copper and only traces wash the PCB in water and use a metal scrub to scrub away the toner.
- Apply some solder on PCB
Ta-Da PCB is ready!
I made solder pads big enough to solder jumper wires. In PCB layout blue tracks are jumper wires.
For NodeMCU you can use perf boards.
Now we can start soldering
Attachments
Step 4: Solder the Components
First its better to start with smaller components like resistor and move up the ladder. It better to check 3.3v regulator output before plugging in ESP8266. Once you have done with transistor , resistor and LEDs try turning on LED by touching base of transistor with 3.3v. If LEDs are lighting up you are good to go.
To solder ESP8266-12E ,first solder one of the pin on corner first, then you have freedom to slightly adjust incase you have gone wrong. Once its aligned solder next diagonal pin, that will hold it in position. Then solder rest of the pins
I couldn't find a micro USB connector so I have used USB B type.Its bit tricky to solder that connector and that too on top layer. so its better to heat pin from underneath and feed in lead wire underneath the connector and when done slide in an piece of thick paper. I recommend you to connect USB connector after testing the entire circuit.
Now hardware is ready! You can decide now what it should do.
.
Step 5: Upload the Code
I am using eLua for this project you can use Arduino if you want. Just use this library if you are planning to use Arduino https://github.com/adafruit/Adafruit_MQTT_Library
Software Required
- NodeMCU Flasher (For Windows to upload Firmware)
- ESPlorer (IDE)
- Frimware (You can custom build your firmware. Keep default selected packages and mark CJSON,end user setup,HTTP,MQTT,PWM) (Download Float not Integer) (nodemcu.bin is frimware I built months back)
First create a custom firmware ,you will receive it in your mail in few minutes. Download the firmware and NodeMCU Flasher. Connect to PC via usb in NodeMCU and in case of PCB connect via CP2102 and Upload the firmware.
Goto https://io.adafruit.com/ and create an account. Once you create a feed follow this guide to setup MQTT settings on the code. Place a color picker on adafruit dashboard and connect it to the feed. set username feed and AIO key as password on the code and upload it via ESPlorer. More information regarding this can be found here.
If code is uploaded and working you should be now seeing its cycling through colors (See video). If you scan for Wi-Fi from mobile you should be seeing "Setup Gadget" connect to it and point your browser to 192.168.4.1 and connect to your Wi-Fi.
If it gets successfully connected it will start to listen to MQTT channel/feed , use color picker to select color you require. It will change to that color.
Attachments
Step 6: Make a Beautiful Box
Another challenge is finding a beautiful enclosure for it. It does three things Protection, Diffusion and Looks. You can use paper ,thin plastic bottle or acrylic sheets. Here I am using acrylic sheet, I have tried three of them (for different projects) and all of them have its own unique beauty. You can bend acrylic sheet by heating with hot wire or cut them into exact dimension and stick them using chloroform or cyanoacrylate. I placed a small piece of acrylic on bottom to hold and tighten PCB to acrylic. I have used 2mm thick acrylic outer dimension is 10 cm x 10 cm x 10 cm
In the video you can see how I used a plastic container and bare 8 mm red, green and blue LEDs for making RGB LED (It was controlled using Arduino Uno).
Step 7: Light It Up!
Once you have completed all steps its time to power it up. If you have already configured SSID and Password to connect to your Wi-Fi router then when it connects and Hue Cycling will stop and it will start listening to your feed when you change color in Dashboard your device will also change its color.
What you have now is a Colorful Pixel. How you use it limited by only your imagination. I have integrated this with Amazon Echo, Facebook Messenger, MQTT Dashboard to make a ON/OFF on your home screen.
You can follow this instructables to integrate Alexa with AdafruitIO without writing a single line of code thanks to rhendro
You can make multiple of them to create Ambilight,or connect a microphone to ADC to react to sound.
If you like this project please Vote
Thanks & Have a nice day