Skip to content
Lorenzo Pistone edited this page Mar 19, 2025 · 6 revisions

Blastic scale

blastic-scale is a Precious Plastic project for providing an IoT scale to keep track of the amount of recycled plastic.

This repository contains the firmware for the UNO R4 WiFi board that powers the scale.

The scale has a display that shows the current weight. Using the capacitive buttons on the board, the user can measure the weight, then select the plastic type, and finally initiate the upload of the measurement to a Google Form provided by Precious Plastic.

Features

  • WiFi upload of measurements to the official Precious Plastic Google form, and optionally to an user-defined cloned Google form
  • data logging on SD card; the SD card can be plugged/unplugged at any time (except when data is logged, do not move it if a yellow led is lit on the board)
  • minimal user interface on the on-board LED matrix, 4-buttons input (OK, NEXT/PREVIOUS, BACK)
  • automatic real time clock synchronization via NTP (when network is available)
  • configuration persistence both on the board itself (eeprom) or the SD card
    • firmware updates do not require a reconfiguration (guaranteed when using eeprom, best-effort when using the SD card)
  • serial interface for configuration, debugging and development
  • several debugging tools (look into the scripts folder).

Flashing the release

If you do not want to setup a development environment (VScode + PlatformIO plugin), you should:

  • install the arduino-cli command line
  • download the .bin file from the the latest release
  • attach the board to the USB port, then list the available connections and take note of your $PORT:
arduino-cli board list --fqbn arduino:renesas_uno:unor4wifi
  • upload the firmware:
arduino-cli upload --fqbn arduino:renesas_uno:unor4wifi -i /path/to/blastic-scale-*.bin -p $PORT

Please do remember that you may need to update the USB bridge firmware of your board, with this suggested procedure.

First boot of the scale

Once you have assembled and flashed the scale, you should set some necessary configuration parameters on the device. All the configuration is currently handled via the command line interface, which is accessible both via the USB cable and a monitor interface, or via a file in the SD card.

In order, you should:

  • plug the USB cable to the scale and your laptop
  • flash the firmware (see above)
  • start the serial monitor (see instructions)
  • reset the device via the hardware reset button
    • you should observe the boot log on the serial monitor
    • note that after each reset the scale tares itself on the currently detected weight: after completing the following initial configuration, it is ok to just tare the scale by pressing the reset button
  • the scale will show on display that it is uncalibrated. Follow these steps to calibrate the device:
    • take a know weight $weight in kilograms, place it on the scale
    • run the command scale::calibrate $weight
  • setup the WiFi connection:
set config.wifi.ssid $your_network_name
set config.wifi.password $your_password         # if the network is open, skip this command
wifi::connect                                   # test the connection
  • set the collection point and person names:
set config.submit.collectionPoint $place
set config.submit.collectorName $name
  • save the configuration in eeprom:
eeprom::save

Once you have walked through the above list, it is safe to unplug or otherwise power down the scale. The battery may also be used now as a power source, without risk of losing your configuration.

Clone this wiki locally