ESP8266 UART to Cloud Getting Started Guide

This introductory guide will teach you how to easily connect WeMos ESP8266 Wi-Fi Module to Medium One cloud via UART for ultra-rapid IoT prototyping.

About the ESP8266 and Medium One firmware

The WeMos module loaded with Medium One firmware will allow you to send and receive JSON events to the Medium One cloud simply by sending data via the UART pin. You can easily integrate this Wi-Fi chip to any embedded design as long as UART is available.  The board is powered via USB and required 3.3V for the UART pins.


  1. Medium One cloud integration with python workflows and dashboards

  2. Easily integrate mobile app to view and control your devices

  3. Easily integrate to your embedded system via 3.3v UART

  4. Send and receive data in real time

  5. Locate GPS of the board based on IP address (nearest city)

  6. Over the air firmware update

  7. Ideal for rapid IoT prototyping!

In this tutorial, you will:

  1. Program/Flash the WeMos board

  2. Setup and Connect WeMos board to Medium One cloud

  3. Use Medium One Workflows to produce geolocation data

  4. Use Medium One IoT Controller app to view your location on a map

Here's what you need to get started:

  1. Medium One IoT Prototyping Sandbox [Buy]

  2. ESP8266 WeMos D1 Mini board, v.2.3.0

  3. Micro USB

  4. WiFi access (2.4GHz)

  5. Windows PC

  6. Latest m1_cloud_io bin image [Link]

  7. esptool.exe flashing tool [Link]

  8. WeMos USB driver [Download]

  9. Medium One IoT Controller App

  10. PuTTY [Download]

Step 1. Set up Medium One Account.

Log into your Medium One account.

Go to “Setup” -> “MQTT” on the left-hand sidebar and copy down the Project MQTT ID for later use.

In Setup, click on “Manage API Keys”, then “Add New API Key”. Create a new API key by typing ‘API’ in Description. Click ‘Save.’

Copy down your API Key for later use.

Still in Setup, go to “Manage Users”, then “Add New User.”

Name the new user and create a password; then click ‘Save.’

Copy down the Login ID (aka Login Username), User MQTT ID, and Password for later use.

Go back to the Dashboard, and open a Single User Real-Time Events Stream widget. 

Make sure to select your user in the top right corner.

NOTE: To save your preferred dashboard layout, click on the Floppy Disk icon in the top right corner.


You have copied down the following info about your project:

  1. Project MQTT ID

  2. API Key

  3. Login Username

  4. Username MQTT ID

  5. User’s Password

The Dashboard with Real-Time Events Stream widget is open and ready to view data.

Step 2. Flash Board

Connect (via USB) the WeMos board into PC. If this is the first time, you may need to wait for drivers to be installed.

Open Device Manager.

Under Ports, note your USB Serial Port #. In this picture it’s COM6, but you’ll need to remember yours.

NOTE: Copy down COM# for later use.

Open the Command Prompt and cd into the folder with the following files that you downloaded for this project:

m1_cloud_io binary and esptool.exe tool.

In the command window, type the follow command and replace COM6 with your COM#:

esptool.exe -vv -cd nodemcu -cb 921600 -cp COM6 -ca 0x00000 -cf m1_cloud_io.ino.d1_mini.bin


Confirm the output of the programming tool.  If you see 100%, you are done.

Step 3. View Board Output

Keep your board connected.

Open PuTTY.  Click the Serial radio button.

Specify COM port from the last step.

Set speed to 9600.

Click open.


With PuTTY terminal window open, type “setup” (without quotes) and press return.  You should see a print out like this:

NOTE: If it is a newer version, you will see more options.

Congrats, you have entered the provisioning mode for the board.

Step 4. Configure Board Settings

NOTE: If you make a typo and then press backspace, the board will not recognize your command/information. If this happens, just hit enter and retry.

On the PuTTY terminal, type "setup" and then “wifi” and follow the prompts to enter your information.

Enter your wifi SSID: <your wifi name>
Enter your wifi password: <your wifi password>
Wifi configuration complete, exiting setup mode. 

Type ‘setup’ to enter provision mode again.

IP address will print shortly if successful.

Connecting to wifi mywifi
<Notification> Connected to Wifi, IP address:  <If you get this message you successfully connected to wifi>

On the terminal, type setup again and then m1.  

Use the credentials from your Medium One account to set up the board.

Enter your Medium One API key: <your API key>
Enter your project MQTT ID: <project MQTT ID>
Enter your device MQTT ID: <user MQTT ID>
Enter your device password: <user password>
Specify your Medium One cloud environment (sandbox, pro or Renesas): pro
Medium One configuration complete, exiting setup mode. Type ‘setup’ to enter provision mode again.
Saving Medium One credentials.
<Notification> Connected to MQTT broker
<Notification> Sending connect msg: {“event_data”:{“mqtt_connected”:true, “fw_version”:ESP.061117A”, “ip”:, “mac”:5C:CF:7F:2F:1E:C1, “ssid”:”dt_router_1″, “chip_id”:3088065, “flash_id”:99359, “flash_size”:524288, “flash_speed”:40000000}, “add_client_ip”:true}
<Notification> Publish success
<Notification> Successfully subscribed

If you see messages similar to the above, congrats, you have successfully entered Medium One credentials!  Note, this event contains module info such as IP address, chip ID and more.

