Gateway and nodes with RFM69HW radio

439 views
Skip to first unread message

NORBERT JÓNA

unread,
Nov 12, 2015, 10:39:58 AM11/12/15
to souliss
Hi,
I'd like to implement a home-automation with multiple media types. The gateway is a MEGA2560 board with ethernet shield(W5100) and a radio transmitter. The nodes are 4 ProMini boards with radio transmitter. During the first tests the transmitter was the NRF24L01+ . Worked, the SoulissApp found the node and all peers, but the range was very low (few meters).

To improve the range the transmitters changed to RFM69HW modules.The connection of the modules to the arduino boards is same as in MOTEINO, see below and the attached sketches.  After the modification of the sketches (#include "bconf/Moteino.h" ), the gateway and the peer freezes. Without gateway the peer works, reacts to the buttons. The gateway always freezes, but sometimes start to work for a while.

The "official" test of the RFM69 modules is working (https://github.com/LowPowerLab/RFM69 - Sample RFM69 receiver/gateway sketch, with ACK and optional encryption ), so the modules are OK.

GATEWAY connections

MEGA2560     ETHERNET sh             RFM69HW
MISO  ----------   MISO  -----------------------   MISO
MOSI  ----------   MOSI  -----  lev.conv.-----  MOSI
SCK   ----------   SCK    ----  lev.conv.------  SCK
SS     -----------  none    ----  lev.conv.------  NSS
D2     -----------  none   -------------------------  DIO0
D10    ----------  SS

D4    -- button1
D5    -- button2
D6    -- LED1
D7    -- LED2

PEER connections
ProMini             RFM69HW
MISO  --------------    MISO
MOSI  --lev.conv.---  MOSI
SCK   --lev.conv.---  SCK
SS    --lev.conv.---   NSS
D2    --------------      DIO0

D4..D7   ---  relay 1...4
D3,D9    ---  INPUT 1,2
A3       ---  4 button analog sense
A0(D14)  ---  DHT11 sensor
A1(D15)  ---  status LED
A4(SDA)  ---  BMP085
A5(SCL)  ---  BMP085

At this moment I have no idea about the solution...
Does somebody have an operational example for the RFM69HW in souliss (gateway + node)?

Thanks in advance
Best regards
Norbert Jona
rfm_gw_01.ino
rfm_pn_01.ino

Di Maio, Dario

unread,
Nov 14, 2015, 5:52:31 AM11/14/15
to sou...@googlegroups.com
Hi Norbert,

my bad, the wiki was wrong. The Atmega2560 is not supported in the Moteino drivers that we are using, so you should use a different AVR or update the library to support the 2560.


Regards,
Dario.

NORBERT JÓNA

unread,
Nov 16, 2015, 2:29:49 AM11/16/15
to souliss
Hello Dario,

Thanks for youre reply.
If I see well, just the interrupt pin and number definitions are missing from the "\souliss\frame\vNet\drivers\mcu_avr\RFM69\src\RFM69.h" for the Mega2560. Are there any other requirements?

Another idea:
Is it possible to define two gateways within a souliss network? One "sub-gateway" for the RFM69 nodes which is connect to the "main-gateway" by RS485...

Di Maio, Dario

unread,
Nov 17, 2015, 1:38:43 AM11/17/15
to sou...@googlegroups.com

Hi,

yes the interrupt are missing. You can have only one Gateway but as many SuperNode as you want.

The SuperNode can bridge from Ethernet to RF and another SuperNode can bridge from Ethernet to RS485, so that RS485 and RF nodes can communicate.

Is it also possible to have a SuperNode with RF and Rs485 connected to a node with Ethernet and RS485.

If the node distance is short, you can use a connection between the USART.

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/218d7e76-edc4-4041-b5a6-6b244002d978%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rich Vincelette

unread,
Nov 22, 2015, 12:35:41 AM11/22/15
to souliss
I'm attempting to do something similar (to the first post) but using an UNO with a W5100 shield and an RFM69HW chip wired to it. I'm planning to use this as a bridge (supernode) to some Moteino sensors I have. I see on the souliss wiki that the SS pins need to be changed but I'm struggling with how to do this and how to define this in in the sketch. 

is what I'm trying possible? if so is there a basic sketch/wiring example that includes this?
Thanks again

Di Maio, Dario

unread,
Nov 22, 2015, 4:52:11 AM11/22/15
to sou...@googlegroups.com

You need to include the bconf/Moteino.h and conf/ethW5100 as configuration files on top of your sketch, this will setup the pins as per Connection page in the wiki.

Then wire accordingly and have a try.

Dario.

From Mobile.

NORBERT JÓNA

unread,
Nov 22, 2015, 6:45:27 AM11/22/15
to souliss
Hello Rich,
As Dario wrote you have to include the "bconf/Moteino.h" which is include the definitions for the RFM69 radio. You can find in the  "frame\vNet\drivers\mcu_avr\RFM69\src\RFM69.h": set the SS pin of the UNO (ATmega328P) as the NSS of the radio and the D2 pin as the interrupt (DIO0).
In the "\frame\vNet\drivers\mcu_avr\ethW5x00\src\w5x00.h" the SS definiton of the W5100 chip is changing to D7 in case of Moteino (BOARD_MODEL=0x0A defined in the bconf/Moteino.h)
So you have to follow this connection otherwise you should modify the libraries/headers.

I've built a gateway with a ProMini + an Ethernet shiled + an RF69MHW radio and a node with a ProMini and an RFM69HW for test. Dario suggested this, because the current libraries aren't support the ATmega2560 but the ATmega328P. It works with the described connections. And don't forget the level converter between the ATmega and the RFM69HW!!

Unfortunately the range is still very low, just few meters. It should be greater, because the penetrating capability of the 868MHz much better than the 2.4GHz (NRF24L01). I'm totally confused...

Best Regards
JN
ProMini_EthSh_RFM69HW_Connections.JPG

Di Maio, Dario

unread,
Nov 22, 2015, 10:38:04 AM11/22/15
to sou...@googlegroups.com

Hi Norbert,

yes 900Mhz has better range compared to 2.4 GHz but the range itself depends on the transmitter power.

Had a try with ESP8266?

Dario.

From Mobile.

Rich Vincelette

unread,
Nov 22, 2015, 2:16:22 PM11/22/15
to souliss
Thanks JN! this helped greatly!

Rich Vincelette

unread,
Nov 24, 2015, 2:12:45 AM11/24/15
to souliss
alright, 
I'm missing something, hopefully someone can see where i've gone wrong, I've wired the uno, w5100 shield, and RFM69HW as such:

UNO              ETHERNET shield             RFM69HW
MISO  (D11) ----------   MISO  -----------------------   MISO
MOSI  (D12) ----------   MOSI  -----  lev.conv.-----  MOSI
SCK  (D13)  ----------   SCK    ----  lev.conv.------  SCK
SS (D7)    -----------  none    ----  lev.conv.------  NSS

D2     -----------  none   -------------------------  DIO0
D10    ----------  SS 

the board is not ping-able like this... 

any further advise would be greatly appreciated, thank you!

/**************************************************************************
    Souliss - Zero Configuration
    modifiied to create an uno/w5100/RFM69HW gateway/supernode
    
***************************************************************************/

#include "bconf/Moteino.h"
//#include "bconf/StandardArduino.h"          // Use a standard Arduino

#include "conf/ethW5100.h"                  // Ethernet through Wiznet W5100
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
//#include "conf/Webhook.h"                   // Enable DHCP and DNS
#include "conf/DynamicAddressing.h"         // Use dynamic address
#include "conf/SuperNode.h"

// Include framework code and libraries
#include <SPI.h>
#include <EEPROM.h>
#include "Souliss.h"

uint8_t ip_address[4]  = {192, 168, 7, 30};
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4]  = {192, 168, 7, 254};
#define myvNet_address  ip_address[3]

#define LIGHT1                  0           // This is the memory slot used for the execution of the logic
#define LIGHT2                  1           

void setup()
{   

    Initialize();

    SetIPAddress(ip_address, subnet_mask, ip_gateway);
    SetAsGateway(myvNet_address); 

    
    Set_SimpleLight(LIGHT1);        // Define a simple LED light logic
    
    // We connect a pushbutton between 5V and pin2 with a pulldown resistor 
    // between pin2 and GND, the LED is connected to pin9 with a resistor to
    // limit the current amount
    pinMode(4, INPUT);                  // Hardware pulldown required
    pinMode(5, OUTPUT);                 // Power the LED
    
    // This node will serve all the others in the network providing an address
    SetAddressingServer();
}

void loop()
    // Here we start to play
    EXECUTEFAST() {                     
        UPDATEFAST();   
        
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds
            DigIn(4, Souliss_T1n_ToggleCmd, LIGHT1);            // Use the pin2 as ON/OFF toggle command
            Logic_SimpleLight(LIGHT1);                          // Drive the LED as per command
            DigOut(5, Souliss_T1n_Coil, LIGHT1);                // Use the pin9 to give power to the LED according to the logic
        } 
              
        // Here we handle here the communication with Android, commands and notification
        // are automatically assigned to LIGHT1
        FAST_GatewayComms();                                        
        
    }

