"Check Wires!!!" - N00B needs some help (please)



  • Hi there everyone.

    Firstly - Thank you for taking the time to read this and potentially offer me some guidance..

    Secondly - I am a newb when it comes to MySensors - I think this is a great project and I look forward to assisting the community with this project in the future.

    **My Problem
    **
    I've (Almost) successfully managed to build an MQTT Gateway ( I had it "Started!" and managed to ping the IP and connect to it with OpenHAB for about 30 minutes, now it wont start again, but thats not my current problem. ).. Once I managed success with the Gateway, I moved on to building a sensor....

    No matter what configuration I try I ALWAYS, ALWAYS, ALWAYS get the message "check wires".. I've tried many things including:

    • Different wireless modules ( I have 3, and I've even tried the one thats currently working on the gateway ).
    • Different pin-out configurations
    • Enabled / Disabled SOFTSPI ( Currently Enabled in my IDE Libs)
    • Checked the pinouts 100 times and even re-did them from scratch at least 3 times...
    • Enabled / Disabled SOFTSPI

    Essentially, I am at a loss of what to do next.

    • I have enabled SOFTSPI, is there anything special I need to do with regards to enabling/using it with the sensors?
    • I have all the latest Libs from MySense
    • Is there extended Debug I can enable?

    Environment:

    Arduino: Arduino Nano V3
    Controller: MQTT by OenHab
    Senesor: Distance sensor


  • Admin

    which ethernet module?
    It worked for 30 minutes you say... Sure you didn't overfeed eth or radio? Might take a while until it fries..


  • Hero Member

    You should only need softspi with something like the ethernet gateway as described here: http://www.mysensors.org/build/ethernet_gateway#wiring-things-up

    It requires different radio connections in this case so as not to interfere with the ethernet module.

    You should not be using softspi with the sensor setup. If you have a check wires message you probably have a radio power problem (did you try a capacitor across the ground/power connections of the radio). Your power supply may not be strong enough to meet the peak power requirements of the radio. Or lastly, the wires are not hooked up properly. Would definitely recommend you not use softspi on the sensor side.



  • @hek Thank you for the response.

    I've properly enabled the softspi now and updated the power as you mentioned, the gateway seems to now be working, or at least its reporting "Started!" and I can ping / telnet to the MQTT server.

    Now I am working on a distance sensor as my first sensor. It too says its working, and I see the V_DISTANCE value's being spit out at the serial console on the sensor itself, but It doesn't appear that the gateway is receiving any of the data.

    In order to get the sensor working I've had to change the Bit Rate to 2MB as per the thread here:
    http://forum.mysensors.org/topic/728/radio-setup-give-check-wires/30

    I changed the bitrate in the MyConfig.h
    #define RF24_DATARATE RF24_2MBPS

    If I do this, does this change the bitrate for the MQTT gateway as well? or is there somewhere else I would need to change it?
    I've grep'd the code for RF24_2MBPS and cant seem to find anywhere else..

    If they are both running at 2MB, they should be talking to each other.. correct?

    Thank you in advance and sorry for the long post.


  • Admin

    Yes, same speed on all devices is needed.



  • OK - I have it all worked out!!!

    For the N00BS who would like to not have to spend 3 days reverse engineering the code.. Here are some key tidbits that I couldn't find documented anywhere..

    1: Enable on the gateway for MqTT or Ethernet GW

    To do this you need to uncomment the line below in utility/RF24_config.h:

    //#define SOFTSPI   // Requires library from https://github.com/greiman/DigitalIO
    

    You only uncomment this line, DO NOT UNCOMMENT SPI_UART as well ( This caused me a days worth of trying to work out what I did wrong )

    IMPORTANT: This file effects the entire library, so if you enable this it effects your sensors as well.

    2: Wire for SOFTSPI
    Because you've now just enabled SOFTSPI, you need to wire your project accordingly. The default wiring diagrams that are noted everywhere are not valid anymore..

    the code is now using the following changes:

     //These are default, but you can change them if you like:
     const uint8_t SOFT_SPI_MISO_PIN = 16;
     const uint8_t SOFT_SPI_MOSI_PIN = 15;
     const uint8_t SOFT_SPI_SCK_PIN = 14;
     const uint8_t SPI_MODE = 0;
    

    3: Validate your radios

    The best thing to do once you've wired up your radios is to dump out the config. This will allow you to validate the wiring is correct and let you know if you've done anything wrong.

    The best way to do this is to add a RF24::printDetails(); line into MySensors.cpp like this:

    open the MySensors.cpp file and locate the line that looks like this:

     MySensor::setupRadio(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate)
    

    at the bottom of the block add RF24::printDetails(); like this:

    void MySensor::setupRadio(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate) {
        failedTransmissions = 0;
    
        // Start up the radio library
        RF24::begin();
    
        if (!RF24::isPVariant()) {
                debug(PSTR("check wires\n"));
                while(1);
        }
        RF24::setAutoAck(1);
        RF24::setAutoAck(BROADCAST_PIPE,false); // Turn off auto ack for broadcast
        RF24::enableAckPayload();
        RF24::setChannel(channel);
        RF24::setPALevel(paLevel);
        RF24::setDataRate(dataRate);
        RF24::setRetries(5,15);
        RF24::setCRCLength(RF24_CRC_16);
        RF24::enableDynamicPayloads();
    
        // All nodes listen to broadcast pipe (for FIND_PARENT_RESPONSE messages)
        RF24::openReadingPipe(BROADCAST_PIPE, TO_ADDR(BROADCAST_ADDRESS));
        RF24::printDetails();
    }
    

    If the output shows all 0's or all FF's, then your wiring is in-correct and the radio is not initializing correctly.

    4: You've done all this, but you're still receiving an error check wires:

    This either means you've not initialized the board correctly and the wiring is still incorrect OR you have a non-Plus radio ( RF24L01 vs RF24L01+ )
    To check this, comment out the while(1) line in the MySensors.cpp file like this:

        if (!RF24::isPVariant()) {
                debug(PSTR("check wires\n"));
                //while(1);
        }
    

    This will alow the initialization to proceed if the device is not a plus version, this way the printDetails() code you've added will be triggered and you can continue to investigate.

    IMPORTANT NOTE:

    The printDetails() output will only show that you have a plus version of the radio if its wired correct and is initializing. If its not initialized, it will not show the proper version of the radio. I had this and spend a day updating code to support a different data rate when it was un-necessary.

    Hopefully this is helpful information and thank you everyone who chipped in some info to giude me to these conclusions..

    Admins: I would highly recommend you guys explain the SOFTSPI bits within the documentation for the Ethernet/MqTT gateways - If it was documented well I think i would have had a lot less trouble. Just my 2 cents. 🙂


  • Admin

    The ethernet build page describes how to use SoftSPI (with a reference from MQTT page). Please clarify what is missing.

    http://www.mysensors.org/build/ethernet_gateway



  • @hek Its missing the note that once you enable SOFTSPI the default sensor documentation is wrong, and that you either need to maintain two versions of the MySensors library or wire your radio the same as the gateway. My issue was that I wired the sensors the same as the documentation in the sensors docs and it doesnt work because SOFTSPI is enabled.

    Alternatively, there should be a IS_GATEWAY defined for gateway code that enables SOFTSPI by default or move the SOFTSPI definition into the gateway code , then the documentation could in fact be correct.



  • @Squint said:

    //These are default, but you can change them if you like:
    const uint8_t SOFT_SPI_MISO_PIN = 16;
    const uint8_t SOFT_SPI_MOSI_PIN = 15;
    const uint8_t SOFT_SPI_SCK_PIN = 14;
    const uint8_t SPI_MODE = 0;

    Can you explain which are the corresponding pin for an arduino UNO. An image would help noobs like me who have spend almost a week to make this work.


  • Admin

    A0 = 14
    A1 = 15
    A2 = 16
    A3 = 17
    ...



  • I am getting check wires when I start the serial monitor on mac arduino ide whereas the same code works on linux(mint 17) without any change. Both are running 1.0.6 ide.

    Is this a known issue with mac?



  • Arduino Pro Mini 328p/ 5v
    Change _SPI.setClockDivider(SPI_CLOCK_DIV2); RF24.cpp to DIV4


Log in to reply
 

Suggested Topics

  • 3
  • 8
  • 1
  • 2
  • 5
  • 6

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts