Open Source Smart Socket

From Microduino Wiki
Revision as of 08:43, 5 April 2016 by Zhangfengfeng (talk)
Jump to: navigation, search

Outline

  • Project:Microduino open source smart socket (ESP8266connect with Blynk)
  • Objective:Mobile phone remote control socket on and off.
  • Difficulty:Low
  • Time-consuming:2 hours
  • Maker:ray
  • Introduction:
    • The user can use moible phone to surf the Internet to connect with Blynk control the Internet of things.
    • The core control module Microduino-Core+ controls the relay switch after receiving introductions.
    • WiFi wireless module Microduino-WIFI,ESP is responsible for wireless communications.
OutletImg.png

Bill of Materials

  • Microduino Equipment
Module Number Function
Microduino-Core+ 1 The core board
Microduino-USBTTL 1 Program download
Microduino-WIFI,ESP 1 Network connection
  • Other Equipment
Equipment Number Function
Bottom case + circuit board 1 Circuit control
Shell 1 Safeguard
Long screw 4 The shell and bottom case fixation
Short screw 3 The bottom case and the circuit board fixation
M3 screw driver 1 Turn the screw

Principle of the Experiment

  • Principle of the Circuit’s Control
  • The socket has two main components on the control panel.
    • Switching mode power supply:Change 220V city power into 5V working voltage to supply Microduino module with power.
    • Relay:Microduino module switch control the socket through it.
  • The socket can pick up any electrical appliances.(<1250W)
  • Microduino core module controls the switch of the relay to control the switch of the household appliances.
  • It is actually a smart switch which can use weak electricity to control strong electricity.
  • Principle of Wireless Communication
    • Use Microduino-WIFI,ESP WiFi communication module to connect with the wide area network.
    • Use Blynk APP to communicate through Blynk server.

Obtain, and Configure Blynk

  • Follow our steps below to know how Microduino and Blynk interact.

Get the Mobile Client of Blynk

BlynkOutletLink.png
  • Of course you can also do one by yourself.
  • If you do it yourself, you can name it as outlet.
BlynkSettingOutlet2.png
  • Then click on the panel and you’ll call up WIDGET BOX, where there are a lot of controls for you to choose.
BlynkSetting3.png
  • Select Value Display, and input state to show this control is used to obtain the state of the socket switch.
  • INPUT selects V0, and READING FREQUENCY select 1second to show the frequency of the socket to send state.
BlynkSettingOutlet4.png
  • Then put a led displaying control to simulate a LED lamp, and set INPUT as V1.
BlynkSettingOutlet5.png
  • The corresponding code in Microduino is
BLYNK_READ(V0) {
  if(digitalRead(outletPin)) {
    Blynk.virtualWrite(V0, "ON");
    ledState.on();
  } else {
    Blynk.virtualWrite(V0, "OFF");
    ledState.off();
  }
}
  • Finally choose a button control, and set the OUTPUT as D6, on behalf of controlling the D6 pin of Microduino.
BlynkSettingOutlet7.png
  • Finally, it looks as this in your mobile phone panel
BlynkSettingOutlet8.png
  • Push the button, and it will show the socket has become the open state.
BlynkSettingOutlet9.png

Program Download

Smart Socket Github:ESP8266BlynkOutlet

Programming

  • Overlay Microduino-Core+ and Microduino-USBTTL together.
    • Connect Microduino-USBTTL with USB cable and prepare to upload programs.
    • Note:Please upload programs before stacking all modules together.
  • Open Arduino IDE for Microduino environment. (The reference to set up:AVR Core:Getting started
  • Click [Tool] bar, confirm board card(Microduino-Core+) processor(Atmega644pa@16M,5V) selected correctly, and choose the corresponding port number(COMX)
  • Click [File]->[Open], browse to the project program address, and click “ESP8266BlynkOutlet.ino” program to open it.
  • After all these are correct, click "→" button to download to the development board.

Assemble the Smart Socket

Chazuo1v1.png
Chazuo2v1.png


  • Step3
    • Make the smart socket shell buckle into the pan, use a 8mmlong screw to screwing in, and fix the top and bottom cases. Now the smart socket part has been set up completely.
Chazuo3v1.png

Operating Introduction

  • Insert the smart socket into a home one.
  • Insert any electric power cord in the home into the smart socket, such as the electric power cord of the television, the refrigerator, and the humidifier.
  • Here we take the phone charger for example, and inset it into the smart socket.
  • Open the Blynk client and press the switch button, you will see the indicator lights up, and theit start charging the mobile phone.

In the picture: ① is the switch button. ② is the power indicator light. ③ is the on and off indicator light of the smart socket.

Chazuo4.jpg

Attention Problem

  • Contacting with the electricity is very dangerous, so pay attention to safety!
  • All installation operation can’t be processed with power!
  • After the installation and the jump, even intelligent socket is closed, you must not touch the power switch!

FAQ