Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Building an Ethernet Gateway on an Arduino Mega

Building an Ethernet Gateway on an Arduino Mega

Scheduled Pinned Locked Moved Troubleshooting
31 Posts 16 Posters 29.4k Views 10 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MSchmidke
    wrote on last edited by
    #8

    Because the Ethernet shield breaks SPIs characteristics to be a bus. Once Ethernet shield is plugged onto Arduino, all other devices on SPI bus won't work anymore.

    This is documented at http://www.mysensors.org/build/ethernet_gateway#wiring-things-up and was true for mine: without ethernet shield, radio on 50/51/52 works perfect. With ethernet shield, radio on 50/51/52 won't work. The alternative SoftSpi is documented on the mentioned page, but A0/A1/A2 as written there will only work for classic Arduinos. The question was what to use instead of A0/A1/A2 on Mega, and I think 14/15/16 are the right ones.

    Marcus,

    1 Reply Last reply
    0
    • sj44kS Offline
      sj44kS Offline
      sj44k
      wrote on last edited by sj44k
      #9

      @MSchmidke I am going to try this asap and post my findings .. but sir .. could you please share with me (and the rest of the world ) how did you find out about these pins ? I love solutions but I crave to understand WHY :)

      But still if this works you deserve my everlasting respect for finding it and sharing !

      @Heinz
      Are you using an Arduino MEGA ? I guess you are not.

      [one hour later]
      Ok figures that you choose 14/15/16 on the mega :) the RF24config.h states :

      `      const uint8_t SOFT_SPI_MISO_PIN = 16; 
            const uint8_t SOFT_SPI_MOSI_PIN = 15; 
            const uint8_t SOFT_SPI_SCK_PIN = 14;  
      

      But having that said I still am not getting a reply on a ping when I ping the ethershield .. so we are close .. but not there yet :)

      I do get the

      0;0;3;0;14;Gateway startup complete.
      

      So that's further than I've been so far ..

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MSchmidke
        wrote on last edited by
        #10

        Oh it would have been really simple to find this config file ... but I didn't.

        I investigated the digital read of analog port. On classic Arduino, you can digitalRead(A0), for example. And I wondered what is behind that "A0" - and tadah it's 14 on classic Arduino. So I supposed there will be simply a 14 in SoftSPI code - et voilà it worked.

        What kind of ethernet related code do you have in your loop? I don't think you'll get a ping if you do not poll the Ethernet. But I'm not sure.

        Marcus.

        1 Reply Last reply
        0
        • sj44kS Offline
          sj44kS Offline
          sj44k
          wrote on last edited by
          #11

          I use the ethernet gateway example of this site, and I am absolutely 100% sure it does reply on ping as when I use the same code on my UNO with the same shield, I do get an reply.
          When switching the shield to the MEGA, and placing the pins on 14 15 and 16 nothing happens.

          Do you get a ping ?

          BulldogLowellB 1 Reply Last reply
          0
          • sj44kS sj44k

            I use the ethernet gateway example of this site, and I am absolutely 100% sure it does reply on ping as when I use the same code on my UNO with the same shield, I do get an reply.
            When switching the shield to the MEGA, and placing the pins on 14 15 and 16 nothing happens.

            Do you get a ping ?

            BulldogLowellB Offline
            BulldogLowellB Offline
            BulldogLowell
            Contest Winner
            wrote on last edited by
            #12

            @sj44k

            https://www.youtube.com/watch?v=jr0JaXfKj68

            1 Reply Last reply
            0
            • sj44kS Offline
              sj44kS Offline
              sj44k
              wrote on last edited by
              #13

              @BulldogLowell

              :)Hunt for the red october classic :)

              1 Reply Last reply
              0
              • barduinoB Offline
                barduinoB Offline
                barduino
                wrote on last edited by
                #14

                I have a similar issue with Adafruit CC3000 shield and a Mega.
                After much fidling around I finally got it to work.

                The Adafruit shiled is the same size of an Uno but when connected to a Mega it doesn't get the SCK, MOSI and MISO from the 13,11,12 pins, it gets them from the central connector ICSP as showed on the picture on this thread.

                So first step was to connect the wireless module to the ICSP.

                The second issue is the CSN and CE pins, these can't be connected to 10 and 9 since they are used by the shield. I've used 35 and 34.

                Adjust your code like this:

                #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                #define INCLUSION_MODE_PIN 32 // Digital pin used for inclusion mode button
                #define CE_PIN 35
                #define CS_PIN 34
                MyGateway gw(CE_PIN, CS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, 6, 5, 4);

                Even with this, some times I still get a check wires message, others just a bunch of errors about the version.

                This erratic behaviour led me to think about noise on the wireless receiver, so in goes a 10uF.

                Its stable now.

                On a side note I also changed the CE and CS pin assignments on the sensors...

                #define DIGITAL_INPUT_SENSOR 4 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
                #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
                #define CHILD_ID 1 // Id of the sensor child

                #define CE_PIN 9
                #define CS_PIN 53

                MySensor gw(CE_PIN,CS_PIN);

                // Initialize motion message
                MyMessage msg(CHILD_ID, V_TRIPPED);

                Cheers

                F 1 Reply Last reply
                1
                • sj44kS Offline
                  sj44kS Offline
                  sj44k
                  wrote on last edited by
                  #15

                  @barduino
                  Can you help me out here, I do not get your remark :
                  So first step was to connect the wireless module to the ICSP

                  As my Ethershield is using this, how will this work together with the radio and the ethershield connected to the same pins ?
                  My guess I am not getting exactly what you mean.

                  barduinoB 1 Reply Last reply
                  0
                  • sj44kS sj44k

                    @barduino
                    Can you help me out here, I do not get your remark :
                    So first step was to connect the wireless module to the ICSP

                    As my Ethershield is using this, how will this work together with the radio and the ethershield connected to the same pins ?
                    My guess I am not getting exactly what you mean.

                    barduinoB Offline
                    barduinoB Offline
                    barduino
                    wrote on last edited by barduino
                    #16

                    @sj44k

                    I dont know much about this so I aks for clarification if some of my notes are incorrect.

                    Not sure if you have the shield from adafruit. In my shield (WiFi and memory card) it is designed to be on top of an uno R3 (getting the sck mosi miso) from pins 13,12,11 or if on top of a mega (my case) it gets the sck, mosi and miso from those central pins (ICSP i think) and you have to solder some jumpers on the shield it self.

                    1428958756089-edited-mega2560_r3_label-small-v2-2.png

                    I took this image from your post

                    As I understand it sck, mosi and miso are intended to be shared. The problem comes with the SS/CS pin (slave select) which each device should have one.

                    In adafruit cc3000 shield this is pin 10 and pin 4 for the sd card. At least pin 10 conflicts with MySensors lib so I had to change this and connect the rf module to other pins (the icsp pins for sck mosi miso and cd pin to 53.

                    When I did this I stoped having check wires message. However when I included the code to connect to the wifi on the cc3000 it couldnt still connect.

                    I ended up disconnecting the mysensors rf module and tryied it with just the cc3000 code and it was behaving erratically, sometimes it connected others not... Is it damaged, is it power, in the end I just gave up, removed the cc3000 shield and connected the mysensors gw to a computer and used nodejs to call my REST service.

                    I'll get back to this some time, it should work....

                    The problem of buying a shield is that you cant change the pins to which it is connected to...

                    1 Reply Last reply
                    0
                    • sj44kS sj44k

                      I am trying to utilize all of my available Arduinos as best as I can, and having all sketches being developed on this site for the UNO my Arduino Mega seems to fit best in it's role as an Ethernet Gateway.

                      By this I am able to use my available UNO to do some more testing and playing around with the MySensor sketches without the need to modify my sketches like I did to do in the past

                      BUT, having that said this also exactly gives away my challenge :
                      Getting the Ethernet Gateway Sketch working on my Arduino Mega with a W5100 Ethernet Shield.
                      Issue is the pinout of a Mega's SPI interface is different than the UNO.

                      So the sketch is working easily on my UNO, but changing the shield and uploading the same sketch to my MEGA results in a non working Ethernet Gateway (debug modes states : check wires)
                      (I did uncomment the #define SOFTSPI line in the RF24_Config.h by the way)

                      Does anyone know which file / library I need to edit to change these pins ? I am using the W5100 shield not the module so I would prefer the shield installed as a is, and not use any jumper cables.

                      E Offline
                      E Offline
                      ewgor
                      wrote on last edited by ewgor
                      #17

                      @sj44k hi, may i ask if you need a NRF24L01 radio module in order to make this Ethernet Gateway work? I'm asking because i understood that for a Serial Gateway you need this module, other way you cannot test it!
                      My second question is if you made it i mean if you can read some sensors using the Ethernet W5100 and the Openhab server?
                      Thanks.
                      Forget the 1st question, i got it...
                      Could you please tell me if you made it with Arduino Mega and the Ethernet shield? which are the right pins that needs to be modified in the RF24_Config.h ?

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        ewgor
                        wrote on last edited by
                        #18

                        everybody in holiday here? nodoby answered on the serial gateway so im asking again here about the ethernet gateway if somebody can tell me/us which are the right pins that needs to be modified to start the ethernet gataway and to test it with openhab?

                        1 Reply Last reply
                        0
                        • hekH Online
                          hekH Online
                          hek
                          Admin
                          wrote on last edited by
                          #19

                          @ewgor said:

                          NRF24L01

                          The NRF or HopeRF RF69 module i central in the MySensors infrastructure as it is centralised around wireless sensors/actuators. Experimental code exist (https://github.com/mysensors/Arduino/tree/gateway-refactoring) which lets you attach sensors to the gateway (serial or ethernet) directly. But this is not documented on the main site yet so you should be comfortable to read up code yourself.

                          How to connect ethernet module (and modify configuration) is described on the main site. I haven't personally used a Mega as gateway myself. But I successfully used it as a sensor for the Touch Scene Controller.

                          1 Reply Last reply
                          0
                          • bruno araripeB Offline
                            bruno araripeB Offline
                            bruno araripe
                            wrote on last edited by
                            #20

                            hy guys,
                            i have a mega bord, and wiznet ethernet shield, and i want to use this whith ethernet getway. i try many configs, but nothing work. please help me.

                            B 1 Reply Last reply
                            0
                            • bruno araripeB bruno araripe

                              hy guys,
                              i have a mega bord, and wiznet ethernet shield, and i want to use this whith ethernet getway. i try many configs, but nothing work. please help me.

                              B Offline
                              B Offline
                              brakc
                              wrote on last edited by
                              #21

                              @bruno-araripe said:

                              hy guys,
                              i have a mega bord, and wiznet ethernet shield, and i want to use this whith ethernet getway. i try many configs, but nothing work. please help me.

                              Hy,

                              I have a same project and same problem.

                              please :sweat:

                              ;-)

                              1 Reply Last reply
                              0
                              • O Offline
                                O Offline
                                otto001
                                wrote on last edited by
                                #22

                                Did someone get the GW with mega and W5100 working????

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  afick
                                  wrote on last edited by
                                  #23

                                  Hello,

                                  Any update ?

                                  1 Reply Last reply
                                  0
                                  • TD22057T Offline
                                    TD22057T Offline
                                    TD22057
                                    Hardware Contributor
                                    wrote on last edited by
                                    #24

                                    Did you try resetting the board after power on? I guess there are some boards that have issues and need a reset after power on before anything works. See the links in this post: http://forum.mysensors.org/topic/1021/security-introducing-signing-support-to-mysensors/157. The links in that post have a relatively easy fix to implement if it turns out that is the problem.

                                    1 Reply Last reply
                                    0
                                    • sj44kS Offline
                                      sj44kS Offline
                                      sj44k
                                      wrote on last edited by
                                      #25

                                      Nope but winter season is starting again so I have some spare time not being "outside" so I will be starting this project back up

                                      1 Reply Last reply
                                      0
                                      • barduinoB barduino

                                        I have a similar issue with Adafruit CC3000 shield and a Mega.
                                        After much fidling around I finally got it to work.

                                        The Adafruit shiled is the same size of an Uno but when connected to a Mega it doesn't get the SCK, MOSI and MISO from the 13,11,12 pins, it gets them from the central connector ICSP as showed on the picture on this thread.

                                        So first step was to connect the wireless module to the ICSP.

                                        The second issue is the CSN and CE pins, these can't be connected to 10 and 9 since they are used by the shield. I've used 35 and 34.

                                        Adjust your code like this:

                                        #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                        #define INCLUSION_MODE_PIN 32 // Digital pin used for inclusion mode button
                                        #define CE_PIN 35
                                        #define CS_PIN 34
                                        MyGateway gw(CE_PIN, CS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, 6, 5, 4);

                                        Even with this, some times I still get a check wires message, others just a bunch of errors about the version.

                                        This erratic behaviour led me to think about noise on the wireless receiver, so in goes a 10uF.

                                        Its stable now.

                                        On a side note I also changed the CE and CS pin assignments on the sensors...

                                        #define DIGITAL_INPUT_SENSOR 4 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
                                        #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
                                        #define CHILD_ID 1 // Id of the sensor child

                                        #define CE_PIN 9
                                        #define CS_PIN 53

                                        MySensor gw(CE_PIN,CS_PIN);

                                        // Initialize motion message
                                        MyMessage msg(CHILD_ID, V_TRIPPED);

                                        Cheers

                                        F Offline
                                        F Offline
                                        flopp
                                        wrote on last edited by
                                        #26

                                        @barduino said:

                                        I have a similar issue with Adafruit CC3000 shield and a Mega.
                                        After much fidling around I finally got it to work.

                                        The Adafruit shiled is the same size of an Uno but when connected to a Mega it doesn't get the SCK, MOSI and MISO from the 13,11,12 pins, it gets them from the central connector ICSP as showed on the picture on this thread.

                                        So first step was to connect the wireless module to the ICSP.

                                        The second issue is the CSN and CE pins, these can't be connected to 10 and 9 since they are used by the shield. I've used 35 and 34.

                                        Adjust your code like this:

                                        #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                        #define INCLUSION_MODE_PIN 32 // Digital pin used for inclusion mode button
                                        #define CE_PIN 35
                                        #define CS_PIN 34
                                        MyGateway gw(CE_PIN, CS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, 6, 5, 4);

                                        Even with this, some times I still get a check wires message, others just a bunch of errors about the version.

                                        This erratic behaviour led me to think about noise on the wireless receiver, so in goes a 10uF.

                                        Its stable now.

                                        On a side note I also changed the CE and CS pin assignments on the sensors...

                                        #define DIGITAL_INPUT_SENSOR 4 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
                                        #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
                                        #define CHILD_ID 1 // Id of the sensor child

                                        #define CE_PIN 9
                                        #define CS_PIN 53

                                        MySensor gw(CE_PIN,CS_PIN);

                                        // Initialize motion message
                                        MyMessage msg(CHILD_ID, V_TRIPPED);

                                        Cheers

                                        Hi, can you please share your Gateway code. I also having problem with a CC3000 and Arduino Mega. UNO was too small :)

                                        Thanks

                                        barduinoB 1 Reply Last reply
                                        0
                                        • F flopp

                                          @barduino said:

                                          I have a similar issue with Adafruit CC3000 shield and a Mega.
                                          After much fidling around I finally got it to work.

                                          The Adafruit shiled is the same size of an Uno but when connected to a Mega it doesn't get the SCK, MOSI and MISO from the 13,11,12 pins, it gets them from the central connector ICSP as showed on the picture on this thread.

                                          So first step was to connect the wireless module to the ICSP.

                                          The second issue is the CSN and CE pins, these can't be connected to 10 and 9 since they are used by the shield. I've used 35 and 34.

                                          Adjust your code like this:

                                          #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                                          #define INCLUSION_MODE_PIN 32 // Digital pin used for inclusion mode button
                                          #define CE_PIN 35
                                          #define CS_PIN 34
                                          MyGateway gw(CE_PIN, CS_PIN, INCLUSION_MODE_TIME, INCLUSION_MODE_PIN, 6, 5, 4);

                                          Even with this, some times I still get a check wires message, others just a bunch of errors about the version.

                                          This erratic behaviour led me to think about noise on the wireless receiver, so in goes a 10uF.

                                          Its stable now.

                                          On a side note I also changed the CE and CS pin assignments on the sensors...

                                          #define DIGITAL_INPUT_SENSOR 4 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!)
                                          #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
                                          #define CHILD_ID 1 // Id of the sensor child

                                          #define CE_PIN 9
                                          #define CS_PIN 53

                                          MySensor gw(CE_PIN,CS_PIN);

                                          // Initialize motion message
                                          MyMessage msg(CHILD_ID, V_TRIPPED);

                                          Cheers

                                          Hi, can you please share your Gateway code. I also having problem with a CC3000 and Arduino Mega. UNO was too small :)

                                          Thanks

                                          barduinoB Offline
                                          barduinoB Offline
                                          barduino
                                          wrote on last edited by
                                          #27

                                          I'm sorry @flopp

                                          It did not work on the end, my shield just stopped working even with an example sketch, so I never completed the project.

                                          What flavor of CC3000 do you have, the shield with the SD card or the small board with just the wifi module?

                                          Cheers

                                          F 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular