Here 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
Sander Stolk
@Sander Stolk
Best posts made by Sander Stolk
-
RE: Parking Sensor
-
RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)
Ok here's the deal to change the channel or other settings:
cd Raspberry
make clean
make all
sudo make install
Done! -
RE: Repeater and the routing
Starting up the library
To initialize radio and start the library, you must call begin(). Begin initializes the sensor node but you can also configure the sensor node operating parameters manually. Call this before anything else in the libraryvoid begin(void (*_msgCallback)(const MyMessage &), uint8_t nodeId, boolean repeaterMode,
uint8_t parentNodeId);
incomingMessageCallback - Callback function for incoming messages from other nodes or controller and request responses. Default is NULL.
nodeId - The unique id (1-254) for this sensor. Default is AUTO(255) which means sensor tries to fetch an id from controller.
repeaterMode - Activate repeater mode. This node will forward messages to other nodes in the radio network. Make sure to call process() regularly. Default in false
parentNodeId - Use this to force node to always communicate with a certain parent node. Default is AUTO which means node automatically tries to find a parent.Nice!
So gw.begin(NULL,4,true,3) is node 4 with repeater mode on and parent 3? Cool! -
RE: 💬 MySensors Stable Node
Keep me posted!
Will order when board comes soldered and ready to use! -
RE: 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...
-
RE: Node's becoming unreachable
@tbowmo The IKEA Fantast probe with MAX6675 breakout board.
Latest posts made by Sander Stolk
-
RE: Ethernet GW WITHOUT radio on Arduino Mega
@gohan Yes I know but the pinout 53, output not. That was all that was needed eventually .
-
RE: Ethernet GW WITHOUT radio on Arduino Mega
So 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 -
RE: 'MySensors' does not name a type
This line is not necessary in MYS 2.0
-
RE: 'MySensors' does not name a type
Maybe post the code so that people can see what is wrong with your code
-
RE: Ethernet GW WITHOUT radio on Arduino Mega
Example sketch is also not working...
Ditto for the ICSP connection header
It must be the wires! -
RE: Ethernet GW WITHOUT radio on Arduino Mega
I 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! -
RE: Ethernet GW WITHOUT radio on Arduino Mega
This 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 Mega
Fellow 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?
-
RE: 💬 Building an Ethernet Gateway
The first one will not compile since the #include <SPI.h> is missing
-
RE: Ethernet gateway compile error
I've got the same error but the thing missing is incluse spi.h somewhere below...