JY-MCU V1.05 Serial to bluetooth converter communication with Linux and arduino


As explained into the previous article, we configure the JY-MCU 1.05 , so now can test it using a linux PC.

First of all, we need to install an bt usb dongle on a PC

  • on linux the drivers is automaticaly loaded but you need to add the folowing lines into the /etc/bluetooth/rfcomm.conf files as defined here
rfcomm0 {

# Automatically bind the device at startup
    bind yes;
   # your JY-MCU bluetooth address
    device 00:11:22:33:44:55
   # RFCOMM channel for the connection
    channel 1;
   # Description of the connection
    comment "Linvor Bluetooth Module";
}
  • for windows XP , install bluesoleil and hyperterminal or putty

Then power supply the bluetooth JY-MCU(using 5VDC) , connect RX on TX , pairing the JY-MCU and bluetooth dongle and open minicom connect on /dev/rfcomm0 115200 8N1 when you type a character on the terminal , it shall be displayed –> it’s OK!! correctly looped .

The schematic below , I use the JY-MCU fritzing model develloped by see http://www.thalin.se/2013/01/fritzing-veroboard-and-breadboard.html :
JY-MCU Tests
Then you can connect the JY-MCU to the arduino using a level converter :

  • my arduino is 5V level
  • the JY-MCU is 3.3V level compliant

JY-MCU with arduino

Upload the folowing code into your arduino board , derived from the code avalaible here http://robotosh.blogspot.fr/2012/07/arduino-jy-mcu-bluetooth.html


char val; // variable to receive data from the serial port
int ledpin = 13; // LED connected to pin 48 (on-board LED)

void setup() {

pinMode(ledpin, OUTPUT); // pin 48 (on-board LED) as OUTPUT
 Serial.begin(115200); // start serial communication at 9600bps
}

void loop() {

if( Serial.available() ) // if data is available to read
 {
 val = Serial.read(); // read it and store it in 'val'
 }
 if( val == 'H' ) // if 'H' was received
 {
 digitalWrite(ledpin, HIGH); // turn ON the LED
 Serial.println("HIGH");
 } else {
 digitalWrite(ledpin, LOW); // otherwise turn it OFF
 Serial.println("LOW");
 }
 delay(100); // wait 100ms for next reading
}

open minicom , connect tthe board and when you type « H » the DEL shall be set to On , off otherwise

Publicités

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s