driving RF from Teensy instead of RF remote?

Status
Not open for further replies.

neep

Well-known member
I have a couple of these RGB LED drivers that go over RF (433.92MHz) :

http://www.aliexpress.com/item/5-24...ntrol-for-LED-RGB-Strip-JS0200/706365687.html

The remote control only works on one driver and is easily lost. So I would like to be able to drive all of these with an Arduino or Teensy but have no idea where to start or if it is even feasible to figure out the protocol and the encoding for the specific remote/controller combination.

I'm also wondering if the controller has more capabilities than the standard remote is allowing one to use, such as individually control each color channel, instead of just cycling through pre-set colors. I found another version of the remote that looks like it may be shipped with the same type of controller, which leads me to believe that more is indeed possible:

http://www.aliexpress.com/item/RF-M...reless-DIY-Dynamic-5V-12V-24V/1180285329.html

Another thing I'd like to do is somehow hook up one of these controllers to a Teensy so that I can use the RF part to create a remote controllable Teensy, with minimal space waste, as these controllers are quite small. My projects (LED dance props like staffs and hula hoops) are extremely tight for space.

Anyone have any experience with this? Talk me into it or out of it please :)
 
Last edited:
I have a couple of these RGB LED drivers that go over RF (433.92MHz) :

http://www.aliexpress.com/item/5-24...ntrol-for-LED-RGB-Strip-JS0200/706365687.html

The remote control only works on one driver and is easily lost. So I would like to be able to drive all of these with an Arduino or Teensy but have no idea where to start or if it is even feasible to figure out the protocol and the encoding for the specific remote/controller combination.

My first guess would be it's a very simple on-off keying protocol.

I'd start with a receiver like this one:

http://www.alibaba.com/product-gs/722094319/wireless_rf_receiver_module.html?s=p

I'd watch/capture the output pin with a scope or logic analyzer while pressing the buttons on the remote. Odds are good it will be a pretty simple and repeatable pattern (hopefully not something like a modern garage door that's designed for security).

If you can capture the patterns for each key, then it just turns into a programming issue to read the pin with digitalRead() and recognize the pulse patterns. Or if you get lucky, there might be 8 or less pulses all be some multiple of a baud rate, where you could use one of the serial ports.

Another thing I'd like to do is somehow hook up one of these controllers to a Teensy so that I can use the RF part to create a remote controllable Teensy, with minimal space waste, as these controllers are quite small. My projects (LED dance props like staffs and hula hoops) are extremely tight for space.

Start by taking it apart. Hopefully something will be apparent as ground (perhaps the negative lead of the battery). Measure the voltage on both wires the buttons with and withing pressing. If they're in a matrix wiring, you'll see rapidly changing voltage as the controller scans the rows. If that case, you'll have some work to do to figure out which pins are rows and which are colums, and some code to write to wait for the controller to output a row pulse and then rapidly send the column "press". Or you could cheat and use something like 74HC4066 chips.

But if you get lucky, maybe each button is just a single digital on-off. You'll find out when you start poking at it with a multimeter or 'scope.
 
Thanks Paul, that's some good ideas! I've been postponing buying a scope / logic analyzer for my electronics lab but it appears now is the time to do so. Any recommendations there?

As for building the remote control after reverse engineering the protocol, what would be a good module for the transmitting part from the Teensy?
 
I believe there's an older thread where scope and logic analyzers were discussed in detail.

Your cheapest option for this project is probably Saleae or a cheap Saleae clone, but beware, their software is only stable on Windows and maybe Mac. The Linux version crashes so much it's unusable.

If you buy a scope, on the low end Rigol has a couple 1000 "Z" models coming out very soon, I believe in the $600 to $900 range depending on bandwidth and extras. Every indication is the new 1000Z's will be the very best value for quite some time, with 4 channels and 30000 waveform/sec speed. I'd wait for one of those. If you can afford $$$, I believe the Agilent 3000X & 4000X are the very best general purpose scopes available today, with awesome 1000000 waveform/sec speed, but they're much more expensive.

