Page 1 of 2

rflink on esp8266

Posted: Monday 24 October 2016 10:15
by ledfreak3d
Hey All.
Anybody know if there are plans to intergrate rflink on a esp8266 instead of a the mega
seems a bit overkill for what it is doing and its big
should not be a big problem to convert the code to run on the esp

Re: rflink on esp8266

Posted: Monday 24 October 2016 10:18
by NietGiftig
ledfreak3d wrote:should not be a big problem to convert the code to run on the esp
Oke, i think you are the perfect man to execute this proposal!

Re: rflink on esp8266

Posted: Monday 24 October 2016 12:04
by ledfreak3d
yea I am willing to try atleast send them a email but never got a reply

Re: rflink on esp8266

Posted: Monday 24 October 2016 16:01
by NietGiftig
ledfreak3d wrote:yea I am willing to try atleast send them a email but never got a reply
Yes, but an email is not coding.
You can fork an previous version, and show the world that its not a problem!
https://drive.google.com/open?id=0BwEYW ... XphN0ZxdEU

(edit changed the downloadlink)

Re: rflink on esp8266

Posted: Monday 24 October 2016 19:19
by Derik
perhaps ask stuntteam [ RFlink ] on this forum
Or :
http://www.esp8266.nu/forum/

Re: rflink on esp8266

Posted: Wednesday 14 December 2016 23:40
by Viktor
rflink port to esp8266 seems easy
In "Misc", add the following code:

Code: Select all

int 
_DEFUN (strncasecmp, (s1, s2, n),
    _CONST char *s1 _AND
    _CONST char *s2 _AND
    size_t n)
{
  if (n == 0)
    return 0;

  while (n-- != 0 && tolower(*s1) == tolower(*s2))
    {
      if (n == 0 || *s1 == '\0' || *s2 == '\0')
    break;
      s1++;
      s2++;
    }

  return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
}
(because 'strncasecmp' is missing in esp8266)

add in "Base":

Code: Select all

#include "Arduino.h"
Change pins in "Base"

Code: Select all

#define PIN_RF_TX_VCC               D1                                          // +5 volt / Vcc power to the transmitter on this pin
#define PIN_RF_TX_DATA              D3                                          // Data to the 433Mhz transmitter on this pin
#define PIN_RF_RX_VCC               D4                                          // Power to the receiver on this pin
#define PIN_RF_RX_DATA              D2 					// On this input, the 433Mhz-RF signal is received. LOW when no signal.
Change D1..D4 to whatever you need
It can now compile on arduino IDE (I'm using Wemos D1 mini)

I'm waiting 433Mhz parts from China, I'll try in a few days if it work

(sorry if bad english, not my natural language)

Re: rflink on esp8266

Posted: Thursday 15 December 2016 0:25
by Stuntteam
Or you just wait until we are ready to release an official version with proper support..

Re: rflink on esp8266

Posted: Thursday 15 December 2016 7:03
by ledfreak3d
Ill give it a go victor i can test rf functionality
Would be great to have a rf link thats smaller then my whole donoticz server

Re: rflink on esp8266

Posted: Thursday 15 December 2016 9:53
by ledfreak3d
Hey Victor

what version of the source did you use and what version arduino ide I cant compile it without errors

Re: rflink on esp8266

Posted: Sunday 29 January 2017 7:54
by Phermansson
I tried Viktors mods with a Nodemcu. Compiles and uploads fine. The onboard led flashes irregularly, when I press a button on my Nexa remote it lights steady. But I dont get any output besides the start message ("RadioFrequencyLink - RFLink Gateway V1.1 - R33;").
The receiver I use is maybe not good. To bad I dont have a Arduino Mega to test with.

Re: rflink on esp8266

Posted: Sunday 29 January 2017 10:13
by gerardwr
Phermansson wrote:I tried Viktors mods with a Nodemcu. Compiles and uploads fine. The onboard led flashes irregularly, when I press a button on my Nexa remote it lights steady. But I dont get any output besides the start message ("RadioFrequencyLink - RFLink Gateway V1.1 - R33;").
The receiver I use is maybe not good. To bad I dont have a Arduino Mega to test with.
I made the changes too, and iT compiled OK but did not seem to receive signals.

You need to make an additionele change in rawsignal to account for the higher clockspeed. After this change signals from RF remotes like Kaku are received OK.

Will check in my source for the correct value to change, stay tuned, I Will add it here, today.

UPDATE
Thx to @hreintke from:
http://www.letscontrolit.com/forum/view ... =11&t=2434
In tab Rawsignal line 23 change to:

Code: Select all

const unsigned long LoopsPerMilli=2775;   // dapted value for ESP8266 = 2775
Output from Kakunew and X10 is recognised by RFlink on the Esp8266, some output from the Arduino Serial Monitor:

Code: Select all

20;1A;NewKaku;ID=000218c4;SWITCH=4;CMD=OFF;
20;1B;NewKaku;ID=000218c4;SWITCH=4;CMD=ON;
20;1C;NewKaku;ID=000218c4;SWITCH=4;CMD=OFF;
20;1D;NewKaku;ID=000218c4;SWITCH=4;CMD=ON;
20;1E;NewKaku;ID=000218c4;SWITCH=4;CMD=ON;
20;1F;X10;ID=41;SWITCH=1;CMD=ON;
20;20;X10;ID=41;SWITCH=1;CMD=ON;
Some other protocols for RF temperature that are recognised with the same RFLink version on an Arduino are NOT recognised on the ESP8266, so perhaps more finetuning is required.

If you have further improvements, please share them!

Re: rflink on esp8266

Posted: Sunday 05 February 2017 7:18
by Phermansson
Ok great! I tried with 2775 and an old Nexa remote. It doesnt recognize it, but I get some output from debug:

Code: Select all

20;01;RFDEBUG=ON;
20;02;DEBUG;Pulses=25;Pulses(uSec)=270,660,240,660,240,660,240,660,240,810,120,120,1740,660,720,210,240,660,720,210,240,900,30,450,150;
20;03;DEBUG;Pulses=35;Pulses(uSec)=60,210,1680,660,240,660,240,660,240,660,240,690,180,330,1590,630,240,660,240,660,240,660,240,720,60,330,2160,210,240,690,240,660,240,2280,1560;
20;04;DEBUG;Pulses=26;Pulses(uSec)=1380,2220,270,660,240,690,240,690,1710,180,240,690,240,660,240,660,240,690,210,690,2160,660,240,660,270,60;
20;05;DEBUG;Pulses=24;Pulses(uSec)=240,690,240,690,1680,150,240,660,240,660,240,660,240,660,690,270,1800,90,240,660,240,660,270,240;
For this to work I also had to power the receiver with 5 volts, 3,3 wouldn't do it.

Re: rflink on esp8266

Posted: Sunday 05 February 2017 11:41
by gerardwr
Phermansson wrote:Ok great! I tried with 2775 and an old Nexa remote. It doesnt recognize it, but I get some output from debug:
<snip>
For this to work I also had to power the receiver with 5 volts, 3,3 wouldn't do it.
It's a start , but you would expect multiple pulsetrains that look alike. More something like this (from an old SelectRemote/Blokker remote), with nice stable value of the last pulse (here 6990). But the Nexa protocol may be different.

Code: Select all

20;8F;DEBUG;Pulses=50;Pulses(uSec)=510,1710,420,1710,420,1710,450,1800,450,1800,420,1800,420,1800,420,1800,420,1800,450,3750,450,1800,420,1800,420,1800,420,1800,420,3750,420,1800,420,3750,420,3750,450,1800,450,1800,420,3750,450,3750,450,1800,420,1800,450,6990;
Re. power. Yes, I have some 433Mhz (with a coil) receivers that also require 5V, but others (with a crystal) are also happy with 3.3V. So it depends on the type of receiver.

Re: rflink on esp8266

Posted: Sunday 05 February 2017 11:52
by gerardwr
There seems to be quite some interest in this topic ( 1000+ views), but the number of posters is rather low.

Would be interesting in hearing from forum users that are actual successful in running RFLink on the ESP8266. Sharing helps!

Re: rflink on esp8266

Posted: Sunday 05 February 2017 12:01
by freijn
Reading in as well as it is very interesting !

Willing to help being tester, unfortunately no time to do coding myself at this moment :-( So can't share anything.

Re: rflink on esp8266

Posted: Sunday 05 February 2017 13:23
by gerardwr
freijn wrote:Reading in as well as it is very interesting !

Willing to help being tester, unfortunately no time to do coding myself at this moment :-( So can't share anything.
No worries, thx.

Re: rflink on esp8266

Posted: Sunday 05 February 2017 18:41
by Phermansson
Nice there is some interrest! Indeed the pulses from the Esp are a bit strange.
I made a new experiment. I took an old Arduino Duemilanove and connected a receiver, loaded the "ReceiveDemo_Advanced" sketch from RCSwitch library. I now have four readings from the Esp-12 setup and two from the Arduino. Here are the results:

Code: Select all

Old Nexa remote
Button A1Off
Rflink with Esp-12
20;02;DEBUG;
Pulses=25;
Pulses(uSec)=
270,660,240,660,240,660,240,660,240,810,120,120,1740,660,720,210,240,660,720,210,240,900,30,450,150;

20;03;DEBUG;
Pulses=35;
Pulses(uSec)=
60,210,1680,660,240,660,240,660,240,660,240,690,180,330,1590,630,240,660,240,660,240,660,240,720,60,330,2160,210,240,690,240,660,240,2280,1560;

20;04;DEBUG;
Pulses=26;
Pulses(uSec)=
1380,2220,270,660,240,690,240,690,1710,180,240,690,240,660,240,660,240,690,210,690,2160,660,240,660,270,60;

20;05;DEBUG;
Pulses=24;
Pulses(uSec)=
240,690,240,690,1680,150,240,660,240,660,240,660,240,660,690,270,1800,90,240,660,240,660,270,240;

Old Nexa remote
Button A1Off
ReceiveDemo_Advanced.pde with Arduino Duemilanove
Decimal: 20 (24Bit) Binary: 000000000000000000010100 Tri-State: 000000000FF0 PulseLength: 355 microseconds Protocol: 1
Raw data: 11128,388,1040,428,996,424,936,460,1032,388,1020,436,988,476,968,436,1000,504,928,380,1028,412,1016,380,1060,356,1032,464,932,476,964,488,964,452,1008,408,1008,504,916,1148,408,316,1160,1092,304,432,1072,360,1012,
 
Decimal: 20 (24Bit) Binary: 000000000000000000010100 Tri-State: 000000000FF0 PulseLength: 352 microseconds Protocol: 1
Raw data: 11064,484,952,448,972,452,936,448,968,480,936,472,964,400,1012,432,988,412,1008,404,1004,448,936,496,932,456,952,488,952,440,984,404,1004,440,972,448,980,408,1000,1156,260,460,996,1136,268,472,944,460,972,
 

Re: rflink on esp8266

Posted: Sunday 05 February 2017 18:48
by Phermansson
See now that the Esp gives one row of output sometimes and other times three.

Re: rflink on esp8266

Posted: Sunday 05 February 2017 19:20
by gerardwr
Phermansson wrote:Nice there is some interrest! Indeed the pulses from the Esp are a bit strange.
I made a new experiment. I took an old Arduino Duemilanove and connected a receiver, loaded the "ReceiveDemo_Advanced" sketch from RCSwitch library. I now have four readings from the Esp-12 setup and two from the Arduino. Here are the results:
<snip>
The Arduino Due output is what you expect. Repeating "packets" of the same data, consisting of 1 looooooong puls (the start/stop of the packet) and a number of shorter pulses. The RCSWITCH code is interrupt based and probably decides on the detection of the long pulse that the packet is complete.

Looking at the ESP output no loooooong pulse is detected, it seems somehow "missed". Not sure why that is, but I know the RFLink code is NOT interrupt based and uses timing loops to measure the pulse-lengths, hence the 2775 change to compensate for ESP-80Mhz vs Arduino-16Mhz.

As long as the ESP output is not similar like the Duenove output you're out of luck using the ESP for detection.

Considering the fact that your code is same as mine, you would expect some kind of HW mishap.

Just a few wild guesses what could be wrong with the ESP setup (please forgive me if I state the obvious):
- your 433 receiver is bust
- your 433 receiver is not properly connected to GND
- your 433 receiver is not properly connected to the appropriate ESP pin
- your 433 receiver pin is connected to the same GPIO as the onboard LED and the flashing LED distorts the data, happened to me once :-(
- you have a weak power supply to the ESP

If your sure that your problem is not HW caused you could try a RF sniffer that I use on the ESP. Its here : https://github.com/pimatic/RFControl
Use the example Rfcontrol/simple.ino, and change the pinnumber in line 5. It will reliably detect the pulslengths.

Good luck.

Re: rflink on esp8266

Posted: Tuesday 07 February 2017 12:22
by Phermansson
Thanks for your input!
I looked over my hardware and tried different things but I get no good results. I think part of my problem is that I don't have one of the approved receivers yet. I think I put this on hold until the RXB6 I've ordered arrives in the mail.