wESP32

An ESP32-based board with wired Ethernet connectivity and power over Ethernet

Oct 29, 2018

Project update 5 of 20

MicroPython Demos

Time for more demo code, this time with MicroPython!

As promised, more demo code has landed in the wESP32 demos repo on Github! This time there are two demo projects, both based on the cool MicroPython project.

MicroPython

The MicroPython home page has this to say about itself:

MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments.

They have a well-supported build for the ESP32, which includes excellent out-of-the-box support for the ESP32’s Ethernet MAC. This obviously makes it a great choice for use on the wESP32. In addition, it’s a very easy language to get started with and the REPL command line allows you to interactively play with a board and test things very quickly. All of these reasons make it very likely that I’ll ship the wESP32 to backers with MicroPython pre-installed!

wesp32_light_server demo

This demo project is a cleaned up version of the code featured in the campaign video at timestamp 00:42 and was used to control the deadbolt in the video. If you pay close attention you can see the web interface says "set the light level", but it can obviously be used for other things than just light. :)

The demo uses the picoweb micro-framework that was specifically created for MicroPython and provides ease-of-use similar to the well-known Python web framework Flask.

The README for the project provides a whole lot more detail than I’m going to cover in this update, but a quick glance at the main.py shows that you can get quite a bit of functionality from very little code, because most of the heavy lifting is done by MicroPython and picoweb, and your application can be quite simple.

A lot of files in the repo are actually just bash helper scripts to make project management and dealing with the board a little easier. You don’t need to use them in your derivative projects but they are there as a reference to show the steps necessary to get the code on to your board. The scripts are written for the bash shell which is standard for Linux and MacOS, and is now even available in Windows.

wesp32_light_dweet demo

While the first demo was useful for making the video, and may be useful for people that want low-latency control of something on their local network, it’s probably more common for an IoT device to be accessed and controlled through a cloud service. Since this often requires an HTTP client instead of an HTTP server, I decided to create a very similar demo that uses the awesome dweet.io service instead.

As before, the README for the project should have all the details you need to get it up and running. Since this doesn’t use any external packages, it’s even easier to get started with. And as a glance at the main.py shows, it is simpler as well: just 26 lines of code!

One cool thing this demo shows is how you can use the ESP32’s built-in unique ID to be able to differentiate between devices and give them separate cloud endpoints without having to hard-code any of it in your code!

Campaign progress

We have made some progress toward the $15K stretch goal, but we still have a ways to go, so please don’t let up on sharing this project with your tech friends and on social media. Thanks! :)


Sign up to receive future updates for wESP32.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects