Configuration

Overview

The Bugg device loads its configuration from a config.json file which must be placed on the microSD card inserted into the device. The name of the configuration file must be exact or the device will not be able to locate it.

A single config.json file can be used for multiple Buggs under the same project (assuming SIM cards are on similar plans).

There is no need to change any parameters within the configuration file to individually identify devices. Devices are uniquely identified by a unique hardware ID baked into the CPU of each device, which is either printed on the enclosure or supplied upon delivery.

Structure of config.json

Download an example config.json file

There are four main components of the config.json file:

  1. General information
  2. Audio recording parameters
  3. Mobile internet settings
  4. Remote server details

Below is an example of a typical Bugg configuration file. To create your own use the downloadable template above rather than copying the below text to avoid potential encoding issues.

{
   "device": {
      "gcs_bucket_name": "bugg-audio-dropbox",
      "project_id": "taiwan",
      "config_id": "a35c532"
   }, 

   "sensor": {
      "record_length": 300,
      "capture_delay": 0,
      "record_freq": 44100,
      "compress_data": true,
      "sensor_type": "I2SMic"
   },

   "mobile_network": {
      "hostname": "internet",
      "password": "pass123",
      "username": "user"
   },

   "type": "service_account",
   "project_id": "XXXX",
   "private_key_id": "XXXX",
   "private_key": "-----BEGIN PRIVATE KEY-----\nXXXX\n-----END PRIVATE KEY-----\n",
   "client_email": "XXXX",
   "client_id": "XXXX",
   "auth_uri": "XXXX",
   "token_uri": "XXXX",
   "auth_provider_x509_cert_url": "XXXX",
   "client_x509_cert_url": "XXXX"
}

Configuration parameters

General information

  • gcs_bucket_name: The name of the GCS bucket that you want audio to be uploaded to
  • project_id: A name for the project
  • config_id: A way to track device configurations (must be manually changed)

The values of project_id and config_id will be included in the filename of uploaded audio data on the remote server.

Audio recording parameters

  • sensor_type: "I2SMic" for the onboard MEMS mic, "ExternalMic" for external microphones
  • record_length: Audio file size (seconds)
  • capture_delay: Delay between recording audio files (seconds)
  • record_freq: Audio sampling frequency (Hz)
  • compress_data: Enable/disable MP3 VBR0 audio compression

The below extra parameters are only used for "sensor_type": "ExternalMic"

  • phantom_power: Phantom power mode ("PIP" = Plug in Power, "P3V3" = 3.3V on M12 Pin 4, "P48" = 48V)
    • Warning potential for high voltages, check compatibility before connecting microphone
  • gain: Sound card gain (0-20, 3dB steps)
  • amplification: Amplification factor (1.0 = no amplification)
  • enable_internal_mic: Record audio in two channels, one mapped to the internal and the other to the external microphone

The difference between gain and amplification is whether the audio is amplified at the sound card level, or after the file has been recorded. We recommend "gain": 10 and "amplification": 1.0.

See the audio page for more detail on Bugg audio specifications.

Mobile internet settings

These settings are specific to both the network provider and mobile data plan used by the nano SIM.

  • hostname: APN hostname
  • username: APN username
  • password: APN password

They can easily be found by searching online (e.g., "Vodafone UK pay monthly APN settings"), or by inserting the SIM card into a phone and finding the APN details in the relevant settings page of the phone OS.

Some mobile providers do not require APN usernames and/or passwords. For these, delete the unused parameters in the config.json file (e.g., "username" and/or "password") so the relevant part of the configuration looks like:

"mobile_network": {
   "hostname": "internet"
},

See the connectivity page for more details on mobile internet settings.

Remote server details

Bugg devices upload audio data to a Google Cloud Storage bucket. The authentication details in the configuration file allow the Bugg to write data to the bucket through a service account.

Once you have set up a GCS bucket and a service account with the required permissions, create a new service account key on the GCS console and download it as a JSON file.

From the service account key, copy the fields type, project_id, private_key_id, private_key, client_email, client_id, auth_uri, token_uri, auth_provider_x509_cert_url, and client_x509_cert_url to the Bugg configuration file.