Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bluetooth-serial [2017/01/25 15:53]
arthur
bluetooth-serial [2018/05/31 01:08] (current)
91.162.188.175 [Bluetooth Module]
Line 17: Line 17:
 [[image http://​gd1.alicdn.com/​bao/​uploaded/​i1/​14767031049461097/​T1RRyXXzXkXXXXXXXX_!!0-item_pic.jpg_400x400.jpg_.webp]] [[image http://​gd1.alicdn.com/​bao/​uploaded/​i1/​14767031049461097/​T1RRyXXzXkXXXXXXXX_!!0-item_pic.jpg_400x400.jpg_.webp]]
  
-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 and it does level shifting of all the pins back to the 3.3V required by the HC module, unlike some of the other breakouts.+I prefer the CZ over the JY for a few reasons – ​it is really small, ​it is really well made, it has the KEY (P34, state pin) already broken out and it does level shifting of all the pins back to the 3.3V required by the HC module, unlike some of the other breakouts.
  
 Of course, some of the US manufacturers make some great boards with superior features and wonderful quality control, but that comes at a price - personally I like paying $4 for a bluetooth module, rather than $25-30. Of course, some of the US manufacturers make some great boards with superior features and wonderful quality control, but that comes at a price - personally I like paying $4 for a bluetooth module, rather than $25-30.
Line 42: Line 42:
 === Arduino sketch: to program the HC-05 === Arduino sketch: to program the HC-05
  
-[[code]]+<code>
  
 // SERIAL LOOP SKETCH FOR COMMUNICATING WITH A BLUETOOTH SPP MODULE // SERIAL LOOP SKETCH FOR COMMUNICATING WITH A BLUETOOTH SPP MODULE
Line 75: Line 75:
   }   }
 } }
-[[/code]]+</code>
  
 === Configure the Bluetooth Module === Configure the Bluetooth Module
Line 104: Line 104:
 You can also change the pairing key if you want, either for easier access or for privacy – my Macbook defaults to 0000, but the HC-05 defaults to 1234. To make it publicly accessible, give it a pin of 0000: AT+PSWD=0000 - to make it secure, pick any 4-digits that you will remember. You can also change the pairing key if you want, either for easier access or for privacy – my Macbook defaults to 0000, but the HC-05 defaults to 1234. To make it publicly accessible, give it a pin of 0000: AT+PSWD=0000 - to make it secure, pick any 4-digits that you will remember.
  
-[[code]]+<code>
 AT+ORGL (Restore the factory default state) AT+ORGL (Restore the factory default state)
 AT+UART=115200,​0,​0 (Set transmission rate to 115,200 bps, one stop bit and no parity bit) AT+UART=115200,​0,​0 (Set transmission rate to 115,200 bps, one stop bit and no parity bit)
 AT+NAME=Smoothie AT+NAME=Smoothie
 AT+PSWD=0000 AT+PSWD=0000
-[[/code]]+</code>
  
 There are other parameters in the AT command set, but none of them are relevant to getting the HC-05 working on the SmoothieBoard. There are other parameters in the AT command set, but none of them are relevant to getting the HC-05 working on the SmoothieBoard.
Line 123: Line 123:
 === Connect: === Connect:
  
-Reboot the SmoothieBoard and you should now be able to connect using a terminal app like CoolTerm or directly using your printer app (like [[[Pronterface]]]).+Reboot the SmoothieBoard and you should now be able to connect using a terminal app like CoolTerm or directly using your printer app (like [[Pronterface]]).
  
 In this configuration,​ the UART is set to 115,200 bps, but the HC-05 is capable of 230,400bps, 460,800bps - right up to 1,382,400, although at those rates you will probably be experiencing some significant percentage of comms errors. The BT SPP link itself is capable of upwards of 3Mb/s, given perfect radio conditions. In this configuration,​ the UART is set to 115,200 bps, but the HC-05 is capable of 230,400bps, 460,800bps - right up to 1,382,400, although at those rates you will probably be experiencing some significant percentage of comms errors. The BT SPP link itself is capable of upwards of 3Mb/s, given perfect radio conditions.
Line 129: Line 129:
 In my experience, going over 230400 doesn'​t really give you anything except the likelihood of more errors. Stick with 115,200 or 230,400 as UART speeds - this is set in the config file: In my experience, going over 230400 doesn'​t really give you anything except the likelihood of more errors. Stick with 115,200 or 230,400 as UART speeds - this is set in the config file:
  
-[[code]]+<code>
 # Serial communications configuration ( transmission rate default to 9600 if undefined )  ​ # Serial communications configuration ( transmission rate default to 9600 if undefined )  ​
 uart0.baud_rate ​ 115200 ​  # Baud rate for the default hardware serial port uart0.baud_rate ​ 115200 ​  # Baud rate for the default hardware serial port
-[[/code]]+</code>
  
 It may be that you are able to perform the Bluetooth AT command setting using the SmoothieBoard itself, but I haven'​t investigated that method. If you have a spare FTDI USB-to-UART module, you can connect that directly to the Bluetooth module and program it using a terminal app. It may be that you are able to perform the Bluetooth AT command setting using the SmoothieBoard itself, but I haven'​t investigated that method. If you have a spare FTDI USB-to-UART module, you can connect that directly to the Bluetooth module and program it using a terminal app.