Code Loading an Arduino over Bluetooth
For a client, I needed to find a tutorial on how to load code updates over Bluetooth, specifically from an Android tablet. I couldn’t find anything on the web where someone was doing this, so i decided to write a tutorial on it. We will download the binary from the web onto a tablet and then load that code into a Mega 2560.
This is rather involved, so I’m breaking it up into parts.
The Five Parts
Step 1: Use a Mega 2560 as an ISP. We will need to replace the standard boot loader in order to accomplish this, but first we need an ISP programmer to use to replace the boot loader. This will show how to set up a Mega 2560 as a programmer for another Mega 2560. The tutorials for this missed some things. I wanted this to be comprehensive.
Step 2: Load MegaCore with Optiboot as the Boot Loader for a Mega 2560. This uses the ISP you created in step one to use Optiboot, which is not only more efficient than the standard Arduino boot loader, but allows you to load a sketch from an existing sketch.
Step 3: Getting the Download Binary for your Sketch. It turns out this was much harder than I expected to figure out how to do. We’re going to use the ArduinoOTA library for this and for the writing of the flash memory later. This was a pivotal part of Code Loading an Arduino over Bluetooth.
Step 4: Downloading and Pushing Arduino Code over Bluetooth. This is the only step in this process that really doesn’t have anything directly to do with Arduino, but it’s the lynchpin to Code Loading an Arduino over Bluetooth. None of it works without this.
Step 5: Using Optiboot and ArduinoOTA to Flash the Binary. This is the final step that places your code in place and start it running by resetting the processor.
So that’s it! Five steps to Code Loading an Arduino over Bluetooth. I hope you enjoy this tutorial as much as I did sharing this with the world.
1 Comment