NORBERT JÓNA

unread,
Nov 24, 2015, 2:58:08 AM11/24/15
to souliss
Hello Rich,

I think that the connections are wrong:

UNO                              ETHERNET shield             RFM69HW
MISO  (D11 -> D12) ----------   MISO  -----------------------   MISO
MOSI  (D12 -> D11) ----------   MOSI  -----  lev.conv.-----  MOSI
SCK  (D13)  ----------------------   SCK    ----  lev.conv.------  SCK
SS (D7 -> D10)    ---------------  none    ----  lev.conv.------  NSS
D2     --------------------------------  none   --------------------------  DIO0
D10 -> D7    -----------------------  SS 

see the attached picture in my previous post.

Best regards
JN

Rich Vincelette

unread,
Nov 24, 2015, 12:52:36 PM11/24/15
to sou...@googlegroups.com
hmmm I'll triple check the connections when i get home! 

the ethernet shield does work on it's own without the #bconf/Moteino.h line .. so it's known good. did you attach your ethernet shield as a shield or did you use jumper wires to wire it together? if ethernet is plugged in as a shield will the hardware know the SS pin has moved to D7? 

thanks again! I'll check my connections again after work
-Rich

--
You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/2Zx1k76yEFo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+u...@googlegroups.com.

To post to this group, send email to sou...@googlegroups.com.

