Problem with multiple relays and delays
-
@zrom69 is this a question or statement?
-
I'm sorry for my English, I'm French
I try to control node 3 and motorized shutters which card must be used aduino thank you
:smiley:@zrom69 no worries.
I am using arduino Nano but others will work too. The Nano is small enough and easy to program (it has USB). The Pro Mini is also a good option, but needs extra programer (it has only serial connectors).
I am using those and all work very well:
http://www.banggood.com/5Pcs-ATmega328P-Nano-V3-Controller-Board-For-Arduino-Improved-Version-p-951797.html
In addition you need the relays - you either could build that yourself or use ready to use ones:
http://www.banggood.com/5V-4-Channel-Relay-Module-For-Arduino-PIC-ARM-DSP-AVR-MSP430-Blue-p-87987.htmlIf you want to control shutters, you usually need 1 relay per direction. so for your 3 shutters it would be 6 relays. I am not sure if there are products out there, you could take one with 8 relays if you do have the space or make them yourself.
The code I posted above is "ready" for 3 shutters (up/down each) and manual control buttons on an Arduino Nano.
you need to connect the relays on digital pins 3/4 & 5/6 & 7/8 and the manual inputs on analog A0/A1, A2/A3, A4/A5 (note: pin 14 makes out of Analog A0, a digital D14)
Besides this, connect the radio and power and you should be ready to go. -
hi @parachutesj hi @all
i tried the sketch posted above. it works but my relay board is active low and the relays are on when they should be off. #define RELAY_ON 0 and #define RELAY_OFF 1 do not change the behavior. the relays stay on. do you have an idea what is happening? thx -
hi @parachutesj hi @all
i tried the sketch posted above. it works but my relay board is active low and the relays are on when they should be off. #define RELAY_ON 0 and #define RELAY_OFF 1 do not change the behavior. the relays stay on. do you have an idea what is happening? thx@ihtgtwtd
change in the code in the routines shutters UP/DOWN/STOPthe parts
digitalWrite(RELAYxxx, HIGH);HIGH to LOW and vice versa
SJ
-
@ihtgtwtd
change in the code in the routines shutters UP/DOWN/STOPthe parts
digitalWrite(RELAYxxx, HIGH);HIGH to LOW and vice versa
SJ
thanks for the quick reply. I did what you suggested and the switches work the right way but when I reset the arduino all relay contacts turn on and stay on until I give a command. this is a major problem, it will destroy the shutter motor. i think there is no defined case when the arduino powers on.
-
thanks for the quick reply. I did what you suggested and the switches work the right way but when I reset the arduino all relay contacts turn on and stay on until I give a command. this is a major problem, it will destroy the shutter motor. i think there is no defined case when the arduino powers on.
@ihtgtwtd
put this into the setup routine within the "for"digitalWrite (pin, HIGH);e.g. like this:
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_COVER); // Then set relay pins in output mode pinMode(pin, OUTPUT); digitalWrite (pin, HIGH); } -
@ihtgtwtd
put this into the setup routine within the "for"digitalWrite (pin, HIGH);e.g. like this:
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_COVER); // Then set relay pins in output mode pinMode(pin, OUTPUT); digitalWrite (pin, HIGH); }@parachutesj
thank you very much. looks good now.