Manage cookies

We use cookies to improve our services. Read more about how we use cookies and how you can refuse them.

The necessary cookies help to make the website work properly.

Anonymous statistical cookies help to understand how visitors use the website.

  • Home Automation, MicroPython
    2 min | 9890

    #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:

    1. Install MicroPython (if you are using an ESP32, otherwise it is already installed on your WiPy)
    2. Connect the WiPy or the ESP32 to Blynk

    Let's start! but first the code:

    PythonCode: 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

    1. Install the Android or iOS application
    2. Register yourself with a valid E-Mail
    3. Create a New Project and choose as device the WiPy
    4. Copy the auth token that you get (usually per E-Mail)

    WiPy 3.0 / 2.0

    1. 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
    2. Change the auth token inside the main.py file with the one that you become per E-Mail
    3. Upload the BlynkLibWiPy.py and the main.py files to the WiPy
    4. 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

    1. Install MicroPython following this tutorial.
    2. 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
    3. Change the auth token inside the main.py file with the one that you become per E-Mail, and switch the corresponding imports
    4. Upload the BlynkLibESP32.py and the main.py files to the ESP32
    5. 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.


    Comments

    Empty