Bluetooth Serial Dongle?

Home Forums TinyG TinyG Support Bluetooth Serial Dongle?

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #6121
    O1iv3r
    Member

    Anyone know where to purchase a Bluetooth Serial Dongle that is confirmed to work with TinyG?

    #6122
    O1iv3r
    Member

    Also anyone know if a Bluetooth serial dongle will work on a Mac/OS X via tgFX?

    #6192
    O1iv3r
    Member

    Bueller?

    #6983
    Zootalaws
    Member

    Yes and Yes.

    Buy an HC-05 on a JCY ‘sled’ for ease of use (can accept 3.3 – 6V) also buy some female headers to solder to the TinyG. I didn’t and it was a total PITA.

    #7039
    Zootalaws
    Member

    Further to this:

    For those that want to implement a Bluetooth connection to their TinyG, here’s a primer:

    For a Bluetooth module, I recommend the HC-05 – on a sled, like the JY-MCU or (my favourite) the CZ-HC-05. You can use a HC-10, but don’t try the HC-06, you won’t have much fun with it. The HC-05 is, in my opinion, the most versatile of the Bluetooth SPPs. I usually have about 50 of varying different types around the place – HC05, 06, 10, 11 – but keep coming back to the HC-05 and in particular, the GOMCU CZ-HC-05 module, which is just better. We use them for programming remote-controlled fishing boats, for controlling bubble walls, LED installations, 3D printers, and all manner of arduino devices that do all sorts of weird and wonderful things. I have tried a number of different brands, including the eye-wateringly expensive units from RedBear, and the $24-$35 units from Adafruit and Sparkfun and keep end up using the $4 units from GOMCU. They have proved remarkably resilient and reliable.

    CZ-HC-05

    I prefer the CZ over the JY for a few reasons – it’s really small, it’s really well made, it has the KEY (P34, state pin) already broken out.

    Tools:
    4 pin female header, soldering iron and solder.
    HC-05 of some sort, on a sled.
    Arduino of some description.
    A breadboard and jumper wires helps.
    This sketch: to program the HC-05

    /*
    AT+ORGL (Restore the factory default state)
    AT+UART=115200,0,0 (Set baud rate to 115200, one stop bit and no parity bit)
    AT+NAME=TinyG
    */
    #include <SoftwareSerial.h>
    #define rxPin 10
    #define txPin 11
    SoftwareSerial mySerial(rxPin, txPin); // RX, TX
    char myChar ;
    void setup() {
      Serial.begin(9600);   
      Serial.println("AT");
      mySerial.begin(38400);
      mySerial.println("AT");
    }
    void loop() {
      while (mySerial.available()) {
        myChar = mySerial.read();
        Serial.print(myChar);
      }
     while (Serial.available()) {
        myChar = Serial.read();
        Serial.print(myChar); //echo
        mySerial.print(myChar);
      }
    }

    Solder the 4-pin female header to the appropriate 4 pins on the V8 TinyG.

    Connect the BT module to the Arduino as follows:

    Arduino pins:
    10 to HC05 TX // RX on Arduino
    11 to HC05 RX // TX on Arduino
    GND to HC05 GND // Common
    5V to HC05 VCC // 5V
    5v to HC05 KEY // 5V : setting this to 5V on the CZ when you power it on puts the HC-05 in command mode, where you can program the features. If you use the JY, you need to be aware of how the implementor has wired it and which pins he has available. Some wire P34 on the sled but leave the pin un-soldered, some wire it all up just like the CZ, some wire other pins… if they haven’t wired it, you will need to hold a signal high to P34 while you power cycle the HC-05 to get it into command mode. Once you have it in CM, you can remove the signal – it will stay in command mode until reset or power-cycled.

    Connect/power on the arduino and load the sketch above.

    Recycle the arduino and the HC05 should initialise and slowly flash its LED – this indicates it is in Command Mode.

    Bring up the Arduino IDE serial monitor and set to 9600+CR+LF
    Enter AT and you should get ‘OK’ back.

    By default, the HC-05 should be set to:

    Slave Mode
    Connection mode: Connect to the Bluetooth device specified
    Baud rate: 38400 bits/s; Stop bit: 1 bit; Parity bit: None.
    Passkey: “1234”
    Device name: “H-C-2010-06-01”

    At this stage I would set to factory defaults, using the AT+ORGL command.

    Then, to set up for the TinyG

    Set the baud rate to 115,200kb: AT+UART=115200,0,0
    Change the device name: AT+NAME=TinyG
    You can also change the pairing key – my Macbook defaults to 0000, but the HC-05 defaults to 1234: AT+PSWD=0000

    There are other parameters in the AT command set, but none of them are relevant to getting the HC-05 working on the TinyG.

    Any questions, just post them here.

    #7041
    Zootalaws
    Member

    Even further…

    After experimenting with reliability, distance, etc. I thought I would ramp up the speed. As BT can comfortably handle 3M/s, I thought I would turn the wick up to 230400: AT+UART=230400,0,0

    Worked a treat.

    Responses to commands are snappy.

    #7043
    cmcgrath5035
    Moderator

    Nice How-To.

    Would it be correct to add, after this paragraph

    Then, to set up for the TinyG

    Set the baud rate to 115,200kb: AT+UART=115200,0,0
    Change the device name: AT+NAME=TinyG
    You can also change the pairing key – my Macbook defaults to 0000, but the HC-05 defaults to 1234: AT+PSWD=0000

    ->>
    Power Down Arduino + HC-05
    Disconnect HC-05 from Arduino and connect to tinyG
    Power up tinyG
    Connect to tinyG/HC-05 from Host computer (CoolTerm, etc)

    #7044
    Zootalaws
    Member

    Details details 🙂 Of course – thanks.

    At some stage you will need to connect your BT module to your TinyG.:)

    #7047
    cmcgrath5035
    Moderator

    Yes, I thought so.
    I went off and searched a bit on the HC-05, might give it a try as I have been looking at ways to safe my laptop from potentially bad voltage events as I play with DC spindles and the like.

    I’ll also assume that to make changes, such as your follow-on change to 230400 baud rate, one needs to go back to the Uno setup suite.

    While I have your attention, what do you use as a Gcode sender?
    Not clear to me that tgFX or the Chilipeppr JSON server will find the BT connection, but do have a platform to experiment with, yet.
    Clearly Coolterm and Putty should be easy to connect

    #7083
    Zootalaws
    Member

    “I’ll also assume that to make changes, such as your follow-on change to 230400 baud rate, one needs to go back to the Uno setup suite.”

    I don’t know what a ‘Uno setup suite’ is, so I doubt I used one 🙂

    I changed the parameter using CoolTerm, then rebooted and changed the default baud rate on my CoolTerm settings.

    Chilipeppr and tgFX both worked fine with the BT device – but I am on a Mac. My ‘production’ machine is an HP laptop running Win8.1. I will try it out on there nd let you know. I have been using the Mac a lot lately as it has all my other stuff on it – and that was the impetus to add BT to the TinyG – I didn’t want to have to keep connecting and unplugging the Mac.

    #7085

    From what I can tell it works fine on windows as well. When I paired it it just generated a COM3 and COM4 and chillipeppr was able to find it fine. My TinyG is still waiting it’s replacement uProc so I can only assume it will work beyond that.

    #7086
    Zootalaws
    Member

    Excellent!

    #7088
    cmcgrath5035
    Moderator

    don’t know what a ‘Uno setup suite’ is, so I doubt I used one 🙂

    I was referring to your initial How-To, post

    Was I incorrect in assuming that your Arduino reference was an Arduino Uno?

    So once paired, Coolterm on your PC can send the “AT+UART=230400,0,0” over the BT link to the far end HC-05. Cool.

    • This reply was modified 9 years, 11 months ago by cmcgrath5035.
    • This reply was modified 9 years, 11 months ago by cmcgrath5035.
    #7093
    grubia
    Member

    I am wandering why I cannot use HC-06 ?
    I’m asking because i have one somewhere at home and i was thinking about trying it.

    #7094
    Zootalaws
    Member

    Was I incorrect in assuming that your Arduino reference was an Arduino Uno?

    Yes, I use mostly Nano’s, Pro Micro’s.

    The ‘Uno setup suite’ is the Arduino IDE – same for all models of Arduino. I didn’t bother going into detail on how you communicate with the Arduino, because if you have one, you invariably know how to talk to/program it.

    So once paired, Coolterm on your PC can send the “AT+UART=230400,0,0″ over the BT link to the far end HC-05. Cool.

    No, the only way to get into command mode is by setting P34 high, via the Arduino and some sort of USB-attached serial connection. The SPP (Serial Port Profile) devices are really dumb. You can go into command mode and tell them how they are to be configured and then reboot them in either master or slave mode and use them as a wireless serial device. You can’t make a BT session and go into command mode. They aren’t flexible like a general-purpose Bluetooth device, even though they have the same chip. It’s all in the firmware and how the pins are broken out. These are aimed at a single purpose. You could rewrite/reflash the firmware and get other functions (like audio, etc.) if you wanted, but the HC-series modules are all aimed at serial comms.

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.