Home › Forums › TinyG › TinyG Support › Bluetooth Serial Dongle?
- This topic has 16 replies, 5 voices, and was last updated 7 years ago by Zootalaws.
-
AuthorPosts
-
June 11, 2014 at 8:29 pm #6121O1iv3rMember
Anyone know where to purchase a Bluetooth Serial Dongle that is confirmed to work with TinyG?
June 11, 2014 at 8:33 pm #6122O1iv3rMemberAlso anyone know if a Bluetooth serial dongle will work on a Mac/OS X via tgFX?
June 19, 2014 at 1:33 am #6192O1iv3rMemberBueller?
November 14, 2014 at 8:32 pm #6983ZootalawsMemberYes 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.
November 27, 2014 at 11:52 pm #7039ZootalawsMemberFurther 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.
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=0000There 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.
November 28, 2014 at 1:03 am #7041ZootalawsMemberEven 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.
November 28, 2014 at 6:20 am #7043cmcgrath5035ModeratorNice 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)November 28, 2014 at 9:15 pm #7044ZootalawsMemberDetails details 🙂 Of course – thanks.
At some stage you will need to connect your BT module to your TinyG.:)
November 29, 2014 at 8:18 am #7047cmcgrath5035ModeratorYes, 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 connectDecember 3, 2014 at 10:10 pm #7083ZootalawsMember“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.
December 3, 2014 at 11:28 pm #7085complacentseeMemberFrom 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.
December 4, 2014 at 1:08 am #7086ZootalawsMemberExcellent!
December 4, 2014 at 6:48 am #7088cmcgrath5035Moderatordon’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 10 years ago by cmcgrath5035.
- This reply was modified 10 years ago by cmcgrath5035.
December 4, 2014 at 7:24 am #7093grubiaMemberI 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.December 4, 2014 at 7:36 am #7094ZootalawsMemberWas 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.
-
AuthorPosts
- You must be logged in to reply to this topic.