Just wondering, any of you guys looked into touch switches like below
Posts made by jeylites
-
RE: In wall light switch node - Custom PCB
-
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.
-
RE: Mysensors stopped working on Vera
@msebbe Mine's been abruptly going offline 3 versions ago. Are all your sensors and gateway running Ver 1.5?
You mind giving me a little more info on your setup eg:
Version,
Hardware,
Radio Distance,
Kind of PSU.This is my setup. I have about 20 relay sensors placed in an area with activated repeater mode. I don't know if it's advisable to set up repeater mode in this manner when these sensors are between 10 and 50 ft apart. From gateway to sensors they range between 30 and 100 ft.
Out of 20 relay sensors, 5 of them take turns to abruptly go offline.
-
RE: Mysensors stopped working on Vera
I'm having the same issue too and I don't know what is going on. I tried a few things like rebooting Vera, Gateway & Nodes, it temporarily fixes it, but some nodes go offline a few days later. This has been going on a for months.
Vera Model: Vera Edge Ui7
Vera version: 1.7.1598Gateway: Ver 1.4
Nodes: Ver 1.5 -
RE: Array Relay Button Actuator
I don't think it matters. You could try flip "gw.send & gw.present" and see how it respond to the change.
-
RE: Array Relay Button Actuator
@rainair, I tested it and it works! Thanks!!!
-
RE: Multimeter Sensor
I have a few chores to accomplish but will keep your thoughts in mind.
-
RE: Help!!! Binary & Relay Compilation Not Working
I'm going to try fix it as suggested. But the thing is it complies....
-
RE: Help!!! Binary & Relay Compilation Not Working
Any ideas how I can get this to work?
-
RE: Help!!! Binary & Relay Compilation Not Working
@BulldogLowell
Essentially, I will like to combine Array Binary and Relay Actuator in one sketch. -
RE: Help!!! Binary & Relay Compilation Not Working
This is the serial message I get
repeater started, id 12
send: 12-12-0-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1
send: 12-12-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
read: 0-0-12 s=255,c=3,t=6,pt=0,l=1:M
send: 12-12-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay
send: 12-12-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
send: 12-12-0-0 s=255,c=3,t=11,pt=0,l=12,st=ok:Alarm Pannel
send: 12-12-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
send: 12-12-0-0 s=255,c=3,t=1,pt=0,l=3,st=ok:1.0
send: 12-12-0-0 s=0,c=0,t=0,pt=0,l=5,st=ok:1.4.1
setup for switch: 5 complete
send: 12-12-0-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1
read: 0-0-12 s=255,c=3,t=1,pt=0,l=10:1435918408 -
RE: Help!!! Binary & Relay Compilation Not Working
My bad. I copied the wrong sketch to this chat. I have revised the sketch and it complies but it's not working... Please see sketch above.
-
Help!!! Binary & Relay Compilation Not Working
REVISED!!!
Compiles but not working
// Simple binary switch example // Connect button or door/window reed switch between // digitial I/O pin 3 (BUTTON_PIN below) and GND. #include <MySensor.h> #include <SPI.h> #include <Bounce2.h> #include <Time.h> //http://playground.arduino.cc/Code/Time #include <TimeAlarms.h> //http://playground.arduino.cc/Code/Time MySensor gw; #define RADIO_ID 12 #define noReeds 3 const int BUTTON_PIN[] = {4,5,6}; // Arduino Digital I/O pin for button/reed switch, A0 - A4 boolean reedState[] = {HIGH, HIGH, HIGH}; #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 1 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay Bounce debouncer[noReeds]; MyMessage msg[noReeds]; void setup(){ gw.begin(NULL, RADIO_ID, true); //stattc RADIO_ID an enable repeater Alarm.delay(250); gw.sendSketchInfo("Relay", "1.0"); gw.sendSketchInfo("Alarm Pannel", "1.0"); Alarm.delay(250); gw.requestTime(receiveTime); // initialize Relays with corresponding buttons for (int i = 0; i < noReeds; i++){ msg[i].sensor = i; // initialize messages msg[i].type = V_TRIPPED; debouncer[i] = Bounce(); // initialize debouncer debouncer[i].attach(BUTTON_PIN[i]); debouncer[i].interval(5); // Setup the button pinMode(BUTTON_PIN[i],INPUT); // Activate internal pull-up digitalWrite(BUTTON_PIN[i],HIGH); gw.present(i, S_DOOR); // present sensor to gateway Serial.print("setup for switch: "); Serial.print(BUTTON_PIN[i]); Serial.println(" complete" ); Alarm.timerRepeat(720, updateState); // update relay status every 2 hrs Alarm.delay(250); } // Fetch relay status 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) gw.present(sensor, S_LIGHT); // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF); } } // Check if digital input has changed and send in new value void loop() { gw.process(); } void incomingMessage(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { // Change relay state digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom gw.saveState(message.sensor, message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } for (int i = 0; i < noReeds; i++){ debouncer[i].update(); // Get the update value int value = debouncer[i].read(); if (value != reedState[i]) { // Send in the new value gw.send(msg[i].set(value==HIGH ? 1 : 0), false); reedState[i] = value; Serial.print("updating state for swicth: "); Serial.print(BUTTON_PIN[i]); Serial.print(" state: "); Serial.println(reedState[i]); } } } void updateState(){ Serial.println("Start state info"); for (int i = 0; i < noReeds; i++) { Serial.print("sending update for switch: "); Serial.println(BUTTON_PIN[i]); gw.present(i, S_DOOR); Alarm.delay(250); //MyMessage msg(relayPin[pin],V_LIGHT); gw.send(msg[i].set(reedState[i]), false); // Send last state from eprom to GW Alarm.delay(250); } } // This is called when a new time value was received void receiveTime(unsigned long time) { setTime(time); }```
-
RE: Array Relay Button Actuator
Just wondering any of you guys made progress in normal switch?
-
RE: IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)
@blacey Thank you sir! Will test it out over the weekend.
-
RE: Controlling existing relays
@twosh the above current sensor could be one option or you could build a voltage divider to measure the 24v side. Something like the battery monitor .... this route is cheap and effective. Thought I don't know how you are going to the programming part but will like to see where it goes
-
RE: Controlling existing relays
@twosh Try this sketch below it works. You can change outputs around by changing
const int relayPin [] = {A2, A3, A4, A5, A6, A7};
&const int buttonPin[] = {3, 4, 5, 6, 7, 8};
// This is the final sketch // Example sketch showing how to control physical relays. // This example will remember relay state even after power failure. #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 8 // Radio Id, whatever channel you assigned to #define noRelays 6 const int relayPin[] = {A2, A3, A4, A5, A6, A7}; 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, AUTO, 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) } } }
-
RE: IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)
@blacey I think I get what you're saying on #define but don't know how to associate child id with ir code. Do you have a sample or something ?
IR blaster - you working on looks great. Next project is to use that to control my AV system.
Thank you!
-
RE: Sensebender Micro
@tbowmo I have nothing against Sensebender Micro. I just feel there should be Sensebender full size version to facilitate the number of I/O one may need.
-
RE: Sensebender Micro
I think version 2 should have a voltage regulator and about the same number of outputs as Arduino Nano.
-
RE: IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)
Hello @blacey , I got a question... If I'm going to add another IR into the sketch, how do I go about doing this? So two independent sensors into one. This is what I have done so far. Correct me if I'm wrong. Should I be changing something in IRsend irsend ....?
And is your IR LED connected to Pin 1 or Pin3?
/*** * Binary IR Switch sketch that controls Luminara Candles * * Sketch inspired by, and a derivative work of, Hek's IR Sensor example sketch */ #include <MySensor.h> #include <SPI.h> #include <IRLib.h> int RECV_PIN = 8; #define CHILD1 3 // Arduino Pin 3 #define CHILD2 4 // Arduino Pin 4 MySensor gw; MyMessage switchMsg1(CHILD1, V_VAR1); MyMessage switchMsg2(CHILD2, V_VAR1); // IR LED must be connexted to Arduino PWM pin 3 IRsend irsend; #define switchOnIRcode 0x00ff629d // Luminara On IR code #define switchOffIRcode 0x00ffa857 // Luminara Off IR code void setup() { gw.begin(incomingMessage); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("IR Switch", "1.0"); // Register a sensors to gw. Use binary light for test purposes. gw.present(CHILD1, S_LIGHT); gw.present(CHILD2, S_LIGHT); // Sync switch state to gateway state upon reset / power-up gw.request(CHILD1, V_LIGHT); gw.request(CHILD2, V_LIGHT); } void loop() { gw.process(); } void incomingMessage(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { int incomingRelayStatus = message.getInt(); // Emit the IR ON/OFF code irsend.send(NEC, (incomingRelayStatus == 1 ? switchOnIRcode : switchOffIRcode), 32); // Sync gateway of the light switch state gw.send(switchMsg1.set(incomingRelayStatus)); gw.send(switchMsg2.set(incomingRelayStatus)); } }
-
RE: Battery Sensor / Voltage Monitor
If I'm measuring a 5.2 volt battery, what value should R1 and R2 be?
If the measuring voltages goes beyond the set voltage will that destroy the Arduino's input (A0)?
-
RE: Battery Sensor / Voltage Monitor
@hek out of curiosity, I was checking out the sketch for Sensebender and saw that it had a Child Id for Battery Sensor and Voltage sensor. How does this work as a Child id?
Since Voltage is not available on Vera at this time , I'm assuming I will not be able to use this feature... correct?
-
RE: Battery Sensor / Voltage Monitor
@hek
I did not know what this does so I did not add.... -
RE: Battery Sensor / Voltage Monitor
@hek Yes sir!
I added all these files below into Luup
-
RE: Battery Sensor / Voltage Monitor
@hek
I couldn't agree more. I saw somewhere in My Sensor someone posted a way to make that go away but I can't seem to find it. -
RE: Battery Sensor / Voltage Monitor
@hek That explains why it's not working
Here is a screen shot of my setup.
-
RE: Battery Sensor / Voltage Monitor
After restarting the node, I do see the battery % on Arduino Node . Question is, how do you make it to show up as a sensor. It will be great to have it show voltage too.
-
RE: Battery Sensor / Voltage Monitor
It actually comes up as Arduino Door... very odd. Still can't get voltage or battery level to show up.
-
RE: Battery Sensor / Voltage Monitor
@ AWI
good to hear from you Yes, I will like it to show up as a sensor, I'm using Vera Edge.
I'm going to make the change and see if it works. Will report back guys!
-
RE: Radio ID's & Child ID's on a large network General Question
@hek
If repeater mode works regardless of which Node ID your in, than I will go with this setup. I was think for repeater to work one will need to have all Node ID on the same channel. I guess I'm wrong on that.Thanks for clearing the air.
-
Battery Sensor / Voltage Monitor
Guys,
This sketch compiled but doesn't work. I wondering if some one could have a look at it and see what I have done wrong. Cheers!
Serial Logs
sensor started, id 1
send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=13,st=ok:Battery Meter
send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
send: 1-1-0-0 s=20,c=0,t=38,pt=0,l=5,st=ok:1.4.1
1023
Battery Voltage: 3.44 V
Battery percent: 102 %
send: 1-1-0-0 s=255,c=3,t=0,pt=1,l=1,st=ok:102// This is an example that demonstrates how to report the battery level for a sensor // Instructions for measuring battery capacity on A0 are available in the follwoing forum // thread: http://forum.micasaverde.com/index.php/topic,20078.0.html #include <SPI.h> #include <MySensor.h> #define CHILD_ID_BATT 20 int BATTERY_SENSE_PIN = A0; // select the input pin for the battery sense point MySensor gw; MyMessage msgBattery(CHILD_ID_BATT, V_VOLTAGE); unsigned long SLEEP_TIME = 900000; // sleep time between reads (seconds * 1000 milliseconds) int oldBatteryPcnt = 0; void setup() { // use the 1.1 V internal reference analogReference(INTERNAL); gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Battery Meter", "1.0"); gw.present(CHILD_ID_BATT, V_VOLTAGE); } void loop() { // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); Serial.println(sensorValue); // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 float batteryV = sensorValue * 0.003363075; int batteryPcnt = sensorValue / 10; Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep gw.sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } gw.sleep(SLEEP_TIME); }
-
RE: Radio ID's & Child ID's on a large network General Question
@ hek
I apologize, I got my terminology all mixed up. Based on my understanding...node-id The unique id of the node that sends or should receive the message (address)
child-sensor-id Each node can have several sensors attached. This is the child-sensor-id that uniquely identifies one attached sensorMy problem is when compiled based on an Auto setup, the Node Id changes from one Arduino to another. Eg; First Node: ID 3 Child 1, Second Node: ID 22 Child 2.
Question, will repeat mode work in this setup? Having a different Node-Id does it mean it's on a different network?
How do I have all nodes to start in Node-ID 3 but have different Childs based on the Auto setup. I'm running an Array sketch so I don't know how to specifically target each output to a specific Child.
Thanks you!
-
RE: Radio ID's & Child ID's on a large network General Question
@hek No that's not what meant. Every time when I load a sketch into the Arduino, it populates a different Radio ID. So assuming I have 5 nodes, they are all in different radio channel. I'm trying to get it in one Radio Ch but different Child IDs....
-
RE: Sensebender Micro
@tekka said:
Yes, have a look at the bootloader here:
https://github.com/mysensors/Arduino/tree/master/MYSBootloaderDo I have to include those files into my sketch or just install MYS on windows and it will auto detect? In other words, do I have to make any changes to the sketch?
Is there any tutorial on MYS implementation?
-
RE: Radio ID's & Child ID's on a large network General Question
Another thing. When I set the Radio to AUTO, it populates and ID automatically. But what I realize is the Radio ID changes from node to node. Eg: Node 1 Radio ID: 2 , Node 2 Radio ID 4. They don't maintain the same Radio but different Child ID.
This only happens in the Array Sketch I'm running.
-
RE: Sensebender Micro
Out of curiosity, can over the air updates be implemented on Arduino Nano? I'm going to get 3 to put Sense to the test.
-
Radio ID's & Child ID's on a large network General Question
Hey guys...
I'm planing to deploy about 23 nodes around the house and below is my setup.
4 Relay Button Actuator X 10 nodes
Motion, Temp, Lux (3 in one sensor) X 11 nodes
4 Binary Switch X 2 nodeMy questions is should I assign individual for Radio ID Relay, 3 in one sensor & binary. Or should I have as one Radio ID for all nodes with different Child.
Example 1: Individual Radio ID on each group
Node 1: Relay Button Actuator (Radio 2), Child 1, 2, 3, 4
Node 2: Relay Button Actuator (Radio 2), Child 5, 6, 7, 8
...etcNode 1: 3 in One (Radio 3), Child 1, 2, 3
Node 2: 3 in One (Radio 3), Child 4, 5, 6
...etcNode 1: Binary (Radio 4), Child 1, 2, 3,4
Node 2: Binary (Radio 4), Child 5, 6,7
...etcExample 2: OR one Radio ID for all groups.
Node 1: Relay Button Actuator (Radio 2), Child 1, 2, 3, 4
Node 2: Relay Button Actuator (Radio 2), Child 5, 6, 7, 8
...etcNode 1: 3 in One (Radio 2), Child 9, 10, 11
Node 2: 3 in One (Radio 2), Child 12,13, 14
...etcNode 1: Binary (Radio 2), Child 15, 16, 17,18
Node 2: Binary (Radio 2), Child 19, 20,21
...etcIf I setup individual Radio ID will repeater mode still work if I have two different IDs on a network. I'm guessing not but will like to know.
-
RE: Motion and lux meters combined in a single device
With the help from @korttoma & @AWI , I put together this sketch. I've tested it and it works. Have fun!
#include <MySensor.h> #include <SPI.h> unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // 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 LED_PIN 5 MySensor gw; // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Motion Sensor", "1.0"); pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input pinMode(LED_PIN, OUTPUT); // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID, S_MOTION); } void loop() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); gw.send(msg.set(tripped?"1":"0")); // Send tripped value to gw { if (tripped){ // from the "Blink" example sketch :-) digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW delay(1000); } // Sleep until interrupt comes in on motion sensor. Send update every two minute. gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME); } }
-
RE: Humidity Sketch causes Vera App to crash
The fix seem pretty easy to follow. But when I exclude the "1" and recompile, I get a bunch of error messages.
Build options changed, rebuilding all HumiditySensor.ino: In function 'void loop()': HumiditySensor.ino:56:34: error: call of overloaded 'set(float&)' is ambiguous HumiditySensor.ino:56:34: note: candidates are: In file included from /Users/Jey/Documents/Arduino/libraries/MySensors/MySensor.h:17:0, from HumiditySensor.ino:2: /Users/Jey/Documents/Arduino/libraries/MySensors/MyMessage.h:161:13: note: MyMessage& MyMessage::set(uint8_t) MyMessage& set(uint8_t value); ^ /Users/Jey/Documents/Arduino/libraries/MySensors/MyMessage.h:163:13: note: MyMessage& MyMessage::set(long unsigned int) MyMessage& set(unsigned long value); ^ /Users/Jey/Documents/Arduino/libraries/MySensors/MyMessage.h:164:13: note: MyMessage& MyMessage::set(long int) MyMessage& set(long value); ^ /Users/Jey/Documents/Arduino/libraries/MySensors/MyMessage.h:165:13: note: MyMessage& MyMessage::set(unsigned int) MyMessage& set(unsigned int value); ^ /Users/Jey/Documents/Arduino/libraries/MySensors/MyMessage.h:166:13: note: MyMessage& MyMessage::set(int) MyMessage& set(int value); ^ Error compiling.```
-
RE: Air Quality Sensor
I'm using the standard Smoke sketch from Mysensor library and it seem to be crashing MySensor plugin on Vera edge. Below is a snapshot of the problem. Any ideas?
-
RE: Humidity Sketch causes Vera App to crash
I have the same issue. Will work on the fix when I get back.
-
RE: Vera Edge UI7 - Serial USB Fix!!!
@hek oh yeah go ahead. Thanks for correcting the mistake. @CaptainZap
-
RE: Vera UI Toggle to Debouncer
I like your idea on both options but I think I'm going with the first one. Out of curiosity, how do you add luup.variable_watch? By changing the luup will that change it from a slide to a push, cosmetic wise?
-
RE: IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)
@blacey Nice. I'm using IR Recorder from the library. I asked because you had a fancy setup in the video Very neat setup!
-
RE: Motion and lux meters combined in a single device
I get what you're saying and I've no clue on how to do that.
-
RE: Motion and lux meters combined in a single device
@mikemayers this might work based on @AWI 's blink ... blink idea.
#include <MySensor.h> #include <SPI.h> unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // 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 31 // Id of the sensor child #define LED_PIN 5 MySensor gw; // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Motion Sensor", "1.0"); pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input pinMode(LED_PIN, OUTPUT); // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID, S_MOTION); } void loop() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); gw.send(msg.set(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME); if (tripped){ // from the "Blink" example sketch :-) digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW delay(100); } }
-
RE: Vera UI Toggle to Debouncer
So on Vera , currently I have a Binary (On/Off) 'switch'. Slide left to turn OFF and right to turn ON. I want to change that to a denouncer so I don't have to slide back and forth to cycle through the functions. For the fan OFF, 1,2,3 is controlled with a single debouncer button. I will like to hardwire it to the Arduino Relay Actuator. As for my gate, open and close is controlled by a single debouncer switch.
Essentialy, I will like to setup Vera to do a push to turn ON. Sort off.... pretty much a tac switch setup.
-
Vera UI Toggle to Debouncer
hey guys,
Is it possible to change the type of switch, from a toggle to a debouncer on Vera U1. The reason I'm asking is, I'm trying to control my 3 speed digital fan switch and I need to cycle through its function with a debouncer. And also I'm planing to use the same method to control my electric curtain's debouncer switch. An ON/OFF toggle wouldn't make sense for this application.
-
RE: IR Switch for Luminara Candle Automation (repost with video, photos and final sketch)
@blacey what program are you using to capture the IR codes from the remote ?
-
RE: Domoticz Beta for MySensors official support?
@blacey I didn't know you into Domoticz.
What's up @kunall....I will like to see where this project goes from a user perspective.
-
RE: VeraEdge
Also make sure you are using UI7 files as linked https://github.com/mysensors/Vera/tree/UI7
-
RE: VeraEdge
The Error message is a normal because the vera need time to reload the new setting. I suggest to go to serial devices and reload the lupp. Hope it work after. I still fill you mist a couple of steps. I suggest doing through all steps again just to make sure.
-
RE: VeraEdge
Can you take a screen shot of your devices on Vera. Try doing a power off / on reset. Or there could be something you didn't create after uploading the Lupp...
-
RE: Controlling existing relays
Yes indeed, this is a dimmer not a Relay. If you need a relay functionality you could employ a solid state relay or mechanical one. Why I say this is the waveform gets altered when going through Traic and its not good for certain electronic items.Excluding a light bulb. See picture below for better understating. I wish i could explain more but in the process of doing something...LOL
I didn't quite understand what you meant by "current physical buttons" ....
-
RE: VeraEdge
Essentially, you don't have to do anything on this page unless you are using an Ethernet Gateway. If so you will have to copy the IP address with port No. into the ip column in Vera.
-
RE: Controlling existing relays
@ceech Perhaps I should test one on a bread board. ..
-
RE: Controlling existing relays
@ceech Just wondering, did you get a chance to test this circuit? I've been wanting to do this for a while., guess will be my next project. Will be great if I could get a kit on Ebay.
-
RE: Multi Button Relay switch
Ever since I removed ACK & true, I have not been having any fails at all.
Everything works and I have posted the final sketch in Array Relay Button Actuator as linked below... Hope it comes in handy. Thanks again MYS community!
http://forum.mysensors.org/topic/1299/array-relay-button-actuator/12
-
RE: VeraEdge
If your gateway is connected, it should look something like this.. See below. On my setup I have it connected via Serial. Initially I had it connected via Ethernet, but felt there was a delay. The serial route seem to be working great for me.
Are you using the latest Vera version: 1.7.1089
-
RE: VeraEdge
Did you "Reset the Lupp"
A trick I learned right after creating devises is to click on " Reload Luup". Then give it a couple of minutes and you should see the created devices on DEVICES on VERA.
" Reload Luup". could be access from Apps -> Develop apps -> Serial Port configuration -> Reload Luup
-
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) } } }
-
RE: VeraEdge
Please give me a break down of what you have done and I will help with the next step.
-
RE: VeraEdge
The first step is to test your sensors and see if they are communicating via Serial monitor, then do the same with serial gateway. If its good you will get a "complete".
-
RE: Array Relay Button Actuator
This is the awkward part. On the Vera App & Web, I'm able to toggle ON / OFF to the respective state of the Relay. Eg: "ON" on Vera energize the Relay and "OFF" de-energine the relay. But, when I use the actuator buttons on Arduino input , its reversed. "OFF" turns ON the Relay ...vice versa.
-
RE: Array Relay Button Actuator
... This is insane and it works How do you change between HIGH/LOW state. I changed the #define settings but it's not taking effect.
-
RE: Array Relay Button Actuator
@AWI How do I go about doing this?
This is the messages i get from the gateway when actuator is pressed on the sensor node.
0;0;3;0;9;read: 11-11-0 s=0,c=1,t=2,pt=2,l=2:0
11;0;1;0;2;0
0;0;3;0;9;read: 11-11-0 s=0,c=1,t=2,pt=2,l=2:1
11;0;1;0;2;1 -
RE: MySensors and Vera UI7
A trick I learned right after creating devises is to click on " Reload Luup". Then give it a couple of minutes and you should see the created devices on DEVICES on VERA.
" Reload Luup". could be access from Apps -> Develop apps -> Serial Port configuration -> Reload Luup
-
RE: What am I missing?
Sorry, I was't clear on my previous post. Initially, I went through two (2) Uno's to test my connected sensors and received similar fail messages as yours. Thinking both Uno's were bad , I decided to used a Nano instead. And that's when everything started to work. It is obvious but it took me a while to figure this out. The Uno's consumes slightly more Amperage than the Nano's as a result the radio wasn't able to keep up with the power from the Arduino Uno. What I've learned is these radios don't work well when power is shared with the Arduino and you have bunch of sensor hook to it. Especially under burst transmission over a short period of time.
-
RE: Array Relay Button Actuator
I dedicated Radio ID 11 for this sketch. I don't have any sensor or actuators on this channel. Initially, I had #define noRelays set as 4 but I changed it to 2 for testing purpose and forgot to update the sketch when I posted here. Anyway, this is the problem I'm facing.
-
I'm unable to control the Relays from the Vera App and Web interface, but I'm able to toggle the light switch button ON / OFF on Vera App and Web from the Arduino button inputs. Basically the Button pin works, but not Relay Pin.
-
I'm unable to switch around for realy HIGH/LOW state.
Serial Report: Upon start up
repeater started, id 11
send: 11-11-0-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1
send: 11-11-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
read: 0-0-11 s=255,c=3,t=6,pt=0,l=1:M
send: 11-11-0-0 s=255,c=3,t=11,pt=0,l=16,st=ok:MultiRelayButton
send: 11-11-0-0 s=255,c=3,t=12,pt=0,l=4,st=ok:0.9b
send: 11-11-0-0 s=0,c=1,t=2,pt=2,l=2,st=ok:0
send: 11-11-0-0 s=0,c=0,t=3,pt=0,l=5,st=ok:1.4.1
send: 11-11-0-0 s=1,c=1,t=2,pt=2,l=2,st=ok:1
send: 11-11-0-0 s=1,c=0,t=3,pt=0,l=5,st=ok:1.4.1Serial Report: When button is pressed
send: 11-11-0-0 s=0,c=1,t=2,pt=2,l=2,st=ok:1
send: 11-11-0-0 s=0,c=1,t=2,pt=2,l=2,st=ok:0#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 #define noRelays 2 const int relayPin[] = {3,7}; const int buttonPin[] = {4,5}; 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(NULL, 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); delay(250); 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){ delay(250); if (message.type == V_LIGHT){ delay(250); if (message.sensor <= noRelays){ // check if message is valid for relays delay(250); Relays[message.sensor].relayState = message.getBool(); delay(250); digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly delay(250); gw.saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number) } } }
-
-
RE: Serial Gateway problem after update
@mjunqueira What actuators sketch are you using? I manage to get it to work using My Sensor single button actuator relay from the library. I'm having problems using Multi Button array sketch.
-
RE: Array Relay Button Actuator
I'm having the same issue too using Multi Button Actuator sketch. I can't figure out how to switch from Lo to Hi or Lo to Hi to drive my relays because nothing happens when I change #define. and the sketch can't seem to communicate with my Vera UI7. But when I use a single actuator sketch from My sensor library, it communicates well with Vera. So its obvious that something is not right in the sketch for it to react that way.
Anyway, this is what I have done with the help of the community. Perhaps you or someone can make it better.
#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 #define noRelays 4 const int relayPin[] = {3,7}; const int buttonPin[] = {4,5}; 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(NULL, 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); delay(250); 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){ delay(250); if (message.type == V_LIGHT){ delay(250); if (message.sensor <= noRelays){ // check if message is valid for relays delay(250); Relays[message.sensor].relayState = message.getBool(); delay(250); digitalWrite(Relays[message.sensor].relayPin, Relays[message.sensor].relayState? RELAY_ON:RELAY_OFF); // and set relays accordingly delay(250); gw.saveState( message.sensor, Relays[message.sensor].relayState ); // save sensor state in EEPROM (location == sensor number) } } }
-
RE: What am I missing?
I had the same problem with an Uno because of power issues. I used a Nano and everything worked like a champ.
-
RE: Motion detector with measurement of light intensity, temperature and humidity in the flush box.
@hexenmeister said:
That makes my Lib automatically.
Are you suggesting you have a specific range that the reading ends at? If so what's the range? BTW, What controller are you using?
-
RE: Motion detector with measurement of light intensity, temperature and humidity in the flush box.
Hardware:
You have two Leds , RED and GREEN connected to pin 5 and 6. What is it used for?
What's the benefits of using LUX and LDR sensor? Why not use LDR?Software: What do you mean by "partially autodetection of sensors" and is it for Lux or Motion?
What does BH1750 (with automatic selection of sensitivity) do ?A diffrent question... I was snooping around your github page. You have MyEthernetGateway, MyEthernetGateway_ENC28J60 and MySerialGateway on list. What do they do? Are they stock my sensor scripts or you made changes to it?
https://github.com/hexenmeister/MySensors_MyDevices
Great work man!
Cheers!
-
RE: Serial Gateway problem after update
just wondering are you having similar issues after the upgrade ? I think its mostly relay actuator that has problem?
-
RE: Serial Gateway problem after update
I think I understand the problem you're having. I have the same problem after upgrading to version 1.7.1089. I don't think its related to Serial firmware update. Because it behaves the same on Ethernet gateway.
the guys at Vera wants to help but I don't know how to explain this issue to them.