Hi @Julien_Moors,
Dit you manage it after all?
I am doing this DIY project too. In my case the relay is working fine, but the problem is that my intercom seems to be “active” before I can use the button to open the door.
That is: someone has to have ringed the bell, or I have to use the button to view the camera before I can use the button to open the door. (I have a Tegui M-72).
Now, I could use 2 Arduino’s and relays to first “press” the button for the video function to make the intercom active, and then use the second to press the button for opening the door.
But another solution could be more elegant…
Parts for a secons Wemos/Arduino will be delivered tomorrow, so that relay can activate the intercom by “pressing” the buttom for screen activating/communication) before “pressing” the dooropener…
You can easely control 2 relais with the same arduino,
: set first relay ON
: delay 200 mSec
: set first relay OFF
: delay 100 mSec
: set second relay ON
: delay 200 mSec
: set second relay OFF
@JPe4619
Hi Jan,
Thank you. I can imagine it can. But I am afraid my programming skill are not up to that level…
Yours?
Would be very grateful if you could modify the code!
Rem: please don’t call these boards “Arduino” boards, but ESP8266 or WEMOS (to prevent confusion)
Something like this should probably work. (not tested, don’t have this boards)
Only the Toggle command will start the 2-relay action (‘Toggle’ is not the right naming, 'Itching is used by Sonoff, but also ‘Pulsed’ is used)
The second relay can be connected to D2.
@JPe4619
Sorry, I program them with the Arduino programmer, that’s why.
Thanks for the code!
There’s just another problem then since I don’t know how to connect the second relay to D2. Since this is a platform where you can stack the components, it seems to having be addressed some way on the “bus”?
Am I correct that I have to short circuit the red contacts (D1) for the first relay board and shortcut the yellow contacts (D2) on the second relay board?
You wrote “remove the D1 link”. But there is nothing to remove; it’s not already not connected. Is D1 the default perhaps? If so, is this default override on the second board when connecting D2 together? Or do I have to do something else to determine 1st and 2nd relay?
Good that you are care-full, but as said, for relay 1 there must be a link on D1 and for relay 2 a link on D2, if there are no links, then you don’t have to remove anything ( it’s so simple, that is is hard to believe
On the product page of the relay, it says:
Het relais is standaard verbonden met de D1 poort van de Wemos
but that seems not to be true. (There is also not a tiny copper track between the solder points ? )
@JPe4619
Well, in fact it is true. According to my multimeter, D1 is connected to each other. It just cannot be seen because of the color/‘paint’ on the board…
So; all is ready now for flashing the software. Unfortunately I get errors…
In short: It said:
relayctrl-2Relays:11:9: error: two or more data types in declaration of ‘PIN_RELAY1’
int int PIN_RELAY1 = D1;* relayctrl-2Relays:12:9: error: two or more data types in declaration of ‘PIN_RELAY2’
int int PIN_RELAY2 = D2;*
Then I removed 1 of the 2 “int”-s where you define the relays D1 and D2.
That seemed to help.
But then I get the errors:
relayctrl-2Relays:19:11: error: expected primary-expression before ‘int’
pinMode(int PIN_RELAY1, OUTPUT);* relayctrl-2Relays:22:11: error: expected primary-expression before ‘int’
pinMode(int PIN_RELAY2, OUTPUT);*
I am stuck there…
I’ll send you the error log as a private message. May be too long (and specific) for here…
Can you help me out once more please?
This script is now working flawlessly for a few weeks here.
One addion would be great, but I suspect it is not possible. Still;
Would it be possible for the Wemos (and therefor Homey via i.e. a webhook? ) to sense if a relay contact has been shortcut externally?
That way it would sense if someone has pressed the doorbell and therefor getting a notification on my mobile (at home or away)