#MicroPython: Home Automation using Blynk connected to a WiPy 3.0 / 2.0
Home Automation, MicroPython | 2 min | 9890
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:
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 token
for 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 token
that you get (usually per E-Mail)
WiPy 3.0 / 2.0
- Rename and upload the
boot.py
file 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 token
inside themain.py
file with the one that you become per E-Mail - Upload the
BlynkLibWiPy.py
and themain.py
files 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.py
file 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 token
inside themain.py
file with the one that you become per E-Mail, and switch the correspondingimports
- Upload the
BlynkLibESP32.py
and themain.py
files 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.
We use cookies to improve our services. Read more about how we use cookies and how you can refuse them.
Empty