Debug / FAQ and how ask for help.


  • Admin

    People asking questions here on MySensors is generally good at it. But for the newcomers it can be good to have a small guide on how to debug and then some things how to improve your chances of getting help.

    Debug

    This flowchart shows the most common problems a newcomer may experience. Try to follow the flowchart if you find your problem. Read the most common actions and also read the FAQ below.

    0_1454445050795_Debug.jpg

    FAQ

    #1:1 How do I debug my sensors/gateway?
    Enable DEBUG in MyConfig.h, re-flash the sketch and look in the Serial Monitor.

    #2:1 Why should I use a capacitor?
    The NRF24L01+ is very sensitive to power spikes, a capacitor may help in smoothing these spikes out. Start with a capacitor of 4.7uF across the radio's 3.3V and GND.

    #2:2 What does ST:Fail/ST=Fail means?
    "st=fail" means the receiving node or gateway has problems sending ack back to the sending node.
    Its probably a hardware issue (power and/or range). Try adding a capacitor (http://www.mysensors.org/build/connect_radio#connecting-a-decoupling-capacitor) to the receiving radio, change powersource, move receiver/sender closer to eachother or build a repeater.

    #2:3 I get "Radio init fail"
    Radio init fail means

    1. Not wired correctly
    2. Not powered correctly
    3. Not a nrf24 with +

    Do you have a capacitor between gnd/vcc on the 3.3v radio? This can make difference... Some reading regarding + and not + Nrf modules.
    http://forum.mysensors.org/topic/1153/we-are-mostly-using-fake-nrf24l01-s-but-worse-fakes-are-emerging/4
    http://forum.mysensors.org/topic/1664/which-are-the-best-nrf24l01-modules/2

    #2:4 I only get Find parent in serial log for node
    Find parent means the node is trying to find its way to the gateway - and if this repeats it cant.
    Its either a range issue or a power issue. You can start by checking the gateway serial log and see if there is any info.
    Also, have you added a capacitor on the radios? This is very important since the radio is sensitive to power spikes.

    It this doesnt work start with changing the power source and check your wirings / ground connection on the node.
    Also you can try to move the node closer to the gateway - if this works and you have some distance between node and gateway you should consider a repeater.

    #3:1 My relay isnt working - why?

    • The radio is very power sensitive and it can help adding/changing caps GND/VCC on the radio. 4.7uF is recommended but you can also add higher or lower and even parallel.
    • How you wire the ground from the relay can also make a difference. I have had relays jamming when i ran ground trough the Arduino and not straight to source. Also the opposite that it dint work well if I dint have ground through the Arduino.
    • Range, when you send a on-command there is a ack going back which needs to be ok ("Error sending command, check device/hardware" message in Domoticz). Follow your serial logs in node and gateway to find out if the radio traffic is ok - and put a repeater in between if necessary.
    • Power - I have had Pro Minis that was a little to weak to trigger the relay... :( When the arduino didnt put enough juice out some tries resulted in a unsuccessful relay switch even if the logs told me so. To test this you can upload a sketch doing nothing else but setting the pin to high and low with a delay in between.

    Correct log for node (standard relay sketch, node ID = 4) when incoming command from controller.
    read: 0-0-4 s=1,c=1,t=2,pt=0,l=1,sg=0:1
    send: 4-4-0-0 s=1,c=1,t=2,pt=0,l=1,sg=0,st=ok:1
    Incoming change for sensor:1, New status: 1

    How to ask for help

    1. Use a meaningful, specific topic header.

    2. Specify your environment:
      Arduino IDE version? OS?
      Which Arduino Library are you running?

    3. Post the code your having problem with and make sure the code is formatted correctly. You can either enclose the source code in 4 "backtick" characters ```` or write 4 spaces first on each line of code.

    4. What is your sensor and gateway debug logs showing? Enable DEBUG in MyConfig.h and look open the Serial Monitor. You can get some hints on how to interpret it here or by using the log parser tool.

    5. How do you power your sensor/gateway? The NRF-radios is very sensitive to power spikes and transients. 90% of communication problems can be resolved by replacing a bad transformer or adding a decoupling capacitor to your radio.

    6. What are the symptoms? Describe the research and diagnostic steps you've done before asking the question. If possible post an example on how to reproduce the problems you've encountered.

    For a more comprehensive guide. Have a look here:
    http://www.catb.org/esr/faqs/smart-questions.html

    Troubleshoot the debug output: use the log parser tool.

    (courtesy of @martinhjelmare from this thread)

    From the source code in the dev branch: link

    s = sensor id
    c = message type 0-4: presentation, set, req, internal or stream. See link
    t = value type: S_VALUE during presentation or V_VALUE during set/req
    pt = payload type: string, byte int, etc. See link
    l = message length
    sg = signed or unsigned message: 0 or 1 for false or true

    0;0;3;0;9 means node 0 , sensor 0, internal message (3), not an ack message (0), log message (9). This means that it's the gateway that prints this info as a log after already having received the message from a node.

    At the end you have the payload: 27

    Similarly for a sent message: link

    General tip

    Start small! If you are having problems with your node - exclude everything (make your code as small as possible) in your sketch and only include the MySensors library. Same for the components - only add minimal needed!
    Upload and debug through serial line. Does it work? Great - add ONE function (analogread and one sensor for example). Upload and debug through serial. Continue until you find that it does not work anymore. Now you know which part is causing you trouble. This is much better than trying to debug a big sketch with a lot of functions and components that might interfere with each other.


  • Admin

    Hi Everyone,

    I made a quick video to share some of the things I've learned when troubleshooting issues. I’m not an expert and this is by no means an all-inclusive troubleshooting guide but hopefully it will give you some tips that will help you get to the root of the problem you’re experiencing.

    MySensors Troubleshooting Tips – 13:32
    — Pete B


  • Mod

    Troubleshoot the debug output

    (courtesy of @martinhjelmare from this thread)

    From the source code in the dev branch: link

    s = sensor id
    c = message type 0-4: presentation, set, req, internal or stream. See link
    t = value type: S_VALUE during presentation or V_VALUE during set/req
    pt = payload type: string, byte int, etc. See link
    l = message length
    sg = signed or unsigned message: 0 or 1 for false or true

    0;0;3;0;9 means node 0 , sensor 0, internal message (3), not an ack message (0), log message (9). This means that it's the gateway that prints this info as a log after already having received the message from a node.

    At the end you have the payload: 27

    Similarly for a sent message: link


  • Mod

    For reading debug output for MySensors 2.0 (starts with TSP/TSM), see this great post by @tekka and the doxygen documentation at https://ci.mysensors.org/job/Verifiers/job/MySensors/branch/development/Doxygen_HTML/group__MyTransportgrp.html#details

    EDIT: Or even better, use the awesome online log parser tool.



  • Hi!

    Thanks for Your troubleshooting guide. For a newbie (like me) it's really appreciated! :)

    A newbie question: Why do You use a 4.7 µF capasitor and on the page for connecting the radio (https://www.mysensors.org/build/connect_radio) they use a 47µF capasitor (10 times bigger)?

    /Pellus


  • Hardware Contributor

    @pellusfromtellus - its a typo... mostly I use a 4.7uF but to be honest im not sure which is the "recommended".



  • @sundberg84: Tks for answering! :)


  • Mod

    @pellusfromtellus thanks for noticing. I've updated the connect radio page, hopefully it is a bit clearer now.

    @sundberg84 nice profile picture. Great to get a face for you :)



  • I just checked my sensors and I'm using 470µF.
    Shows to go you really should check what you grab from a bag of capacitors ;)



  • "Error sending command, check device/hardware"
    

    I had oxidized dupont wires between radio and arduino. Good thing to check if your sensors lives outside!


  • Mod

    I have updated the instructions above with references to the new awesome online log parser tool created by @hek. https://www.mysensors.org/build/parser


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.