Bluetooth Car with Speedometer

Mikaela Matias

Overview

The goal of this project is to provide an interactive and user-friendly way to control a battery-operated car (ex. Speed and direction) via Bluetooth while displaying its current speed. Users can do this in two ways: Simplicity Connect App and my custom Bluetooth Web application. This project can move the car in three directions (right, left, and forward), make it stop and go, and adjust the speed to make it go slower or faster. Enabling notifications will allow the user to see the speed (cm/s) of the car in real time.

The videos below demonstrate vehicle control by using Silicon Labs Si Connect tool (left) and Web Bluetooth app (right).

Demo 1 Demo 2

Hardware

I used the robot car chassis kit by Emozy combined with the BGM220-EK4314A microcontroller board, bluetooth, optical speed encoder and motors. The Microcontroller allows every component of the car and application to function. It controls the car's motors, compute the speed, and sends and receives bluetooth data and commands. Optical speed encoders are connected to the wheels and are used to calculate their speed.

Schematic Wheel encoder

Bluetooth is the main form of communication between the user and the vehicle. This allows the user to write request to change the direction and speed of the car, and receive notifications of the car's speed. The car is powered by four AA batteries. The following hardware peripherals were used to implement my project:

Front view Back view Side view

Software

For this project I used Simplicity Studio for backend, Visual Studio Code for middleware, and Notepad for front-end.

In Simplicity Studio, I was to control the car's motor to make it move, change direction, and adjust its speed. I was able to implement a Bluetooth connection from the user and the microcontroller then log a message to see if the connection was made successfully (if plugged to the computer, it will also show up in Tera Term).

I also included functionality to the car's motor by sending a Bluetooth write request to the controller. Each direction corresponds to a specific number that is passed from the user to the microcontroller: 1-stop, 2-right, 3-left, 4-backwards (not implemented), 5-forward and once the microcontroller receives those number it will automatically move the car to those directions. Same logic applies when setting the speed of the car using the website, pressing any of the buttons will send a write request to the microcontroller with a predetermined unsigned integer value that would adjust the motor speed. Lastly, I was able to calculate the speed of the car and pass those value via bluetooth notifications.

For the web application, I used notepad to code the website's user interface (UI) in HTML. I mainly used tables and buttons to display my controls and log messages. Additionally, I used JavaScript and Visual Studio Code to implement functionalities to the buttons and act as a bridge to connect the website to the microcontroller via Bluetooth.

I also used the Silicon Labs' mobile application "Simplicity Connect". I was able to test out all my Bluetooth notification in real time and send commands to the microcontroller manually. While it was able to do the majority of what my website can do, though it takes longer for the user to control the speed and direction since they have to manually encode it. It would also assume that the user knows these specific values for them to properly use the control. One feature that the app lacks is making left or right turns automatically, unfortunately, the user will have to make it go forward (by pressing 1) quick enough so that it will it turn. Otherwise, it will make the car go in circles. The website would let the user control the car without having them manually enter the number and would prevent the car from just going in circles when you press left or right.

Final Thoughts

Overall, it was a great experience doing this project. I was able to learn a lot about C programming language, Bluetooth and notifications at a deeper level. At first, it was very challenging trying to understand and make all the controls for the car work. However, once I was able to overcome it and understood how the mechanics work, it became really fun having to implement new features, create a website, and play with my car!

Downloads