[SOLVED] Problems with Ethernet Gateway (Arduino Ethernet Shield)
-
I we tried allot of different sources of power, this was the firs thing I did. I have a stupid question to. The radio connection are the same even if I use soft_spi right? Or should also the radio be connected to the 3 analog pins?
-
For normal sensors you should probably run with the hardware SPI. So yes. disable it when gateway has been compiled and flashed.
-
Found the problem. It was actualy this coment that made do the setup completely wrong:
@BulldogLowell said:
@niccodemi said:const uint8_t SOFT_SPI_MISO_PIN = 15; const uint8_t SOFT_SPI_MOSI_PIN = 14; const uint8_t SOFT_SPI_SCK_PIN = 16;and these are the correct pinouts for my Arduino Ethernet Shield, correct?
This is moving the SPI communication between the Uno and the shield off to another set of pins, and we are leaving the radio pins on hardware SPI?
So from this I had moved the Ethernet SPI pins to the allocated SOFT_SPI pins and not the radio pins like I was supposed to. @Dan-S did correct Jim but somehow I missed that part.
-
Found the problem. It was actualy this coment that made do the setup completely wrong:
@BulldogLowell said:
@niccodemi said:const uint8_t SOFT_SPI_MISO_PIN = 15; const uint8_t SOFT_SPI_MOSI_PIN = 14; const uint8_t SOFT_SPI_SCK_PIN = 16;and these are the correct pinouts for my Arduino Ethernet Shield, correct?
This is moving the SPI communication between the Uno and the shield off to another set of pins, and we are leaving the radio pins on hardware SPI?
So from this I had moved the Ethernet SPI pins to the allocated SOFT_SPI pins and not the radio pins like I was supposed to. @Dan-S did correct Jim but somehow I missed that part.
-
@korttoma said:
and these are the correct pinouts for my Arduino Ethernet Shield, correct?
No, this is the new pinout for the radio. Radio uses SoftSPI and the ethernet uses the good old hw SPI..
@hec that was what I was trying to explain with my post also. It was an earlier post by Jim that got me to do the setup incorrectly.
-
@korttoma No, the whole point of using SOFT_SPI is that you use different pins. The reason is that the W5100 "hogs" the SPI interface, so if you cannot access SPI_EN on W5100 then you cannot share SPI pins with W5100.
@Anticimex said:
@korttoma No, the whole point of using SOFT_SPI is that you use different pins. The reason is that the W5100 "hogs" the SPI interface, so if you cannot access SPI_EN on W5100 then you cannot share SPI pins with W5100.
Sorry for being confusing. The SOFT_SPI feature affects the RF module, not the W5100 module. Sorry for being unclear on that point.
But the reason for having SOFT_SPI is because of the W5100 modules violation of SPI praxis.
So; when using SOFT_SPI, RF module needs to be wired differently. -
Just to make things a bit more clear for the next guy with a W5100 module that wants to use the SOFT_SPI :
download Master library 1.4.1
Patch file RF24_config.h (xxxx\MySensors\utility) to enable softspi,
uncomment (remove //) #define SOFTSPI
and change pin numbers as below:
const uint8_t SOFT_SPI_MISO_PIN = 15; const uint8_t SOFT_SPI_MOSI_PIN = 14; const uint8_t SOFT_SPI_SCK_PIN = 16;Connecto radio and Ethernet module according to this:

start arudino ide 1.5.8, open Ethernet Gateway sketch and amend/add below lines
add this line: #include <DigitalIO.h>
comment UIPEthernet.h (//#include <UIPEthernet.h>)
uncomment Ethernet.h (#include <Ethernet.h>)
and choose IP address
-
Just to make things a bit more clear for the next guy with a W5100 module that wants to use the SOFT_SPI :
download Master library 1.4.1
Patch file RF24_config.h (xxxx\MySensors\utility) to enable softspi,
uncomment (remove //) #define SOFTSPI
and change pin numbers as below:
const uint8_t SOFT_SPI_MISO_PIN = 15; const uint8_t SOFT_SPI_MOSI_PIN = 14; const uint8_t SOFT_SPI_SCK_PIN = 16;Connecto radio and Ethernet module according to this:

start arudino ide 1.5.8, open Ethernet Gateway sketch and amend/add below lines
add this line: #include <DigitalIO.h>
comment UIPEthernet.h (//#include <UIPEthernet.h>)
uncomment Ethernet.h (#include <Ethernet.h>)
and choose IP address
@korttoma Good overview. Actually, it is also possible to skip the IP address and use DHCP. Works just fine (though obviously you need a router that assignes a known IP to your chosen MAC, since the controller needs to know the IP of the GW.
-
Just to make things a bit more clear for the next guy with a W5100 module that wants to use the SOFT_SPI :
download Master library 1.4.1
Patch file RF24_config.h (xxxx\MySensors\utility) to enable softspi,
uncomment (remove //) #define SOFTSPI
and change pin numbers as below:
const uint8_t SOFT_SPI_MISO_PIN = 15; const uint8_t SOFT_SPI_MOSI_PIN = 14; const uint8_t SOFT_SPI_SCK_PIN = 16;Connecto radio and Ethernet module according to this:

start arudino ide 1.5.8, open Ethernet Gateway sketch and amend/add below lines
add this line: #include <DigitalIO.h>
comment UIPEthernet.h (//#include <UIPEthernet.h>)
uncomment Ethernet.h (#include <Ethernet.h>)
and choose IP address
I'm happy to see you have it working and nice job with the table, I think it caps off the whole thread.
It would be nice to see this setup as one of the detailed instructions on the main MySensors webpages.
@Anticimex, great to see the contribution!
-
Is it possible to use soft SPI for ethernet module and keep the original wiring for radio module?
-
Is it possible to use soft SPI for ethernet module and keep the original wiring for radio module?
-
@korttoma Good overview. Actually, it is also possible to skip the IP address and use DHCP. Works just fine (though obviously you need a router that assignes a known IP to your chosen MAC, since the controller needs to know the IP of the GW.
@Anticimex said:
it is also possible to skip the IP address and use DHCP
So what do I need to change in the sketch to use DHCP?
-
@Anticimex said:
it is also possible to skip the IP address and use DHCP
So what do I need to change in the sketch to use DHCP?
-
@Anticimex Is there any advantage to using DHCP?
-
Wether you use DHCP reservation on your router, or set the IP in the sketch, you need a static IP. You are configuring that static IP in the MySensors configuration on your Vera (assuming you are using Vera).
-
There is an advantage in using DHCP.
- You do not have to recompile and reflash your GW if you for some reason need to change it.
- If you have an environment using DHCP, introducing a device that enforces a certain IP is very bad practice, and you should then make sure your DHCP server make sure to not assign any device the same IP. Consequently, since the controller needs to know the IP of the GW, when DHCP is used, the DHCP server needs to statically tie the IP in question to the MAC the GW uses. But I think that is a much more sane solution in a network.
-
OK. So if I use DHCP and tell my router to reserve a particular address for my Gateway, operationally I won't notice any difference from directly assigning it as it is currently set up. But if I use DHCP I will be able to see it listed under "attached devices" on my router which is an advantage. With the current assignment, the router doesn't "see" my gateway. So I think I will try the DHCP route as an experiment because I like the idea of the router centrally managing and recognizing all of the network clients.
-
Converted my Ethernet gateway to a DHCP connection. Went without a hitch and is now listed in my Netgear's list of attached devices and operating normally. So far, so good.
-
I have now updated the ethernet sketch and instructions on www.mysensors.org to give a bit clearer instructions on how to use W5100 module and SoftSPI.
@hek said:
I have now updated the ethernet sketch and instructions on www.mysensors.org to give a bit clearer instructions on how to use W5100 module and SoftSPI.
greate! But you forgot one thing ;)
RF24_config.h
const uint8_t SOFT_SPI_MISO_PIN = 15; const uint8_t SOFT_SPI_MOSI_PIN = 14; const uint8_t SOFT_SPI_SCK_PIN = 16;