@gohan Yes I know but the pinout 53, output not. That was all that was needed eventually .
Sander Stolk
Posts
-
Ethernet GW WITHOUT radio on Arduino Mega -
Ethernet GW WITHOUT radio on Arduino MegaSo here is the deal!
You need to set Pin 53 to Output in your sketch and wire from 50-53 instead of 10-13.
It's working now -
'MySensors' does not name a typeThis line is not necessary in MYS 2.0
-
'MySensors' does not name a typeMaybe post the code so that people can see what is wrong with your code
-
Ethernet GW WITHOUT radio on Arduino MegaExample sketch is also not working...
Ditto for the ICSP connection header
It must be the wires! -
Ethernet GW WITHOUT radio on Arduino MegaI also believe it has to be something with the wireing. I will check this tonight when I'm going to try it on the ICSP header.
And to test it with the default sketch! -
Ethernet GW WITHOUT radio on Arduino MegaThis is the code used for both devices:
#include <SPI.h> #define MY_DEBUG #define MY_GATEWAY_W5100 // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal) //#define MY_W5100_SPI_EN 4 //Nano Mega //10 SS 53 //11 MO 51 //12 MI 50 //13 SCK 52 #define MY_IP_ADDRESS 192,168,1,80 // If this is disabled, DHCP is used to retrieve address // The port to keep open on node server mode / or port to contact in client mode #define MY_PORT 5003 #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xDD #if defined(MY_USE_UDP) #include <EthernetUdp.h> #endif // Relay 1 Perk en Gras // Relay 2 Fontein // Relay 3 Relay_3_MS // Relay 4 Relay_4_MS // PIR 5 PIR Schuur // Dista 6 Auto geparkeerd // Door 7 Poort // Door 8 Schuurdeur //Adding modules #include <Ethernet.h> #include <MySensors.h> #include <NewPing.h> #include <Bounce2.h> #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 4 // Total number of attached relays #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay // PIR #define CHILD_ID_PIR 5 // Id of the sensor child #define DIGITAL_INPUT_SENSOR_PIR 21 // PIR #define INTERRUPT DIGITAL_INPUT_SENSOR_PIR // Usually the interrupt = pin -2 (on uno/nano anyway) int oldValueTripped=-1; // Distance sensor #define CHILD_ID_DIST 6 #define TRIGGER_PIN 12 // Afstandsmeter Trigger #define ECHO_PIN 13 // Afstandsmeter Echo #define MAX_DISTANCE 300 // Max distance we want to start indicating green (in cm) #define PARKED_DISTANCE 130// Distance when "parked signal" should be sent to controller (in cm) NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); unsigned long sendIntervalDIST = 15000; // Send park status at maximum every 5 second. unsigned long lastSend; int oldParkedStatus=-1; int skipZero=0; // Doors #define CHILD_ID_GATE 7 #define CHILD_ID_SD 8 #define Sheddoor 8 // Schuurdeur #define Gate 7 // Poort Bounce debouncerGate = Bounce(); Bounce debouncerSD = Bounce(); int GateoldValue=-1; int SDoldValue=-1; MyMessage msgDIST(CHILD_ID_DIST, V_TRIPPED); MyMessage msgPIR(CHILD_ID_PIR, V_TRIPPED); MyMessage msgGate(CHILD_ID_GATE,V_TRIPPED); MyMessage msgSD(CHILD_ID_SD,V_TRIPPED); void before() { for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { // PIR pinMode(DIGITAL_INPUT_SENSOR_PIR, INPUT); // Gate pinMode(Gate,INPUT); digitalWrite(Gate,HIGH); debouncerGate.attach(Gate); debouncerGate.interval(5); // Sheddoor pinMode(Sheddoor,INPUT); digitalWrite(Sheddoor,HIGH); debouncerSD.attach(Sheddoor); debouncerSD.interval(5); } void presentation() { // PIR present(CHILD_ID_PIR, S_MOTION); // Distance present(CHILD_ID_DIST, S_DOOR); // Gate present(CHILD_ID_GATE, S_DOOR); // Shed present(CHILD_ID_SD, S_DOOR); // Relays for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); } } void loop() { // PIR Get the update value int tripped = digitalRead(DIGITAL_INPUT_SENSOR_PIR) == HIGH; if (tripped != oldValueTripped) { // Send in the new value send(msgPIR.set(tripped==HIGH ? 1 : 0 )); oldValueTripped = tripped; } // Distance unsigned long now = millis(); unsigned int fullDist = (sonar.ping_median() / US_ROUNDTRIP_CM); int displayDist = min(fullDist, MAX_DISTANCE); if (displayDist == 0 && skipZero<10) { // Try to filter zero readings skipZero++; return; } // Update parked status int parked = displayDist != 0 && displayDist<PARKED_DISTANCE; if (parked != oldParkedStatus && now-lastSend > sendIntervalDIST) { if (parked){ send(msgDIST.set(1)); } else { send(msgDIST.set(0)); } oldParkedStatus = parked; lastSend = now; } // Gate debouncerGate.update(); // Get the update value int Gatevalue = debouncerGate.read(); if (Gatevalue != GateoldValue) { // Send in the new value send(msgGate.set(Gatevalue==HIGH ? 1 : 0)); GateoldValue = Gatevalue; } // Sheddoor debouncerSD.update(); // Get the update value int SDvalue = debouncerSD.read(); if (SDvalue != SDoldValue) { // Send in the new value send(msgSD.set(SDvalue==HIGH ? 1 : 0)); SDoldValue = SDvalue; } } void incomingMessage(const MyMessage &message) { if (message.type==V_LIGHT) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.sensor, message.getBool()); } } -
Ethernet GW WITHOUT radio on Arduino MegaFellow board members,
I've got a Arduino Mega 2560 in my shed which I would like to function as a GW by Ethernet.
I've got the code right for MYS 2.0 so that is not the problem I think.I've got an W5100 Ethernet module connected to the ports 50-53 and 5+ and GND on my Arduino Mega. Fixed IP and valid MAC address. When I debug my Mega it says IP: 0.0.0.0 but when I connect the same module with the same code to a Nano on the ports as advised than debug It says IP: 192.168.1.80 as programmed.
On what pins do I need to connect my W5100 on my Mega?
Is it on the middle PIN's? or just the 50-53 pins?
Do I need some changes in the code? For example SoftSPI enable?Again: Nano connected with same code and same module: OK!
Mega connected with same code and same module: IP 0.0.0.0Can somebody point me in the right direction?
-
💬 Building an Ethernet GatewayThe first one will not compile since the #include <SPI.h> is missing
-
Ethernet gateway compile errorI've got the same error but the thing missing is incluse spi.h somewhere below...
-
Node's becoming unreachableI think I have to replace the shed-node. This Arduino Mega just stops in its loops and last night it just hangs. No more fast blinking led.
Will convert it to a Nano but have to figure out how because of the many childs. -
Node's becoming unreachable@sundberg84 said:
@Sander-Stolk - Maybe you can try a metalic/aluminium case? I have seen much better performance of my network since i change GW and repeaters to a aluminium case.
@Sander-Stolk said:
This is the one to test: http://www.icstation.com/22dbm-100mw-nrf24l01ppalna-wireless-transmission-module-p-4677.html
I'm checking these out to see if I can fix the radio problem once and for all
-
Node's becoming unreachableTo be sure that the radio is not interrupted or failing in any other way because the lack of power, I've connected the radio with a voltage regulator so 5v in and 3.3 volt out with CAP.
It helped a little but not much hence the order of a new radio for the Shed which is isolated.
This is the one to test: http://www.icstation.com/22dbm-100mw-nrf24l01ppalna-wireless-transmission-module-p-4677.html -
Node's becoming unreachableOk! So I found some issues but not fixed completely...
What I found out is that my Shed node is sending through my attic-node. Why? I dont know but parent was 1 and distance 2.
After a Clear EEPROM on the Shed-node and disconnected the Attic-node, re'-uploaded the original sketch and voila a few Find parents and Fails but then I saw 4-4-0-0 instead of 4-4-1-0.
So that was one problem fixed. The attic-node was not isolated with foil so now most of the time the Shed-node is sending OK and not so many Fails.
I've ordered a new type of radio with a shield and a external antenna as some may know from the comparison video of the NRF24's on youtube.Is there a way to make the parent (0) static to prevent node's from seeking and broadcasting?
So that I can force my Shed-node to always contact the parent 0 instead of roaming towards the strongest link.
I know that I can redirect node's to use a specific repeater node but not a parent node.So far this update. When the kids are not in sleeping I will check their node's to find out if there is something wrong.
Keep you all posted!
-
Node's becoming unreachable@hek I will start debugging today when I'm at home from this node.
-
Node's becoming unreachable@tbowmo The IKEA Fantast probe with MAX6675 breakout board.
-
Node's becoming unreachable@mrwomble Measure the temp of the meat on the BBQ and the kettle itself. I get a push message from Domoticz when the centre of the meat hits a certain temperature regarding the switch I flipped for cow, chicken, fish and so on...
-
Node's becoming unreachable
-
Node's becoming unreachableFellow board members!
I've got this "huge" mansion :P which is problematic!
Let me tell you what I have:
1 RPI 3 Domoticz with Mysensors Gateway 1.4 directly attached to RPI Headers. Radio is the 1000 meter range version with alu foil connected to the ground of the antenna. This radio antenna is extended with a extention wifi cable to place the antenna higher.In every room there is a node made from a Arduino Nano and a good USB power supply (Apple ones). Most of them have normal radio with cap installed.
Every node in my house has a static ID.
There is 1 node on the attic which has a 1000m radio which is not insulated with alu foil (to do) but is reaching downstairs with the right angle of the antenna. This node is a repeater and a parent for an other node to control my airco in the same attic. Otherwise the radio of the airco will NOT reach downstairs.I've got a shed also with an 1000m radio which is insulated and also extended with a wifi extension cable to reach the gateway. This board is a Arduino Mega with a 4 relay board, parking sensors and door sensors. This node is a repeater and also a parent for the node in the kids playhouse outside.
The node in the kids outdoor playhouse is a Nano with normal radio with cap.
There are several other nodes but most of them are repeaters.
My problem:
Sometimes my gateway cannot send a successful switch command to my shed. We are talking 15 meters away from each other with insulated radio's and extended antenna's in a line of sight.Sometimes the connection / node's become numb like the one for my airco. Then I cannot send a normal command to my Airco node relaying through my attic radio. Then I have to reset the attic node and then the airco node to get it live.
There are several questions that I'm struggling with...
1 Is it a problem that almost every node is a repeater?
2 Is it a known problem that connections "disappear" from the network and after a reset it's running well?
3 What can I do the make the system more reliable?
4 Should I roll back to the basics and create a USB Gateway on my Pi and place the radio elsewhere? Or go EthernetGateway to be sure I reach my shed?I'm willing to invest quite some time to get this system up and running but I'm quite irritated about the connection drops and resets I have to give.
I think the system is well designed but we are facing radio problems at least and maybe some scripting errors from my side regarding the use of a repeater node or dedicated parent routing.If someone is willing to help I would be very happy!
I will post a sketch how nodes are placed and configured later today.
FYI I've scanned with the poor mans wifi scanner and changed all the channels to 111.
-
Parking SensorHere a working example with a 16-Bit ring with radio because the misses hit the fence for the second time this year with the car.



Sensor in action <--Video