Author Topic: IR over distance  (Read 838 times)

0 Members and 3 Guests are viewing this topic.

Offline remixTopic starter

  • Contributor
  • Posts: 12
  • Country: us
IR over distance
« on: November 03, 2022, 05:31:34 pm »
Hello,
i am having issues with two TSOP4838 38khz IR Receivers, both connected to ESP32 at the same time.
One is half meter away, the other one is about 2 meters away, both connected using unshielded cable.
With the same software, the one closer to the ESP32 works without issues, but the other does not.
Connecting it to my oscilloscope, it's obvious that the rising time on both ir receivers is different.




Chan 1 (Yellow) is the further receiver and chan 2 (blue) is the one closer to the esp32

Can you help me understand why 1.5 meters of wire are causing the slow rising time ?
 

Offline pqass

  • Frequent Contributor
  • **
  • Posts: 906
  • Country: ca
Re: IR over distance
« Reply #1 on: November 03, 2022, 06:01:08 pm »
Inductance? 
Try adding a 10-30k pullup resistor at the ESP32 input pin (yellow).
 
The following users thanked this post: remix

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1152
  • Country: lt
Re: IR over distance
« Reply #2 on: November 03, 2022, 07:11:16 pm »
That's because of cable capacitance and weak drive. The receiver has an open colector output (with internal 30k pullup). Although it can drive LOW at reasonable current, driving HIGH is only achieved through that 30k pullup. Include cable capacitance and you get slow rising edge (capacitance is being charged through pullup and it takes time).

If you use long cables, either use low value pullup, like 2.2k or even less, or add a buffer to drive a cable (cmos output logic gate should do fine, may need to include small series resistor to reduce ringing like 56R or so).

Edit: Oh, and you should really add some supply bypass capacitor directly on your TSOP4838 pins. Be careful with ceramics though. They may cause voltage overshoots and damage the IC if long cables are used. You want some ESR here. So small electrolytic (like 4.7u) plus a small ceramic is ideal. You can also use just a ceramic, but add a small series resistor like 1-3 Ohms.
« Last Edit: November 03, 2022, 07:30:35 pm by Manul »
 
The following users thanked this post: remix

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1151
  • Country: us
Re: IR over distance
« Reply #3 on: November 04, 2022, 07:36:30 am »
This is an excellent demonstration of why transmission lines need to have lower characteristic impedance for higher frequency signals.
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 

Offline remixTopic starter

  • Contributor
  • Posts: 12
  • Country: us
Re: IR over distance
« Reply #4 on: November 04, 2022, 09:27:28 am »

Adding 2k pull up improved the rising time.

Manul  - I will later add the bypass capacitor as well.

Thank you all
 

Offline Manul

  • Super Contributor
  • ***
  • Posts: 1152
  • Country: lt
Re: IR over distance
« Reply #5 on: November 04, 2022, 11:24:00 am »
To be honest, the rising edge looks bad but not so so bad. I bet that part of your problem is that you have multiple edges detected simply due to slow rise time and noise. This is a classic case of why we need schmitt trigger inputs for slow/dirty signals. So you should add a buffer with schmitt trigger input before ESP32 for proper signal conditioning.
 
The following users thanked this post: remix

Offline remixTopic starter

  • Contributor
  • Posts: 12
  • Country: us
Re: IR over distance
« Reply #6 on: November 04, 2022, 11:36:03 am »
Yes, you are right. I was measuring too fast for changes and sometimes i was getting wrong readings.
It this particular case - IR is a slow protocol ~590us between pulses and i can easily compensate for the wrong readings in software.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf