because of the low price it was quite an impulse buy although it was also an experiment for me. I've never done any wireless networking and so I honestly have no idea how to use this thing. Right now I have it hooked up like their diagram says and I have no idea how to control it.
#include <SoftwareSerial.h>
//setup
SoftwareSerial mySerial(2, 3);
//loop
char c;
if (mySerial.available())
{
c = (char)mySerial.read();
if (c=='H')
{
///// if the key is a letter H do your code here
//comprende?
}
}
It currently isn't talking to anything. I can pair my phone and computer with it but that's it.
Then, the bluetooth device IS talking to either your phone or your computer. It's just that nothing gets from the bluetooth device to the Arduino, because you haven't written that code.
"That code" consists entirely of Serial.write(), Serial.print(), Serial.println(), Serial.available() and Serial.read() statements in the proper order, with the proper things being sent.
Normally, knowing what to send is easy, because the bluetooth device provider tells you exactly what to send to the device to make it do something, and tells you exactly what the return data means.
Where you saved money was on the documentation. It appears that you got exactly what you paid for.
"Description
Industrial serial port bluetooth, Drop-in replacement for wired serial connections, transparent usage. You can use it
simply for a serial port replacement to establish connection between MCU and GPS, PC to your embedded project and etc.
Computer and peripheral devices
GPS receiver
Industrial control
MCU projects
Default serail port setting : 9600 1
Pairing code : 1234
Running in slave role: Pair with BT dongle and master module
Usage
Coupled Mode: Two modules will establish communication automatically when powered.
PC hosted mode: Pair the module with bluetooth dongle directly as virtual serial.
Bluetooth protocal : Bluetooth Specification v2.0+EDR
Frequency : 2.4GHz ISM band
Modulation : GFSK(Gaussian Frequency Shift Keying)
Emission power : <=4dBm, Class 2
Sensitivity : <=-84dBm at 0.1% BER
Speed : Asynchronous: 2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
Security : Authentication and encryption
Profiles : Bluetooth serial port
CSR chip : Bluetooth v2.0
Wave band : 2.4GHz-2.8GHz, ISM Band
Protocol : Bluetooth V2.0
Power Class : (+6dbm)
Reception sensitivity: -85dBm
Voltage : 3.3 (2.7V-4.2V)
Current : Paring - 35mA, Connected - 8mA
Temperature : -40~ +105 Degrees Celsius
User defined Baud rate : 4800, 9600, 19200, 38400, 57600, 115200, 230400,460800,921600 ,1382400.
Dimension : 26.9mm13mm2.2mm
Pin definition :
PIO8 connects with LED cathodea with 470ohm series resistor in between. LED NEGATIVE connects to ground. It is used
to indicate the module state. After powered on, flashing intervals differ in different states.
PIO9 is used to control LED indicating paring. It will be steady on when paring is successful.
PIO11, module state switching pin. HIGH -> response to AT command; LOW or floating -> regular work status.
With build-in reset circuit, reset is completed automatically after powered on.
Steps to set to MASTER:
Set PIO11 HIGH with a 10K resistor in between.
Power on, module comes into AT Command Response Status
Open HyperTerminal or other serial tool, set the baud rate 38400, 8 data bits, 1 stop bit, no parity bit, no Flow Control
Via serial port, send characters "AT + ROLE = 1 r n",if successful, return "OK r n", where r n is carriage return.
Set PIO11 LOW, re-power, then in Master state, automatically search for slave module and connect.
"
Suggest you find some moreinfo on
"CSR chip : Bluetooth v2.0"
I get all of that except this. The module only has 4 avaliable pins for me to connect to. I feel like the PIO8 and such are the connections to the actual module and not what I'm wiring to.
CrossRoads:
Pin definition :
PIO8 connects with LED cathodea with 470ohm series resistor in between. LED NEGATIVE connects to ground. It is used
to indicate the module state. After powered on, flashing intervals differ in different states.
PIO9 is used to control LED indicating paring. It will be steady on when paring is successful.
PIO11, module state switching pin. HIGH -> response to AT command; LOW or floating -> regular work status.
With build-in reset circuit, reset is completed automatically after powered on.
Steps to set to MASTER:
Set PIO11 HIGH with a 10K resistor in between.
Power on, module comes into AT Command Response Status
Open HyperTerminal or other serial tool, set the baud rate 38400, 8 data bits, 1 stop bit, no parity bit, no Flow Control
Via serial port, send characters "AT + ROLE = 1 r n",if successful, return "OK r n", where r n is carriage return.
Set PIO11 LOW, re-power, then in Master state, automatically search for slave module and connect.
"
Suggest you find some moreinfo on
"CSR chip : Bluetooth v2.0"
Exactly - they do into all this detail about IO pins you don't really have access to.
But you can send it AT commands. Find the CSR chip documentation and learn more about them.
Alright, so I was able to get the documentation from the folks who sold me the bluetooth module.
I checked it over and I didn't see anything that rendered it useless although I'm a newbie at this sort of stuff so maybe somebody could give me a little direction on how to use it? Could I not just do regular serial communication with it?