Burn program over Bluetooth?

This forum is dedicated to all issues and questions related to your individual setups and configurations
Post Reply
lysgaard
Posts: 11
Joined: Wed May 29, 2013 3:52 pm

Burn program over Bluetooth?

Post by lysgaard »

Hi, I've got a multiwii with a bluetooth module. I'm missing the ftdi-usb module, but that got me thinking. Is it possible to burn programs over bluetooth?

squid10
Posts: 20
Joined: Sun May 12, 2013 8:24 pm

Re: Burn program over Bluetooth?

Post by squid10 »

NO!
i just did it now... it will stop before upload completion.
in order to recover from that you need to remove the BT from the port, reset the board with the reset button and only then you'll be able to upload sketches again.

lysgaard
Posts: 11
Joined: Wed May 29, 2013 3:52 pm

Re: Burn program over Bluetooth?

Post by lysgaard »

Ok, is there any good reason why this doesn't work? I though the bluetooth and usb spoke the exact same serial protocol. That it was just "two ways of sending the same type of signals"?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Burn program over Bluetooth?

Post by PatrikE »

Boards have different uploadspeed.
You need to check the settings for your board arduino..\hardware\arduino\boads.txt

Change Baudrate on your Bluetooth to match.

And there's no resetsignal via the BT.
The arduino must be reset at correct time to be able to recieve the program.
Normally you press reset when the TX or RX LED blinks quickly.

mwiidude
Posts: 19
Joined: Tue Apr 30, 2013 3:45 pm

Re: Burn program over Bluetooth?

Post by mwiidude »

Bluetooth is quite slow as a serial protocol, as as mentioned, you'd need to adjust your baud rates to match AND you need to re-burn a new bootloader to use that baud rate!

I'm assuming that your MultiWii is a ATmega 328-based board, and in that case you need a slower bootloader, and one that has a longer delay that waits for the host to initiate the upload connection since you need to re-set the board manually (that's another issue unto itself!)

There's no way that an unmodified UNO or Duemilanove bootloader will work with Bluetooth.

User avatar
ezio
Posts: 827
Joined: Sun Apr 01, 2012 11:03 pm
Location: Paris
Contact:

Re: Burn program over Bluetooth?

Post by ezio »

mwiidude wrote:Bluetooth is quite slow as a serial protocol, as as mentioned, you'd need to adjust your baud rates to match AND you need to re-burn a new bootloader to use that baud rate!


Absurd

mwiidude
Posts: 19
Joined: Tue Apr 30, 2013 3:45 pm

Re: Burn program over Bluetooth?

Post by mwiidude »

ezio wrote:
mwiidude wrote:Bluetooth is quite slow as a serial protocol, as as mentioned, you'd need to adjust your baud rates to match AND you need to re-burn a new bootloader to use that baud rate!


Absurd



How so? Arduino bootloaders are designed to run at a fixed baud rate, that is a known fact.

The UNO bootloader uses 115,200 baud and the Duemilanove uses 57,600, and there's NO way you're going to get a Bluetooth module to run reliably at those rates!

There's also the other issue of no hardware reset available over Bluetooth, and the bootloader delay itself. Even if you re-compile the Arduino bootloader to run at 9,600 baud (fairly easy), you need to adjust the bootloader delay to allow you time to manually re-set the board, and then hit "program".

The original Arduino NG bootloader is actually a good example, where it has a painfully long bootloader delay, and connects at 19,200 baud.

Please check your facts before posting pointless rebuttals...

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Burn program over Bluetooth?

Post by Sebbi »

Bluetooth has no problem with higher baudrates. It's just not too easy to set the connected bluetooth module to exactly the needed baudrate so the bootloader works, but I see no reason why it shouldn't work when your Arduino board has a manual reset button somewhere (the Arduino IDE even waits for the reset to occur, so no problem there)

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Burn program over Bluetooth?

Post by copterrichie »

Without having tried it myself, I think the Bluetooth latency issue will be a problem. http://www.free2move.se/?page_id=1058

the Programmer is looking for ACK and NAK during transmission.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Burn program over Bluetooth?

Post by Sebbi »

Well ... then explain why it has been working for years?

http://www.youtube.com/watch?v=i-69D0iDVxE

Just change the baudrate to whatever your board is using for the bootloader and figure out how to reset the board ... or build something like this: http://letsmakerobots.com/node/30915

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Burn program over Bluetooth?

Post by copterrichie »

Sebbi wrote:Well ... then explain why it has been working for years?

http://www.youtube.com/watch?v=i-69D0iDVxE

Just change the baudrate to whatever your board is using for the bootloader and figure out how to reset the board ... or build something like this: http://letsmakerobots.com/node/30915



did you read your own link?

I located the version of avrdude shipped with my Arduino IDE, it's under $ARDUINO_HOME/hardware/tools/avrdude. here I renamed the avrdude program to to avrdude-real and then put a little perl program there instead:

#!/usr/bin/perl
use strict;
use warnings;

foreach (@ARGV)
{
s|/dev/ttyS0|/dev/rfcomm3|;
}

my @cmd = ("$0-real", @ARGV);