Edit: here's a better Rigol 1000Z link.

I highly recommend buying a 4 channel scope. Often only 1 or 2 are needed, but when you need a 3rd and 4th (eg, SPI, I2C plus any other signal, pulsing a pin to "see" when some function runs, etc), you can simply do a lot more with 4 channels that's difficult with only 2.

Avoid crappy scopes like Owon and USB dongles. They suck. It's temping to shop by tech specs, and those products are sold based on specs (eg, more memory or bigger screen than some much better scope). But when you actually use a scope, the speed and usability of user interface is what makes the difference between troubleshooting your circuit vs troubleshooting the scope. But one spec that really does matter is the number of waveforms per second the scope can capture and render as intensity graded pixels. 50000 is pretty good. For scopes without that spec, you can assume it's probably only at best LCD's refresh rate, or only a few per second for USB scopes. Fast waveform capture and intensity graded rendering lets you "see" subtle or weird issues. A slow scope just can't do that.

As for the RF module, my understanding is they're all pretty much the same, at least those simple ones. When you drive the pin high (or low, depending on the module), the just transmit an unmodulated carrier. I'd just get whichever one is most convenient. Or maybe a couple, since they're so cheap, and see if there's any difference. But I doubt they will be.
 
Last edited:
Another option that might work, which doesn't involve buying anything new, would be to just write a tiny program that reads the pin and uses Serial.print() in a loop. You might use an elapsedMicros to pace the pin reading at some consistent speed.

In essence, that's all the Saleae does, only it has much faster USB and fancy software. Did I mention their software crashes on Linux?
 
Well you got me thinking it's time I invest in a good scope anyway. I like the Rigol link you sent and those are sort of within my budget. This will be for many projects to come, and I did electronics in school a long time ago and have always missed having access to a scope since then. I'm looking at the 70MHz ones and wondering about the difference between the DS1074Z-S and DS1074Z, the only thing there seems to be the first one has a 2 channels 25MHz waveform Generator. Do you think it's worth the price difference?

I'm also wondering why both the 100MHz and the 70MHz do 30k waveform captures / second. I always thought that the sample rate was directly related to the waveform capture number. I'm going to do some more reading.
 
Sorry to be off-topic, but speaking of scopes, has anyone tried this all-in-one multi-platform product:

http://my.bitscope.com/store/?p=view&i=product+BS120U

From the summary:

BS120 is a high performance isolated USB Mixed Signal Oscilloscope and Waveform Generator. It combines a dual channel digital oscilloscope, 8 channel logic analyzer, dual port DSP waveform generator, multi-band real-time spectrum analyzer and transient data recorder in one small unit which is fully isolated from the PC to which it is connected
 
The Rigol DS1074 looks pretty amazing for under $600. I'm pretty sure it's going to become the new standard in the hobbyist world. The sample rate is slow in 4 channel mode, there's no external trigger, and 1 vertical control shared for 4 channels is slightly annoying, the screen is a bit small for 4 waveforms (and tiny fonts), and the fan will probably be loud, but it still looks like a pretty amazing scope for such a low price.

Of course, nobody's actually used one yet, except a brief video from Dave Jones briefly at a trade show. But it did seem to perform pretty well in that video. Rigol's also recently proven they can make pretty good scopes. Most of the other Asian "budget" scopes are junk. If you're cautious, wait a while until the reviews come out, or maybe even 6-8 months until Rigol's had time for a hardware rev or two?

The 2 models will have basically the same hardware, perhaps with a different analog filter. I've heard people say the 70 and 100 MHz models in the DS2000 series are identical (eg, they both are approx 110 MHz). I'm sure a lot more info will become available after many people gets their hands on these new scopes.

I personally prefer a separate stand-alone function generator. I like having a dedicated set of buttons and knobs, but maybe I'm just old fashioned? Maybe you could get one used for less than $233? In fact, I have a Protek B8010FD that I'll probably be selling in a year or two.

If you do compare Rigol's function generator to other units, look at the ranges for non-sine waveforms. They're often a lot less. Everybody loves to print one large number and hope you don't look at the others that aren't nearly as good.

