Client Connection Guide for ESP devices with Micropython
Getting ready for Micropython
Running Micropython MQTT sample on ESP Devices
- There are several ways to run and burn micropython on your devices. It is preferred to use uPyCraft IDE to accomplish this task.
- Follow up this link to make your environment ready for the python development and running uPyCraft.
- As the previous link suggests, get the latest firmware from the given link and follow up the instructions in the IDE.
- Firstly, download MaQiaTTo client sample repository via git or just download as zip :
$ git clone https://github.com/cagdasdoner/maqiatto.git
- From gathered directory, navigate into ESP8266 Micropython related code :
$ cd maqiatto/esp8266_micropython
- Put all python codes under your uPyCraft workspace directory.
- From the IDE menu, do File->Flush Directory. Your files will be visible in the IDE.
- Update below credentials under boot.py file :
# Update below credentials with yours
ssid = 'YOUR_WIFI_SSID'
password = 'YOUR_WIFI_PASSWORD'
mqtt_user = 'YOUR_MQTT_USER'
mqtt_pass = 'YOUR_MQTT_PASS'
topic_sub = b'YOUR_TEST_TOPIC'
topic_pub = b'YOUR_TEST_TOPIC_AGAIN'
- Connect your device to PC via USB and select correct port via Tools->Serial.
- Press F5 or Tools->Donload and Run.
- Reboot your device and you will see below logs bottom side of the IDE which means everything is OK :
('192.168.1.10', '255.255.255.0', '192.168.1.1', '192.168.1.1')
Connected to www.maqiatto.com broker, subscribed to email@example.com/sensor' topic
(firstname.lastname@example.org/sensor', b'maqiatto test #0')
(email@example.com/sensor', b'maqiatto test #1')
(firstname.lastname@example.org/sensor', b'maqiatto test #2')