Wireless 3D printing

Last week I had a "USB cable incident" with my Prusa (computer and printers are on different tables in my office). It was entirely my fault as I walked across the USB cable and I almost threw my printer to the floor. As a result, the ferrite torus I put in the USB cable to prevent EMI problems broke. Without it, I know prints may interrupt anytime due to interference.

While on eBay looking for a replacement, I realized that a Bluetooth module was costing less than $15 now. So I thought I could give it a chance to the idea of operating my printers wirelessly.   Later, I learned of an even cheaper module at $6.60, but this one is 3.3v only (which is ok if you are using this voltage for your Arduino, but I am using 5v).

A quick look at Sprinter firmware and Arduino Mega and RAMPS board specs revealed that Serial2 port using 16 (TX) and 17 (RX) pins was easily available on the ext4 connector of RAMPS board. And so was GND and +5V. Making it very easy to connect the Bluetooth module.



And for the firmware changes, I do have an easy solution if you can give up the usage of the USB serial communication for printing (which I was). Just do a search and substitution of string "Serial." by "Serial2." in Sprinter.pde (same idea could be applied to other firmwares) and that is all. This way your printer will no longer be usable from the USB but you can always go back by reloading the former version of firmware. Please note that if you enable SD printing you may need to do the string replacement in some other source files too (same simple replacement).


You need to configure the module to use 115200bps (or change the firmware to 9600bps which is the default module speed) and you can do that by selecting the AT mode and using serial interface (3.3 volts only!) you use AT+UART=115200,0,0 command. Please note this module uses 38400 bps when in AT mode. For this job I used Spakfun's FTDI basic breakout module.

Once configured, the module can be wired to the RAMPS board with four wires (GND, +5V, RX, TX).  Select the board in your favorite software (I use Pronterface) and you can connect and interact with your printer.

Problems ahead

Unfortunately, not all was a success (yet). For some weird reason, still to be determined (defective Bluetooth module, bad module firmware, ...), my happiness is not complete as there is a problem. Once I start printing, the print job is interrupted after a few moves.

The cause of the problem is that my Bluetooth module misses some characters in the RX line if Mega is not transmitting a character for more than ten seconds. The end result is that "ok" responses are damaged or lost entirely whenever the motion takes longer than ten seconds, so printing of large objects becomes a problem. But Bluetooth connection is never lost, so I guess the cause it is a poor implementation of power management in the Bluetooth module.

I hope that by replacing the module firmware or by adjusting some parameter I will be able to fix the problem. If not, I will be forced to buy a different module and keep this one for another task where this behavior won't be a problem.

Update: Once I replaced the Bluetooth module behaving badly from another [cheaper] supplier I have got it all working nicely and wirelessly at last.  It works in Linux, Windows and OSX.

Comments

Justblair said…
Seems to me that neither bluetooth or USB are going to give you the secure connection that you require.

Better option is to use a SD card and use your bluetooth to start the print.

I have been using SD for a while now and it never skips a beat. I am using an LCD display and rotary encoder so there is no need for any serial connection at all.
misan said…
Bluetooth and SD sounds like a good combination.

I have ordered a new module from another manufacturer to give it a try.
Julian Hardy said…
Nice work! Definitely agree with the suggestion to use Bluetooth + SD-Card. That way, the connection is only required for initiating the print and keeping an eye on progress. If the connection drops out for any reason, it doesn't really matter coz' the RAMPS can just carry on printing from the Gcode on the SD-Card. I did something similar, only using XBree instead of Bluetooth - see my blog entry at: http://julianh72.blogspot.com.au/2011/11/look-ma-no-wires.html
misan said…
I saw your post Julian and I did have some Xbee around too but I thought my fellow reprapers could do it even cheaper (many computers do have BT interface, and those who don't can use a $2 BT dongle). Besides, the XBee way was already taken ;-)
Superbatman said…
Why dont you use AUX-1? You could keep the Serial command. Plug and unpluge the module for use or not.
misan said…
I was not aware of AUX-1 port.

But do you mean using it as a Serial port? Arduino doc does not state these pins as a hardware serial port.

Can you elaborate on the idea?

Thanks.
misan said…
Ok, I'll answer myself: RAMPS 1.4 schematic has the serial tag over a socket with outputs A3 & A4, these are not a serial port, but the other socket is D1 and D2 that are RX & TX of serial port.

So yes, using that would be a better idea, in fact I am just going to switch to this output.

Thanks for the tip!
Superbatman said…
Yes, thats what I mean. I just ordered on of this cheap Bluetooth myself from China.

As far as I understand it you can also programm them using an Arduino. Just connect them to some pins and the arduino to pc with usb and run some easy code.

I ll blog about it too, as soon as my item arrives from china.
Sasi said…
Great work,

have you tried it with the android app?
https://play.google.com/store/apps/details?id=com.hermit.btreprap

the needed sparkfun dongle is quite costly, just wondering if you can control it with your "random" dongle aswell... ?
misan said…
Thanks for the tip. I am going to try this out. It seems it is going to work ok ... as I have managed to make it work from Windows, OSX and Linux.
Sasi said…
Did you have any luck with the app?

I've tried it with an android ice 4.04 but it gets stuck at the connecting stage in the app, while the lights turn green on the bluetooth indicating "connection"
misan said…
I could not find the APK file. Unfortunately Google Play stopped working on my 4.0.3 Galaxy S. I cannot make it work then.
Sasi said…
It works like a charm on the S3. I'm using the bluemate silver as bluetooth module.

misan said…
I've downgraded my phone OS to Froyo (long story, don't ask) and I have been able to test the android app with this Bluetooth dongle. It works nicely!
Jorge S. Anis said…
Good Job, any wait i get "conecting..." anda nothing happends :(

Popular posts from this blog

VFD control with Arduino using RS485 link

How to get sinusoidal s-curve for a stepper motor

Stepper motor step signal timing calculation