Jy mcu bluetooth wireless serial port

Jy mcu bluetooth wireless serial port

After a long while without posting I finally got some time to work in a project which I will later post here (A bluetooth controlled car), but first I had to test the bluetooth module and I’ll use arduino for it, let’s get start with it.

first upload the following test code to your arduino.-

char val; // variable to receive data from the serial port int ledpin = 8; // LED connected to pin 48 (on-board LED) void setup() < pinMode(ledpin, OUTPUT); // pin 48 (on-board LED) as OUTPUT Serial.begin(9600); // 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 >else < digitalWrite(ledpin, LOW); // otherwise turn it OFF >delay(100); // wait 100ms for next reading > 

Now power up your bluetooth module with 3.3V works just fine, ground it first and then connect to 3.3V, once that’s ready connect the Tx (transmitter) of the module to the Rx (Receiver) of the arduino and the Rx of the module to the Tx of arduino and attach an LED to port 8 of your arduino with and 220Ω resistor. (More details on wiring.- http://robotosh.blogspot.mx/2012/07/arduino-jy-mcu-bluetooth.html)

Once you got that working let’s configure our mac’s.-

1.- Go to system preferences and click on the bluetooth symbol.

Image

now you should see something like this.-

Image

click on the plus sign to add a device and you should see something like this.-

Image

click on your device in my case that’s the only bluetooth device available, odds are you’ll see something like this.-

Image

don’t worry just click Passcode Options and select use a specific passcode in my case the passcode is 1234 so I just change it and clicked ok.

Image

Now you should see something like this.-

Image

great it’s almost done let’s get back to the system preferences menu and select the bluetooth option again, select our device, click the gear icon and select “Edit Serial Ports…” like the following image.-

Image

let’s keep things simple for the test so configure as following (with the name you wish).-

Image

look at the path it generate and now let’s open terminal and write.-

A list of all of the devices will be displayed you should be able to see the same path we saw at the config window. Write at the terminal the following.-

screen /dev/tty.(here goes the device you want to acces)

an empty window appears now type H and the LED we attached to port 8 of arduino now turns on type another character and it should turn off.

That’s all for today I’ll be posting as I advance in the project. Best Regards.

Читайте также:  Bluetooth dun что это

Источник

Setup JY-MCU BT BOARD v1.2

This Bluetooth RS232 adapter allows connection from any device that supports RS232 to PC or mobile device that supports Bluetooth. This walkthrough demonstrates how to configure some parameters such as name and Baud rate.

JY-MCU Inex V1.2 Bluetooth Transeiver RF Module Wireless Serial 6 pin Arduino

By default, this adapter has the following settings:

  • 9600 Baud 8N1
  • Device Name «linvor» (a name that occurs as the BT device).
  • Device pin or pass: 1234

Once paired with your PC or another device via BT, It creates a virtual port COMxx

Default settings for COMxx are 9600 Baud, 8N1, but this can be changed BT device configuration (I have renamed it as Quadx650):

image

image

image

But this only changes the virtual RS232 settings but we still need to setup RS232 in the other side.

The RS232 port configuration

At this point is necessary a cable or direct RS232 connection on your computer. There are a lot of alternatives on the market, in my case I use FTDI Basic (Buy)

But there are many local alternatives, some directly available on a PC home depot.

Connecting the module for configuring through AT commands

The module is configurable through AT commands sent from RX, TX PINs when it is not paired (connected through BT with the PC).

From now on everytime I say MBT (module bluetooth) and FTDI (adapter rs232 – usb)

  1. Unpair BT device.
  2. Feed the module with 5v, in my case the USB adapter is 5V.
    1. 5V (FTDI) – > 5v (MBT)
    2. GND – > GND
    1. (MBT) TX – > RX (FTDI)
    2. RX (of the MBT) – > TX (FTDI)

    Well now we can connect through FTDI to the MBT using PuTTY:

    image

    COM17 is the FTDI port, in your case it could be another. Remember default setting is 9600 8N1 .

    image

    In PuTTY type AT (do not press enter) and if the response is OK means that we did everything correctly.

    It is now time to set up the MBT using a series of AT commands. My recommendation is to open a Notepad and write the commands that we are going to use, then copy and paste in the terminal (use right click on the terminal, do not use Ctrl + V). Why? couse MBT process the command to fast, if you manually type the command it fails but when you paste the whole sentence it works fine.

    To change the device name BT must send AT+NAMExxxxx, in my case, use the following command to baptize it Quadx650

    To change the Baud rate, and upload it to 115200 use BAUD8 that in the table is equivalent to 115200.

    For testing it is possible to mate the device and open two consoles one pointing the FTDI COM and another to the COM on the MBT. Anything typed on a console should echo in the other.

    photo 1

    photo 2

    photo 3

    You can then change the parity, PIN etc. For them I leave the rest of the AT commands

    HCxx Manual

    AT command set

    The way to the AT command mode: supply power to the module, it will enter to the AT mode if it
    needn’t pair. The interval of command is about 1 second.
    Default parameter: Baud rate:9600N81, ID: linvor, Password:1234

    1 Test communication
    Send: AT (please send it every second)
    Back: OK

    2 Reset the Bluetooth serial baud rate
    Send: AT+BAUD1
    Back: OK1200
    Send: AT+BAUD2
    Back: OK2400
    ……
    1– 1200
    2– 2400
    3– 4800
    4– 9600 (Default)
    5– 19200
    6– 38400
    7– 57600
    8– 115200
    9– 230400
    A– 460800
    B— 921600
    C— 1382400
    PC can’t support the baud rate 115200 than lager. The solution is: make the MCUS have higher baud
    rate (lager than 115200) through programming, and reset the baud rate to low level through the AT
    command.
    The baud rate reset by the AT command can be kept for the next time even though the power is cut
    off.

    3. Reset the Bluetooth name
    Send: AT+NAMEname
    Back: OKname

    Parameter name: Name needed to be set (20 characters limited)
    Por Ejemplo:
    Send: AT + NAMEbill_gates
    Back: OKname
    Now, the Bluetooth name is reset to be «bill_gates»
    The parameter can be kept even though the power is cut off. User can see the new Bluetooth name
    PDA in refresh service. (Note: The name is limited in 20 characters.)

    4 change the Bluetooth password pair
    Send: AT+PINxxxx
    Back:OKsetpin
    Parameter xxxx: The pair password needed to be set, is a 4-bit number. This command can be used
    in the master and slave module. At some occasions, the master module may be asked to enter the
    when the master password module tries to connect the slave module (adapter or cell-phone). Only if the
    password is entered, the successful connection can be built. At the other occasions, the pair can be finish
    automatically if the master module can search the proper slave module and the password is correct.
    Besides the paired slave module, the master can connect the other devices who have slave module, such
    as digital camera Bluetooth, Bluetooth GPS, Bluetooth serial printer etc.
    Por Ejemplo:
    Send: AT+PIN8888
    Back: OKsetpin
    Then the password is changed to be 8888, while the default is 1234.
    This parameter can be kept even though the power is cut off.

    5. Do not check parity (The version, higher than V1.5, can use this command)
    Send: AT+PN (This is the default value)
    Back: OK NONE

    6. Set odd parity check (The version, higher than V1.5, can use this command)
    Send: AT+PO
    Back: OK ODD

    7 Set even parity check (The version, higher than V1.5, can use this command)
    Send: AT+PE
    Back: OK EVEN

    8 Get the AT version
    Send: AT+VERSION
    Back: LinvorV1.n

    Share this:

    Me gusta esto:

    Relacionado

    12 pensamientos en “ Setup JY-MCU BT BOARD v1.2 ”

    Hi,
    I have been trying to change the baudrate on my JY-MCU INEX BT_BOARD V1.2 and have linked it up to my pc using and FDTI adaptor (arduino uno with chip removed) and also with a CP2102 USB to serial adaptor.
    In both cases I have installed the drivers for the adapters and they show up in device manager where I check the COM port.
    However the device manager does not say anything about it being a bluetooth device, just a «Communications port» or «USB to UART Bridge». I start up Putty set the baud rate to 9600, set flow control to none and open a putty terminal.
    The terminal opens, but then nothing else. I have tried entering «AT» but nothing appears in the terminal.
    With every keystroke I do, the RX light flashes on my FDTI adapter but there is nothing on TX or on screen.
    I have tried reversing RX and TX with no effect. I can pair a device with the bluetooth module, and I know I have successfully used this before as a connection between my phone and an Arduino.
    I do not recall ever changing the baud rate. (I have tried 115200 in putty just in case but it makes no difference). Is there anything special one has to do to be able to type in the Putty terminal? Am I missing something here?

    Also, I have successfully used that FDTI adapter to change the baudrate for a GPS module through serial. Just not using Putty.

    I have the same problem. I can see my FTDI board, all drivers look good, and I can pair with the HC-06, but when I issue AT commands to the board I get no response. And I too have used my FTDI board to configure a Minnim OSD, so I know it works. Question: Does my FTDI board need to be set to 3.3volt on the back of the board? Alejamp, can you look and see how yours is set since you’ve been successful with this combination?
    Thanks.

    I’ve been able to communicate with my BT adapter successfully with the advice given here. I issue the AT commands and get good response. If I change the baud rate, I must also change the baud rate of my terminal, so I know it works. The problem is that when I remove power the BT adapter seems to forget the settings I gave it, reverting back to linvor, 1234, 9600 baud, etc. Is there a command to tell it to retain the settings, or are they lost on power down? Many thanks.

    KDM, I don’t know why your BT module seems to forget the settings. Settings should be persistent. Make sure your power supply is 5V.
    I have changed the settings once and them install it in my quadcopter. I have used it several times without need of re setup the BT module.
    I have the HCxx module manual, which is the small board attached to JY-MCU, here is the link: Haz clic para acceder a hc-serial-bluetooth-products-201104.pdf Sorry I can’t help you.

    Источник

    Interfacing Bluetooth Modules HC-05, HC-06, JY-MCU BT_BOARD v1.02 and v1.03 with Arduino Uno and Arduino Mega 2560

    This tutorial guides you, how to interface Bluetooth module with Arduino UNO and Arduino Mega 2560. Interfacing HC-05, HC-06, JY-MCU v1.02 or v1.03 with Arduino Uno or Arduino Mega 2560 using two serial ports.

    HC-05 Pinouts:

    Bluetooth HC-05 pinouts

    HC-05 & HC-06 have different pin numbers of LEDs only, power and Serial Communication pins are same.

    JY-MCU Pinouts:

    Bluetooth JY-MCU Pinouts

    JY-MCU BT_BOARD v1.02 and v1.03 have same pinouts.

    Connections:

    Interfacing bluetooth HC-05 with Arduino, Connection Diagram

    Interfacing bluetooth HC-05 with Arduino, Connection Diagram - bluetooth device in command mode

    Interfacing bluetooth HC-05 with Arduino, Connection Diagram - JY-MCU

    Connect Bluetooth Module JY-MCU BT_BOARD v1.02 and v1.03 with Arduino as:

    Bluetooth JY-MCU Arduino Mega 2560 Arduino Uno
    1 – Gnd GND GND
    2 – Vcc +5v +5v
    3 – RX TX1 TX
    4 – TX RX1 RX

    Connect HC-05 or HC-06 with Arduino as:

    Bluetooth Arduino Mega 2560 Arduino Uno
    1 – Gnd GND GND
    2 – Vcc +3.3v +3.3v
    3 – RX TX1 TX
    4 – TX RX1 RX

    Code for Arduino Mega:

    void loop()
    <
    if(Serial1.available())
    <
    byte a=Serial1.read();
    Serial.write(a);
    >

    if(Serial.available())
    <
    byte a=Serial.read();
    Serial1.write(a);
    >

    Code for Arduino Uno:

    As Arduino Uno has only one serial port. So we will connect Bluetooth Module with RX and TX pins of Arduino Uno. This code will continuously transmit text “GalaxySofts” and “http://www.galaxysofts.com” with a delay of 1 second.

    Video on Interfacing Bluetooth Modules with Arduino Uno and Mega 2560:

    Источник

Оцените статью
Adblock
detector