If you wish to make your SmoothieBoard wireless, you can easily add a cheap Bluetooth SPP (Serial Port Profile) module.
The Bluetooth SPP module on a breakout board makes for an easily configured wireless connection for the SmoothieBoard and other motion-control units.
The most popular of these SPP modules are the ‘HC’ series of modules. Be careful what you buy - not all HC modules are created equal, just as not all JY-MCU breakout boards with HC-05 modules are the same. The ubiquitous JY-MCU breakout board has been copied and made by a vast number of Chinese board manufacturers and not all of them are good - some add level shifting for all pins from 5-7V to the 3.3V needed by the HC module, some only level shift the power pins - you get what you pay for. If you are buying from one of the well-known Chinese market sites, check the reviews of that product in the shop you are buying from. If every JY-MCU being sold on Aliexpress was actually made by Linvor, they would be an extremely profitable company.
For an SPP module, I recommend the HC-05 Bluetooth 2.1 EDR (Enhanced Data Rate) module on a breakout board (like the JY-MCU or my personal favourite, the CZ-HC-05)
You can also use a BLE (Bluetooth Low Energy) or BT4.0 device like the HC-10, but you will need a comms device that talks BLE/BT4.0 and not many computers do (a recent-model Apple Macbook Pro/Air will be able to, my recent-model HP doesn’t), so by sticking to the HC-05 you can be sure of being compatible with the majority of devices.
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.
Connect the BT module to the Arduino as follows:
Arduino pins:
// SERIAL LOOP SKETCH FOR COMMUNICATING WITH A BLUETOOTH SPP MODULE
// BASE HC-05 Config Commands
// AT+ORGL (Restore the factory default state)
// AT+UART=115200,0,0 (Set transmission rate to 115200 bps, one stop bit and no parity bit)
// AT+NAME=Smoothie
// AT+PSWD=0000 Set pairing code to 0000
#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);
}
}
Connect/power on the Arduino, load the Arduino IDE 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. If not, check your settings and electrical connections. Is the HC LED slowly pulsing or fast? If it is fast, you aren’t in command mode - go back over the steps above.
By default, the HC-05 should be set to:
The first thing to do is to ensure the module is set to factory defaults, using the AT+ORGL
command.
Then, to set up for the SmoothieBoard
AT+UART=115200,0,0
AT+NAME=Smoothie
(or anything you like: KillR3D, MyPrinter, Arthur, KZ223398 - the module don’t care.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.
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+NAME=Smoothie
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 SmoothieBoard.
Connect the female DuPont cables to the 4 UART pins on the Smoothie (next to the USB connector - labelled TX RX V+ GND) and the corresponding pins on the HC-05 breakout and power up the board.
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 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:
# Serial communications configuration ( transmission rate default to 9600 if undefined )
uart0.baud_rate 115200 # Baud rate for the default hardware serial port
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.