If you have your Dashboard open, the event should have appeared in your Real-Time Events Stream widget.

In the terminal, type "setup" and then "send".  Use this to send a sample event to the cloud for debugging purposes.  Send the sample event:


Here is an example:

You are in setup mode.
* Type ‘wifi’ (without quotes) to configure the WiFi settings.
* Type ‘m1’ (without quotes) to configure Medium One cloud credentials.
* Type ‘send’ (without quotes) to send an event to Medium One.
<UART> Sending payload to cloud: {“event_data”:{“hello”:”world”}}
<UART> Publish ok


See the data appeared in the Real-Time Events Stream log. If too much time has passed, refresh the Dashboard and repeat the last step.

The board will say “Publish ok” even if the event did not send to Medium One, so make sure to check your event log!

Step 5. Connect the Mobile App

Note: These instructions are for the iOS mobile app, but the Android version is similar.

Open the IoT Controller app and click on the plus sign in the top right corner.

Now you can give your project a name and input your API Key, API Login, and API Password from the account set up.  

In order to link your mobile app to the correct account, select ‘Pro’.

Then press “Done.”

Click "Add New Widget".

Select the Switch widget.

Press the power icon on the left-hand side of the switch to access the settings. (on Android, you have to slide your finger to the right on the widget to access the settings)

Type “raw” for the stream, and “switch” for the tag. Then press “Done.”

Press “+ Add New Widget” again and scroll down to the bottom to select “Map.”

Press the marker icon on the left-hand side of the map and type “processed” for the stream and “gps” for the tag. Then press ‘Done.’

Now press ‘Save’ at the bottom of the app. You should get a confirmation that it was saved.


Click on the switch to turn it on.

You should see an event show up in the Real-Time Events Stream on your Dashboard.

Step 6. Create Workflow To Calculate Location

Go to “Config” from the left-hand sidebar on your Medium One account and click ‘Data Streams.’

Click “raw” and then click the active check-boxes next to “ip_address” and “switch.” Then click ‘Save Data Stream.’

Now go to your Workflow Studio on your Medium One account and click ‘Create.’

Give your workflow a name at the top left of the workflow. Then click the “Tags and Triggers” icon, which is the first icon on the right-hand sidebar.

Select “raw”, and then draw the “ip_address” tag onto the workflow.

Now click on the “Modules” icon (the second icon in the sidebar), click on “Foundation” and drag a “Base Python” module into the workflow.

Click the “Outputs” icon (third icon on the sidebar) and drag two “Processed Stream – Single” outputs into the workflow.

Double click on the Base Python module and click “Inputs/Outputs.” Then click “Add Output.”

Copy and paste the code here into the Script area, replacing any code that was previously there. Then click ‘Save.’

Now connect the Base Python module to its input and outputs as shown in the picture.

Click on the “Revisions” icon (second from the bottom of the sidebar).

Click the checkmark under the latest revision to activate the workflow.


Go to your Dashboard and reset the WeMos board by pressing the Reset button. Alternatively, you can unplug/plug in the board.

In addition to the WeMos event, you should get two GPS events in your Real-Time Events Stream widget.

Step 7. Display Location Data

Click “Config” and then “Data Streams” on the left-hand sidebar. Then click “processed.”

Look for “processed.gps” and change the type from “GeoPoint – Time Series” to “GeoPoint – Last Value.”

Then press ‘Save Data Stream.’

Go back to your Dashboard, and add the Single User GeoPoint Chart widget.

After selecting your user, you should see your general location marked on the map. Since it is based on IP address, it is not 100% accurate.

NOTE: To save your preferred dashboard layout, click on Floppy Disk icon in the top right corner.

Additionally, if you open up your IoT Controller app, you will see this point marked on your map widget.

Step 8. Create Workflow to Relay Mobile to Board

Go back to your Workflow Studio and create a new workflow.

Name it, and then drag the following into the workflow:

  1. raw:switch tag (from the first icon: Tags & Triggers)

  2. Base Python module (from the second icon: Modules)

  3. Processed Stream – Single output (from the third icon: Outputs).

Then connect them together as shown in the picture.

Now double-click on the Base Python module, and replace the code with the code here.

Click ‘Save and Activate.’


Reset the WeMos board by pressing the Reset button; then, open your PuTTY terminal (configured to the port that you have the board plugged into).

You should get a notification that you are connected to MQTT broker.

Open the mobile app and press the switch. After pressing the switch, you should get a Subscribe message on your board (on the terminal)

This was taken after turning the switch on and off.

More Info

Sending and Receiving Data via UART on the WeMos Board

The WeMos board can send and receive data via UART.

  1. UART RX is pin D2

  2. UART TX is pin D1

  3. Baud rate is 9600

Sending Data to Medium One

You can send data to Medium One simply by sending a string to pin D2.  The string must adhere to Medium One’s JSON payload standard and end with “\r” (carriage return.)

For example, you can transmit “{“event_data”:{“hello”:”world”}}\r” where {“hello”:”world”} is the JSON payload to the cloud and everything else before and after are required as part of the overall structure.

Receiving Data from Medium One

Data received from Medium One doesn’t need to be in JSON format. The packet received by the cloud will and appended with “\r” to serve as the delimiter.

Congratulations! You completed the tutorial.

Want to learn more about what Medium One can do?

Check out our documentation and tutorials & get started on your next IoT project!