Getting started with micropython
- Download micropython from the official website preferably
esp8266-20170108-v1.8.7.bin
- Copy it into the homeAutomation/nodemcu folder
- Rename the exampleConfig.py to config.py
- Run
To start mqtt server as a docker container and also start ngrok which exposes the mqtt services
5. Get the url from ngrok. It should look something like this
- From the ngrok url go to config.py replace the MQTT_HOST to be '2.tcp.ngrok.io'
Replace also the MQTT_PORT to be 14262 add an MQTT_TOPIC.
- Add your wifi password and essid to the config file
- The config file you be looking like this at the end
- Flash the micropython binary file and upload your code with the following command
-
Go to putty select connection type to be serial and speed to be 115200. The serial line should be the port your nodemcu is connected. For my case it was at /dev/ttyUSB0
It should look like this
-
Run the following code to start the program
You should see your led blinking. Make sure your wifi is okay and you have started the mqtt server