
89
3.2.6.2 Bluetooth module test
JDY-16 module test method see
“hummer-bot\JDY-16\JDY-16 Module Test.pdf”
3.2.6.3 Bluetooth protocol
Using Bluetooth to control the car means we use the Android app to control the Bluetooth sending
instructions to the Arduino serial port, so as to control the motor's forwarding, reversing, speed and so on.
Since the wireless communication is involved, one of the essential issues is the communication problem
between the two terminals. But there is no common "language" between them, so designing communication
protocols are required to ensure a perfect interaction between Android and Arduino. The main process is: the
Android identification terminal packs the detected commands into the corresponding data packets, and then
sends them to the Bluetooth module (JDY-16). When JDY-16 receives the packets, it will transmit them to
Arduino through the serial port, then Arduino to analyze the data packets and execute the corresponding
actions. The data format sent by the upper computer end (Android) is as follows, which mainly contains 8
fields, we use a structure to represent it.
Protocol
Header
Data Length Device Type
Device
Address
Function
Code
Control
Data
Check
Sum
Protocol
End Code
In the 8 fields above, we use a structural body to represent.
“Protocol Header” means the beginning of the packet, such as the uniform designation of 0xAA.
Data length” means except the valid data length of the start and end codes of the data.
“Device type” means the type of device equipment
“Device address” means the address that is set for control
“Function code” means the type of equipment functions that need to be controlled, the function types we
currently support is as follows:
typedef
struct
{
unsigned
char
start_code
;
// 8bit 0xAA
unsigned
char
len
;
unsigned
char
type
;
unsigned
char
addr
;
unsigned
short
int
function
;
// 16 bit
unsigned
char
*
data
;
// n bit
unsigned
short
int
sum
;
// check sum
unsigned
char
end_code
;
// 8bit 0x55
}
ST_protocol
;
Summary of Contents for Hummer-Bot-1.0
Page 1: ...Hummer Bot 1 0 Instruction Manual V 2 0 ...
Page 18: ...15 Step4 You need to install motors Figure 3 1 5 Schematic diagram of motor installation ...
Page 50: ...47 Figure 3 2 15 Diagram of Data without Obstacles ...
Page 83: ...80 Test code Path hummer bot Lesson ModuleDemo IrkeyPressed IrkeyPressed ino ...