INSTRUCTOR-SPORTSWOMEN ARDUINO ROBOTS AND BLUETOOTH MODULES CONFIGURATION
There is an instructor robot and also several sportswomen connected each other to the following.
You can connect as many robots as you want among them. The only one condition that is required is that each robot that it is connected to the previous, it is not separated from this last one, more than the scope of the bluetooth signal that joins them together. On the other hand, the signal can go through walls and doors. That is, it would be possible to connect, for example, 1000 robots among them, controlled by the first through the slave bluetooth module HC-06. Also can be distributed by the floors and rooms of an building. I bought 3 Arduino robots Smart BAT CAR
For the project I have used a HC-06 module together with several HM-10 modules that are of the type BLE (Bluetooth Low Energy). These last consume less that the first. For connecting your mobile to a HM-10 module properly you have to use a Android O.S. above 5.0. But because I had a mobile Samsung S4 Mini with and Android 4.4.2, it was very handy for me to use the HC-06 as a slave module of the main robot and the HM-10 for the others. The HC-06 it is of classic bluetooth, not BLE.
So then, I use with the instructor robot:
A HC-06 on slave mode. It comes with the BAT CAR robot.
A HM-10 bluetooth BLE 4.0, in master mode for connecting to the slave of the following sportswomen robot.
In both sportswomen robots I use the modules:
HM-10 slave for connecting to the previous robot.
HM-10 master to connect to the following sportswomen.
Other adquisitions:
Jumper cables in Vigos' Electronson's physical store. The virtual shop is
DFPlayer Mini MP3, for it being able to play music:
32G micro SD card, for storing songs and voice commands as well as, possibly, all the files retated to the project. There are not necessary so many gigabytes:
3W speaker, for connecting to the MP3 player:
A protoshield. It is not strictly necessary. What it is necessary is a miniprotoboard. The protoshiesld overlaps SCL and SDA pins, because of that, it was requiered to cut a coner cantel for avoiding it.
USB to TTL serie cable, for programming the bluethooth modules. The HC-06 and the HM-10 can be plugged directly. There is necessary to cross the respective RX and TX of the devices to connect.
Set up of the HC-06 module:
AT+NAME<Name>
Ex: AT+NAMEHC-06leader
AT+BAUD<Number>
Ex: AT+BAUD8
8=>115200
Set up masters HM-10 :
AT 9600 Without line adjustment (by default)
AT+NAME?
AT+NAMEMaestro1
AT+BAUD4 => 115200
AT+MODE2 (send, receive)
AT+ROLE1 (central, master)
This last command resets the module. Open again the serial monitor at 115200, Without line adjustment.
AT+IBEA0 (no ibeacon). Default.
AT+TYPE0 (no PIN). Default.
Set up slave HM-10:
AT 9600 Without line adjustment (default)
AT+ADDR? For obtaining the MAC
AT+BAUD4
AT+MODE2 (send, receive)
AT+ROLE0 (slave) (there are reset)
AT+IBEA0 (no ibeacon) (default)
AT+TYPE0 (default)
AT+IMME1 (for connecting to a master when it ask for it through AT+CON<MAC>)
AT+IMME0 (if once connected for first time, a immediate connection once got on, is needed)
Project StepsSet up the bluetooth modules through AT commands, put them on the robots. Use two modules on each robot except on the last. Put the protoshield on the master (instructor) robot. Connect the MP3 mini Player to Arduino like on the image bellow:
Add new functions to the code that comes with the Arduino BAT CARS of Yahboom. Like spiral() and circle() based on mathematics already knew by the old greeks:
void circle ()
{
int slow;
// right motor back off
digitalWrite(Right_motor_back, LOW);
analogWrite(Right_motor_go, control); // PWM--Pulse Width Modulation(0~255) control speed
// left motor go ahead
digitalWrite(Left_motor_back, LOW);
slow = (int)(control * 2 / 3);//without decimals
analogWrite(Left_motor_go, slow); // PWM--Pulse Width Modulation(0~255) control speed
//speed of left wheel is two thirds of right wheel
}
void spiral(){
int rightWheel = 200;
analogWrite(Right_motor_go, rightWheel); //I already do not use digitialWrite HIGH
for (int leftWheel = 50; leftWheel <= 150; leftWheel += 5)
{
analogWrite(Left_motor_go, leftWheel);
delay(250);
}
}
Or the read Real Madrid's melody, made thanks to the buzzer and different delays:
void madrid()
{
//2 spaced sounds
digitalWrite(BUZZER, LOW);
delay(75);
digitalWrite(BUZZER, HIGH);
delay(400);
digitalWrite(BUZZER, LOW);
delay(75);
digitalWrite(BUZZER, HIGH);
delay(400);
//3 sounds
digitalWrite(BUZZER, LOW);
delay(50);
digitalWrite(BUZZER, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
delay(50);
digitalWrite(BUZZER, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
delay(75);
digitalWrite(BUZZER, HIGH);
delay(400);
//another 4 sounds
digitalWrite(BUZZER, LOW);
delay(50);
digitalWrite(BUZZER, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
delay(50);
digitalWrite(BUZZER, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
delay(50);
digitalWrite(BUZZER, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
delay(75);
digitalWrite(BUZZER, HIGH);
delay(400);
//2 sounds
digitalWrite(BUZZER, LOW);
delay(50);
digitalWrite(BUZZER, HIGH);
delay(200);
digitalWrite(BUZZER, LOW);
delay(75);
digitalWrite(BUZZER, HIGH);
delay(200);
}
Further, add songs an command recorded on the SD memory card, as necessary according to the conditions prescribed by the library of the MP3 player module <DFRobotDFPlayerMini.h>. Incorporate also the new commands of this library to the main Arduino program.
Last create an app on App Inventor to manage the instructor robot. Only we have to configure buttons to send commands. The ones that are read by the serialEvent() function of the main program of Arduino. Already we can do that the three robots do the same drills at the same time.
I have done the app only with emoticons, so it is understood for anybody in any language:
If you have liked our posts, please consider to donate so we can go on.
Comments