#exec @cmd;
system @cmd;
printf "Programming %s\n", $? ? 'FAILED' : 'SUCCESS'


mwiidude
Posts: 19
Joined: Tue Apr 30, 2013 3:45 pm

Re: Burn program over Bluetooth?

Post by mwiidude »

Programming Arduino over Bluetooth is the Holy Grail that has never really been solved. Sure there are some combinations of hardware and software kludges, but none have ever worked reliably, and you always run the risk of having your board reset at the most inopportune times! (mid-air!)

There was a European company that made customized Arduino-compatible boards with Bluetooth programming capability, but they used a custom bootloader, with a 9,600 baud data rate, and still relied on a manual board reset. I can't find any reference to it, but I know I made note of it somewhere!

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Burn program over Bluetooth?

Post by Sebbi »

Yes, I read my link ... it is a very hacky solution, but works if you want to do it automatically. The problem is the automatic reset that is not available over a bluetooth serial module, but you could as well press some button resetting your Arduino ... which works!

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Burn program over Bluetooth?

Post by copterrichie »

Sebbi wrote:Yes, I read my link ... it is a very hacky solution, but works if you want to do it automatically. The problem is the automatic reset that is not available over a bluetooth serial module, but you could as well press some button resetting your Arduino ... which works!


LOL

Now its time for tweaking the Arduino IDE to program through the bluetooth link. This requires a little hack to the IDE, which I were not able to get working on the windows side, which is why this guide is considered linux only.Btw. I'm working in version 0022 of the IDE. I still don't like the new version 1 thing!

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Burn program over Bluetooth?

Post by copterrichie »

The bottom line is, there are other issues besides just changing the baudrate.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Burn program over Bluetooth?

Post by Sebbi »

No there aren't ... change the baudrate, make sure you can reset the Arduino. Then upload the sketch in the Arduino IDE and reset when the IDE is waiting for the bootloader -> voila.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Burn program over Bluetooth?

Post by copterrichie »

Sebbi wrote:No there aren't ... change the baudrate, make sure you can reset the Arduino. Then upload the sketch in the Arduino IDE and reset when the IDE is waiting for the bootloader -> voila.


Please, may we see a video tutorial of you loading the MWC via Bluetooth? I am sure it would be very helpful to us all.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Burn program over Bluetooth?

Post by Sebbi »

For which part do you need help, copterrichie? Setting the baudrate via AT commands or keeping an Arduino in the reset state long enough?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Burn program over Bluetooth?

Post by copterrichie »

Sebbi wrote:For which part do you need help, copterrichie? Setting the baudrate via AT commands or keeping an Arduino in the reset state long enough?


Can you simply make a video of your procedure using Bluetooth to load the WMC firmware to the Arduino? I think your tutorial would not only help me, but others too.

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Burn program over Bluetooth?

Post by Sebbi »

That's rather time intensive ... and I already linked a video from someone uploading a sketch over bluetooth. The procedure would be:

1) find out how you can bring your bluetooth module into AT mode, so you can change the baudrate
2) find out the correct baudrate for your Arduino (bootload)
3) connect to your module in AT mode (via the FTDI serial adapter you already use to upload to your MWC board) and issue the commands to set it to that baudrate
4) plug the bluetooth module on the serial port of your MWC board
5) connect from you PC over bluetooth (when using windows you can have virtual com ports ... establish a connection there and find the COM port in the Arduino IDE)
6) find out how you can reset your MWC board!
6a) your board has a reset button, than it's easy ... just hold it down, click "upload sketch" and release when the IDE says it's uploading now
6b) you don't have a reset button, than you have to manually connect the reset pin on your Arduino to ground and disconnect when the IDE says it's uploading now
6c) (may not work with all bluetooth modules) if your BT module has RTS/DTS you could connect RTS to the DTR pin on your Arduino (on the serial header if you use an external FTDI adapter or directly with a 0,1 µF capacitor in line) to automatically trigger the reset. That's the method used when uploading over USB serial bridges. But be aware that your Arduino will then always reset when you connect and this might not be the best solution if you also want to fly your copter/plane this way and connect to it (GUI/telemetry) while in air.

I wont produce a video of me setting all these things up, I can only record the actual connection/upload procedure, but that is rather uninteresting and I have already posted a link of someone doing that ;-)

Edit
You can probably skip steps 1-3 when you normally upload sketches with either of the following settings in the Arduino IDE:
Arduino Uno
Arduino Mega 2560 or Mega ADK
Arduino Mini w/ ATmega328
Arduino Ethernet

those all use a baudrate of 115200 which should be the default of most bluetooth modules. To find out the baudrates of other configurations/boards see the file boards.txt in the "hardware" directory of your Arduino IDE installation.

imjosh
Posts: 1
Joined: Sun Mar 30, 2014 5:24 pm

Re: Burn program over Bluetooth?

Post by imjosh »

Here's a how-to I wrote to be able to program Arduino via Bluetooth. Hopefully it's not too hacky. It is Windows-centric but if you need it to work on Linux, maybe it will help you figure that out too.

http://makezine.com/projects/diy-arduin ... ng-shield/

Post Reply