Configuration

The Debuggoid must be configured with a valid WiFi connection and MQTT broker. This tutorial details how-to send a configuration via commands sent to the debuggoid via to the ESP8266’s UART.

Prepare the serial connection

To configure the Debuggoid, you need a 3.3V-TTL serial port, like a 3.3V USB-UART data cable with a FTDI converter.

  1. Connect a 3.3V USB-UART data cable connected to the pins GND/TX/RX. Power can also be provided by connecting the 3.3V pin. For more details on the pinout, see the Debuggoid page.
  2. Identify the correponding port: typically /dev/ttyUSB0 or /dev/ttyACM0 on GNU/Linux, COM5 on Windows systems
  3. Power-up or Reset the Debuggoid

Configuration

General format

Commands are JSON objects in the following format:

1
2
3
4
{
    "command":"cmd",
    "payload": JSON_OBJECT
}

where cmd is a command in:

  • help: print help,
  • config: debuggoid configuration,
  • reboot: reboot the module,

The JSON string can be sent in a 1-line format, without newline chars nor indentation. The JSON string can be sent:

  • by connecting the 3.3V USB-UART data cable connected to the pins GND/TX/RX (and no target connected to the SWD port),
  • by the target connected via the SWD cable.

Send a configuration to the debuggoid

The debuggoid is configured via the config command. The following JSON illustrate all the parameters available:

1
2
3
4
5
6
7
8
9
{
    "command":"config",
    "payload":{
        "ssid":"testbed",
        "pass":"WPA_password",
        "hostname":"debuggoid1",
        "broker":"broker-test.mqtt.org"
    }
}

Sending an empty payload dumps the configuration:

1
2
3
{
    "command":"config",
}

To change few parameters, you can limit the payload field. For example, to adjust only the wifi parameters:

1
2
3
4
5
6
7
{
    "command":"config",
    "payload":{
        "ssid":"testbed",
        "pass":"WPA_password",
    }
}

If you do not have a 3.3V USB-UART data cable, the target can be used to send a new configuration to the Debuggoid. For example, the following Arduino sketch reconfigures the MQTT broker:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
void setup()
{
  Serial.begin(115200);
  delay(1000);
  Serial.println("{ \"command\":\"config\", \"payload\": \
                  { \"broker\":\"lab.iut-blagnac.fr\" } }");
}

void loop()
{
}