User Tools

Site Tools


(Up to user-created-add-ons)

Adding wireless capability to your Bukobot

Interested in putting your printer in the garage so that you can't hear (not that its very loud) or smell it (e.g., if you are printing ABS) but you would still like to monitor it from the comfort of your living room? Perhaps you should consider adding a wireless module to your printer.

Bluetooth connection to Azteeg controller

You can buy a Bluetooth module called the JY-MCU module here: for a very cheap $8.60. Its a Class 2 Bluetooth slave device which is 5V tolerant. The device also comes with a female to female cable which allows you to connect the module to PCB expansion pin headers. The range is about 8-12m (depending on obstacles and quality of other Bluetooth adapter - I could get over 20m with a clear line of sight and a Class 1 Bluetooth adapter).

Instructions for adding Bluetooth wireless to your Azteeg X3 controller

If you solder a 2.54mm 4 pin right angle female header onto the J2 connector of the X3 board on the BOTTOM of the PCB (which is Serial Port 0), then the JY-MCU module plugs directly into this connector! [If you can't find a 4 pin right-angle female header then you can just use one with more pins and use side cutter pliers to cut off the extra ones (e.g., or]


[Don't worry if you don't have an X3, there are other pins you can use to connect the module as described below. The X3 was designed to be pin compatible with a RAMPS Arduino board but it has some extra connectors as well (like J2).]

You will also need a Bluetooth adapter on your PC/laptop if it doesn't already have one. Most of them are Class 2 strength, If you can get a Class 1 adapter then that will have slightly greater range (this should still be true even if you are using it with the Class 2 JY-MCU although obviously you won't get the full Class 1 100m range).

Warnings: Don't connect the module backwards.

Configuring the JY-MCU module

