Timothy BargoSebastian Zaratekevin ortiz
Created March 9, 2017

Collecting bluetooth device data with the HC05

The objective of the project is to collect Bluetooth device information in a high traffic area of a high school, and look for any patterns.

103
Collecting bluetooth device data with the HC05

Things used in this project

Hardware components

Photon
Particle Photon
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Hand tools and fabrication machines

Epilog Laser

Story

Read more

Custom parts and enclosures

Acrylic Box Enclosure

In order to make the box, we first had to make a prototype to make sure we don't waste material and to make sure the sensor fit perfectly inside the box. After our prototype was complete, we realized that the box was too big so we cut down on our measurements. We also had to make a small space in the box so that the usb cable can go thru the box and connect to the laptop.
We chose our box to be acrylic because we wanted to be able to see the sensor and to make sure it is working properly and all lights on the sensor to be visible.

Schematics

Fritzing Diagram

Please note the white wire bridging between the VCC pin near the HC05 to the STATE pin of the HC05, this is necessary as when put into inquiry mode with "AT+INQ", the HC05 will leave AT mode, which is required for the Photon to be able to communicate with the HC05, the wire bridging VCC and STATE brings the HC05 immediately back into AT mode.

Code

HC05

Arduino
The code uses the HC05 Bluetooth device.

Every 60 seconds the device inquires for nearby Bluetooth devices, writes the inquiry output to variable as follows
+INQ:6C40:8:B795E1,38010C,7FFF
OK
Which is the pulled into a Google Spreadsheet, and processed into a more friendly format there.
String deviceInfo;
char incomingChar = 'A';
void setup() { 
	Serial.begin(38400);   
	Serial1.begin(38400);
	Particle.variable("deviceInfo", deviceInfo);

	delay(10000); //A delay to confirm HC05 has booted and has done what is needed
	Serial1.println("AT+INIT"); //initializes the SPP library
	Serial1.println("AT+INQM=0,128,46");
	//AT+INQM
	//first parameter 0 tells the HC05 to not connect to the first device, nad to continue looking
	//second parameter 128 is an arbitrary choice, it is the maximum number of devices the HC05 will look for
	//third paramter 46 is the time the HC05 will inquire for Bluetooth devices, equal to n*1.28seconds, 46 puts it just under 60 at 58.88 seconds
}


void loop() {
    
    deviceInfo = "";
    Serial1.println("AT+INQ"); //begin inquiry
    
    while (Serial1.available() > 0) {
    incomingChar = (char)Serial1.read();        // read next available byte, cast to char
    deviceInfo += incomingChar;                  //append to string
    }
    Serial.write(deviceInfo);
	  delay(60000); //wait 60 seconds
}

Credits

Timothy Bargo
1 project • 0 followers
Sebastian Zarate
-1 projects • 0 followers
kevin ortiz
-1 projects • 0 followers

Comments