Debugging Sensors and the Gateway

created by hek , updated by mfalkvidd

You may run into some weird problems when you start building your own sensors. We've tried to keep a list of common problems an solutions here.

  • Are you using the latest stable MySensors library version on EVERY sensors AND the gateway? Does the Controller plugin version match the library version?
  • Are you really using a genuine NRF2401+? Sometimes ebay sellers send out the none-plus version or HopeRF RFM73 clone.
  • Triple-check the radio wiring.
  • Check the power to the radio module. It requires a stable 3.3V power source. Try adding a decoupling capacitor over the 3.3V and GND pins to minimize the ripple. Choose a cap around 47uF with low ESR if possible. Check polarity of capacitor. Or switch to a ceramic variant.
  • Try switching to another power source. Some cheap USB chargers give very poor output.
  • Powereing your sensor through your computes USB port? Make sure it has enough juice. Especially when using amplified radio version.
  • Keep leads between Arduino and radio short. If possible, skip the dupont cables and mount things closely on a prototype pcb board.
  • If you're using an amplified version of the NRF24L01+ chip (with an external antenna) and experience communication problems you could have problem feeding it with enough power. Try bypassing Arduinos relulator by feeding it directly from a 3.3v power source. You can also try adjusting (lowering) the PA level. This is done by adding parameters to the begin() method or editing MyConfig.h before uploading sketch to the problematic sensor node. Note that PA level does not affect the receive sensitivity. See the MySensors Library API for more information.
  • Some have reported big differences in reception based on the orientation of the radio.

Enabling Debug and Monitoring the Logs

To enable debug messages in the examples and the gateway, you need just add #define MY_DEBUG in the sketch before including MySensors.h.

After you have enabled debugging, connect your sensor or gateway via USB to your computer (like you are uploading a sketch). From the Arduino IDE, select the correct Port from the Tools menu then open the Serial Monitor to view the debug messages. Note: the default Baud Rate for MySensors is 115200

The sensor will print debug messages when sending and receiving data over the radio network. This if very useful information for diagnosing a problem in your setup.

In Summary:

  • Build and upload the sketch with the above debug flag enabled in MyConfig.h.
  • Keep the sensor connected to your computer and enable the Serial Monitor in the Arduino IDE. Tools>Serial Monitor.
  • Set the baud-rate to 115200.

Debug message format

Debug messages will look like this:

0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.0.1-beta
0;255;3;0;9;TSM:INIT:TSP OK
0;255;3;0;9;TSM:INIT:GW MODE
0;255;3;0;9;MCO:REG:NOT NEEDED
0;255;3;0;9;MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1

The Transport messages (TSM & TSF) are described here.

The MySensors Core messages (MCO) are described here

Confirm the "Sent successfully" messages on the sending side. On the receiving side (gateway) check that the message arrives and that CRC checksum (cr) is the same as the sending sending side.

Clearing EEPROM

Your sensors contains a small static memory (EEPROM). This will hold information about the unique id of your sensor and routing information. On rare occasions you might need to clear this memory back to the factory default.

To clear the EEPROM memory, upload the following sketch to your sensor or gateway (and wait 20 seconds).

 * The MySensors Arduino library handles the wireless radio link and protocol
 * between your home built sensors/actuators and HA controller of choice.
 * The sensors forms a self healing radio network with optional repeaters. Each
 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
 * network topology allowing messages to be routed to nodes.
 * Created by Henrik Ekblad <[email protected]>
 * Copyright (C) 2013-2015 Sensnology AB
 * Full contributor list:
 * Documentation:
 * Support Forum:
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 * This sketch clears radioId, relayId and other routing information in EEPROM back to factory default
// load core modules only
#define MY_CORE_ONLY

#include <MySensors.h>  

void setup()  
  Serial.println("Started clearing. Please wait...");
  for (int i=0;i<EEPROM_LOCAL_CONFIG_ADDRESS;i++) {
  Serial.println("Clearing done. You're ready to go!");

void loop()      
  // Nothing to do here...

More Troubleshooting Tips

You can get more troubleshooting tips here or by watching the following video.