Follow me as I build biometric (fingerprint) security, integrated front and rear lighting, and more, into my new Airwheel Q3 self-balancing unicycle for a Burning Man 2015 conveyance! While this is an advanced skill level project, I tried to take copious amounts of photos and created notes all over them, and attempted to keep the words a bit lighter since all the code is also attached!
Step 1: Background Motivation
The Playa is BIG.
Like.. really big. Most people don't realize the the occupied clock of Burning Man is ~1.5 miles wide and the greater BLM land with art on it or "deep playa" is ~2 x 2.5miles. This means that if you want to take part and participate in society and many fun events all over the city, you will put on a lot of miles! Thats why Burning Man is home to tens of thousands of bikes and countless alternative means of conveyance.
Last year I had nothing but problems with the second hand cruiser bike I brought with me. Aside from trying to ride it on a par-dry playa (which wasn't a good idea I realize), the hub loosened after the first day and the chain popped off at least 50 times over the week on the bumpy Esplanade. Over the 9 amazing days I spent in the BRC, this was my only qualm. This year, I am going to try something a little different.
Step 2: Hello Airwheel
Looking around, I found many different means or transporting oneself around the playa widely varying between artistic and utilitarian. I wanted something specific. Something small that would hold up to the smooth, sandy, and sometimes bumpy playa, had a reasonable range, torque and rider weight.
After doing a lot of research, I came across the Airwheel Q3. A small, self-contained electric wheel that has a 20-25 mile range with support of up to 265 pound riders and the ability to traverse 15º inclines. Sounded like a perfect fit! While Airwheels are hard to find in the US (I hail from the land of Teslas and technology, and have never seen one) there is a North American distributor in Ontario, Canada (Airwheel Distributor).
Even though the Airwheel Q3 seemed to fit the bill almost perfectly, there were a few areas I felt I could improve for my given Playa use case.
- Lighting - An all important night time security/art measure on the playa for any Burner transportation.
- Auth Security - Airwheel comes with a simple power button. While I don't consider Burning Man a crime prone society, its best to take a few proactive measures to secure such a cool vehicle!
- Anything else that sounded like a good idea/had room for because.. why not?
Step 3: Gathering the Materials
I have a BOM of the primary components used in this guide below, but I might have odds and ends (laying around the workbench already) that have been incorporated as well mentioned in the guide. I attempted to collect them in a more miscellaneous list below the BOM.
Bill of Materials
- Airwheel Q3 - North American Distributor - (realistically, this authentication device we end up making could be used to control the access to any device, as long as the method for enabling/disabling[transistor/relay/TTL] was adapted properly)
- Arduino Pro Micro 5v - Sparkfun - While this code is Arduino board agnostic, as-is, Its actually important that it be an Arduino with the Atmega32U4. The Arduino "Leonardo" should also work. Its current iteration pushes 97% resources utilization (SRAM and ROM) and all but 5 pins occupied.
- Fingerprint Scanner - Sparkfun - I opted for the ~$31 model instead of the ~$50 model as the difference is 20 or 200 fingerprints, and my use case does not need more than a couple. However your milage and application may vary.
- 4-pin JST Cable - Sparkfun - for interfacing to the above fingerprint scanner!
- Waterproof Metal LED Switch - Sparkfun - These come in many LED ring colors and in latching and momentary varieties. I actually used 1 latching (white LED ring) on this project.
- 128x64I2C Graphic OLED - Adafruit - I used the 1.3" version, Adafruit also has a 0.96" version with the same resolution and capabilities if needed.
- Half-size Perma Proto-board - Adafruit
- 3x8-Neopixel Strips - Adafruit - Two for the headlights, 1 strip for the brake lights.
- 2x 72v->5v 500mA Switching DC/DC converter - Mouser - This was one of the hardest to find pieces of this project!
- Insulated 5V Relay - Radio Shack - 5V 20mA activation needed with 1amp 250V switching capacity.
Odds & Ends
- Flyback diode - Radio Shack - As a preventative measure on the above relay coil.
- Capacitors -
- 2x 4.7uF 100V for the Recom power converters
- 2x 100uF 35V for the 5V ouput lines and neopixels.
Step 4: Arduino Software
By the end of this project, the Arduino source file was almost 800 lines in length, pushing all PROGMEM space boundaries of the Atmega32U4 once compiled. For that reason I have not attempted to put any code inline in the browser window and have instead attached the sketch in its entirety. I will however point out that you need the following 3rd-party libraries installed in your Arduino IDE to compile this sketch:
Step 5: Arduino Hardware
Sparkfun Pro Micro (Atmega 32U4)
I love the Arduino community for its open-source nature, and the availability of so much hardware and protocols via 3rd-party libraries. In my initial research, I found Arduino libraries readily available for the OLED display, fingerprint reader and the WS2812-based Neopixel LEDs. Therefore it was a natural choice for this project, but at that time I didn't realize just how far it would push that little 8-bit AVR processor.
After all libraries(8 total) were included and all strings and bitmaps for the LCD UI were in place this is what the Atmega32U4's resources utilization looked like:
Program Space (ROM): 28,094B used of 28,672B= 97%
Volatile Memory(RAM): 2,196B used of 2,560B= 85%
This is specifically on the Atmel32U4 SMD processor of the Sparkfun Pro Micro (Arduino Leonardo as well), which has a bit more RAM than the standard Atmel328P DIP you see in the Arduino One. If you were to use the Atmel328P, there would need to be some more space optimization of the code and RAM utilization, probably in the string usage or LCD library/resolution code areas.
I have attached a Sparkfun Pro Micro board diagram with the pinouts annotated on it. I hope that along with the pin definitions in the Arduino code sketch, it should be enough info (with some inferred electronic knowledge) to get this all hooked up, if not, please let me know in the comments and I will progressively elaborate!
Before I took the time to mount and integrate everything, it would remiss of me not to test the entire circuit while external to the Airwheel. I successfully tested the OLED and biometric startup flow in the image above, while separately unit testing each Neopixel array.
Step 6: Mounting Planning
Looking at the top of the assembled Airwheel, its apparent that anything which requires an external cutout mount (OLED, Biotmetric, Lights) will need to be on side opposite to power button/charger. After opening up the Airwheel, there is (barely) sufficient space around the battery to mount the necessary electronics. Check the image notes to see where we plan to mount everything!
Step 7: Getting/Controlling Power
One of the biggest hurdles for the project to be a truly "integrated" solution, is getting all the new electronics to be powered from the high voltage DC battery pack we have readily available. We could easily have it all powered by its own lithium ion batteries, but since this is an authentication and control mechanism for the wheel, its functionality is tightly coupled with the wheel power system. This means it always needs power with the wheel and would be rendered superfluous if it had power when the wheel did not.
Linear Regulator/Voltage Divider/Switching Buck Converter?
In the power world there is a lot of ways to get from voltage A to voltage B, depending on your current and efficiency needs. We are looking for the most efficient way to reduce ~65V down to 5V.
- Voltage Regulator - Would be very inefficient burning off the massive voltage drop as heat.
- Voltage Divider - Not to be used for significant currents
- DC Buck Converter - High efficiency, but more expensive and harder to find 5Vout from >40Vin.
Searching Mouser's expansive component catalog with my DC buck search criteria, I found the Recom R-78HB5.0-0.5. This little 3-pin package takes in up to 72V DC in and drops it to 5V @ 500mA average, at an 86% efficiency! Perfect fit. I picked up two: one for the 8 tail light LEDs and all the electronics, and one for the 16 headlight LEDs (they will be white and take up more power).
Data sheet application note: For Vin >50V, Recom recommends a 3.3uF 100V capacitor on the Vin lines, to slow the voltage increase and prevent damage to the builtin soft-start function of the converter.
The use of the insulated mechanical relay was somewhat a lazy one. I was looking for the easiest way to connect the two OEM power leads, without spending any time figuring out the voltage, direction of current or gate saturation needed to use a FET. I found a 5v relay at a local RadioShack (soon to be extinct) that fit this need nicely. It has 5v 20mA activation current and can switch up to 1A 250V. Even though this is a small relay and coil, I preventatively outfitted a flyback diode across the coil leads to dissipate excess EMF.
Step 8: Biometrics & OLED Display
Biometric (Fingerprint) Reader
The GT-511C1R fingerprint reader I selected from Sparkfun was very easy to integrate, given the availability of an Arduino library and numerous code examples on the web (including this great Garage Door Instructable). I selected the GT-511C1R over its sibling the GT-511C3 simply for price and use case. The more expensive 511C3 has 10x the fingerprint storage, but is otherwise identical to the GT-511C1R. Both readers rock the same serial interface with 360º fingerprint recognition and identical positive/negative acceptance performance.
For the initial enrollment, I added logic to check for the number of enrolled fingerprints on the device. If that number is 0, it will begin the initial enrollment of the first fingerprint instead of asking for authentication. After that, there is not currently a way to start enrollment except to explicitly run the EnrollFingerprint() function in the setup() lifecycle event, temporarily.
Future Improvement: Utilize the magnetic reed switch to begin enrollment, when it is triggered after entering the authenticated running state.
The 128x64 pixel OLED display I used is very flexible, it can be controlled via 3.3-5v TTL signals and supports SPI or I2C protocols. To save an arduino pin and since I did not need the fastest refresh rate, I opted for the I2C interface. This required soldering two jumpers pads together on the back of the Adafruit display (pictured).
To create the custom boot image pictured, create a monochrome bitmap in your photo editor of choice (good ole fashioned BMP), and run it through the Img2Code java program within the Adafruit_GFX library available from their Github. This will produce a hex byte array that is a binary representation of the image in code. This will be stored in PROGMEM space on the arduino so it does not quickly consume all of our SRAM. A full 128x64 image is 1kB in size, which is not huge when in the 28kB of program space, but immense if left in the paltry 2.5kB of SRAM. I have left both my boot image and the smaller headlight image in the Arduino project attached to this Instructable so you can see the actual definition and usage of those byte arrays.
Further display learning
The rest of the drawing code in the project and anything else available can be found at this great tutorial from Adafruit on using their OLED displays with their own libraries.
Step 9: Headlight & Taillight Mounting
If you have not had a chance to play with the WS2812 LED/Driver combo known as the "Neopixel" from Adafruit, you are missing out! These powerful little LEDs each have an on-die constant current driver that is individually addressable and capable of 24-bit color reproduction! You get all this for just the cost of a single digital data line and some 5V power!
The headlights are two 8-Neopixel strips mounted side-by-side, but connected digitally to appear as a single 16 pixel strip. I soldered the two strips together and to the 3-pin JST cable routed through the body, prior to mounting them with the screw hardware.
The taillights are a single 8-Neopixel strip and were mounted in the same fashion as the headlights, and with their own 3-pin JST power/data cable.
Finding small mounting hardware for some of these petite PCBs can be tough! I am lucky enough to have a local high-performance R/C Hobby shop that has a massive selection of small metric and imperial hardware. I ended up using 12mm long 2-56 Hex screws with #2 washers for spacers and 2-56 Nylock nuts for fasteners.
Step 10: Sugru Playa Sealing
In order to make the Neopixel PCB mounting more secure and dust/playa proof, I employed the help of DIY miracle material, Sugru. I cleaned the surfaces with an alcohol wipe and applied the black Sugru as a long rolled cylinder (like clay or play-doh) to the edges of the PCB and cable routes holes. Press firmly to get good contact adhesion and let cure for at least a few hours (preferable overnight) before continuing. I added a small amount of Sugru to the backside (inside) around the cable for strain relief, since we will be bending it at an acute angle once the battery is back in place.
Valuable Note: Get a smooth Sugru finish (no fingerprints!) by rubbing the Sugru with a finger dipped in soapy water after you have it all applied. In addition to following all the best practices found here.
Step 11: Failsafe
When it comes to planning technology and software its similar to planning for the playa; always try to plan for the worst. What if this new fangled fingerprint reader that works "Oh so well!" now, starts to fail because of all the grit and dust on the sensor at the mid-point of the week?
Backup Auth Failsafe
Originally, I was hoping to fit a Parallax RFID reader into the BurnWheel as a means of overriding biometric authentication if needed. While I happened to have a spare reader in the workshop, I quickly realized this antenna sized PCB would not fit in the tight Airwheel compartment.
Still needing a failsafe, I settled on a small insulated reed switch that I would mount against the inside of the body. When a strong magnet activates this reed switch while the power button is being turned on, the biometric authentication will be overridden and the wheel will power up right away!
SHHHHhhh don't tell anyone.. its a secret.
Realizing that the Arduino software might need tweaking once all of the component are installed into the wheel, I needed an easy way to access the board. I found a right-angle micro USB 9" extension cord (to female micro USB) that I was able to route out of the back of the Airwheel chassis, nearest the taillights. This ended up being a godsend, as I am still tweaking the software and it was a pain to get everything fit together at the end.
Step 12: Integration With the Airwheel
Although the Arduino-based biometric and fingerprint system we have created could stand alone, the real "cool" factor comes when we can fully integrate this with the existing control electronics and high-voltage DC power system of the Airwheel. To achieve this, we will have to modify the existing OEM electronics in the following ways:
- Power Button
- The built-in power button is a nice latching waterproof LED backlit switch that has + and - for the LED and both NO (normally-open) and NC (normally-closed) contacts to the C (common) button lead.
- Cut all 4 wires from the switch. Keeping the pair from C and NO contacts as the "power on" leads distinct from the + and - LED leads.
- The LED leads will go to the 5V and GND on the static power rails and be powered on as soon as the switch is on (digital pin not needed).
- The 2 "power on" leads need their circuit closed in order to power up the primary Airwheel electronics, so that is what our relay will be connecting together post authentication.
- Connect an additional + and GND cable to the 60V battery solder points (I went under the board)
- The 60V GND goes to the GND of the Recom DC/DC converters (also common GND).
- The 60V Positive lead goes to the C connection of the power switch and the NO lead goes to the + lead of the Recom power converters. (Powering the converters and electronics only when the power switch it ON)
- I added another latching LED button onto the front of the Airwheel, below where the OEM power button is placed. While I do not consider this an "Integration point" I wanted to mention it here, since it is the only other modification on the OEM electronic half of the Airwheel chassis.
Step 13: Putting It All Back Together
Return of the Sugru! Since this miracle material is flexible (yet dimensionally stable) and electrically isolating, its really is a good and quick solution to our PCB mounting problem. I made a few balls of Sugru underneath the PCBs to ensure enough standoff room to prevent shorts against the metal backplane, and just a few corner supports for stability.
Using modular connectors to interface to the wheel may provide flexibility in the future, but squeezing 8 JST connectors plus their few inches of excess wire in this tight space proved a bit frustrating. I found that you just need to close the two halves together very slowly, keeping the connectors positioned in the negative space and ensuring no cables are being pinched as the body pieces come together.
Step 14: First Tests & Conclusion!
Since I did pretty good unit tests of the circuit design and solution early on (and passed most failures at those junctions) I feel like had good luck when finally testing out the fulling integrated solution. As soon as the power button was pressed, the OLED and both light arrays illuminated instantly and I was prompted to "Press Finger".
Right away, some of the light colors and delay times for the UI were longer than I would prefer, but since we added the USB extension cable to the Arduino externally, reprogramming was a cinch. Over the next day or two I honed in a few things in the sketch I wanted to improve and there are still a few more features I would like to see if the PROGMEM space allows.
I hope you found this Instructable interesting and informative and please note that this project is still "in progress" as I am still iterating on the software to add features and make room for more lighting animation and logic. As I make those changes, this Instructable will always be updated with the latest! I plan on creating a few more in-depth feature videos as well shortly. Please let me know in the comments if you would like more detail in any area of this project and I will be obliged to provide what I can to the community!
First Prize in the