No PCB WiFi Smart Switch W/ ESP8266 and Ubidots
Introduction: No PCB WiFi Smart Switch W/ ESP8266 and Ubidots
I know that a well done electronic project needs it own PCB to assamble it. In the best-case scenario we can afford a custom PCB order from a company as JLCPCB as an examble, but this is not always the case, sometimes we are just trying to build a prototype that we consider do not need a PCB to do what it meant to do, and we need it for now so we don't have time to waiting things to arrive.
That's why I consider that knowing that we can replicate or build our projects with Perfboards is important, so I build this tutorial to show you how do I made my Perfboard version of a PCB project that I've done years ago.
If you are a visual learner I know that a video worth more than 1000 words, so here is a Tutorial video. (I am a Spanish speaker, so please consider turning on English subtitles):
Hope you to enjoy the project!.
Step 1: Skills Needed
As you could noticed, nothing looks very difficult on this project, but you will need some basics knowings about:
-Using the Arduino IDE.
-Welding.
-Wiring.
Disclaimer: notice that this project works with main voltajes, please don't do anything if you don't know how to handle this securetely.
Step 2: Components and Parts List
A good place I can recommend to find your components, it's MakerFocus, it's an Open Source Hardware Store!
1. Perfboard.
2. ESP8266 WiFi Microcontroller.
3. BTB16 .. BTA24 Triac or Similar.
4. Hi-Link 3.3v Power Supply.
5. 2x Terminal blocks 3 p, 2 p
6. 100nf 400v Capacitor (104)
7. 2x 470 ohm 1/2W Resistors
8. 470 ohm 1/4W Resistor
9. MOC3010 Opto-Triac
10. 382
2x 1Kohms Resistors
11. wire
Step 3: Circuit Diagram
The circuit is simple, it has the ESP8266 connector, that has all the resistors to set up the ESP on boot mode. The Triac Switching stage that handle the main voltajes and the current of the load to control, and the Power Supply that converts 120-220Vac to 3.3v DC to power up the ESP8266.
Schematic PDF attached.
DOWNLOAD Schematics, Code and Libraries for FREE
Step 4: Circuit Assembly on Perfboard
The thing with this project is to use a perfboard to assemble it, I usually use custom PCBs made by JLCPCB as you can notice on my other projects, so lets get through this.
1. Clean the surface of your perfboard with sandpaper.
2. Place the components and solder their pads.
3. Make the connections with a strip of wire in the digital stage (low voltage).
4. Make the connections with an isolated wire in the Power Stage (Main Voltage).
5. You are done.
If you want to build the PCB version of this project you can order it on JLCPCB, they manufacture really fast and best quality in the market Printed Circuit Boards:
📦$2 for 5 PCBs & cheap SMT (2 Coupons)
Step 5: Programming the ESP8266 and Testing
To properly program our ESP8266 we need a USB to TTL interface, it could be an Arduino (w/o the atmega), or a USB to TTL converter, in my case I made my own USB to TTL adapter circuit to program specifically the ESP8266, you can see it here and make yours:
First of all, create your Ubidots Account (could be the STEM free student version).
1. Open the code (Download here).
2. Select the ESP8266 Board.
3. Select the right COM port.
4. Set your Ubidots Token in the Code.
5. Set your WiFi credentials.
* In this case the device name is "wifiswitch" (you can change this).
+ The variable that is controlling the switch is called "light"
+ The output pin of the ESP8266 is the GPIO0.
+ The input pin for the external push button is the GPIO2.
Once you program your ESP8266, test it, verify it connectivity to the network and use the Serial Monitor to see if it subscribe properly to the device "wifiswitch" and the variable "light" and show you every detail as you can see in the picture attached. 977