Skip to content

Flash a board over USB ​

With the browser flasher you turn an ESP32 board into a Sensora device without writing code. The browser installs the firmware over USB, gives the board your Wi-Fi details and links it to your project. The firmware, named Sensora Agent, finds supported sensors by itself and sends their readings every 60 seconds.

What you need ​

  • Board: an ESP32, ESP32-S3 or ESP32-C3 board with 4 MB of flash or more. There is no firmware for other boards, also not for the ESP8266 or the Raspberry Pi Pico W. Connect those with HTTP.
  • Cable: a USB cable with data wires. Many charging cables have none.
  • Browser: Chrome or Edge on a desktop computer, with the dashboard open at an https:// address or at http://localhost. Browsers allow USB access only on these pages.
  • Wi-Fi: a 2.4 GHz network.
  • Server: the firmware installed on the server, and an address that the board can reach. See the next section.

Install the firmware on the server ​

The browser downloads the firmware from your Sensora server. A new install has none, and the flasher then shows this warning:

The Plug in a board screen on a server without firmware, with the warning No firmware is installed on this server

You need two values from the release notes of the sensora-library repository: the tag of the release, and the public key that the release is signed with. Sensora has no built-in key, so it refuses a release until you give it one.

  1. Add two lines to deploy/.env. PUBLIC_URL is the address that boards use to reach your instance. It must be reachable from the board's Wi-Fi, so it cannot be localhost.

    ini
    PUBLIC_URL=http://192.168.1.20:8090
    FIRMWARE_PUBLIC_KEY=<public key from the release notes>
  2. Apply the change:

    bash
    docker compose -f deploy/docker-compose.yml up -d
  3. Install the release. Replace <tag> with the release tag:

    bash
    docker compose -f deploy/docker-compose.yml exec app bun run firmware install --release <tag>

    The command downloads the release from GitHub and installs it only if its checksums and its signature are right.

  4. Check the result. The answer has "available": true, the version and the chip families.

    bash
    docker compose -f deploy/docker-compose.yml exec app bun run firmware status

Install again after the container is created again

The firmware is stored inside the app container, not on a volume. When Docker creates the container again, for example after you change deploy/.env or update Sensora, the firmware is gone. Run the install command again.

The warning in the flasher also names SENSORA_AGENT_RELEASE. Do not use it. In version 0.1.27 the Docker build cannot check the signature of the release, and the build stops with an error.

Install a build you made yourself ​

You can build the firmware from source and install it without a signature. Run tools/build.sh in a copy of the sensora-library repository. The result is in dist/<version>/. Then run these two commands in the sensora folder:

bash
docker compose -f deploy/docker-compose.yml cp ../sensora-library/dist/<version> app:/tmp/agent
docker compose -f deploy/docker-compose.yml exec app bun run firmware install --from /tmp/agent --allow-unsigned

The flasher marks such a build as Unsigned development build.

Sensora runs on another computer

The page http://192.168.1.20:8090 is neither https:// nor localhost, so the browser blocks USB there. Put HTTPS in front of Sensora, or forward the port over SSH and open http://localhost:8090:

bash
ssh -L 8090:localhost:8090 [email protected]
  1. Wire your sensor to the board and plug the board into your computer. See Sensors the firmware detects.
  2. In the dashboard, open Devices, select Connect device, then Plug in a board by USB.
  3. Optional: enter a Name. If you leave it empty, the device gets the board's own id as its name.
  4. Check How the board reaches this project. It holds PUBLIC_URL, or the address of the page if PUBLIC_URL is not set. It must be an address that the board can reach.
  5. Select Connect board & install and pick the serial port of your board. Installing erases everything on the board.
  6. Wait while the page installs the firmware and links the board to a new device in your project.
  7. At the step Join Wi-Fi, select your network, enter the password and select Connect.

When the first reading arrives, the Your board is live page opens. It shows the latest readings and the sensors that the board found.

If no reading arrives within 90 seconds, the page says that the board is on Wi-Fi but no data reached the server. The usual cause is an address that the board cannot reach. Open Device log at the bottom of the page to see what the board prints.

Select Board already runs Sensora: link only to skip the install. Use it for a board that already runs the Sensora Agent, or your own firmware built with the Arduino library. This works on a server without firmware. Sensora creates a new device and writes its credentials and the address onto the board.

If the board does not show up ​

  • Use a data cable.
  • Hold the BOOT button while you plug the board in.
  • Close other programs that use the serial port, such as a serial monitor.
  • If the board does not answer after the install, press its RESET (EN) button and try again.

Sensors the firmware detects ​

The firmware looks for these sensors each time it starts. If two sensors give the same reading, the second gets the suffix _2, the third _3.

BusSensorI²C addressReadings
I²CBME2800x76, 0x77temperature (°C), humidity (%), pressure (hPa)
I²CBMP2800x76, 0x77temperature (°C), pressure (hPa)
I²CSHT4x, SHT3x0x44, 0x45temperature (°C), humidity (%)
I²CAHT200x38temperature (°C), humidity (%)
I²CBH17500x23, 0x5Cilluminance (lx)
I²CSCD40, SCD410x62co2 (ppm), temperature (°C), humidity (%)
OneWireDS18B20, DS1822noneprobe_temperature (°C)

Every board also reports rssi (Wi-Fi signal), uptime_s and heap_free (free memory). If the firmware finds no sensor, it looks again once a minute, so you can wire a sensor to a running board.

Other sensors are not detected. For those, write your own firmware with the Arduino library or send the readings over HTTP.

Pins ​

  • I²C: SDA 21 and SCL 22 on ESP32. SDA 8 and SCL 9 on ESP32-C3 and ESP32-S3. To use other pins, change Sensor pins (I²C) in the flasher or on the USB tab.
  • OneWire: GPIO 4. To change it, send the console command config ow_pin <gpio> and restart the board.

What Sensora creates for the board ​

From what the board reports, Sensora creates a template with the readings and their units, and a dashboard named after the device if the board reports at least one sensor reading. The template marks the device offline after 5 minutes of silence. If you give the device another template later, Sensora does not replace it.

The USB tab: log and console ​

Every device page has a USB tab. Use it to see what a board prints and to send it commands.

The USB tab of a device page with the Connect board button

  1. Plug the board into your computer and open the device's page.
  2. Open the USB tab, select Connect board and pick the serial port.

The page shows the firmware on the board, the device that the board is linked as, the address it sends to and the Wi-Fi state. Serial log shows what the board prints. Select Restart board to see its start-up log, which includes the sensors it finds.

To send a command, type it in the box under the log and select Send. help lists all commands. Useful ones are status, sensors (a fresh reading of each sensor), i2c scan (every I²C address that answers) and uplink (send the readings now).

If the board on the cable is linked as another device, you can read its log, but you cannot send commands or change it from this page.

Update the firmware over USB ​

Install the new release on the server. Then connect the board on the USB tab of its device page and select Update to followed by the version. The update keeps the Wi-Fi details, the link to the device and the sensor pins.

To clear a board instead, flash it again with Connect board & install. That creates a new device, and the old device stays in your project until you delete it.

To update boards without a cable, see Firmware updates.

Sensora is open source under the Apache 2.0 license.