Setting up an Electrodragon IoT board with MicroPython

This post explains how to install MicroPython on an ElectroDragon IoT board using a Raspberry Pi and a USB TTL cable.

ElectroDragon Wifi IoT Relay Boards

ElectroDragon IoT boards are built on Espressif Systems ESP8266-12 F microcontrollers which include WiFi and 4 MB of flash memory and can readily run MicroPython. ElectroDragon now offer several configurations. The original AC powered dual relay version is used below.

Key Specifications

  • Based on ESP-12F ESP8266 Wifi Board
  • This relay board use one AC input, and supports two relay AC outputs.
  • Use mature AC-DC power module, input voltage 85 – 265VAC
  • Relay: HF32F-G-5-HS, Common – open, 10A 250VAC, 30VDC, Control 5V
  • Plastic enclosure design support, package includes the PCB board, plastic case, and self-drilled screws (screws are not assembled). Case general dimension is 111*42 mm

Primary Header Pins

Button 2 / Flash
Output Relay 1
Button 1



Other Pins

LED status
Output Relay 2

Install the ESP flash tool

From the Raspberry Pi
sudo pip2 install esptool
sudo pip2 install esptool --upgrade

Download the MircoPython firmware

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers

Check the latest stable MircoPython firmware release on

From the Raspberry Pi
mkdir ~/working
cd ~/working

Connect the Raspberry Pi to the ElectroDragon IoT board

Using a USB TTL cable, connect the ElectroDragon IoT board as below and then to the Raspberry Pi

Black —— GND
Red —— 5V (VCC)
Green —— RXD (GPIO-03)
White —— TXD (GPIO-01)

Tip it is much easier to restart the ESP8266 with a USB TTL cable that includes a switch.


To put the ElectroDragon in:

  • flash mode - hold BUTTON 2 (nearest the GPIO pins) when connect power 5V/GND 
  • normal mode - don’t hold any buttons down when connect power 5V/GND. 

Flash the MicroPython firmware and verify 

Erase the existing firmware

To erase the firmware, put the ElectroDragon IoT board in flash mode:

From the Raspberry Pi
#execute the following commands
sudo --port /dev/ttyUSB0 erase_flash
Flash the MicroPython firmware and verify To install the latest MicroPython firmware, put the ElectroDragon IoT board in flash mode. You may need to repeat the below operations multiple times as it is not always successful in the first attempt.
Restart the ElectroDragon IoT board in flash mode:

From the Raspberry Pi
#execute the following commands
sudo --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20170823-v1.9.bin
sudo --port /dev/ttyUSB0 --baud 460800 verify_flash --flash_size=detect 0 esp8266-20170526-v1.9.bin

Check that MicroPython is installed correctly

Restart the ElectroDragon IoT Board in normal mode.

Install minicom on the Raspberry Pi to connect and verify the installation using the below commands. See

Tip: To exit minicom:  Ctrl-Shft-A Shft-X <enter>

From the Raspberry Pi
sudo apt-get install minicom
minicom -o -D /dev/ttyUSB0
On the ElectroDragon

# Should get python prompt
# If not try Ctrl-C

# Check flash is good
>>> import esp
>>> esp.check_fw()
size: 598068
md5: cf3a503028855e9dc093a2ec3ab53634

# Check version is good
>>> import sys
>>> print(sys.implementation)
(name='micropython', version=(1, 9, 0))

# Optionally enable WebREPL if you want to connect over web
>>> import webrepl_setup
WebREPL daemon auto-start status: disabled

Would you like to (E)nable or (D)isable it running on boot?
(Empty line to quit)
> E
To enable WebREPL, you must set password for it

# To soft-reset micropython and restart the start-up files. Ctrl-D
# Exit minicom Ctrl-Shft-A Shft-X 

Install Adafruit MicroPython Tool (ampy) on the Raspberry Pi

Adafruit MicroPython Tool (ampy) is a utility tool to interact with a MicroPython microcontroller including copying files back and forth.

Install ampy, restart the ElectroDragon in normal mode and connect.

Tip: Make sure you exit minicom before using ampy

From the Raspberry Pi
sudo pip3 install adafruit-ampy
sudo pip3 install adafruit-ampy --upgrade
ampy --port /dev/ttyUSB0 ls

ampy --port /dev/ttyUSB0 get

Congratulations you are all set to work with MicroPython!


  1. I admire this article for the well-researched content and excellent wording. Electronic PCB Board Cloning. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.

  2. You have worked nicely with your insights. Lots of valuable data can be taken from your article. Genuinely it is a significant article for us.Custom Layout Training Institutes in India

  3. Excellent post. I really enjoy reading and also appreciate your work. This concept is a good way to enhance knowledge. Keep sharing this kind of articles, Reverse Engineering PCB Board Thank you.

  4. Nice info, I am very thankful to you for sharing this important knowledge. This information is helpful for everyone. Read more info about Arduino Starter Kit for Sale. So please always share this kind of information. Thanks.


Post a Comment