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.
  • 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 Offline
        hekH Offline
        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
                        • barduinoB barduino

                          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 Offline
                          F Offline
                          flopp
                          wrote on last edited by flopp
                          #28

                          @barduino

                          EDIT: NOT SD-card

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            spugna85
                            wrote on last edited by spugna85
                            #29

                            Here the solution to run Arduino Mega and the shield W5100.

                            Into the file MyConfig.h, after the line:
                            #include <stdint.h>:

                            you must add the following lines:

                            #if ARDUINO < 100
                            	#include <WProgram.h>
                            #else
                                   #include <Arduino.h>
                            #endif
                            

                            Then replace the lines:

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

                            with these:

                            const uint8_t SOFT_SPI_MISO_PIN = A2;
                            const uint8_t SOFT_SPI_MOSI_PIN = A1;
                            const uint8_t SOFT_SPI_SCK_PIN = A0;
                            

                            Finally enable define SOFTSPI removing the comment (//)

                            Compile and load the software and you're done! :grin:

                            A 1 Reply Last reply
                            3
                            • B Offline
                              B Offline
                              bozo
                              wrote on last edited by
                              #30

                              hello
                              i've got the ethernet gateway on the mega that work but after a power loose, the ping of the gateway is ok but no more return on the serial monitor even after reset

                              i'm using a external power for the mega and same result with usb power.

                              1 Reply Last reply
                              0
                              • S spugna85

                                Here the solution to run Arduino Mega and the shield W5100.

                                Into the file MyConfig.h, after the line:
                                #include <stdint.h>:

                                you must add the following lines:

                                #if ARDUINO < 100
                                	#include <WProgram.h>
                                #else
                                       #include <Arduino.h>
                                #endif
                                

                                Then replace the lines:

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

                                with these:

                                const uint8_t SOFT_SPI_MISO_PIN = A2;
                                const uint8_t SOFT_SPI_MOSI_PIN = A1;
                                const uint8_t SOFT_SPI_SCK_PIN = A0;
                                

                                Finally enable define SOFTSPI removing the comment (//)

                                Compile and load the software and you're done! :grin:

                                A Offline
                                A Offline
                                anibaldiniz
                                wrote on last edited by
                                #31

                                @spugna85
                                Hello, I'm putting the code as you indicated, and connecting the nRF24L01 pins:
                                6 CSN
                                5 CE
                                Pin 50, 51, 52

                                and message: 0;0;3;0;9;radio init fail
                                I link capacitor in power, I have done everything. And now????
                                :anguished:

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


                                11

                                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