Deploy edge AI for drive modes

How TinyML can transform driving condition detection?

According to the latest research, drive modes may be the new Eldorado for car makers looking to create the ultimate driving experience.
In a paper published in 2021[1], researchers show that certain drive modes can increase the electrical consumption of an electric vehicle (EV) cruising a freeway by 15% to 30%.

AI road state monitoring


As consumers still experience range anxiety, according to a 2023 study by J.D. Power, improving battery life by about a third, in optimal cases, could significantly improve customer satisfaction. Drive modes also target hazardous conditions such as wet, icy, or snowy roads to provide a safer drive. The problem is that switching between modes requires the driver to select the appropriate setting manually. 
 

[1] Claire Sugihara, Katrina Sutton, Adam Davis, Vaishnavi Karanam, Gil Tal. From sport to eco: A case study of driver inputs on electric vehicle efficiency. Transportation Research Part F: Traffic Psychology and Behaviour. Volume 82. 2021. Pages 412-428. doi.org/10.1016/j.trf.2021.09.007

Drive modes are so good! Why can’t they be automatic?

In essence, drive modes represent various drivetrain configurations destined to create or emphasize a particular driving experience. For instance, by modifying the steering column’s response, the suspensions’ flexibility, or the regenerative braking’s aggressiveness, the system will create vastly different driving experiences to focus on specific goals.

The traditional Eco mode dials down responsiveness and changes the gear ratio to prioritize energy savings, whereas Comfort mode tweaks the suspension to absorb bumps more. Conversely, Sport mode ensures a powerful throttle, heavier steering, and harsher suspensions to give drivers an experience closer to racing than cruising.

Car makers don’t automatically transition from one mode to the other because they are in such stark contrast from one another that it could startle drivers. However, driving conditions are rarely uniform unless driving on a modern highway for long stretches at a time.

More often than not, a user will experience slow traffic that would beg for the Eco mode, then a bumpy area under major construction that would be perfect for comfort mode before needing a quick acceleration to get out of a standstill, which would benefit greatly from a short burst of Sport mode before going back to Eco. And that’s not even accounting for sudden weather changes. Snow mode tweaks the transmission and dials down the throttle response to lower the power and torque. The goal is to prevent the car from getting stuck by protecting drivers against the element and themselves. By slowing down responses and forcing a steadier acceleration, the system limits the risk of digging the wheels into snowy terrain, even if drivers suddenly push down on the gas pedal.

However, a driver with a heightened focus on the road shouldn’t have to think about switching drive mode. As the weather suddenly changes, the car should help users focus on their surroundings, not distract them with modes and settings.

A problem tailored for machine learning and ST

AI versus humans

The solution to this issue may rest in machine learning. Thanks to their myriad of sensors, cars have been able to detect roads, weather, and other conditions with far more accuracy than any person. In fact, vehicles have been so precise and astute at managing slippery or hazardous conditions that features like traction control and anti-lock braking systems have been mandatory for decades.

Systems have also gotten so smart that traction control can assist drivers in normal conditions to avoid understeering or oversteering in corners. Using machine learning to detect road conditions and choose the best mode automatically is thus a natural evolution of the years of innovations that have shaped the car.

However, building an automatic drive mode system and road detection mechanism can be challenging, with engineers often wondering where they would even start. Here are just three easy steps to get projects going on the right track and reduce the time it takes to release a product to market.

Machine learning in cars with an ST board

ST’s first machine learning solution that recognizes four car states: parked, normal road condition, bumpy road, skidding or swerving

Step 1
Get the AEKD-AICAR1 kit

Creating a machine learning application can seem like a daunting task. When teams think of collecting data, training neural networks, and implementing algorithms on a microcontroller, they can become discouraged before even the first proof of concept.

Small companies may not even have a data scientist on board or the expertise to deal with neural networks. Hence, we released the AEKD-AICAR1 evaluation kit to demystify the early stages of this process.

The bundle includes the AEK-CON-SENSOR1 connector board and AIS2DW12 three-axis accelerometer. The motherboard itself houses the SPC58EC Chorus microcontroller with 4 MB of flash that comes with a pre-trained neural network. Put simply, the AEKD-AICAR1 Sensor Node Kit has everything developers need to get started with their machine learning application. 

s s s

We even provide a display to show a simple UI representing car states to ensure teams can demo their proof-of-concept more easily. There’s also a setting to power the entire system with a typical 12 V battery or eight AA batteries to improve overall mobility.

Automotive AI on the edge for car state classification

An innovative idea in the AEKD-AICAR1 that defines an ECU detection node with an embedded artificial intelligence processing.

Step 2
Using ST’s software ecosystem

Out of the box, the pre-trained neural network can recognize four states: normal road, bumpy road, skidding, and parked. Moreover, it is possible to combine these states with additional situations like skidding on a normal road, skidding on a bumpy road, parking with the engine on, or parking with the engine off.

Obviously, we used a small set of training data since the application is for demonstration purposes only. Yet, despite the very limited training data available at the beginning, we obtained a success rate of 94%, with issues only in some of the additional conditions. Put simply, teams can already envision what they can accomplish with vastly more information and intricate algorithms.

s s s

To start testing models, developers can simply grab AutoDevKit Studio and the SPC5-STUDIO-AI plugin, which will enable them to import the most popular deep learning frameworks, such as Keras and TensorFlow Lite. The ST plugin even validates the neural network and can simulate its performance on a microcontroller to give developers an idea of the memory footprint needed and inference times.

While this step is important, regardless of a team’s expertise level, it can especially help engineers with less experience. It’s easy to overestimate the RAM or computational throughput requirements when working on machine learning at the edge. Our tools can help obtain an accurate perspective of an application’s hardware needs faster.

s s s
Step 3
Test your application and perfect it

The next step is to place the AEKD-AICAR1 on the floor of the driver’s side, toward the front of the vehicle, to test the algorithm and capture more data. Indeed, this replicates real-world performance and can collect more information. Hence, engineers aren’t simply designing a smarter driving condition detection but perfecting it at the same time.

As teams gather more data from the accelerometer or additional sensors connected to the kit, it becomes possible to detect more road conditions accurately, thus opening the door to a truly intelligent driving mode selection. Our user manual even provides Python scripts and a walk-through of Google Colab, so even those with little experience in data science can get started.

Read also: AEKD-AICAR1- Machine Learning in cars with an ST board to avoid mindless hype and being left behind

The race to be first

Following those three steps will help teams start on the right track. Developers will still have to optimize their solutions and find a path to market that makes them competitive. However, ST not only provides support but also offers an entire Partner Program full of companies with the expertise to give customers a unique edge. Put simply, the issue isn’t whether machine learning will automate drive mode selection and road condition detection but who will be the first to implement it.

Edge AI for automotive

Machine learning and edge AI with SPC58 and Stellar automotive solutions for improved safety and advanced services