- 05
Feb - 2019Home Automation, MicroPython
2 min | 20484#MicroPython: Home Automation using Blynk connected to a WiPy 3.0 / 2.0
Home Automation, MicroPython | 2 min | 20484
This time a quick tutorial to control your WiPy 3.0 / 2.0 or an ESP32 using Blynk.
Blynk is the most popular mobile app for the IOT. Works with anything: ESP8266, Arduino, Raspberry Pi, SparkFun and others.
I found a library to connect MicroPython to Blynk but it is only compatible with the WiPy 1.0. Thus, I modified it and made it compatible with the WiPy 3.0 / 2.0 and with the ESP32 running MicroPython. If you do not have any idea about MicroPython, I recommend you to read this tutorial.
This is what I will try to accomplish in this tutorial:
- Install MicroPython (if you are using an ESP32, otherwise it is already installed on your WiPy)
- Connect the WiPy or the ESP32 to Blynk
Let's start! but first the code:
![Python]()
Code: https://github.com/lemariva/uPyBlynk Hardware & Software
DIY Instructions
The instructions are divided in three categories. You need to install first the application on your Android/iOS system and get the
auth tokenfor the IoT device. Then, if you have a WiPy 3.0 / 2.0 modified the repository code as described and upload it to the board. If you have an ESP32, you need to install first MicroPython.Android / iOS
- Install the Android or iOS application
- Register yourself with a valid E-Mail
- Create a New Project and choose as device the
WiPy - Copy the
auth tokenthat you get (usually per E-Mail)
WiPy 3.0 / 2.0
- Rename and upload the
boot.pyfile to the WiPy to connect your WI-FI. Do not forget to change the<wlan-ssid>and<wlan-password>with your SSID and the WPA2 password of your router - Change the
auth tokeninside themain.pyfile with the one that you become per E-Mail - Upload the
BlynkLibWiPy.pyand themain.pyfiles to the WiPy - Reboot the WiPy.
Check the WiPy 3.0 / 2.0 pinout here.
If you need some help to upload the files to the WiPy, follow this tutorial.
ESP32
- Install MicroPython following this tutorial.
- Rename and upload the
boot.pyfile to the ESP32 to connect your WI-FI. Do not forget to change the<wlan-ssid>and<wlan-password>with your SSID and the WPA2 password of your router - Change the
auth tokeninside themain.pyfile with the one that you become per E-Mail, and switch the correspondingimports - Upload the
BlynkLibESP32.pyand themain.pyfiles to the ESP32 - Reboot the ESP32.
Check the ESP32 pinout here.
Conclusions
This tutorial helps you to connect a WiPy 3.0 / 2.0 or an ESP32 running MicroPython to Blynk. Blynk allows you to control your IoT board using an Android or iOS system directly without opening a port on your router, nor using a Home Assistant / MQTT broker. The code is based on an existing library for the WiPy 1.0. It is still buggy, but PWMs, DIs, DOs, ADCs are working.









Empty