How to reset BLUZ DK from Gateway


I have an application where the DK units only talk to the Gateway (i.e. one way). However, I would like to use the Gateway to reset the Bluz units. Here is my code but the Bluiz units are not resetting.

Gateway Code:

void resetSensors()
//Sends a message to Reset ALL Sensors
  uint8_t rsp[2] = {'H', 'i'};
  for (int i = 0; i < 4; i++) {
    gateway.send_peripheral_data(i, rsp, 2);

Bluz DK code:

void dataCallbackHandler(uint8_t *data, uint16_t length) {
    sendData = true;

void setup
void loop()

 if (sendData)
        sendData = false;


Out of curiosity, how are you verifying that they are not resetting? If they rebooted when in local communication mode, they may reconnect very quickly. Are they connecting to the cloud?

The code looks correct, though I can’t see when the resetSensors function is called in the gateway. When are you actually calling that?


Thanks @eric.

The Bluz units send data periodically to the Gateway.

There are two reasons how I know:

  1. The Bluz units send to the Gateway a counter value which is not reset to zero.

  2. The led on the Bluz remains white.

On the Photon Gateway, I execute resetSensors right before System.reset.


Out of curiosity, why are you resetting the devices in this way?

You may want to add a small delay after you send the gateway.send_peripheral_data command to the bluz board, I imagine a few seconds should suffice. That command may block at the Photon level, but not at the gateway level. So the command may not get through before the gateway is reset.


Thanks @eric, inserting a delay resolved it.

The reason is that I need all Bluz restarted upon the restart of the Gateway to zero their contents.