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.


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

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • 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.

  • CircuitPython

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

  • Recycled E-Ink

    Combining open firmware with recycled hardware, Inkplate launches a crowdfunding campaign for an open source e-paper display.

  • RaspPi-Controlled Toy Sailboat

    With Node-RED, you can create a web dashboard that instructs a Raspberry Pi to set the rudder position on a toy sailboat.

  • Decisions, Decisions

    When it comes to open hardware projects, the choice of an Arduino or a Raspberry Pi board can determine success or failure. Read on for guidance in selecting the best board for your specific needs.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95