Close

Testing wireless connectivity + uPyCraft IDE

A project log for Haptic Sleeve

Sleeve worn on the arm to provide haptic feedback while performing handwriting exercises.

grant-stankaitisGrant Stankaitis 03/23/2020 at 04:270 Comments

To start off, I tested the ESP32 wireless connectivity using the built in examples in Zerynth. I tried the 'WiFi_Scan' example, and was able to successfully discover all of the available WiFi networks in my vicinity.

Since the ESP32 program that was developed for the Haptic Sleeve contained multiple modules (boot.py, main.py, simple.py), finding a way to utilize these within Zerynth was a challenge. I realized that Zerynth was flashing FreeRTOS, a real-time operating system, when the ESP32 was virtualized. There are benefits to using an RTOS as I learned in my embedded systems course, however they can be confusing to work with. I found that there was no way for me to configure the FreeRTOS boot script through Zerynth. Based on the programs/modules, I was able to conclude that the previous students that developed the code were solely running the code on the board without an operating system. To replicate the project for now, I searched for an alternative IDE that allowed me to interface directly with the ESP32 without an operating system. In the future, I think it will be very beneficial to run the ESP32 on FreeRTOS, so that is something we can think about switching over. It won't be too difficult to figure out how to optimize the code for the operating system.

uPyCraft IDE setup

Here is where uPyCraft IDE comes in. Surprisingly, it is a fully-featured IDE. It reminds me of the Arduino IDE, but I still prefer Zerynth as an IDE. It has a built in console that communicated directly with the firmware running on the ESP32, as well as a file browser which allows you to drag and drop programs onto the board. I followed these links to get everything set up and configured with the ESP32.

Install uPyCraft

Flash MicroPython firmware

uPyCraft getting started with ESP32

I tested the same LED blink code below using uPyCraft to upload the code, and it works perfectly!

from machine import Pin
		
led = Pin(2, Pin.OUT) # Onboard LED
button = Pin(0, Pin.IN) # BOOT button

while True:
  if(button.value() == 0): # LED off when button released
    led.value(1)
  else: # LED on when button pressed
    led.value(0)

In my next log, I will detail how I tested and verified wireless connectivity with Mosquitto server.

Discussions