Skip to main content

💻 Firmware

Environment

Dev Environment Setup

  1. Clone this repository;
  2. Open Particle Workbench;
  3. Run the Particle: Import Project command, follow the prompts, and wait for the project to load;
  4. Run the Particle: Configure Workspace for Device command and select a compatible Device OS version and the bsom platform when prompted (docs);
  5. Connect your device;
  6. Compile & Flash!

Main Firmware Functionalities

  • Cityscanner: Handles operation modes;
  • CitySense: Collects environmental data (payload);
  • CityVitals: Collects telemetry/status (vitals);
  • CityStore: Handles SD card and USB data storage/transfer;
  • MotionService: Puts device to sleep when vehicle is not moving;
  • LocationService: Provides GPS data;

Block Diagram

Operation modes

  • IDLE sensors off, provides only telemetry data;
  • REALTIME logs data onto the SD card and send it in real time (via Particle publish);
  • LOGGING buffer data onto the SD card and send multiple records upon request (via USB);
  • PWRSAVE ike LOGGING but in low power mode.

Payload

#ElementTypePurposeSource
0deviceIDidentifierUnique device identifier from particlePartile module
1timestamptemporalUTC time of measurementGPStime in Epoch
2latitudespatialLatitude (decimal degrees)GPS module
3longitudespatialLongitude (decimal degrees)GPS module
4PM1.0atmosphericParticulated Matter (1 μm)Sensirion SPS30
5PM2.5atmosphericParticulated Matter (2.5 μm)Sensirion SPS30
6PM4atmosphericParticulated Matter (4 μm)Sensirion SPS30
7PM10atmosphericParticulated Matter (10 μm)Sensirion SPS30
8numPM0.5atmosphericParticle count (0.5 μm)Sensirion SPS30
9numPM1atmosphericParticle count (1 μm)Sensirion SPS30
10numPM2.5atmosphericParticle count (2.5 μm)Sensirion SPS30
11numPM4atmosphericParticle count (4 μm)Sensirion SPS30
12numPM10atmosphericParticle count (10 μm)Sensirion SPS30
13PM sizeatmosphericAverage particle sizeSensirion SPS30
14temperatureatmosphericAmbient air temperature (°C)BME280
15humidityatmosphericAmbient relative humidity (%)BME280
16gas_op1_wair qualityGas sensor 1 (write pin)Alphasense AFE
17gas_op1_rair qualityGas sensor 1 (read pin)Alphasense AFE
18gas_op2_wair qualityGas sensor 2 (write pin)Alphasense AFE
19gas_op2_rair qualityGas sensor 2 (read pin)Alphasense AFE
20noisesoundEnvironmental noise in (dB)Alphasense AFE

Vitals

#ElementTypePurposeSource
0deviceIDidentifierUnique device identifier from particleParticle module
1timestamptemporalUTC time of measurementGPStime in Epoch
2latitudespatialLatitude (decimal degrees)GPS module
3longitudespatialLongitude (decimal degrees)GPS module
4voltage_battelectricalBattery voltage (V)Battery IC
5current_battelectricalBattery current (mA)Battery IC
6isChargingstatusCharging status (boolean)Firmware
7isCharginSstatusSecondary charging status (boolean)Firmware
8isChargedstatusBattery fully chargedFirmware
11voltage_solarelectricalSolar panel voltage (V)Solar
12current_solarelectricalSolar panel current (mA)Solar
13cell_strengthsignalCellular network signal strengthCellular RSSI

Command line interface

A Python script provides a command line interface (CLI) for retrieving data over USB. To use it, follow the step-by-step instructions in the data retrieval guide