Communication makes even smarter

Unfortunately, our car is still pretty stupid. Maybe it would be helpful to be able to send it a few instructions now and then. For example, the car could simply follow us when we move, or it could respond to commands we send it.

For this we will extend the Arduino with a Bluetooth transmitter. Bluetooth is a radio standard for transmitting data, music, videos or pictures over short distances. We will use a HM 10 - BLE Bluetooth module for communication.

Wiring the HM 10 BLE Module

Testing the Bluetooth - Connection

For this test you need the software in the box below and a program for your cell phone or tablet with which you can send text commands to the Arduino. I used the program "Serial Bluetooth Terminal" for these tests.

// Bluetooth Test
// Attention: The HM 10 uses Bluetooth LE (Low Energy), makes sure that the program
// you use for communicating also supports BT LE (I use the Serial Bluetoot Terminal)
// With this test software you can send text messages to your arduino and vice versa.
// Stefan Hager (2021)

#include 
    
const int BTRX = 10;
const int BTTX = 11;
SoftwareSerial SerialBT(BTRX, BTTX);


void setup() {
  SerialBT.begin(9600);
  SerialBT.println("Connected with Arduino via HM 10 BLE Module...");
}


void loop() {
  if (SerialBT.available())
  {  // Message arrived
     String msg = SerialBT.readString(); 
     SerialBT.print(msg);
  }
}