NORBERT JÓNA

unread,
Nov 25, 2015, 1:44:38 AM11/25/15
to souliss
Hi Rich,

I'm using ProMini boards so my Ethernet shield connected by wires. In case of UNO and plugged/stacked ethernet shield, the SS pin of the W5100 is hard-wired to D10 (=PortB2 SSpin of ATMega328p). It is Ok if there is no RFM69 radio (bconf/Moteino.h not included). When you include the "bconf/Moteino.h" the connections are redefined by the libraries, because of the MOTEINO hardware, where the NSS pin of the RFM69 HARD-WIRED to the SS pin of the MCU. If you want to use another SPI device, you have to choose another pin for SS of the new device OR you can change the SS pin definiton of the RFM69 using the "radio.setCS( pin number)" after the "Initialize();". BUT IN YOURE CASE it is not a solution, because the "frame\vNet\drivers\mcu_avr\ethW5x00\src\w5x00.h" redefines the SS pin assignment of the W5100 if the BOARD_MODEL=0x0A (Moteino) to D7 (PortD7). So you should use wires or you should modify the libraries.

My next plan is to modify the RFM69 headers and libraries to a more flexible/configurable version by "_INSKETCH" statements. The current libraries are for the "official" MOTEINO boards with the "official" connections and not for the home made clones with unique connections (for example UNO+plugged ethenet shield + RFM69). Maybe a brand-new "bconf/****" header...

Best regards
Norbert Jona

Di Maio, Dario

unread,
Nov 25, 2015, 2:02:07 AM11/25/15
to sou...@googlegroups.com

Hi Norbert,

good point.

Using a shield keep the connection on pin 10 out, and replace it with a wire on the headers.

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.

To post to this group, send email to sou...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages