Controlling a vehicle via Bluetooth
Go to >>> New programs after update and improvements
This educational file includes 2 parts:
1 - Arduino B4R vehicle - Construction of the vehicle and development of the Arduino B4R program which will allow this vehicle to run.
2 - B4A Bluetooth driver - Development of the B4A application for Android Smartphone which will allow the vehicle to be controlled remotely via the Bluetooth system.
1 - Construction of the Arduino vehicle
Necessary material :
- an Arduino Uno board;
- a quarter of a quick connection plate ("Breadboard");
- one HC-05 Bluetooth module;
- two rechargeable Li-ION batteries and their connection box with cover;
- a plywood backing 1 cm thick, 29.7 cm long and 14 cm wide;
- an L298N Shield module allowing the connection and management of the two motors;
- a general switch;
- a 5.5 X 2.5 male plug for powering the Arduino Uno board;
- 2 Arduino DC motors and 2 adapted wheels;
- 2 rear swivel casters;
- an Android smartphone with Bluetooth technology.
Step 1: Installation of motors, wheels and casters
Step 1 : Returned vehicle
Step 2 : Installation of the main composants
Connecting components
We add the accessories: front leds (white or blue), rear red diodes connected to digital pin D13, a buzzer which will serve as a horn, connected to digital pin D3.
Front Lights and red lights
We add a small button to test motors offline bluetooth
This little button is connected to the analogic pin A0.
2 – Bluetooth Driver B4A - Application for Android device
We will now devote ourselves to the development of the Android application allowing you to transform your smartphone or other Android device into the cockpit of the vehicle previously produced.
This application will be developed in Visual BASIC for Android (B4A)
Successive screenshots of the screen of the Smartphone used
Before using this application intended to detect the Bluetooth module of the vehicle, then to connect to it, you must of course turn on the vehicle so that the Bluetooth signal emitted by the HC-05 module is detectable by
your smartphone.
This results in the rapid and continuous flashing of the small red LED of the HC-05 module. You must also check in the connection settings of your Smartphone that the Bluetooth system is activated.
The Smartphone home screen invites you to click on the green "Connection" button and then "Searching for device" is displayed.
If, after a certain time, the Smartphone does not detect an HC-05 Bluetooth module on, a message invites you to check the power supply of the vehicle and therefore of the HC-05 module, the small red LED of which should flash rapidly in a continuous way.
When the HC-05 module is detected by the Bluetooth system of your Smartphone, the words "HC-05 detected, please wait" is displayed and then, a few seconds later, the connection is effective and is verified in two ways:
1- The small red LED of the HC-05 module installed on the scooter starts flashing twice quickly with a pause of a few seconds before the next double flash and the large blue LED indicator lights up steadily.
2- On the screen of the Smartphone, the words "HC-05 Bluetooth module connected" is displayed and the blue Bluetooth logo appears, as well as the control buttons on the cockpit of the vehicle.
From this moment, you can control the vehicle using your smartphone using the appropriate keys:
Download
New programs after update and improvements
Change in the battery connections, the power supply of the Arduino board is now done on the VIN pin
New vehicle dashboard with touch key functions and changes from the previous table
Download the new B4R program - Download the new B4A app