My transmitter consists of this exact IR LED, with an 180 ohm resistor, operating at 5V, that is being pulsed by an ATTINY13 using this code:

void setup(){
  DDRB |= (1<<PB0); //Set pin PB0 as output
  DDRB |= (1<<PB1); //Set pin PB1 as output
  TCNT0 = 0;

  TCCR0A |=(1<<COM0A0); //Timer0 in toggle mode Table 11-2
  TCCR0A |=(1<<WGM01); //Start timer 1 in CTC mode Table 11.5
  TCCR0B |= (1 << CS00);// Prescaler table 11.6
  OCR0A=110; //CTC Compare value, 36khz

void loop(){
  TCCR0A &= ~(1<<COM0A0); //off
  TCCR0A |=(1<<COM0A0); //on

Arduino ISP was used to program the chip.

The receiver is a TSOP1236 (datasheet in PDF).

A timer, on the receiver's end, is running and resets every time a burst is detected. If it misses, meaning it wasn't detected after x ms, it fires an alarm, indicating that somebody disrupted the beam and thus walked past.

Perhaps using a correct burst/gap rate and ratio, suited to the TSOP, could help me code the timer in C by making the gap more consistent?

What would be a good burst/gap rate and ratio? Which value would you suggest for the delay in the loop() function? I am too much of a rookie to find any indications in the TSOP datasheet to help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.