MicroPython and ESP8266 Airboat

Water Python

© Lead Image © shamain, 123RF.com

© Lead Image © shamain, 123RF.com

Article from Issue 222/2019
Author(s):

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.

Figure 1: WeMos ESP8266 with an Arduino Uno form factor.

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.

Figure 2: L9110 fans.

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.

Figure 3: Airboat construction.

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.

Figure 4: uPyCraft MicroPython IDE.

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

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • CircuitMess Nibble

    The Nibble kit by CircuitMess is a freely programmable mobile game console that makes getting started with microcontroller programming a breeze.

  • BBC micro:bit

    Designed for students, the BBC micro:bit, in conjunction with MicroPython and the Mu editor, can help you get started with microcontroller programming.

  • Light Painting

    In the photographic method of light painting, you expose a subject over an extended period of time while moving the light sources. With a little technical support from a Raspberry Pi Pico, you can achieve sophisticated results.

  • ESP8266 for WiFi Sniffing

    The ESP8266 is in the core of many IoT devices. Thanks to ESP8266 sniffer mode, you can monitor the WiFi medium for diagnostics and optimization.

  • CircuitPython

    The CircuitPython run-time environment runs on almost all microcomputers and microcontrollers, making it perfect for cross-platform programming.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News