Hello,
I hope this question is not too silly.
I am planning to water the garden during summer vacations. The idea is to use an arduino to control a solenoid valve. I will also connect a 433Mhz receiver on it.
Domoticz is running on rpi2 with a rflink attached to it.
Is there any recommended protocol so that arduino will act like a remote control socket.
Any idea is welcomed.
Thanks,
Olivier
Which protocol ?
Moderators: rtenklooster, Voyager, BertB, Stuntteam
Re: Which protocol ?
Hello Olivier,
you can use the rc-switch library for this purpose: https://github.com/sui77/rc-switch
Basically, you can use whatever protocol is supported by rc-switch. In case you have some
wireless remote control, you can maybe use the same protocol as that one so can switch
it manually with that one as well. The ev1527 protocol is pretty popular.
Kind Regards,
dk
you can use the rc-switch library for this purpose: https://github.com/sui77/rc-switch
Basically, you can use whatever protocol is supported by rc-switch. In case you have some
wireless remote control, you can maybe use the same protocol as that one so can switch
it manually with that one as well. The ev1527 protocol is pretty popular.
Kind Regards,
dk
Re: Which protocol ?
Hi,
Thank you for the feedback.
With some difficulties, I am now able to receive what rflink(domoticz) is sending.
On Ardnuino, I used this piece of code :
inspired from https://z4ziggy.wordpress.com/2014/06/2 ... with-ease/
On domoticz, I added a On/Off Switch set as ARC protocol.
Now, there are many improvments to implement:
Thank you for the feedback.
With some difficulties, I am now able to receive what rflink(domoticz) is sending.
On Ardnuino, I used this piece of code :
Code: Select all
#include <RCSwitch.h>
// number of times to resend sniffed value. use 0 to disable.
#define RESEND_SNIFFED_VALUES 10
// ye, thats the led pin #
#define LED_PIN 13
// class for 434 receiver & transmitter
RCSwitch rf434Switch = RCSwitch();
void setup()
{
// print fast to console
Serial.begin(115200);
// 434 receiver on interrupt #1 (pin #3)
rf434Switch.enableReceive(1);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println("[+] Listening");
}
// simple decimal-to-binary-ascii procedure
char *tobin32(unsigned long x)
{
static char b[33];
b[32] = '\0';
for ( int z = 0; z < 32; z++) {
b[31 - z] = ((x >> z) & 0x1) ? '1' : '0';
}
return b;
}
void process_rf_value(RCSwitch rfswitch, int rf)
{
char str[120];
unsigned long value;
value = rfswitch.getReceivedValue();
if (value) {
sprintf(str, "[+] %d Received: %s / %010lu / %02d bit / Protocol = %d",
rf, tobin32(value), value, rfswitch.getReceivedBitlength(), rfswitch.getReceivedProtocol() );
// mask
if (value & 00000001) {
digitalWrite(LED_BUILTIN, HIGH);
} else {
digitalWrite(LED_BUILTIN, LOW);
}
} else {
sprintf(str, "[-] %d Received: Unknown encoding (0)", rf);
}
Serial.println(str);
// reset the switch to allow more data to come
rfswitch.resetAvailable();
}
void loop()
{
if (rf434Switch.available()) {
process_rf_value(rf434Switch, 434);
}
}
On domoticz, I added a On/Off Switch set as ARC protocol.
Now, there are many improvments to implement:
- Masks the bits sent from rflink for "protection"
- filter multiple sent (rflink send it 4 times. probably normal)
- Find a good solenoid valve
- Put this in water proof box
- ...
Who is online
Users browsing this forum: No registered users and 9 guests