Shop OBEX P1 Docs P2 Docs Learn Events
555 Timer and BS2 Infrared Detector — Parallax Forums

555 Timer and BS2 Infrared Detector

luminastrumluminastrum Posts: 4
edited 2007-12-14 18:58 in BASIC Stamp
Gentlemen,

Need help with the BS2 and infrared detector.

I have wired a standalone infrared modulator using an IR LED, a CMOS 555 timer and it's own 5V regulated power supply. The circuit is configured to output a 38.5Hz signal with a 50% duty cycle. I used my multi-meter to adjust and confirm the frequency.

Here's the problem... I have a working BS2 stamp with an infrared detector that I've used for "object avoidance" projects. The problem is that the BS2 detects my infrared modulator, but only for a split second. If I block the detector with my hand and remove my hand quickly and repeatedly, the BS2 stamp detects but stops detecting at about the same frequency as my hand.

Shutting OFF & ON the infrared modulator has the same effect. Anyone know what's going on? Thank you.


D.O.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2007-12-11 20:16
    Perhaps you need a pull-up on the infrared detector's 'signal' pin? I've found these 'pull-down' when they detect a signal, but sometimes 'float' to a 'high' state -- which the BS2 doesn't read quite right without a 10 KOhm pull-up resistor.
  • luminastrumluminastrum Posts: 4
    edited 2007-12-11 23:28
    Allanlane5, thanks for your response. I do recall leaving out the resistor in the BS2 circuit. Question... how does a resistor between my BS2 input pin and the infrared detector's output pin improve performance? Does the resistor cause an RC delay? Appreciate your comments.

    D.O.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-12 17:13
    Hello,

    The 40 kHz detectors are designed to pick up signal modulated at that frequency and decode the output. Typically there is a signal encoded onto the 40 kHz carrier wave. It may be modulated in many ways including PWM, but it usually has to be there to do anything useful with the signal. Just sending a 40 kHz square wave isn’t likely to do anything. The output is likely going to be HIGH when idle and briefly go LOW upon detection, but if you’re not modulating the signal, nothing interesting is going to happen. Forrest M. Mims III wrote some interesting articles about communication using a 555 Timer IC. Typically the output is modulated by pulsing the trigger pin on the 555. I would do some research into this. I just did a search on Google and found hundreds of websites explaining the theory of how these systems work, including example circuits. There was even a BASIC Stamp 1 AppNote some years ago that demonstrated serial transmission of data over such a link. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • luminastrumluminastrum Posts: 4
    edited 2007-12-14 06:13
    Chris,

    Thanks very much for your tip. I added a second 555 timer to modulate my 38kHz carrier signal. I set the modulator frequency at 1kHz (50% duty cycle) and verified it with my multi-meter. This circuit has its own separate power and is independent from the BS2 module. So then I powered the BS2 module with the off-the-shelf infrared detector and no luck, the BS2 detected for a split second only. Cycling the 555 circuit switch helped, but the BS2 detection was intermittent at best.

    I did some more research and found that the infrared detector offered by Parallax (and others) stops detecting if it encounters a clean and CONTINUOUS 38kHz signal. This feature is built-in to avoid detecting noise, which can be continuous. Although I modulated the 38khz carrier with a 1kHz signal, it's still considered noise apparently. So then I tried something different on the BS2 module. Instead of connecting the infrared detector's input power pin to +Vdd, I connected it to a BS2 output pin. With basic stamp code shown below, I modulated the power feeding the infrared detector, and partial success (the 1 milli-second PAUSE is crucial). The detection occurred but pulsed. Then I increased the 555 modulator frequency beyond 1kHz and the detection pulse increased. At 4kHz, great success! No more pulsing, just solid detection!

    I think the BS2 off-the-shelf "crash avoidance" projects avert the un-modulated 38kHz problem with the 1 milli-second pulse of power to the infrared LED. This is equivalent to cycling the power to my 555 timer circuit.

    I can use some help as to why the 38Khz on 4khz is still considered noise. I prefer to power the infrared detector with +Vdd instead of a BS2 output pin. I hope these findings help someone else.


    FOR ii=1 TO 2000

    HIGH 10
    PAUSE 1
    detect_left = IN11
    LOW 10

    DEBUG CRSRXY, 1, 1, "left =", DEC5 detect_left
    NEXT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-14 18:58
    Hello, yes, this is as I was getting at in my previous message. Some systems use different protocols for communication. Some use PWM, but in my initial Google search I actually found that many systems send the ~40 kHz signal in bursts. In some systems the burst is considered one logic level and a lack/gap in the signal is the opposite. Again, this is one of many ways of using these IR receivers, just as there are also several frequencies they operate in. Originally this was 40 kHz, just like older Ultrasonic remotes. Later there were frequencies spanning from 32 kHz on through 56 kHz that I have seen. Of course you should always obtain the correct receiver for the application and frequency range you plan to use it in for the above reasons. Hopefully this (and above) information will have helped many people looking into IR systems. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.