I would NOT waste money on that BS120 USB gadget.
 
Last edited:
A good oscilloscope captures many waveforms per second and renders them onto the screen with intensity grading. The screen probably refreshes at 25, 30 or 60 Hz. But if your waveform is 10 us long (1 us/div) and reoccurring continuously (eg, no waiting for the trigger event), an ideal scope would capture it 100000 times per second. At 60 Hz refresh, each redraw of the screen would represent all 1666 copies of the waveform during that time.

If something "weird" is happening infrequently, a good scope will make the problem apparent. For example, perhaps the waveform involves signals from a Teensy. Maybe the interrupt for a serial port or millis or USB communication on Teensy3 happens at just the wrong moment during your code that creates the signals. Those interrupts are very brief and they don't happen often, and whether they are correlated with your signal can depend on subtle factors in your software and the core library code in Teensyduino, and maybe just dumb luck. Often when interrupts happen relative to waveforms can be random. Very often such problems are extremely infrequent, where the interrupt occurs at precisely the wrong instant while your code is doing something.

On a good scope, those extremely infrequent events are more likely to be captured and displayed as a faint but visible trace. Sometimes you'll stare at the screen for many seconds and see a little "blip" or "wiggle" or "double edge" as a result. No scope, not even the Agilent 4000X, is "zero blind". They all miss some input. But better scopes capture faster and more frequently (Agilent can capture 1 million waveforms/sec), which maximizes the chances that something "different" in the waveform on an infrequent basis will actually appear as something noticeable on the screen.

Edit: obviously 1000000 waveforms per second is only possible if the trigger event happens 1 million or more times per second. If you only work with slower signals, like serial data at 115200 baud, the upper limit is always how many triggers are possible per second. But generally, faster scopes will manage to trigger more times per second and capture & render more waveforms per second than slower scopes that miss the opportunity to observe your signals because they're busy doing other work. Fast scopes capture and display the maximum amount of information, giving you a far more complete picture.

Old analog scopes work this way. The electron beam sweeps across the screen for every trigger event, and the phosphor in the screen does the intensity grading automatically. But you can't see anything before the trigger, you can't capture a single trigger (the Polaroid film for those ancient scope cameras is no longer made - long exposure on a normal camera will overexpose), and you don't get lots of nice features found on all modern digital scopes.

A slow scope, or a USB dongle that captures only a few times per second, is very unlikely to show you infrequent signal anomalies. With modern systems based on microcontrollers like Teensy, often things do work 99+% of the time and you're looking for those exceptional cases. A good scope can help you discover those cases.
 
Last edited:
Okay, I've put in a request with the EU reseller of Rigol for a DS1074 scope. So that's underway, but in the mean while I want to see where I can get without that, so I've started by taking off the shrink-wrap from the receiver / controller to see what we have under the hood. Here's some pictures:







Anybody recognize anything I can connect a Teensy input to?
 
And here are pics of the remote controller:





Looks like the important looking ICs on both the remote and receiver are not generic ones. So I guess I'll just have to trial and error and hope I don't blow anything up. What I find interesting is that there are more buttons possible on the remote. I wonder how these can be used. I have some a variation on the one I have that has more buttons employed, and I ordered a pair, so that will be interesting to compare.

I also found the product manufacturer website, and the specs of the particular one I believe I have:

http://rayruntech.com/product/product39.html

"Each unit can be matched to 3 remote controllers" - makes me wonder how the distinction is made between the controllers.

To start debugging the protocol w/o a scope I've ordered a 433MHz transmitter and receiver on Ebay:

http://www.ebay.co.uk/itm/221308877191
 
Last edited:
Okay, I have the 433MHz receiver and transmitter pair now, and I've been able to send and receive between a Teensy and an Arduino Uno using the VirtualWire library.

What I would like to do now is analyze the protocol that is coming off the LED controller remote. I've tried several libraries for example this one:

https://code.google.com/p/rc-switch

