What is bufr.sh?

bufr.sh is a tool to remotely flash your Arduinos over internet. Now you can update your Arduinos' firmware from halfway across the world, without having to connect them to USB host. All your arduinos need is:

  • bufr.sh bootloader, currently 4kb in size, flashed.
  • a connection to internet through Ethernet shield.
  • literally 2 lines of code in your sketch for polling updates.


Download CLI

Linux 32-bit 64-bit
macOS 32-bit 64-bit
Windows 32-bit 64-bit

Download the zip, extract the file and place it in your PATH.


Hardware Compatibility

Arduino Uno R3 or AVR Atmega328p, connected to internet through Arduino Ethernet Shield based on Wiznet W5100 chip. The newer Ethernet Shield 2 based on W5500 chip will not work yet. Support for Ethernet shield 2 coming very soon, with support for other Arduino models next.


Limitations

Currently, you cannot (and should not) use Arduino's Ethernet and SPI libraries, while running bufr.sh bootloader. These limitations will be removed shortly.


Arduino sketch instructions

As said earlier, you only need 2 lines to poll for updates. First line declares a function called "bufr_poll()". Place this exact line somewhere at the top of your code, before setup() and loop().

The other line is just a call to this function. You can place it anywhere you want the Arduino to poll for any firmware updates. See the example sketch on the right.

If there is an update, the Arduino will restart automatically, download and flash the new firmware, and restart again with the new code running; everything without ever touching the Arduino in any way.

An Arduino that is freshly flashed with bufr.sh bootloader will accept the firmware updates on its own.


//declare function bufr_poll()
void (*bufr_poll)(void) = (void(*)(void))0x7e00;

void setup()
{
	pinMode(LED,OUTPUT);
	Serial.begin(9600);
}

void loop()
{
	Serial.println("Polling in 1 second.");
	delay(1000);
	//poll for firmware updates
	bufr_poll();
	Serial.println("Polling done.");
}
					

Create a new account

Provide a username (min. 8 characters length, may include numbers, letters, underscore and hyphen), a password (min. 8 characters length), and a valid email address. A verification link will be sent to this ID immediately, which will be valid for 24 hours.


$ bufr register
Username: hackernoob
Password: s3cretp@55w0rd
Email: hacker.noob123@example.com
OK
					

Login

Account should be verified before you can login.


$ bufr login
Username: hackernoob
Password: s3cretp@55w0rd
					

Add a device

Device name should be atleast 8 characters long. Only letters, numbers, underscore and hyphen are allowed. Max 5 devices can exist at a time on a basic account.


$ bufr add DEVICE-NAME
OK
					

Delete a device

Devices can be deleted. Cannot be undone. Everything related to the deleted device will be wiped. Asks for a confirmation once.


$ bufr del DEVICE-NAME
Type YES to delete DEVICE-NAME: YES
OK
					

Tag a device

Tag name should be atleast 8 characters long. Only letters, numbers, underscore and hyphen are allowed. Max 5 tags can exist at a time on a basic account. Many tags can be assigned to a single device. If the tag doesn't already exist, it will be created.


$ bufr tag DEVICE-NAME TAG-NAME
OK
					

Untag a device

Tags can be removed from devices. Removing a tag from all devices will delete the tag altogether.


$ bufr tagrm DEVICE-NAME TAG-NAME
OK
					

Get device status

Device list shows basic device info and status. The tags assigned to devices, and last communication time is shown. Also, device connectivity is depicted as follows.

  • DEAD: device hasn't polled for an update for a long time
  • ALIVE: device is polling
  • IDLE: device is ready to receive update
  • FLASHING: device is currently downloading firmware


$ bufr list
office-arduino [work-devs, door-ctrl] : [2017-10-11 21:13:07 +0000 UTC] ALIVE IDLE
home-uno [home-devs, home-project] : DEAD
floor1-uno [home-devs] : [2017-10-11 21:13:07 +0000 UTC] ALIVE FLASHING
					

Download device bootloader

Bootloader should be downloaded and flashed for all devices. For the bootloader to properly function, you have to provide IP address info (device IP, gateway IP, and netmask, in this order) that the device will be assigned in your network. Once the command finishes execution, the bootloader will be placed in your current working directory. Flash the bootloader normally with these fuse settings for Uno:

  • efuse 0xff
  • hfuse 0xd8
  • lfuse 0xff

A device name that is deleted and re-added will need a fresh bootloader download and flash. If you need to change IP settings, just re-download and re-flash the bootloader with new settings.


$ bufr bootloader DEVICE-NAME 192.168.1.47 192.168.1.1 255.255.255.0
$ ls *.hex
DEVICE-NAME.hex
					

Upload hex file for a single device

Hex file need to be created out of sketches in Arduino-IDE. The hex file location needs to be known. The path shouldn't have any spaces. Note the "dev" keyword after "hex" command.


$ bufr hex dev DEVICE-NAME PATH/TO/HEX/FILE.hex
OK DEVICE-NAME
DONE
					

Upload hex file for multiple devices

Hex file is uploaded using a tag, instead of a device name. Note the "tag" keyword after "hex" command. All the devices currently belonging to this tag will be flashed with this hex file.


$ bufr hex tag TAG-NAME PATH/TO/HEX/FILE.hex
OK device-1
OK device-3
OK device-9
DONE