Thanks for the explanation guys. Very much appreciated!!! Just an update on what I have done. I swapped my old Ethernet Shield with a new one and everything started working. Did a ping test on all four attempts, packet lost came in 0%. Lesson learned, never assume that the since its a new hardware it would not fail. Well, mine failed despite being 2 weeks old. LOL
jeylites
@jeylites
Best posts made by jeylites
-
RE: UI 7 Ethernet Gateway Problem
-
RE: INA219 DC Current Sensor
Has anyone made any progress implementing the AC current sensor or is there a My Sensor plugin?
-
RE: Array Relay Button Actuator
I revised the sketch based on your advice and seem to be working as we speak. I tried to make the final sketch as organized as possible, It has be copied below. Thank you everyone for making this work!!!
#include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define RELAY_ON 0 // switch around for realy HIGH/LOW state #define RELAY_OFF 1 // MySensor gw; #define RADIO_ID 11 // radio Id, whatever channel you assigned to #define noRelays 2 const int relayPin[] = {3,7}; // switch around pins to your desire const int buttonPin[] = {4,5}; // switch around pins to your desire class Relay // relay class, store all relevant data (equivalent to struct) { public: int buttonPin; // physical pin number of button int relayPin; // physical pin number of relay byte oldValue; // last Values for key (debounce) boolean relayState; // relay status (also stored in EEPROM) }; Relay Relays[noRelays]; Bounce debouncer[noRelays]; MyMessage msg[noRelays]; void setup(){ gw.begin(incomingMessage, RADIO_ID, true); delay(250); gw.sendSketchInfo("MultiRelayButton", "0.9b"); delay(250); // Initialize Relays with corresponding buttons for (int i = 0; i < noRelays; i++){ Relays[i].buttonPin = buttonPin[i]; // assign physical pins Relays[i].relayPin = relayPin[i]; msg[i].sensor = i; // initialize messages msg[i].type = V_LIGHT; debouncer[i] = Bounce(); // initialize debouncer debouncer[i].attach(buttonPin[i]); debouncer[i].interval(5); pinMode(Relays[i].buttonPin, INPUT_PULLUP); pinMode(Relays[i].relayPin, OUTPUT); Relays[i].relayState = gw.loadState(i); // retrieve last values from EEPROM digitalWrite(Relays[i].relayPin, Relays[i].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly gw.send(msg[i].set(Relays[i].relayState? true : false)); // make controller aware of last status gw.present(i, S_LIGHT); // present sensor to gateway delay(250); } } void loop() { gw.process(); for (byte i = 0; i < noRelays; i++){ debouncer[i].update(); byte value = debouncer[i].read(); if (value != Relays[i].oldValue && value == 0){ Relays[i].relayState = !Relays[i].relayState; digitalWrite(Relays[i].relayPin, Relays[i].relayState?RELAY_ON:RELAY_OFF); gw.send(msg[i].set(Relays[i].relayState? true : false)); gw.saveState( i, Relays[i].relayState );} // save sensor state in EEPROM (location == sensor number) Relays[i].oldValue = value; } } // process incoming message void incomingMessage(const MyMessage &message){ if (message.type == V_LIGHT){ if (message.sensor <noRelays){ // check if message is valid for relays..... previous line [[[ if (message.sensor <=noRelays){ ]]] Relays[message.sensor].relayState = message.getBool(); digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly gw.saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number) } } }
-
Vera Edge UI7 - Serial USB Fix!!!
Following @mjunqueira post on creating a Vera support ticket, I decided to do the same. The support team at Vera send me a link to do a firmware update that will fix the "Serial USB issue". I followed the steps and it has been working great for me so far.
Step 1
Do a Backup. Just incase it fails to update, you have your previous settings.
Step 2
Cut and paste the following hyperlink http://download1204.mios.com/firmware/os_mt7620a/openwrt-ramips-mt7620a-na301-squashfs-sysupgrade-107.bin into the “URL for OpenWRT custom firmware:” field (image attached) on the Firmware page, under settings and follow the user prompts.
Step 3
There will be two options "Backup or Update Firmware". ... Select Update Firmware.
Sit back, relax and follow the instructions.The whole process will take approximately 15 mins or less.Step 4
Configure Serial Port and My Sensor
Cheers!
-
RE: Array Relay Button Actuator
The following sketch has got what you're looking for. Hope that helps.
Relay With Actuator Switch Toggle
#include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define RELAY_ON 0 // switch around for realy HIGH/LOW state #define RELAY_OFF 1 MySensor gw; #define RADIO_ID 11 // Radio ID, whatever channel you assigned to #define noRelays 6 const int relayPin[] = {A0, A1, A2, A3, A4, A5}; const int buttonPin[] = {3, 4, 5, 6, 7, 8}; class Relay // relay class, store all relevant data (equivalent to struct) { public: int buttonPin; // physical pin number of button int relayPin; // physical pin number of relay byte oldValue; // last Values for key (debounce) boolean relayState; // relay status (also stored in EEPROM) }; Relay Relays[noRelays]; Bounce debouncer[noRelays]; MyMessage msg[noRelays]; void setup(){ gw.begin(incomingMessage, RADIO_ID, true); delay(250); gw.sendSketchInfo("MultiRelayButton", "0.9b"); delay(250); // Initialize Relays with corresponding buttons for (int i = 0; i < noRelays; i++){ Relays[i].buttonPin = buttonPin[i]; // assign physical pins Relays[i].relayPin = relayPin[i]; msg[i].sensor = i; // initialize messages msg[i].type = V_LIGHT; debouncer[i] = Bounce(); // initialize debouncer debouncer[i].attach(buttonPin[i]); debouncer[i].interval(5); pinMode(Relays[i].buttonPin, INPUT_PULLUP); pinMode(Relays[i].relayPin, OUTPUT); Relays[i].relayState = gw.loadState(i); // retrieve last values from EEPROM digitalWrite(Relays[i].relayPin, Relays[i].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly gw.send(msg[i].set(Relays[i].relayState? true : false)); // make controller aware of last status gw.present(i, S_LIGHT); // present sensor to gateway delay(250); } } void loop() { gw.process(); for (byte i = 0; i < noRelays; i++){ debouncer[i].update(); byte value = debouncer[i].read(); // if (value != Relays[i].oldValue && value == 0){ if (value != Relays[i].oldValue){ Relays[i].relayState = !Relays[i].relayState; digitalWrite(Relays[i].relayPin, Relays[i].relayState?RELAY_ON:RELAY_OFF); gw.send(msg[i].set(Relays[i].relayState? true : false)); gw.saveState( i, Relays[i].relayState );} // save sensor state in EEPROM (location == sensor number) Relays[i].oldValue = value; } } // process incoming message void incomingMessage(const MyMessage &message){ if (message.type == V_LIGHT){ if (message.sensor <noRelays){ // check if message is valid for relays..... previous line if [[[ (message.sensor <=noRelays){ ]]] Relays[message.sensor].relayState = message.getBool(); digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly gw.saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number) } } }
Latest posts made by jeylites
-
RE: In wall light switch node - Custom PCB
Just wondering, any of you guys looked into touch switches like below
-
RE: [SOLVED] Gateway as a sensor node in v1.6
Should a Repeater have it's on unique ID or the same ID as the NODE that it's repeating?
-
RE: Repeater and the routing
Should a Repeater have it's on ID or the same ID as the NODE that it's repeating?
-
Replacing Radio with ESP8266 on Nodes and Gateway
Anyone here knows if we could replace NRF24L01+ or RFM69 radio to an ESP8266, both on Gateway and Nodes?
-
RE: Array Relay Button Actuator
The following sketch has got what you're looking for. Hope that helps.
Relay With Actuator Switch Toggle
#include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #define RELAY_ON 0 // switch around for realy HIGH/LOW state #define RELAY_OFF 1 MySensor gw; #define RADIO_ID 11 // Radio ID, whatever channel you assigned to #define noRelays 6 const int relayPin[] = {A0, A1, A2, A3, A4, A5}; const int buttonPin[] = {3, 4, 5, 6, 7, 8}; class Relay // relay class, store all relevant data (equivalent to struct) { public: int buttonPin; // physical pin number of button int relayPin; // physical pin number of relay byte oldValue; // last Values for key (debounce) boolean relayState; // relay status (also stored in EEPROM) }; Relay Relays[noRelays]; Bounce debouncer[noRelays]; MyMessage msg[noRelays]; void setup(){ gw.begin(incomingMessage, RADIO_ID, true); delay(250); gw.sendSketchInfo("MultiRelayButton", "0.9b"); delay(250); // Initialize Relays with corresponding buttons for (int i = 0; i < noRelays; i++){ Relays[i].buttonPin = buttonPin[i]; // assign physical pins Relays[i].relayPin = relayPin[i]; msg[i].sensor = i; // initialize messages msg[i].type = V_LIGHT; debouncer[i] = Bounce(); // initialize debouncer debouncer[i].attach(buttonPin[i]); debouncer[i].interval(5); pinMode(Relays[i].buttonPin, INPUT_PULLUP); pinMode(Relays[i].relayPin, OUTPUT); Relays[i].relayState = gw.loadState(i); // retrieve last values from EEPROM digitalWrite(Relays[i].relayPin, Relays[i].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly gw.send(msg[i].set(Relays[i].relayState? true : false)); // make controller aware of last status gw.present(i, S_LIGHT); // present sensor to gateway delay(250); } } void loop() { gw.process(); for (byte i = 0; i < noRelays; i++){ debouncer[i].update(); byte value = debouncer[i].read(); // if (value != Relays[i].oldValue && value == 0){ if (value != Relays[i].oldValue){ Relays[i].relayState = !Relays[i].relayState; digitalWrite(Relays[i].relayPin, Relays[i].relayState?RELAY_ON:RELAY_OFF); gw.send(msg[i].set(Relays[i].relayState? true : false)); gw.saveState( i, Relays[i].relayState );} // save sensor state in EEPROM (location == sensor number) Relays[i].oldValue = value; } } // process incoming message void incomingMessage(const MyMessage &message){ if (message.type == V_LIGHT){ if (message.sensor <noRelays){ // check if message is valid for relays..... previous line if [[[ (message.sensor <=noRelays){ ]]] Relays[message.sensor].relayState = message.getBool(); digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly gw.saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number) } } }
-
RE: In wall light switch node - Custom PCB
Nice work so far. I had a similar idea to use Binary Switch to turn ON/OFF my relays and lights but I had to discard the idea after going through several issues. Occasionally my serial gateway would fail to connect to the Vera and it would paralyze all my lightings. Essentially the Binary switches talk's to the Relays by going through the gateway. So decided to redesign the electronics to accommodate Relay with Button Actuator Sketch. If you lose the gateway, you could still bet that it would work though I wouldn't say it's 100% reliable but it gets the job done. Lately, I'm also exploring other avenues to somehow use www.Souliss.net concepts on MySensor and I was informed that My sensor Ver 2.0 Beta has got something similar by using ESP8266. I don't know how much of this is true but I'm pretty sure @hek will be able to explain.
-
RE: New to this and frustrated with the arduino IDE
Out of curiosity, what version Arduino are you running? I ran version 1.0.6 without any problems. I only have an issue on 1.6.7. It looks like 1.6.7 manages library differently.
-
RE: New to this and frustrated with the arduino IDE
After checking, I notice there are two library folder. There is one in My Documents and another in Program Files - Arduino - library. Which MY Sensor files need to go into which folder?
-
RE: New to this and frustrated with the arduino IDE
Thanks guys, I'm going to give a third try.
-
RE: New to this and frustrated with the arduino IDE
Where do you have to install MY Sensor library? I have downloaded Arduino-Master and copied all the files into Arduino Library but its not working.