Wednesday 29 May 2013

Blackberry10 and Arduino: how to make them friends

This is an image and a video showing the arduino interacting with my dev alpha C (like a blackberry Q10):


You can find the Bluetooth Cascades app here: https://github.com/blackberry/Cascades-Samples/tree/master/bluetoothsppchat

For arduino just follow the previous tutorial: http://pestohacks.blogspot.it/2013/05/arduino-bluetooth-rn-42-recently-ive.html

Tuesday 21 May 2013

Arduino & Bluetooth RN-42

Recently I've started to deeply experiment with Arduino.
My last experiment involved using bluetooth.
I've bought a bluetooth module: RN-42 , cause it is cheap and there are a lot of tutorial around the web that talk about it.

Connection to the Arduino Uno

The image above rappresent the connection on the front of the chip.
To make it working with Arduino you should connect:
  • RN42 PIN 11 to Arduino 3.3V
  • RN42 PIN 12 to Arduino GND
  • RN42 PIN 13 to Arduino TX
  • RN42 PIN 14 to Arduino RX
  • RN42 PIN 16 to RN42 PIN 15
After that you have to power ON Arduino.

Setup the module
I have used an android application, BlueTerm (free), to setup the module.
The RN-42 have a "command" mode to change the parameter of the module: speed, bluetooth name, and other options.

After power on the module, pair your device (or simply your pc) with the RN-42, the PIN is 1234.
Than use a bluetooth terminal to connect to the module again and type these commands:
$$$
SU,11
S~,3
SN,whatevernameyouwant
---
The $$$ means "enter command mode" instead "---" means "end command mode".
After every command you should see an "ACK" response from the module.

The description of the above commands and all the available commands are reported here : https://www.sparkfun.com/datasheets/Wireless/Bluetooth/rn-bluetooth-um.pdf

Testing the connection
Connect your arduino and launch the ide.
Write the following code:

void setup() {              
   Serial.begin(115200);

}
void loop() {
  Serial.println("hello bt");

 delay(1000);  
}

and then load it with usb connection to arduino.
Now use a bluetooth terminal to connect to the module and read the data.

Check this video if you are searching a good tutorial.