Initially the BT modules comes configured for 9600 baud (8bits, no parity, 1 stop bit) with a PIN of 1234 and you must use AT commands to change it. However, the device only accepts AT commands when the device is not paired. This means that you need to use the Arduino to reconfigure the device (you can't connect the module directly to the serial port on your PC because the voltage levels are not right).

The best way to do that is to connect the device to the second serial port on the Mega 2560. This allows you to talk to the board via USB (serial port 0) and also configure the JY-MCU.

For this you'll need to solder some header pins onto the EXP1 and EXP3 expansion ports of the X3. You can buy a 1 x 40pin breakable 2.54mm pin header for this (such as this from the same vendor).

Now using the supplied cable connect VCC and GND on the module to the +5V & GND pins on EXP3. Then connect the RXD and TXD pins on the module to D16 and D17 pins on EXP1 (respectively) as shown below. Make sure you get the wiring the right way around or you can damage the module.


Then paste the following program into the Arduino IDE and upload it to the board via the USB cable:

void setup()  
  Serial.begin(57600); // this is baud rate for the normal USB serial port
  Serial.println("Type commands!");

  // this is the X3 EXP1 (D16/D17) serial port 
  Serial2.begin(9600);  // JY-MCU v1.05 defaults to 9600 baud.

void loop()
  while(Serial2.available()) {  
  while(Serial.available()) {  

When the board is running (and USB cable still connected), open the Tools→Serial Monitor. Set the baud rate to 57600 and set line endings to “No line endings” (important).

You should see “Type commands” displayed in the window.

The red light on the bluetooth module should be flashing which indicates that it is unpaired.

Type AT and press send. The device should return OK if everything is working properly.

BEFORE making any configuration changes to the device, I suggest you skip down to the “Testing the JY-MCU module” section and test that you can get end-to-end communication working at the default 9600 baud rate.

Other AT commands supported by the JY-MCU module:

  • To change the baud rate use AT+BAUDy where y is a hex digit chosen from
1 for 1200 bps 
2     2400 bps
3     4800 bps 
4     9600 bps 
5    19200 bps 
6    38400 bps 
7    57600 bps 
8   115200 bps 
9   230400 bps 
A   460800 bps 
B   921600 bps 
C  1382400 bps

Note: This command takes effect immediately after the module sends the OK<baudrate> response. So you'll need to change the firmware baud rate by changing the “Serial2.begin(9600);” line above to use the new baudrate value and then upload the new program to the board using the USB cable.

  • To change the pairing pin number enter AT+PINxxxx where xxxx is a four digit pin number.
  • To change the device name AT+NAMEaaaaaa (up to 20 characters)
  • To report the firmware version AT+VERSION (e.g., Lindor 1.5)
  • To change the parity use AT+PN (No parity), AT+PE (Even parity), AT+PO (Odd parity). [Normally you just leave it as No parity.]

Again, do not send CR or LF end-of-line characters. If you try to automate the configuration, don't send more than one command per second.

For Bukobot purposes you probably want to set the baudrate to 230400, i.e., AT+BAUD9 (the default Marlin firmware baud rate is 250000).

[Aside: the unused “Key” and “State” pins are only for the Bluetooth Host version of this board (i.e. not used by JY-MCU).]

Alternate script for configuring the JY-MCU module (without soldering on the EXP1 and EXP3 headers)

This script is a bit more automated, and allows you to configure the module by plugging it into the same UART used for USB. This is ONLY for boards that connect to the USB→UART chip through 1K or greater resistors (Azteeg X3 and official Arduino boards do, others may not).

On these boards, if you connect the USB and BlueTooth module (to J2) at the same time, then the BlueTooth's TX signal will override the USB's because the USB chip connects through a 10K resistor; however both the USB and the BlueTooth module will read any data transmitted on the ATMega's TX line. [On boards without a resistor then both modules will be trying to drive against each other and may result in driver damage.]

This arrangement allows the following script to echo configuration status or error information to the Arduino IDE Serial Monitor as it is performs each configuration of the JY-MCU module.

/* Utility to automatically configure a JY-MCU bluetooth module
  to replace the USB serial link on arduino-compatible boards.

Requires an arduino with at least one UART connected to USB->UART
  chip through resistors so that the module can take precidence.

  Set the defines in the first section.
    (the first 3 can be commented-out to leave those values alone)
  Upload the sketch with the bluetooth module unplugged
  Open serial monitor and set it to the OLD_BAUDRATE
  Plug in the module and press the reset button
  Watch the serial monitor to make sure each AT command is followed
    by a corresponding OK command.

To do:
  Add success/error signaling
  Add target baudrate autodetection (the module will respond to
    "AT" with "OK" if the correct baudrate is chosen).

#define BTPIN "0000" //4 digit numeric pin for pairing (string)
#define NAME "Bukobot" //unique alphanumeric name, 20 characters max (string)
#define BAUDRATE 115200 //serial baud rate (integer). 115200 recommended for best compatibility
/* Only the following baud rates are allowed:
1200 2400 4800 9600 19200 38400 57600 115200 230400 460800 921600 1382400 */
#define OLD_BAUDRATE 9600 //9600 by default. If you changed the rate for this module, use that value
#define OK_PIN 0
#define ERR_PIN 1

#if BAUDRATE==1200
  #define BAUDHEX "1"
#if BAUDRATE==2400
  #define BAUDHEX "2"
#if BAUDRATE==4800
  #define BAUDHEX "3"
#if BAUDRATE==9600
  #define BAUDHEX "4"
#if BAUDRATE==19200
  #define BAUDHEX "5"
#if BAUDRATE==38400
  #define BAUDHEX "6"
#if BAUDRATE==57600
  #define BAUDHEX "7"
#if BAUDRATE==115200
  #define BAUDHEX "8"
#if BAUDRATE==230400
  #define BAUDHEX "9"
#if BAUDRATE==460800
  #define BAUDHEX "A"
#if BAUDRATE==921600
  #define BAUDHEX "B"
#if BAUDRATE==1382400
  #define BAUDHEX "C"
  #ifndef BAUDHEX
    #error Only the following baud rates are allowed: 1200 2400 4800 9600 19200 38400 57600 115200 230400 460800 921600 1382400

long baudrates[] = {1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1382400};

void setup() {
  #ifdef BTPIN
  Serial.write("AT+PIN" BTPIN);
  while(Serial.available()) Serial.write(;
  #ifdef NAME
  Serial.write("AT+NAME" NAME);
  while(Serial.available()) Serial.write(;
  #ifdef BAUDHEX
  Serial.write("AT+BAUD" BAUDHEX);
  while(Serial.available()) Serial.write(;

void loop() {
  while(Serial.available()) Serial.write(;

int blinkpin(int pin) {
  while(true) {
    digitalWrite(pin, HIGH);   // set the LED on
    delay(1000);              // wait for a second
    digitalWrite(pin, LOW);    // set the LED off
    delay(1000);              // wait for a second

Testing the JY-MCU module

Download a terminal program like TeraTerm (a free program for Windows or CoolTerm for Mac.

  1. Add the bluetooth device (it comes up as “lindor” by default until you change its name)
  2. This should create an outgoing serial COM port connection to the device (you can check this in Bluetooth Settings). The COM port connects to serial port service called “lindor Rev B” on the device. You should not need to make your PC/laptop discoverable as you will only be making outbound connections to the device. [On Windows it also automatically creates an inbound COM port mapping but you can delete this from the Bluetooth Settings as it will never be used.]
  3. You can set the baud rate of the created COM port in the device manager (for Windows).
  4. Open the terminal program and create a session using the correct serial port settings.

Now the red (pair) light should become solid (you may need to type in the device's pin number).

Test that you can enter data in the terminal program have it appear in the Arduino Serial Monitor and vice versa.

If you connected the JY-MCU to J2 then you should change the program to simply echo data back on the main serial port. You should then see any text you send from the terminal program echoed back by the Arduino. You won't be able to send text from the Arduino Serial Monitor in this configuration.

Recompiling the Bukobot firmware

Now you will need to recompile the Bukobot Marlin firmware to use the new baud rate. Follow the firmware recompilation instructions here: printer-firmware. Change the BAUDRATE value to match your module in Configuration.h. Compile and upload to the X3.

Then change your USB serial port speed to match the new firmware speed and make sure that you can run the new firmware over USB (e.g., from Repetier Host) before trying with the wireless module. Once you have confirmed that the new firmware works, then disconnect the USB and connect the Bluetooth module to J2.

[Alternatively, the latest version of Marlin firmware now has a SERIAL_PORT value in Configuration.h and so you can change this to 2 if want to keep the Bluetooth Module connected to the expansion pins. This is also what you'll want to do if you are using another RAMPS based controller board which doesn't have a J2/Serial Port 0 header. The current Bukobot firmware is based on an older version and so you'll need to replace MarlinSerial.h and MarlinSerial.cpp in the current firmware source with the newer files from the main Marlin github head and then #define a SERIAL_PORT value.]

Possible problems

I can't get the Arduino IDE (1.0.1) to connect to the board via a Bluetooth COM port (I'm guessing the IDE is trying to change the baud rate when talking to the Arduino bootloader which is not supported by the JY-MCU). After trying to connect with the IDE via Bluetooth, it would also seem to screw up the bluetooth COM configuration and I would have to remove the whole Bluetooth adapter and add it again (although this last part may be more to do with flaky drivers for my PC's Bluetooth adapter rather than anything to do with the JY-MCU). Repetier-Host seems to work fine.

It is normal that the TX/RX LEDs on the X3 shield don't work when J2 is being used to communicate to the Arduino.

What about an Azteeg X1 controller?

For an X1 (or Sanguinololu) board you will need to connect the Bluetooth module to a different set of pins. You will need to connect the JY-MCU RXD pin to TX1 and the JY-MCU TXD pin to D10 (which is actually RX1). These pins are a different serial port to the normal USB serial port (the X1 board provides no way to connect to TX0/RX0 directly like X3).

You can then configure the JY-MCU module similarly to the X3 board instructions above except that you should use “Serial1.” instead of “Serial2.” in the posted configuration program (there are 4 places you need to change it).

You will also need to change the Marlin firmware to use the other serial port. With the latest Marlin firmware this is a simple matter of changing SERIAL_PORT in Configuration.h to 1.

The Arduino bootloader will still continue to operate with the default USB serial port.

Other Bluetooth options

  • If you need greater range, you might consider a BlueSmirf Gold modem ( which is a Class 1 Bluetooth device (100m but more expensive). [Don't forget to connect the CTS pin to RTS pin for this device.] For the maximum range you should also have a Class 1 bluetooth adapter as well. This device also has a maximum baud rate of 115200.
  • For even greater range see BlueGiga modules (eg

Wifi connection to Azteeg controller

The Wifi solutions are a little more expensive than the Bluetooth (around ~$47 for the pair of boards described below) but they have a better range than the Class 2 Bluetooth adapters.

The solution I describe uses an RN-XV WiFly XBee drop in module with Xbee Shield. There are some other WiFly based Arduino shields but many of them require that communication is through an SPI serial bus interface which would require major Marlin firmware changes.

The RN-XV module ( is based on Roving Network's RN-171 WiFly module and emulates an XBee module in terms of pin out; in other words, it provides a UART based serial interface. Unfortunately the RN-XV device operates at 3.3V and so requires an XBee Shield to connect it to the 5V Arduino board. I used the following shield: because it was both cheaper and smaller than the Sparkfun one (

The RN-XV module even supports the native Marlin baud rate of 250000 (which is an exact multiple of the ATMega's 16MHz clock speed and therefore has more accurate sampling). You can get RN-XV modules which allow the connection of a high gain Wifi antenna but I just went for the simple wire antenna version (comes presoldered).

Connecting the WiFly module to the printer controller

As the Azteeg boards do not have a standard Arduino pin layout, you cannot directly plug in the XBee shield. Instead I soldered on a set of jumper leads onto the shield so that I could connect it to the Azteeg expansion port header pins (using the same X1 or X3 alternate serial port pins described for the JY-MCU module). I did this by simply cutting off the end of a M/M or M/F jumper lead and soldering it directly onto the correct pins of the shield (for instance, using jumper leads although you can find cheaper).

[I could have simply connected the leads directly to Arduino connectors on the underside of the board (without soldering) but this would have made mounting the board awkward. In fact to make the board sit flat, I actually physically cut off all the underside Arduino connectors using a pair of side cutter pliers.]

Here is a photo of the module connected to an Azteeg X3 controller:

[+5V and GND are connected to the corresponding pins in the EXP3 header. The module's RXD and TXD pins are connected to D16 and D17 pins of the EXP1 header (respectively). The two XBee shield switches are in the right-hand position (this just selects which shield pins the RXD & TXD signals are connected to).]

Configuring the WiFly module

Once the WiFly module is connected to the Azteeg's alternate serial port, you need to follow similar instructions to configuring the JY-MCU module (in order to allow you to send commands to the WiFly module using the Arduino's USB serial port). Upload the same serial configuration program listed for the JY-MCU to the Azteeg board (don't forget to change Serial2 to Serial1 for an X1 controller). The WiFly module also has a default baud rate of 9600 (8 bits, 1 stop bit, no parity).

Set the Arduino IDE Serial Monitor to use a baud of 57600 (to match the configuration program) and initially set the line ending to be “No line ending” and send $$$ to make the WiFly module enter command mode. It should respond with CMD.

Then change the line ending to “Both NL & CR” to send the rest of the commands.

The command set supported by this module is fairly extensive. You can find a full command reference and user guide here:

Enter the following set of commands while in command mode (don't include the comment):

set comm close 0                       # turn off local message sent on connection close
set comm open 0                        # turn off local message sent on connection open
set comm remote 0                      # turn off remote message sent on connection open
set comm idle 300                      # set a 5min idle timeout to disconnect
set comm match 10                      # flush TCP frame buffer on new line
set opt deviceid Bukobot               # set wifi device name (to anything you like)
set sys printlvl 0                     # turn off debug sent to Arduino when not connected
set wlan rate 0                        # set max data rate to 1Mbit/sec to maximize range
set wlan ssid <wifi SSID>              # set Wifi SSID to use
set wlan phrase <wifi password>        # set wifi password to use
set uart raw 250000                    # set baud rate
save                                   # save to default configuration 
reboot                                 # apply baud rate change
> Note: if your Wifi SSID or password contains spaces then replace the spaces with $ symbols.

After changing the baud rate of the Wifi module you will need to update and reload the configuration program to match.

By default the WiFly module will attempt to auto-connect with the Access Point advertising the configured SSID and use the configured WiFi password. It will then automatically use DHCP to obtain its network settings and then start listening on port 2000 for inbound connections. All this behavior can be changed by additional commands if desired.

Connecting to the WiFly device

You now need to install a virtual COM port provider on your computer. This software will look like a normal serial port to your host software (such as Repetier) and open a TCP connection to the printer to send/receive the resulting data. The software will transparently reconnect if it needs to.

On Windows I used HW Virtual Serial Port 3 ( which is free for private use. You simply select a new COM port, enter the WiFi module's IP address and TCP port (2000 by default), deselect “NVT enabled”, select “Purge buffers when port is opened” and click Create COM port. You then simply configure Repetier Host to use this new COM port.

[Anyone want to add a suggestion for Mac?]

Network security

The above configuration instructions do not set a password on the WiFly module. Whilst a clear text password is supported by the RN-XV module (set opt password), it is not supported by the HW Virtual Serial Port 3 software. I'm sure that some other virtual COM port provider software does support sending a password but I was not overly concerned by this situation. The printer is still only accessible using your Wifi Access Point which means that someone must know your wifi password before they can connect to the WiFly module (unless of course you have enabled guest access on your network). [Besides, clear text passwords are pretty weak if someone already has access to your wifi network.]

Recompile Firmware

As with the JY-MCU module, if you are not connecting your WiFly module to J2 on the X3 controller then you will need to recompile your Marlin printer firmware to use the correct serial port for communication. [Although you can leave the baud rate at the default 250000.]

You can also easily connect the shield to the X3's J2 connector (Serial Port 0) by soldering on a 4-pin right-angle male header onto the bottom of the board (such as You can use the Bukobot firmware unchanged if you do this.


  1. You can test your end-to-end serial connection using TeraTerm (or similar) just as described for the JY-MCU module.
  2. You can also enter command mode from the WiFi side (type $$$ in rapid succession without a carriage return).
  3. You can usually configure your router/broadband modem to always allocate the same nominated IP address to a particular wireless MAC address. Doing this means that you won't need to update your virtual COM port software with a new IP address every time the router changes its DHCP address allocation. You can use the get mac command on the WiFly module to display its MAC address if you can't work it out from the router.
make-your-bukobot-wireless.txt · Last modified: 2013/01/02 03:05 by buildrob