ESP Board Setup

From ElectroDragon Wiki


  • MQTT Debugging please see MQTT

Quick Start Quide - AP Point

  • Serial port will output verbose debug information, step by step
  • If you want to reset back to factory mode, press BTN2 but be caurful of the high voltage. Board will reset, restart and show up AP mode again.
Steps User Action Description -
Config Network Power up your board
  • Board will provide a wifi AP "ESP-Relay-Board" or similar
  • (Also all leds blink for testing purpose)
-
Config Network Connect to "ESP-Relay-Board" (or similar) it with no password your phone will then ask you to sign in by pop-up message -
Config Network Configure wifi with scan, click show up wifi list and click your Wifi SSID - -
Config Network Connect to SSID
  • Enter Your wifi router password
Config MQTT Check MQTT Address
  • Keep default remote MQTT server address (default iot.electrodragon.com)
  • Optional - Remote MQTT server port (no need change, default 1883)
  • Optional - Remote MQTT server user ID (not used, keep empty)
  • Optional - Remote MQTT server user password (not used, keep empty)
Config MQTT Setup your own module topic ID
  • MQTT Topic ID, for example we use a complex ID: 74dyt6, but final ID is ESP_74dyt6 (not ESP-74dyt6)
  • please use a unique complex name, otherwise if conflict with other users' topic ID, it can not connect
Config MQTT Connected Successfully Board led blink slowly
Control via MQTT Send commands to control
  • 1_ON or 1_OFF to MQTT example topic ID ESP_74dyt6 will turn on or off relay 1
  • same for relay 2

MQTT APP Control

  • Use any MQTT app (for exampe MyMQTT) to control here for example

Setup for MyMQTT or similar

  • Set only - Server address iot.electrodragon.com (IP address 167.88.114.101)
  • Keep default port 1883

Subscribe to your own command topic

  • For example, if you use board MQTT topic "74dyt6 ", then the full topic name will be ESP_74dyt6
  • Please make sure the ID name is unique and complex, better use numbers instead of words

Board Setup

General Commands

  • The following is for ESP Relay control board.
Board Type Command Description
ESP Relay Board 1_ON Turn on onboard relay 1
ESP Relay Board 1_OFF Turn off onboard relay 1
ESP Relay Board 2_ON Turn on onboard relay 2
ESP Relay Board 2_OFF Turn off onboard relay 2
  • The following is for ESP LED strip board.
  • To use local WLAN command control, you must first know the led board IP address
Board Type Command Description
ESP LED strip board #00ff00 turn light to green. ff for green value 255
ESP LED strip board 192.168.0.111\rgb\00ff00 turn light to green. 192.168.0.111 is board IP address

LED status

LED Status
0.2 seconds very fast blink board is getting IP address from router, no IP address yet
5.0 seconds very slow blink connected to wifi, connect to mqtt server, wait for commands
0.5 seconds blink wait for smartconfig

Update Log


Demo code and update Log

R3 version

  • Download R3 firmware here File:Relay board 20161118.zip
  • mqtt sever info saved in mqtt_config.txt file
  • After smartconfig, ssid and password saved in config.txt, when power up will always use this setup for wifi
  • support to switch to unique ID (chipID) mode control by sending commands "chipID+ON" (162243ON) to ID topics
  • File:Esp relay board firmware r3.1.zip, new firmware implemented on board from 4th Feburary 2017.

R4 version

  1. Including two servers config, in ID control mode, send commands "server1" or "server2" to swtich, or edit file "check_server.txt" change 1 for server1, or 2 for server2
  2. server 1 "mc" is mqttcloud free server, server 2 "sg" is Singarpore server, optimized for Asia area too.

Documents

Other Software and Firmware

Firmware

Demo video

Demo code


Obsolette

In board config files for mqtt:

  • mqtt_server_1.lua, mqtt_server_2.lua - including server configuration details
  • wifi_config.txt - your wifi name and password
  • check_mode.txt - check if your board use mac control or not


Quick Start Quide (Smart-Config, old)

  • Config Steps
Steps Descriptions Screenshot
0. Power up
  • Power up by AC power directly (or USB-TTL CP2102 for debugging)
  • Relay and relay LED will switch on/off twice for debugging purpose.
1. Smartconfig
  • Download IOT espressif apk from google play
  • in app, choose add devices, and enter password of your wifi setup
  • connect esp relay board on power
  • If you only want debug, can just CP2102 USB-TTL board, which provide sufficient power
  • Optionally press BTN2 button to clean in board config
2. finish smartconfig
  • click enter in iot app, wait until device found
3. Config your mqtt server
  • download mymqtt app or mqtt dashboad from google play
  • Use mymqtt for example, Config your mqtt server as follow
Server: m13.cloudmqtt.com
User: jtpfneeq
Password	: 4Og5kJ5WYQYT
Port: 14967
4. General commands test
  • Send commands "ON" or "OFF" to Topic "Light1" or "Light2"
  • You will here the relay coil click, and appliance connected with be switched on or off, LED on or off
5. Check mac address for unique control

There are three ways:

  • check the wifi spot, "AI-THINKER-D92069", D92069 is the MAC ID
  • In above IOT espress config, when config done, also can see D92069
  • Subscribe to topic "Light1", mac address will be published to this topic, all the time when power up
6. Switch to Mac IC control mode
  • Send commands, for example mac id is D92069, send "D92069ON" to mqtt topic Light1
  • Board will restart and switch to mac control mode
  • In new mode, use mac ID D92069 as topic
  • commands "1ON" "1OFF" "2ON" "2OFF" to control each relay
7. use station mode control
  • Connect to wifi spot, for example, "AI-THINKER_D92069"
  • download and use widget "socket control widget" from google play
  • create a new widget, and see the screenshot on right
  • a1, b1 are switch relay on, a0, b0 are switch relay off
  • board station server IP is 192.168.4.1, listen on port 80