Unable to use the SerialGateway code


  • Plugin Developer

    I had a good share of pain with the NRF24 modules and the SerialGateway code. I can happily load the ping test onto two pro mini 3,3V and they talk to each other just fine. When loading the SerialGateway code onto the 3,3V pro mini, it does not react on serial commands (e.g. 0;0;4;4; or 0;0;4;6;1). So I grabbed a 5V, loaded the gateway code on it, and voila, it responds to serial commands. But no RF comms, and when loading the ping example on the 5V pro mini, I get no replies. The NRF24 was powered from a TOE8852 lab power supply set to 3,3V in this case. That unit has very low ripple (this was also used for the successful ping test between the two 3,3V pro minis). Anyway, maybe something is b0rked with that combo, so I got an Arduino Mega. I tried to feed the radio off the 3,3V connector on the mega (with and without 4,7u cap). Same result, the gateway code works fine, but no RF. 3rd attempt with a shiny new Mega 2560.. but.. you guess it.. no luck. I've verified the 3,3V supply right on the NRF24 with a multimeter. I've swapped radios back and forth (got a lot of 10). SOoo.. a few questions:

    1. am I doing something stupid here without realising it?
    2. what is the recommended arduino to run the serial gateway code?
    3. why is the gateway code not working on a 328 pro mini 3,3V?

    I'd appreciate any hints before I fetch the analyser and the scope for further debugging..

    regards,
    Hari


  • Admin

    I have only verified the SerialGateway on the Nano board. But I see no reason why it wouldn't work on the Pro Mini 3.3.

    What are you expecting the serial command 0;0,4;4 to do? Send a command to sensor 0? That is the gateway itself and not a valid radioId.


  • Plugin Developer

    I've tried two different pro mini 3,3v boards, and the SerialGateway does not respond to serial commands on them. I expect 0;0;4;4; to reply the firmware version of the serial gateway. And it works fine on non-3,3V-pro-mini. The vera lua script is doing the same on startup:

    -- Request version info from Arduino gateway
    sendCommandWithMessageType("0;0","INTERNAL",tonumber(tInternalTypes["VERSION"][1]),"Get Version")

  • Admin

    Trying to pick up a chat session with you. look in the lower corner of the screen (or the chat bubble at the top right of the forum).


  • Mod

    Could this be "related" to my issue?
    I can't seem to get it working with an Uno board.
    I will do some more testing today.


  • Plugin Developer

    Things seem to work with the mega 2560 after realising that it has completely different SPI pins:

    pin D8-----------CE (chip enable in)
    SS pin D53----------CSN (chip select in)
    SCK pin D52----------SCK (SPI clock in)
    MOSI pin D51----------SDI (SPI Data in)
    MISO pin D50----------SDO (SPI data out)

    In the sketch I use this:
    Gateway gw(8, 53, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, 6, 5, 4);

    Dunno why the pro mini 5V is not working, but as I'm able to talk to a sensor already I probably won't dig further into that..

    2;0;1;0;26.1


  • Admin

    @hari

    Good to see you've had some progress.


  • Admin

    @hari

    I'm also trying to use a Mega as a node (not gateway) do you have any suggestions for that? I tried connecting the pins as you suggested above but it didn't work. I am still going to do some research but I thought I'd reach out to see if you (or anyone else) has already done this so I don't have to recreate the wheel.

    Thanks,

    Pete


  • Mod

    @petewill My problem with the uno's is that they are not (at) all sufficiently powered on the 3.3v pin. Very odd but if I were you I would test that first Pete...


  • Admin

    @marceltrapman Interesting. I'll test that tonight when I get home. Thanks!


  • Admin

    Got it to work! Not sure exactly what the problem was because it sort of started working by accident. I think it was either a bad connection between the radio and the Mega or else it had to do with the initial start up of the Mega or radio taking too long. Not sure if that's even possible but what seemed to fix it is starting the serial monitor (in the Arduino IDE). That seemed to reset the code but not the power. As soon as I did that the messages changed from saying a "relay not found" to this:

    Started sensor.
    Relay=0, distance=1
    No radio id found in EEPROM fetching one from sensor net gateway
    Relaying message back to gateway.
    Tx: fr=255,to=0,la=255,ne=0,ci=255,mt=4,ty=5,cr=136: 
    Ack: received OK
    Message available on pipe 1
    Sent ack msg to 0
    Rx: fr=0,to=255,la=0,ci=255,mt=4,t=5,cr=199(ok): 12
    Message addressed for this node.
    Radio id received: 12
    Radio id stored in EEPROM was: 12
    Relaying message back to gateway.
    Tx: fr=12,to=0,la=12,ne=0,ci=255,mt=0,ty=17,cr=30: 1.3b3 (960efcd)
    Ack: received OK
    Relaying message back to gateway.
    Tx: fr=12,to=0,la=12,ne=0,ci=255,mt=4,ty=7,cr=218: 0
    Ack: received OK
    Relaying message back to gateway.
    Tx: fr=12,to=0,la=12,ne=0,ci=3,mt=0,ty=1,cr=194: 1.3b3 (960efcd)
    Ack: received OK
    Relaying message back to gateway.
    Tx: fr=12,to=0,la=12,ne=0,ci=3,mt=1,ty=16,cr=63: 1
    Ack: received OK
    

    Once I got these messages I just started the Inclusion on the Vera side of things and closed/opened the serial monitor again and it found my sensors!



  • @hek : it happens that I have currently the same setup (3.3v mini pro as serial gw via FTDI); and am suffering from exactly the same symptoms (no reaction when I push commands to the GW). Reception, however, is ok. I plan to add a capacitor for the ripple; but given incoming reception is ok, I doubt it will make a difference?
    Needless to say that uploading the sketch works fine, and that upon writing the TX led flimmers.

    EDIT : nevermind, solved.


Log in to reply
 

Suggested Topics

  • 3
  • 8
  • 5
  • 2
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts