Arduino Mega + RelayWithButtonActuator sketch



  • Hi guys πŸ™‚

    First of all, I thank u very much for such a briliant site !
    I do at home overhaul, so I decided a few things to automate. I have Mysensors serial gw (Arduino Uno) connected to Raspbery Pi with Domoticz on it. With simple sketches it works like a charm (with Arduino Nano nodes). But not with my Arduino Mega 😞

    I'd like to make arduino mega node which will be connected to 16 channel (or more) relay board witch will controll lights all over my house. The perfect sketch for it is RelayWithButtonActuator (so I could control it both from standard buttons and Domoticz). And it works perfect with arduino nano board (I've tried unmodyfied sketch). I' cant even start with Mega because all I can get from it's serial port is "check wires" message...

    I know that Mega has diferent pinout then nano/uno/pro... but i've connected it like below

    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)

    But what with IRQ pin ? And should I change sth . in sketch file? I'm just getting started with all that Arduino stuff so thank u in advance for guiding me πŸ™‚ And sry for my English.


  • Admin

    Skip the IRQ if you want (we don't use it in the library currently).

    3v3 output on the mega is super junk. Try using a step down from the 5V rail to feed the radio.



  • nothing has changed



  • shouldn't I change sth in RF24_config.h ?


  • Hero Member

    Did you change the sketch according to the connected CSN/CE Pins?



  • What exactly should i change?


  • Hero Member

    http://www.mysensors.org/download/sensor_api_14#gateway

    You have to add CSN/CE Pin with the initialization.

    Something like:

    MySensor gw(8, 53);
    


  • Wow πŸ™‚ TimO thx a lot !!! it's alive πŸ‘ I've connected humidity and temp sensor for testing,



  • Ok, so as temperature/humidity sensor it works ok πŸ™‚

    But I can't get it to work as relay node.
    Rx led is blinking when I push the button but nothing else is happening (no affection @ relay).

    repeater started, id 0
    send: 0-0-0-0 s=255,c=0,t=18,pt=0,l=5,st=fail:1.4.1
    send: 0-0-0-0 s=255,c=3,t=6,pt=1,l=1,st=fail:0
    send: 0-0-0-0 s=255,c=3,t=11,pt=0,l=14,st=fail:Relay & Button
    send: 0-0-0-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0
    send: 0-0-0-0 s=1,c=0,t=3,pt=0,l=5,st=fail:1.4.1
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-0-0 s=1,c=1,t=2,pt=2,l=2,st=fail:0
    send: 0-0-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:```


  • As you can see in your messages the code "st=fail" means there is an issue.
    Did you install the decoupling capacitor like mentioned here

    As @hek mentioned the 3v3v output of a mega is (and I quote) "super junk" this might be the cause of your issue, the decoupling capacitor might just solve this (by the way it is always advisable to install these) but also the usage of a step down regulator so you can use the 5v rail to feed the radio could be necessary (in combination with the capacitor).

    I have had a Mega + radio running on it's 3v3 feed with only the capacitor installed but all depends of the quality of your components so hard to say that this is always a winning combination, but that would be my way to go.



  • Please, could you post your code? I canΒ΄t make my arduino mega work.


Log in to reply
 

Suggested Topics

50
Online

11.4k
Users

11.1k
Topics

112.6k
Posts