Code:
/*
  Simple example for receiving
  
  http://code.google.com/p/rc-switch/
  
  Need help? http://forum.ardumote.com
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  delay(1000);

  mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
}

void loop() {
  if (mySwitch.available()) {
    
    Serial.println("mySwitch.available()");
    
    int value = mySwitch.getReceivedValue();
    
    if (value == 0) {
      Serial.print("Unknown encoding");
    } else {
      Serial.print("Received ");
      Serial.print( mySwitch.getReceivedValue() );
      Serial.print(" / ");
      Serial.print( mySwitch.getReceivedBitlength() );
      Serial.print("bit ");
      Serial.print("Protocol: ");
      Serial.println( mySwitch.getReceivedProtocol() );
    }

    mySwitch.resetAvailable();
  }
}

However I am not able to read anything from the pin. mySwitch.available() just never happens. I've tried different pins.

I've also tried this library:

https://bitbucket.org/fuzzillogic/433mhzforarduino/wiki/Home

Same thing: nothing happens. I am measuring voltage difference on the data pin of the receiver though, which is connected to interrupt 0 (pin 2), but somehow this doesn't actually trigger the interrupt.

Anyone who ever did this successfully? Either Teensy or Arduino?
 
Last edited:
I believe there's an older thread where scope and logic analyzers were discussed in detail.

-snip-

If you buy a scope, on the low end Rigol has a couple 1000 "Z" models coming out very soon, I believe in the $600 to $900 range depending on bandwidth and extras. Every indication is the new 1000Z's will be the very best value for quite some time, with 4 channels and 30000 waveform/sec speed. I'd wait for one of those.

I finally got my hands on a DS1104Z! I haven't had an oscilloscope to work with for many years and am excited about using it for the protocol analysis of these RF transmitter/receiver pairs.

Thanks for the tip on that oscilloscope Paul!
 
most of our digital world, communications, etc, are not recurrent waveforms; they're often a bit stream (serial, as in SPI, etc). So a digital storage 'scope, even with just 10K sample memory (for the sake of cost), is good enough for most hobby/student endeavors. This has been the case for my DSO2090 ($130, China-direct). It's USB. I use a 'scope so infrequently that I can't rationalize a $400 or more scope with a built-in LCD display, vs. USB and use the laptop/desktop's display, and mouse instead of buttons on the 'scope.
But, then, I'm cheap.
 
Those USB scopes are great at capturing single-shot events and clean, repetitive signals.

But where they really fall short compared to a "real" scope is their waveform update rate. An expensive Agilent 3000 or 4000 series scope can capture 1000000 waveforms per second (on the time scales where the width of the display is under 1us), or at a rate about as fast as the horizontal scale, and render intensity graded images on the screen that represent all those captures. Many budget scopes are now offering 10000 to 50000 waveform/sec capture+rendering, which is still pretty good, especially for under $1000. I believe that DS1104Z is 30000 waveforms/sec?

If your problem is highly reproducible, any slow scope can view it.

But if it's a difficult problem where you get a correct waveform nearly all of the time and only an infrequent occasions does your circuity or software the wrong thing, on a high end digital scope (or a true analog scope) you'll see a faint but easily visible "ghost" trace will appear.

With a slow scope, the best you can do is turn on infinite display persistence. If your trigger source is precise (eg, not on a noisy signal), eventually after minutes to hours, a slow scope might accumulate enough data to show the infrequent events a fast scope can capture in only seconds. But even then, how would you know to look? The huge advantage of a fast scope is the intensity graded display can show you "weird" faint echos or ghost-like replicas or alternate version of your signal while you're just casually poking around the circuit. Often times that stuff just means you didn't get the triggering set up perfectly, so there definitely is an art and level of experience to using a scope. But at least you get to see it and have every opportunity to notice something isn't quite right on those rare occasions causing the faint trace that's not where the signal usually goes.
 
I rely on single-trace capture, and some special software actions to cause the problem to occur, then use the trigger input of the scope. That way, the trigger time is where I begin to look.
But yes, it's much easier if the anomaly recurs frequently.
 
Status
Not open for further replies.
Back
Top