MicroPython and ESP8266 Airboat
Water Python
An airboat project uses a standalone WiFi web server for remote control.
My daughters and I have built a number of airboat projects, but this time I thought that I'd use MicroPython [1], 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.
For this project, my goal was to create a MicroPython standalone WiFi access point and use it as a small web server for controlling the airboat fans.
Hardware
The hardware for this project included:
- 1 ESP8266 module (WiFi microchip)
- 2 L9110 fans
- 1 Arduino Uno proto shield (or use a small breadboard)
- 9V battery or portable phone charger
- K'Nex blocks
- 1 small plastic box
- 2 plastic water bottles
- Duct tape
MicroPython is supported on a number of WiFi-enabled ESP32 and ESP8266 modules. These modules are well priced, with the NodeMCU module starting around $5. Most of the ESP8266 modules also support Lua and Arduino C/C++ programming.
For this project, I used a WeMos ESP8266 module, which comes in a Arduino Uno form factor (Figure 1). I like the WeMos modules, because I can use my Uno proto shields. Also, these modules support 5V DC, as opposed to the typical MicroPython modules, which only support 3.3V. The fans will work with 3.3V, but they generate a lot more wind power at 5V.
The L9110 fans (Figure 2) designed for Arduino projects only cost about $5. They have four pins: VCC, GND, INA (direction), and INB (on/off). For this project, I only used forward-spinning fans, so I only needed to use the INB pin.
Boat Construction
For the boat frame, I used K'Nex pieces because they are lightweight and sturdy (Figure 3); however, other construction kits could be used, as well. Water bottles provided flotation, and duct tape secured the bottles to the frame. To help protect the electronics, I used a small plastic snack container. The fans were wire-wrapped to the boat frame.
MicroPython Setup
Among the available MicroPython development environments, the uPyCraft IDE [2] that I used for this project is well-integrated (Figure 4) and has some excellent tutorials to help you get started.
Typically for MicroPython projects, you create two applications: boot.py
and main.py
. I like to equate this arrangement to Arduino, which has a setup()
function (boot.py
in Python) and a loop()
function (main.py
in Python). For this example, I wanted to keep the documentation simple, so I put everything in the boot.py
file; however, a main.py
file is recommended for larger projects.
Buy this article as PDF
(incl. VAT)