Edge Impulse logo
Blog Post

Are You Gonna Go My Way? Control Your Turn Lights with VoiceTurn

Machine Learning, TinyMLVoiceTurn lets riders warn others about the direction they're going to take, simply by saying left or right.

Nick Bild

February 23, 2022

    Leisurely riding bicycles for fun and exercise is one thing, but riding them primarily as a means of transportation is a different experience. Getting around town on a bicycle means sharing the road with cars and trucks, and that can be daunting, considering how vulnerable and exposed a bicyclist is. Under these circumstances, it should come as no surprise that accidents happen — as many as half a million bicycle riders are injured in traffic accidents annually in the United States.

    Engineer Alvaro Gonzalez-Vila spent some time pondering this problem, and realized that at least part of this problem may result from the fact that very few bicycles come equipped with turn signals. This leaves cyclists with only hand signals to alert nearby drivers to their intentions. Hand signals are not ideal, because many drivers will either not recognize them or misinterpret them, and also because the act of signaling requires a hand to be removed from the handlebar, which can cause instability and lead to accidents. Gonzalez-Vila wanted to create a universally understood signal that could be operated in a hands-free manner by the cyclist, so he built VoiceTurn. This device allows bicyclists to simply say “left” or “right” to cause a traditional-looking turn signal to illuminate at the rear of the bicycle.

    The hardware needed to build VoiceTurn is surprisingly simple and inexpensive. An Arduino Nano 33 BLE Sense — with an Arm Cortex-M4 MCU running at 64 MHz and a built-in microphone — supplied the processing power and the means to capture audio samples. A strip of waterproof WS2813 RGB LEDs served as the source of illumination for the turn signals. Power was supplied by a small lithium ion battery pack, and strips of plastic and cable ties were used for mounting VoiceTurn on the bicycle.

    Arduino Nano 33 BLE Sense awaiting your command

    To teach the Arduino to recognize voice commands, Gonzalez-Vila turned to Edge Impulse for help in building and deploying a machine learning model that could fit comfortably within the tight resource constraints of the device. Rather than attempt to collect a large, diverse dataset to train that model, the Google Speech Commands Dataset, consisting of 65,000 short utterances, was leveraged. Recordings of “left,” “right,” and background noise were extracted from the dataset. To prevent false positives for the target words, a random sampling of other words were also extracted. This dataset was then uploaded to Edge Impulse.

    In designing the impulse, Gonzalez-Vila chose to preprocess the audio data with an Audio Mel Frequency Cepstral Coefficients (MFCC) block. Doing so reduces the complexity of the data that flows into the classifier, which allows for better performance on resource-constrained edge compute devices like the Arduino Nano. The learning block of the impulse is a neural network classifier that infers what class an audio sample belongs to based on the features produced by the MFCC block. With a complete pipeline design, a few hyperparameters were tweaked before clicking the “train” button. Using a test dataset that was set aside from the training data, the classification accuracy of the model was found to be 80.48%. Not bad at all for a first pass, and this accuracy likely can be improved by adding more training data or exploring transfer learning blocks within Edge Impulse.

    Assessing model performance

    The trained model was exported to a ZIP file, which can then easily be imported into Arduino IDE and deployed to the hardware. This enables on-device classifications to take place, without the latency or privacy concerns of sending data to the cloud. Gonzalez-Vila programmed the RGB LEDs to respond according to the recognized voice commands within the Arduino IDE, then attached everything to his bicycle. The result is a bicycle that is safer to ride in traffic, and with hands-free operation.

    You cannot find VoiceTurn at your local bicycle shop just yet, but there are enough details in the project write-up for anyone that wants to make a weekend project out of building their own.

    Want to see Edge Impulse in action? Schedule a demo today. 


    Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

    Subscribe to our newsletter