Arduino Libraries

The GaugeWidgets and PolarDraw libraries are Arduino-IDE compatible graphics libraries optimized for drawing gauges on the ESP-32 based M5Stack 320 x 240 TFT screen.

GaugeWidgets. The GaugeWidgets library includes vertical, horizontal and angular (arc or circle) widgets. Individual widgets have up to five color-selectable ranges, up to eight pointers of eight types (including arrows, of lines/bars, ‘bugs’ (markers), and needles. Pointers have selectable colors and individual single-character ‘tags’ that help in labeling. Also, text datum helpers are provided to assist you in the positioning of text strings such as values and units.

PolarDraw. The PolarDraw Library allows you to place lines, triangles, quadrangles, circles, arcs, and text with arbitrary rotation, size, and line width. Handy for instrument labeling and drawing, but see the library example for more interesting applications.

FMI on the hardware used: www.M5Stack.com

Examples of compound Gauges created using the vertical, horizontal and arc elements from the GaugeWidgets library:

Using the widget primitives in the GaugeWidgets library, you build elaborate gauges, such as shown above. Most of the math is taken care of. You just perform simple screen positioning of widgets and values. For commercial endeavors, please contract me to develop custom gauges or library elements. Many of the gauge examples have been flight tested!

I created this library in order to provide electronic gauges for experimental amateur built (E-AB) aircraft, but you can easily use it for simulators, vehicles, boats and spacecraft (!). You may download and use The libraries with a license for non-commercial purposes. UPDATE:<May 13, 2020> Deprecates the PolarText library and incorporates all of the methods into the PolarDraw library. PolarDraw adds the ability to place graphical objects with arbitrary revolution, rotation and line thickness.

Etymology: PolarDraw uses polar coordinates (r, theta) to specify points in a 2-D drawing plane. It draws ASCII text (numbers, characters, strings) and geometric objects at various angles, sizes, widths and thicknesses. It uses extensive use of floating point mathematics for trigonometric functions and is ideally suited to 32 bit microprocessors, such as the ESP-32.

Try out the PolarDraw library. It will make your head spin. It allows you to place graphical objects and print text anywhere on the screen, with specified revolution, rotation, height, width, color, datum position and line width. Yes, the library does double rotation– once around a graphics datum and the other around the text or object datum. No sines or cosines were injured during the creation of this library.

Update 9/3/2020: PolarDraw adds geometric object methods (line, triangle, rectangle, quadrangle, arc, circle and ellipsoids) to the textual polar methods. Objects can all be drawn with outlines of variable width, color and end effects. For rectangles, arcs and ellipsoids, graduation marks can also be enabled, simplifying the creation of your own gauges.

Download Libraries

NOTE: Libraries will soon be offered for the huVVer-AVI programmable aircraft instrument. This device features a larger, brighter screen than the M5 and supports a number of interfaces useful in avionics applications. More information on this device will be available in January, 2021.

To install, download the .zip file to your PC. Open the Arduino main program menu Sketch:Include Library then select Add.ZIP Library, then navigate to the downloads location on your computer to select the .zip file.

You must also have the M5Stack library installed, and the Additional Boards Manager URL under main menu File:Preferences set to https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json

Restart Arduino, then go to File:Examples:GaugeWidgets (or PolarDraw) and run the example sketches.

Support: Bug reports and feature requests can be sent to me using the Contact page on this site. Please, no basic questions about the M5Stack hardware or how to run the Arduino environment.

If you want to donate to keep this website running, send me an email and I’ll tell you how! For commercial use of this intellectual property, please contact me for licensing terms. Thanks, Vern (Voltar).

OnSpeed

ONSPEED is an angle-of-attack (AOA) that is used for approach, landing and maneuvering. It provides tone and visual clues to maintain a safe, optimum AOA for maneuvering, approach, and landing. If the pilot maintains ONSPEED, the airplane cannot stall. FMI www.flyonspeed.org

huVVer.tech is providing hardware and software for the OnSpeed AOA/Energy display. Various 3-D printed mounting bezels and a rear case are available from Shapeways, and the power/data base (huVVer-M5PWR) is available directly from OnSpeed. The actual display unit is available from M5tack.com.

Using one of the M5Stack display modules, the Shapeways rear case and one of the optional mounting bezels or pivot and the power/data base from OnSpeed, a complete aircraft auxiliary display system can be built. The display system can run any of the code available on this page.

Here are some mounting systems currently in development:

Order 3D Printed Parts

All of the mechanical parts available here: https://www.shapeways.com/shops/b43d .

Want to DIY or use a different supplier? Here are the STL files for the OnSpeed pivot mount, back case and bezels: http://www.huvver.tech/m5-mechanical/

Custom Power/Data board for M5Stack. Robust power module for aircraft, automotive and marine applications. Withstands +/- 100 Volt power surges and provides electrostatic discharge protection on inputs and outputs. Uses standard Molex connectors for rear access. Contact OnSpeed www.flyonspeed.org for availability.

What’s Next?

  • Autotrim Controller. Based on an existing design, this will be ported to the ESP-32 platform. Additional features will include altitude hold and heading or track hold without autopilot servos installed.
  • Ignition Advance Controller. Will modify the ignition timing of existing electronic ignitions that use manifold pressure inputs. Will monitor RPM, MAP, CHT and EGT to optimize timing without stressing the engine.
  • Transponder Controller. Will allow the control of remote transponders without the need of a functioning EFIS. Used as a low-cost emergency controller for when your EFIS fails or for the back-seat pilot.
  • Angry Birds— just kidding (bad Karma)

2 thoughts on “Arduino Libraries

Leave a Reply