Shop OBEX P1 Docs P2 Docs Learn Events
IR signal speed — Parallax Forums

IR signal speed

shmowshmow Posts: 109
edited 2010-05-27 04:35 in Propeller 1
Hello All,

I'm trying to duplicate my TV remote with a propeller.
I have the prop wired to an IR emitter, and I have
a 56.9kHz IR receiver reading the emitter's signal
(and showing the result with an oscilloscope).

I'm stumped regarding the output speed; I know the propeller is fast enough.
But, I can't get the IR emitter to signal a change in state fast enough, particularly when the receiver
is reading the low states - see attached jpeg for a better understanding.
Below is the code.
If you have any suggestions then please let me know.

regards,
Shmow


VAR
byte PulseTime

OBJ

BS2 : "BS2_Functions"

PUB Main
BS2.start(31,30)
dira[noparse][[/noparse]0]~~
PulseTime:= 1 'this is where the change state signal should be 1ms but it's more like 3ms (see attached oscillascope image)

repeat
if ina == 1 'when button pressed - sends "down" - as in scroll down guide - signal to satellite box receiver

DownPulse
bs2.pause(5)

DownPulse
repeat 4
bs2.pause(3)
DownPulse

bs2.pause(2)
DownPulse

PUB DownPulse

BS2.FREQOUT(0, PulseTime, 56900) 'down
519 x 363 - 13K

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-04-25 18:41
    You should avoid BS2 emulation if you want serious speed. You can easily configure one of the counters to modulate an IR LED at the desired frequency. For control you connect the cathode side of the LED to the output pin and the anode side to Vdd (with an appropriate current limiter, of course). Now you can write a "1" to the pin to turn off the LED and a "0" to allow the counter to modulate it. This simplifies control and will give you better timing precision.

    This article (I wrote for N&V) may help: http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp4.pdf

    The second half of the article gets into transmission. If you tell me what protocol you're trying to emulate I may already have some code written, or can whip something up as I have frameworks in place.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA

    Post Edited (JonnyMac) : 4/25/2010 6:46:44 PM GMT
  • shmowshmow Posts: 109
    edited 2010-05-26 19:02
    Thanks JohnnyMac,
    I'll have a run at it without the emulation; I'm sure you'll be hearing from me again on this topic.
    Regards,
    Shmow
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-05-26 19:09
    You will always see some asymmetrical lag from the IR receivers (albeit not 2ms worth). This can usually be corrected at the transmit end by precompensating the pulse widths.

    -Phil
  • BradCBradC Posts: 2,601
    edited 2010-05-27 04:35
    Phil Pilgrim (PhiPi) said...
    You will always see some asymmetrical lag from the IR receivers (albeit not 2ms worth). This can usually be corrected at the transmit end by precompensating the pulse widths.

    I got caught by this very recently when I was replicating the IR output from one of my air conditioner remotes (it sends ~108 bits in a modified NEC protocol). I was having reliability issues getting the AC to accept the command, yet I was transmitting precisely what the output of the receiver was to within about 100nS. When I thought about it and took the on-time lag into account manually, suddenly it became 100% reliable. What I meant to do was pop the top of the remote and actually measure the timing at the transmit led, but I just put an arbitrary fudge factor into each on pulse and that worked.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Are you suggesting coconuts migrate?"
Sign In or Register to comment.