@mfalkvidd thank you yeah cause my eventual plan is to run power over Ethernet and power all the arduino's over POE and then that way expand off the arduino's that way. While RS485 is okay I figured I'm already going to be piping Ethernet through the house anyway so just add on to that. But I can run multiple gateways running back to my controller though correct, and then just disable the line of code in my sensors that enables the RF side?
fdlou147
@fdlou147
Best posts made by fdlou147
-
RE: Hi everyone newbish question here
Latest posts made by fdlou147
-
Arduino Mega2560 and multifunction gateway issues/questions
(I hope I got the right subforum, as this is a troubleshooting issue)
So, I have built a Arduino Mega with a Ethernet Shield coupled to a 16 channel relay board as a gateway/node with MyController as the main control point. I'm using the Mega in this configuration for future expansion(eventually going to run house heat circulator and zone valves thru this gateway as well).
Currently, Im going to be utilizing it for home generator system control(choke control(eventually automated based on temp, but not there yet),ignition/start, low oil alarm, Gen AC OK, shelter door open, local generator inhibit), A/C power fail indication, and boiler summer/winter control, but I'm having a slight issue(s) in my coding i think in the sketch.
So, I got the relays to autopopulate in MyC, but I only get one input to autopopulate(pin 39).
When I trigger a input pin as a state change, there is an excessive delay before MyC sees it, but now adding in other inputs I no longer receive state changes in these sensors. I also dont see, like the relays output on command, a serial line for debug purposes, so I can even see if the trigger is even being seen, but the relays still trigger.
Im going to be using contact closures for 80-90% of all my inputs.
So, what did I goof, or miss?The code is below. Thanks in advance everyone!
#define MY_DEBUG #define MY_GATEWAY_W5100 // Enable UDP communication //#define MY_USE_UDP // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below #define MY_IP_ADDRESS 192,168,1,8 //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1 //#define MY_IP_SUBNET_ADDRESS 255,255,255,0 // Renewal period DHCP //#define MY_IP_RENEWAL_INTERVAL 60000 #define MY_PORT 5003 // Controller ip address. Enables client mode (default is "server" mode). // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. // #define MY_CONTROLLER_IP_ADDRESS 192,168,2,5 //#define MY_CONTROLLER_URL_ADDRESS "my.controller.org" #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED #define MY_DEFAULT_LED_BLINK_PERIOD 300 #if defined(MY_USE_UDP) #include <EthernetUdp.h> #endif #include <Ethernet.h> #include <MySensors.h> #include <Bounce2.h> #define RELAY_PIN 22 #define NUMBER_OF_RELAYS 16 #define RELAY_ON 0 #define RELAY_OFF 1 /*#define LOCK_1 6 #define NOF_LOCKS 1 #define LOCK_LOCK 1 #define LOCK_UNLOCK 0 */ #define CHILD_ID 20 #define BUTTON_PIN 38 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 21 #define BUTTON_PIN 39 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 22 #define BUTTON_PIN 2 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 23 #define BUTTON_PIN 3 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 24 #define BUTTON_PIN 4 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 25 #define BUTTON_PIN 5 // Arduino Digital I/O pin for button/reed switch /*#define CHILD_ID 8 #define BUTTON_PIN 8 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 9 #define BUTTON_PIN 9 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 10 #define BUTTON_PIN 10 // Arduino Digital I/O pin for button/reed switch #define CHILD_ID 11 #define BUTTON_PIN 11 // Arduino Digital I/O pin for button/reed switch */ Bounce debouncer = Bounce(); int oldValue=-1; // Change to V_LIGHT if you use S_LIGHT in presentation below MyMessage msg(CHILD_ID,V_LIGHT); void before() { for (int sensor=1, pin=RELAY_PIN; 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() { pinMode(BUTTON_PIN,INPUT_PULLUP); /* digitalWrite(BUTTON_PIN,HIGH);*/ debouncer.attach(BUTTON_PIN); debouncer.interval(3); /*for (int lock=1, pin=LOCK_1; lock<=NOF_LOCKS; lock++, pin++) { pinMode(pin, OUTPUT); digitalWrite(pin, loadState(lock)?LOCK_LOCK:LOCK_UNLOCK);*/ } void presentation() { // Register binary input sensor to gw (they will be created as child devices) // You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. // If S_LIGHT is used, remember to update variable type you send in. See "msg" above. sendSketchInfo("Generator / Utility Room", "2.0"); present(CHILD_ID, S_LIGHT); for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); // Fetch lock status /* for (int lock=1, pin=LOCK_1; lock<=NOF_LOCKS; lock++, pin++) { present(lock, S_LOCK, "SecureActuator", false); }*/ } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.getType()==V_STATUS) { // Change relay state digitalWrite(message.getSensor()-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.getSensor(), message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.getSensor()); Serial.print(", New status: "); Serial.println(message.getBool()); /* if (message.getType()==V_LOCK_STATUS /*&& message.getSensor()<=NOF_LOCKS && !message.isEcho()) { // Change relay state digitalWrite(message.getSensor()-1+LOCK_1, message.getBool()?LOCK_LOCK:LOCK_UNLOCK); // Store state in eeprom saveState(message.getSensor(), message.getBool()); // Write some debug info Serial.print("Incoming change for lock:"); Serial.print(message.getSensor()); Serial.print(", New status: "); Serial.println(message.getBool()); }*/ } } void loop() { debouncer.update(); // Get the update value int value = debouncer.read(); if (value != oldValue) { send(msg.set(value==HIGH ? 1 : 0)); oldValue = value; } }
-
RE: Momentary output command to node
Also, ideally, moreso very necessary, the momentary needs to be sorta snappy, as I am planning on connecting to a starter circuit on the generator, so which is why i was thinking more at the node built into the sketch as opposed to the controller, due to lag times in data to/from node
-
Momentary output command to node
So I've been diving into my setup a bit more now, as my work schedule has lightened due to the state of the world. My question is, because I'm a dummy is I have the mysensors platform running on a UNO with a relay shield. Now, in MyController, you can latch, and unlatch relay outputs, but there isnt anything to allow a momentary pushbutton action. Now, is this unattainable from MyController, and if it is, would MySensors sketch running at the node allow a lockout after x seconds of being asserted from the controller as on, so it reverts off, even if someone forgot to turn off the relay. Even better, I did see there is ack commands in MyController, so if the sketch only allowed the relay on for x seconds, the ack command could revert the controller to off state?
-
RE: Hi everyone newbish question here
@kimot Yeah, but mainly this is more proof of concept. If this platform works for what I am trying to accomplish, I may just go mesh and start migrating to mysensors/mycontroller
-
RE: Hi everyone newbish question here
@mfalkvidd thank you yeah cause my eventual plan is to run power over Ethernet and power all the arduino's over POE and then that way expand off the arduino's that way. While RS485 is okay I figured I'm already going to be piping Ethernet through the house anyway so just add on to that. But I can run multiple gateways running back to my controller though correct, and then just disable the line of code in my sensors that enables the RF side?
-
Hi everyone newbish question here
Hi everyone. So I installed MyController on my LINUX server(not a RPI, a repurposed PC which also shares my network file system) So I am wanting to us MySensors and Arduinos with Ethernet shields as my nodes. Now I dont know if this question is appropriate here or for the mycontroller forum, but I am wondering, do I need a gateway if I want to use ethernet to communicate to MC? It looks like gateway is needed for a RF link to the MC, but I am not planning on using RF, due to the excessive saturation of RF I already have in my home with my career, hobby, etc(Land Mobile Radio Service Tech) and I wanted a more concrete connection unaffected by enviromentals as much as possible(my entire network infrastructure is on extended runtime UPS, plus eventually a generator, which I hope to also control off MC)
My ultimate goal I'm planning on:
Sump Pump Runtime logging
High Water/Sump Fail notification with email trigger
Power Failure Event Notification
Semi Automatic Transfer Switch Control and Status
Generator Control and Status
Hardwired Fire/Smoke/CO Detector Trigger and Email/SMS Notify
Oil Fired Boiler Control/Status/Emergency Shutdown
Oil tank level indication with email notify on low level
Critical Network Infrastructure Up/Down via Ping/SNMP Traps with email notify
Integration into Samsung SmartThings Platform(FUTURE, possibly) or potentially completely migrating all smarthome devices to MCMy overall goal is to build this out to allow me to reach my critical home infrastructure while i am not at home. I work for a company where on short notices i work long hours, and that leaves my wife home(who I love, but is clueless on what/how/when to do things when things fail)
( I crossposted this to MC Forum)