MicroPython and ESP8266 Airboat

Final Application

Now that all the pieces are working independently, I can pull it all together. For the final code (Listing 2), I've defined two fans (motorR and motorL); a fan control function (fancontrol(left,right), line 31) is called from the web requests (lines 35-49). Figure 7 shows the airboat web server, and Figure 8 shows the airboat in action.

Listing 2

Access Point and Web Controls

 

Figure 7: Airboat web controls.
Figure 8: Airboat in action.

Summary

You'll be quite surprised how fast two fans will move the airboat. To ensure the boat runs straight forward, balancing the direction of the fans or adding a simple rudder might be necessary.

I've done the same project on the exact same hardware in Arduino C++. The response speeds seem similar, but the Python code might be slightly leaner. Although the MicroPython IDE wasn't as robust as the Arduino IDE, I enjoyed testing the Python code interactively from a command prompt.

I won't be giving up on Arduino C++, but I can definitely see a place for MicroPython, especially for projects with lots of string manipulation.

The Author

You can investigate more neat projects by Pete Metcalfe and his daughters at https://funprojects.blog.

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

Direct Download

Read full article as PDF:

Price $2.95

Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs

News