October 11, 2018: uQR: Generate QR Codes in MicroPython

This last week I ported the python-qrcode library to MicroPython. The result is uQR!

Porting python-qrcode to MicroPython involved:

  1. Removing libraries unavailable in MicroPython.
  2. Rewriting syntax that is unavailable in MicroPython.
  3. Removing Py2/Py3 cross-compatibility code.
  4. Removing QR code image generation.
  5. Rewriting recursive function calls into loops: MicroPython has a much shallower recursion limit than CPython.
  6. Consolidating all of the code into one file, for easier MicroPython deployment.

The result:A microcontroller connected to a miniature LED display, depicting a QR code.

Due to memory limitations, I can only create small QR codes on the ESP8266 microcontroller. But I’m getting an ESP32 and a slightly larger screen: I’d like to make a project and video about accepting lightning network payments with the ESP32.

October 10, 2018: The Legendary Octosniffle Lives

After months and versions of prototyping, the Legendary Octosniffle is finally printing. I printed the main components in wood PLA and applied stain and polyurethane to achieve a nice wood-like appearance.

I designed the Legendary Octosniffle around the basic Delta 3D printer geometry, with the following modifications:

  • Lead-screw drive vs. a belt drive.
  • Magnetic effector joints.
  • More printed structural parts vs. purchased parts than in a typical delta printer.

I’ve very happy with the printer’s:

  • accuracy
  • aesthetics

And I’m satisfied with the printer’s:

  • speed

More to follow.

September 3, 2018: Flying Cars

As a kid I watched hours of re-runs of The Next Step–the 1991 futurism serial documentary, not the 2013 Canadian dance drama. Little did I know that the future had already arrived in the 1949!

JASchilz posing in front of the Taylor Aerocar at Seattle's Museum of Flight
The Taylor Aerocar III, at Seattle’s Museum of Flight

Flying cars were apparently solved decades ago. The first Taylor Aerocar (pictured above) was built in 1949, by fellow Oregon son Molt Taylor. Wikipedia categorizes the Aerocar as a roadable aircraft–more of a driving plane than a flying car–and there are many more entries, including what was basically a Cessna Skymaster welded to a Ford Pinto.

Remembering back 25 years, I think that we were looking for the following characteristics in the flying car of the future:

  • Freeway capable performance as a car
  • Push-button conversion from car-mode to plane-mode
  • Takeoff and landing from/to street driving
  • Easy to fly, like driving a car
  • Ease of ownership: not much more difficult to obtain and store than a regular car

Ease of takeoff, landing, and flying would require some aerodynamic characteristics (like a low stall speed) and some technology (like automatic rudder coordination) that would have set a true “flying car” apart from an entirely airworthy “roadable aircraft” like the Taylor Aerocar.

Today, there’s a new flying car dream:

  • The flying car doesn’t drive at all: it performs vertical-takeoff-and-landing (VTOL)
  • You don’t own the flying car: you hail it like a taxi
  • You don’t pilot the flying car: it pilots itself using modern automation technology

To offer these affordances, the new flying car takes advantage of electric multirotor technology. Rotorcraft are generally less efficient than fixed-wing aircraft in terms of energy expended per mile of travel, but they are natural VTOL fliers. And some companies are designing hybrid craft with multirotor VTOL takeoff and landing capabilities and fixed-wing travel efficiency.

The new flying car will ultimately find some niche in a growing set of transportation options. In suburban regions, a flying car could provide last-mile transportation between a train-station and your home. In urban areas, flying cars might provide point-to-point transportation between transit hubs, avoiding congestion by taking advantage of big sky theory.

And as a postscript for future Martians, rotorcraft will be even more important in the Martian atmosphere: the lift of a wing scales linearly with air density and quadratically with speed. To get the same lift from a given wing in Mars’s 1% atmosphere then requires that the wing be moving at 10 times the speed it would move on Earth. A fixed-wing aircraft would have to travel at 10 times the speed on Mars compared to Earth to achieve identical lift, yielding stall speeds of 500+mph and requiring immense runways. A rotorcraft, on the other hand, only has to spin its rotors 10 times faster. A given craft only needs 38% of the lift on Mars that needs on Earth, of course, but in the back-of-the-envelope calculation the air density parameter dominates.

I’m making this post on the eve of my enrollment in Udacity’s Flying Car Nanodegree program.

August 12, 2018: Creating GitHub Repositories at the Command Line

I like programming in vim. But when I want to share a new project with the world, I have to fire up a web browser in order to create a new repository in GitHub.

No more. I dug into the GitHub API literature and found that you can create a repository by POST request to their RESTful web API. For example, you can  create a GitHub personal API token with at least the “public_repo” scope and then:

curl -u YOURGITHUBUSERNAME:YOURPERSONALAPITOKEN --header "Content-Type: application/json" --request POST --data '{"name": "test-repo"}' https://api.github.com/user/repos

See the API documentation link above for a full list of optional data that you can send to this endpoint. And of course, you can use any HTTP tool to send this request, curl is not required.

To make the process smoother, I added the following variables to my environment:

export GITHUB_CREATE_REPO_API_KEY="YOURPERSONALAPITOKEN"
export GITHUB_USERNAME="YOURGITHUBUSERNAME"

And then created the following shell script:

#!/bin/sh

curl -u $GITHUB_USERNAME:$GITHUB_CREATE_REPO_API_KEY --header "Content-Type: application/json" --request POST --data "{\"name\": \"$1\", \"description\": \"$2\"}" https://api.github.com/user/repos

With that script in my PATH, the command mkgithubrepo data-structures-exercises "Various data structures implemented in Python and C." creates a GitHub repository at https://github.com/JASchilz/data-structures-exercises with the description “Various data structures implemented in Python and C.”