PCBWay 3rd PCB Design Contest

Make a DIY Sonoff Smart Switch Use Android App

What’s Sonoff?

Sonoff is a smart switch device line for Smart Home developed by ITEAD. One of the most flexible and inexpensive devices from that line are Sonoff Basic and Sonoff mini. These are Wi-Fi enabled switches based on a great chip, ESP8266/ESP8285.

While the Sonoff may work quite well for basic users, others may want to hack to make own with their hardware. The hardware to build DIY Sonoff smart switches its low price: ESP8266 with 1MB flash, Relay LED, Button and power.

Next, to load the firmware to esp8266 you don't need a computer or laptop, just need an Android smartphone with an awesome app that is SwitchIoT, with this app makes an IoT device is as easy as uploading firmware without the need for registers/login and server configurations.

This tutorial will tell you how to make a DIY Sonoff smart switch using several different hardware models. Make a DIY Sonoff Smart Switch Use ESP-01

Make a DIY Sonoff Smart Switch Use ESP-01Make a DIY Sonoff Smart Switch Use ESP-01Make a DIY Sonoff Smart Switch Use ESP-01Make a DIY Sonoff Smart Switch Use ESP-01

Which requires the lowest cost is using ESP-01 and the relay module.

Need an additional module USB to TTL converter for ESP-01 used when flashing the firmware only. You need to modify it by adding a button to connect the GPIO0 to GND so that when ESP-01 is turned on while the button is pressed and held it can enter flash mode.

Use an OTG to connect between USB TTL converter with Android smartphone.

 Make a DIY Sonoff Smart Switch Use Wemos and Relay, Button Shield

Make a DIY Sonoff Smart Switch Use Wemos and Relay, Button ShieldMake a DIY Sonoff Smart Switch Use Wemos and Relay, Button Shield

Here you only need the Wemos board, relay, button and dual base shield with the header pins soldered.

You will easy to assemble it because it only stacked several shields together as in the picture, check the orientation of the pin not to reverse.

Use an OTG and micro USB cable to connect between Wemos and an Android smartphoneMake a DIY Sonoff Smart Switch Use NodeMCU and Relay Module

Make a DIY Sonoff Smart Switch Use NodeMCU and Relay Module

If you use a NodeMCU you need a breadboard to place it and to place the relay module. Need at least 3 pieces of jumper cable to connect as follows:

NodeMCU <===> Relay module

VIN <===========> VCC

GND <===========> GND

D0 <===========> IN

Use an OTG and micro USB cable to connect between NodeMCU and an Android smartphone.


Step 4: Make a DIY Sonoff Smart Switch Use Bluino IoT Starter Kit

NodeMCU <===> Relay module

VIN <===========> VCC

GND <===========> GND

D0 <===========> IN

Use an OTG and micro USB cable to connect between NodeMCU and an Android smartphone.



Step 4: Make a DIY Sonoff Smart Switch Use Bluino IoT Starter KitKit

Make a DIY Sonoff Smart Switch Use Bluino IoT Starter KitMake a DIY Sonoff Smart Switch Use Bluino IoT Starter Kit

The Bluino IoT Starter Kit already has Wemos board, relay, LED and button. You will use a relay connected to pin D6, LEDs connected to pin D0 and a button connected to pin D1. Use an OTG and micro USB cable to connect between Wemos and an Android smartphone

Flash Sonoff Basic R1/R2/R3/mini With SwitchIoT Firmware

Flash Sonoff Basic R1/R2/R3/mini With SwitchIoT FirmwareFlash Sonoff Basic R1/R2/R3/mini With SwitchIoT FirmwareFlash Sonoff Basic R1/R2/R3/mini With SwitchIoT FirmwareFlash Sonoff Basic R1/R2/R3/mini With SwitchIoT FirmwareFlash Sonoff Basic R1/R2/R3/mini With SwitchIoT FirmwareFlash Sonoff Basic R1/R2/R3/mini With SwitchIoT Firmware

ESP8266/ESP8285 is programmed via the serial port. To flash Sonoff hardware you need an USB to TTL converter level 3.3V (PL2303) and dupont cable to connect it. You may need to solder a pin header on the PCB to easily connect a USB to TTL converter. Sonoff Basic R1/R2/R3/mini each pcb has different points of RX, TX, 3V3 & GND, you can see the mark according to the picture.

Basically you have to connect the PCB Sonoff with the USB to TTL converter as follows:

PCB Sonoff <==> USB to TTL

3V3 <==========> 3V3

RX <==========> TXTX <==========> RX

GND <==========> GND

To able flash sonoff first you must enter to flash mode, do it by holdding and pressing button when you insert OTG to smartphone to power up.Uploading Firmware From Android to ESP8266/ESP8285 Use SwitchIoT App

Uploading Firmware From Android to ESP8266/ESP8285 Use SwitchIoT AppUploading Firmware From Android to ESP8266/ESP8285 Use SwitchIoT AppUploading Firmware From Android to ESP8266/ESP8285 Use SwitchIoT AppUploading Firmware From Android to ESP8266/ESP8285 Use SwitchIoT App

After you finish setting up hardware with a smartphone, it's time you start upload the firmware into the ESP8266/ESP8285 chip. Wait before that make sure DO NOT CONNECT AC POWER during the flash cable connection.

Install SwitchIoT app from Google Playstore.

SwitchIoT App

Open the SwitchIoT app, enter to widget settings menu, select the option "Upload firmware via USB", then specify the preset options according to the hardware that you will flash. Finally press the "UPLOAD" button and wait until this is done it will take a little time.

If you don't have an USB OTGIf you don't have an USB OTG or you are still at risk with your phone when uploading firmware from the phone, you can generate a firmware file in binnary format (eg. 0x00000_32e5_NodeMCU.bin) by tap "GENERATE .BIN" button on App then send it to email or online storage, next open it on your computer then uploaded firmware using software NodeMCU Flasher.



Step 7: Connect SwitchIoT Device to a Network




Apply for sponsorship >>
524 Projects Sponsored
Jan 11,2020
743 viewsReport item
  • Comments(0)
  • Likes(1)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
    View More
    x
    mm
    Earn a $5 Welcome Bonus