Thursday 15 November 2012

JY-MCU "linvor" AT Commands (change name of linvor)

Today I found out how to change the name of my "linvor" serial Bluetooth module to my desired name.
It's quite easy, however due the different baud rates you nee to experiment a little with them in order to get a good connection. So experiment with setting the baud rate in the Arduino code.

I connected the RX pin of linvor to pin 2 and the TX pin of linvor to pin 3 of the Arduino.
Then I changed the default SoftwareSerialexample of the Arduino IDE a little. Now the Serial.begin(rate); is set to 9600: Serial.begin(9600); which is the baud rate of the linvor.

/*
  Software serial multple serial test
 
 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.
 
 The circuit: 
 * RX is digital pin 2 (connect to TX of other device)
 * TX is digital pin 3 (connect to RX of other device)
 
 created back in the mists of time
 modified 9 Apr 2012
 by Tom Igoe
 based on Mikal Hart's example
 
 This example code is in the public domain.
 
 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

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

  
  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

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



Open your serial monitor and if everyting is correctly set up you should see: "Goodnight moon!"
If you receive weird symbols your baud rate is wrong.
After that send: "AT". It should send OK back.
Now you're able to configure the linvor. Send one command at a time.

List of available ATcommands:
Command
Description
Options
Response
AT+VERSION
Returns the software version of the module

OKlinvorV1.x
AT+BAUDx
Sets the baud rate of the module 
The command AT+BAUD8 sets the 
baud rate to 115200
1 >> 1200 
2 >> 2400 
3 >> 4800 
4 >> 9600 (Default) 
5 >> 19200 
6 >> 38400 
7 >> 57600 
8 >> 115200 
9 >> 230400
OK115200
AT+NAMEOpenPilot
Sets the name of the module
Any name can be specified up to 20 characters
OKsetname
AT+PINxxxx
Sets the pairing password of the device
Any 4 digit number can be used, the default 
pincode is 1234
OKsetPIN
AT+PN
Sets the parity of the module
AT+PN >> No parity check
OK None
source:http://wiki.openpilot.org/display/Doc/Serial+Bluetooth+Telemetry

14 comments:

  1. I have two modules (linvor 1.8), each connected to it's own arduino. I'm not able to get one arduino to send data to the other, but works with a wire on same pins.

    ReplyDelete
    Replies
    1. For communication between two arduino's you need a host and a slave module since one has to pair with the other.

      If I'm correct most linvoir modules are slave. Which allows you to pair with for instance your phone by searching the module and filling in the pair code.
      For a connection between Arduino's you need another version of the linvoir which is the master/host. Then you can say to the master module "I want to you to connect with my other linvoir module with pair code xxxx".

      If i'm correctly DX.com is selling this master/host module too. I have no experience with it, but I'm quite sure this is the kind of module you need together with your other linvoir module to set up the connection.

      Good luck with your project!

      Delete
  2. Hi!I've got a problem.I found that I get the exact text in english alphabets only when I use a combination of Serial-9600 and myserial-57600. But,when I type "AT", I receive back the symbol "ÿ". I wonder where I am going wrong.Could you please give your views?Thanks.

    ReplyDelete
    Replies
    1. Hi Sunny,

      It's quite some time ago since I posted this. Since then I haven't experimented anymore with microcontrollers and serial communication. If I'm right this is a baud rate mismatch. Try to change the bound rate in a tool like Putty and see if this helps.

      Let me know if you find the solution. Maybe it can help others. :)

      Delete
  3. I have some problem with the serial monitor and the at commands. When I open serial monitor it says: "Goodnight moon!". But when I send "AT" or any other at command there is no response at all. It seems like the serial monitor isnt capable of sending anything. Did you experience any similar issues?

    ReplyDelete
    Replies
    1. Managed to solve it. I made the error to connect the bluetooth module to pin 0 + 1 on my ArduinoUno. But those pins are also connected to the USB. I connected the bt module to pin 10 + 11, changed them as well in my code and it works :)

      PS: I want to thank you for the nice Tutorial

      Delete
  4. good evening
    I am writing because I have a problem with the connection to the bluetooth module HC-06
    The module is paired but will not connect
    I have followed your tutorial but I keep getting the error notice "error 507 unable to connect. Is the device turned On? "
    I am giving you some information about the devices used:
    Rev3 arduino
    Bluetooth module JY-MCU HC-06
    Smartphone Huawei Y300
    The software used to implement the application is App Inventor 2
    Java development kit 7u25
    Settings smartphones
    Bluetooth Module HC-06 paired
    I can tell you that if I use the app "Amarino combined with Amarino plugin bundle
    The operation is perfect
    I tested two other modules HC-06 with negative results
    I make AT command test is OK
    I'm hoping for help from the network

    ReplyDelete
    Replies
    1. I'm not familiar with your setup. When I google your error this seems a App Inventor related issue. To check this you could try to connect to the bluetooth module from the terminal of your smartphone.

      Delete
  5. Sorry in my post I did not give a 'complete information
    I'm doing a project to control LED RGB smartphone via bluetooth and Arduino Uno
    From research I came to the conclusion that it is a problem of protocols or settings, bluetooth fact of Huawei Y300 works with EDR protocol and the Bluetooth module HC_06 works with protocol "RFCOMM Protocol TDI"
    You could be of help if you can tell me the properties of your bluetooth module so I can make comparisons. More than a month I am trying to solve the problem
    TKS Gianni Gallo

    ReplyDelete
    Replies
    1. I dindn't go in depth that much. So I can't tell you more about the protocols. I've used various android devices in the past which worked well with this module like the HTC desire and the Samsung Galaxy Tab 10.1. You could try another device to find out if that makes a difference.

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Hi, can someone please help me?
    everything entered in the serial monitor is printed in putty; so that works fine

    but all the AT commands (AT+VERSION etc) doesn't work..

    am i doing something wrong?

    ReplyDelete
    Replies
    1. Are you sure that you can communicate correctly to the device? If Putty displays your commands it does not mean that they are actually received by the device properly.

      I think you have to check if you paired correctly with the device and check your putty settings if you are actually talking with the correct baud rate etc.

      If I remember it correct I can remember that BAUD rate 115200 worked well for me.

      Delete
    2. Did you solve your problem? i got the same problem , help me

      Delete