Building an Ethernet Gateway on an Arduino Mega
-
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.
-
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 ?
-
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 ?
-
:)Hunt for the red october classic :)
-
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 53MySensor gw(CE_PIN,CS_PIN);
// Initialize motion message
MyMessage msg(CHILD_ID, V_TRIPPED);Cheers
-
@barduino
Can you help me out here, I do not get your remark :
So first step was to connect the wireless module to the ICSPAs 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. -
@barduino
Can you help me out here, I do not get your remark :
So first step was to connect the wireless module to the ICSPAs 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.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.

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...
-
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.
@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 ? -
-
@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.
-
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 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.@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:
-
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.
-
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 53MySensor gw(CE_PIN,CS_PIN);
// Initialize motion message
MyMessage msg(CHILD_ID, V_TRIPPED);Cheers
@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 53MySensor 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
-
@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 53MySensor 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
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
-
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
-
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> #endifThen 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: