RCSwitch library

Status
Not open for further replies.

2n3055

Well-known member
Hi,

Does anybody know why RCSwitch library is not working on Teensy2.

Same problem with Teensy 3.

Thanks
 
Looking at the code and the #defines, this library seems just not to be intended to run on Teensy. You should either ask the author for adding Teensy support, or you fork the library, add Teensy support yourself and do a pull request afterwards.

But when it comes to control RC servos, the PulsePosition library which comes with Teensyduino is much more powerful and available immediately.
 
But when it comes to control RC servos, the PulsePosition library which comes with Teensyduino is much more powerful and available immediately.
I don't need the send parts but need to data from receiver.

Unfortunately I don't have the level to rewrite/design such a library:-(
 
I looked at the link quickly and it links to RF 433 radio …

it isn't clear what part RCV or Xmit is desired for the controls … more details would help
 
Regarding PulsePosition

https://www.pjrc.com/teensy/td_libs_PulsePosition.html

I don't need the send parts but need to data from receiver.

Unfortunately I don't have the level to rewrite/design such a library:-(

Good news for you - the receive parts are separate from the transmit parts. You can use either, or both. So if you only want to receive PPM but not send it, all you need to do is use the PulsePositionInput and simply not use PulsePositionOutput. Easy peasy!

But do be aware PulsePosition only works on Teensy LC, 3.1, 3.2, 3.5 & 3.6. It doesn't work on Teensy 2.0.
 
But looking quickly at the RCSwitch.cpp code, it's not clear to me whether it's really doing PPM or something else. Will look again when I have a little more time.

I do see code for both sending and receiving stuff RCSwitch.cpp, if that matters to you...
 
Thanks Paul,

But it's not to control/receive servo motor data (PPM coding). But to decoded radio frame coming from a radio remote control. Switching on/off AC power socket!
 
@2n3055 - giving a link to the radio in use would help. It might be a generic one - but if from a know maker sFun/AdaF or like one of their products getting the to the right library will be faster.
 
@2n3055 - giving a link to the radio in use would help. It might be a generic one - but if from a know maker sFun/AdaF or like one of their products getting the to the right library will be faster.

I don't find many information but some timing diagram (Intertechno):
HTML:
https://esp-32.com/index.php/2017/06/15/433mhz-signal-pattern-inspection/#comment-44

With an Arduino, decoding with RCSwitch library works perfectly (tried Virtualwire without success). But apparently it's not a piece of cake to adapt it with Teensy...
 
For what it is worth have used RCSwitch in in both modes with a T3.2 without any particular hassle other than the input pins for the library being built around the Arduino Uno interrupt pins, has been a while since I was in the code but:

mySwitch.enableReceive(2);

configures it to receive on pin 2, despite comments in the code saying otherwise.

What I have had a lot of trouble with is some of the transmitter modules being pretty rubbish and ones that worked with 5V power on a slower Uno lost 50-75% of their range at 3.3V with a faster and noiser peripherals running alongside it. Suspect your problem is at least in part electrical.

Possibly complicating things is that the version I use is from some random part of the internet some years ago and left alone because it works so will need to check if the linked library above is actually what shows up on my machine as 'RC switch'.
 
But apparently it's not a piece of cake to adapt it with Teensy...

Can you tell us what you've actually tried which did not work?

I installed the library and opened the ReceiveDemo_Simple example. It compiles without any error.

I looked at the code in more depth. It appears to use only the very standard Arduino functions, which do work on Teensy. The input signal in received using a function from attachInterrupt with "CHANGE", which is will supported on Teensy. The Teensy boards (and other hardware this library supports) runs *much* faster than Uno, but the library is doing all the timing by getting microseconds from the Arduino micros() function, which works on all Teensy boards.

The only "gotcha" I can see, which GremlinWrangler already mentioned, is it takes the interrupt number rather than pin number. On Uno & Mega, the int number and pin numbers are different, as the comment in the code explains. On Teensy 3.2 (and most other newer boards) the int number and pin number are the same. So that ReceiveDemo_Simple will listen for the signal on pin 0.

This library really should "just work". If you're getting some sort of error message, or you're running it and getting wrong results, or no results at all, perhaps the problems are not incompatible software, but some sort of mistake or misunderstanding you've made? We can try to help, but we can't even see what you've really done. In fact, from your messages, I can't even tell if you've even tried using the library yet, or if this all based on your assumption it wouldn't work if you tried.
 
I need to apologies for my mistake.

After your remarks, I made some tests and something else was changed!!
Tried RCSwitch with an another (oldest!!!) remote and... it works...

It time to understand why. With logic analyzer I saw.

Intertechno has updated his coding. Now it's code is not the same. The ID device is now 26 bits lang. https://waschto.eu/intertechno-433-mhz-funksteckdose-in-fhem-einbinden/
(sorry it's only in German, see under "neue Steckdose – selbst lernend – 32-stelliger Code").

Capture d’écran 2019-02-24 à 14.07.02.jpg
Capture d’écran 2019-02-24 à 14.07.21.jpg

Now I need to found a new library to decode this new frame...

If somebody has an idea...

Thanks and sorry again
 
Status
Not open for further replies.
Back
Top