Arduino & Bluetooth jymcu serial

Another option to use arduino and bluetooth, is using a small jymcu module, with uses a very simple serial interface. The setup is very easy, and basically you use a serial interface to interface the module.

As the module is basically the same as the bluetooth shield, the hc05,

These are the commands to use.

AT – Response OK
AT+NAMExxxx – Where xxxx is the friendly name of the module
AT+BAUDx – Where x sets the baud rate
(values & baud rates below)
AT+VERSION – Returns the firmware version
AT+PINxxxx – Sets a new pairing code

1——1200 2——2400 3——4800 4——9600
5——19200 6——38400 7——57600 8——115200

I bought my module at Dx, you can also find them at Ebay, even cheaper.

I used pins 5 and 6 to rx and tx, respectivelly. As hc-05 runs on 3.3V the rx in from the bluetooth module needs to lower the Voltage from Arduino tX PIN. So use a resistor bridge to lower the voltage, connect the arduino tx pin on a 1k resistor, connect the bluetooth module between this resistor and another of 2.2K, and connect 2.2K at ground.

Arduino Tx —[1k]—-.—-[2.2k]—–GND
Bt Rx—————–|

Following is the code I used.

Before compiling, to connect pin on the bt module, you need to lower the voltage, basically you connect pin 5 to arduino directly, and for Rx, you connect folowing the diagram

Arduino JYMCU Connection

Arduino JYMCU Connection

This is the module I used:
JY MCU Bluetooth Module

Source Code

#include

SoftwareSerial mySerial(5, 6); // RX, TX

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

Serial.println(“Ready to forward AT commands to JY-MCU: “);

// set the data rate for the SoftwareSerial port
mySerial.begin(38400); // Or 9600, depending on your firmware version
}

void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}