Teensy LC + IR receiver

Status
Not open for further replies.
Hello,

This is my first post here. Although I had some electrical engineering at school, that knowledge has faded. So please bear with me.. I tried searching this forum, and to study the data sheets etc..but I am still not 100% sure of my findings.. Hoping someone can help me out..

The project:
I wish to connect an IR receiver to my Teensy LC. The project's supply voltage is 5V.

I don't have a nice schematic yet, but if needed I can make one, but I think my question is of a more generic nature. Please let me know so I can help you help me.

The problem:
I read that the max voltage the I/O pins on the LC should be exposed to is 3.3V. This led me to checking the output voltage from the IR sensor. From the datasheet I get:

VS = -0.3 to +6, and that VO = - 0.3 to (VS + 0.3)

I have a linear 5V to 3.3V regulator (TO-220) I can use here, but I think that still makes the VS = 3.3, and 3.3+0.3=3.6V.. Higher than the rated input on the Teensy LC pins.

The question(s):

Have I misunderstood? I am a bit fuzzy on how 3.3V in can become >3.3V out, but as I recall there were a few electrical concepts I struggled with at school, this could very well be one of them:D

Will this work ok, or will I fry my LC if I try this approach? Any alternative ideas on how to solve this?

Any input to this, probably rather simple, issue is greatly appreciated!

//Ole
 
Last edited:
Less EE than you by far … but data sheet linked shows : Supply voltage: 2.5 V to 5.5 V

Though indeed the table showing output voltage can be supply plus 0.3V - odd. It only draws 3 mA - maybe reduce the supply voltage to 3 volts - and even at -0.3 from supply or 2.7V it would trigger a Teensy digital as high?
 
Looking at the data sheet schematic on page one there is no magic inside, it has a pull up resistor to the supply and a transistor that will cause an output of close to zero when the IR detector activates it. The supply voltage can be 3.3V so all should be well wired up supplied with 3.3V and connected directly to a LC IO pin. Unsure how the math indicating a step up in voltage came about.

Since it uses a pull up rather than a transistor drive to achieve the high this also means that it can PROBABLY be run from 5V if that makes sense since the pullup resistor will constrain the current trying to flow through the teensy LC pin from the 5V supply. This involves either sacrificing an LC to science or digging into the LC manual for the protection components and their current limits. In this case just doing running from 3.3V looks like the right answer and does not require a stash of sacrificial LCs to work out possible series resistors on the IO pin.
 
Less EE than you by far … but data sheet linked shows : Supply voltage: 2.5 V to 5.5 V

Though indeed the table showing output voltage can be supply plus 0.3V - odd. It only draws 3 mA - maybe reduce the supply voltage to 3 volts - and even at -0.3 from supply or 2.7V it would trigger a Teensy digital as high?

Yeah, I found it odd as well.

I had the same idea, lower the supplied voltage to 3.0, but the regulator I have only goes to 3.3, and I read that using a resistor to drop the remaining 0.3 might not be such a a good idea..
 
Looking at the data sheet schematic on page one there is no magic inside, it has a pull up resistor to the supply and a transistor that will cause an output of close to zero when the IR detector activates it. The supply voltage can be 3.3V so all should be well wired up supplied with 3.3V and connected directly to a LC IO pin. Unsure how the math indicating a step up in voltage came about.

Since it uses a pull up rather than a transistor drive to achieve the high this also means that it can PROBABLY be run from 5V if that makes sense since the pullup resistor will constrain the current trying to flow through the teensy LC pin from the 5V supply. This involves either sacrificing an LC to science or digging into the LC manual for the protection components and their current limits. In this case just doing running from 3.3V looks like the right answer and does not require a stash of sacrificial LCs to work out possible series resistors on the IO pin.

I am starting to think this will work out with the 3.3V supplied to the IR sensor. Do you think, if I tried this (for science), I would find out real quick if it worked or not? As in..the Teensy would die fairly quick, or would it be a drawn out affair where it dies after prolonged exposure to +0.3V above threshold? I am kinda hoping for the quick death rather than have the project stop working after a month or two..

Either way I have to wait for new IR sensor to arrive before I can give it a go :)
 
IIRC, the popular library for reading IR pulses (IRremote) uses attachInterrupt to learn when a pulse comes in in some cases. Note, that not all pins on the LC support the attachInterrupt function. Of the main pins, 0, 1, A5, A4, A3, and A2 cannot be used with attachInterrupt.


Thanks. I had this working on an Adafruit Pro Trinket with a different library. However I ran out of dynamic ram (for very different reasons)..so now I am giving the Teensy a shot. I might have to switch to a different library as well.
 
I am starting to think this will work out with the 3.3V supplied to the IR sensor. Do you think, if I tried this (for science), I would find out real quick if it worked or not? As in..the Teensy would die fairly quick, or would it be a drawn out affair where it dies after prolonged exposure to +0.3V above threshold?

It should work just fine. :)
Even if by some blackmagic that 3.3V rises to 3.6V on the data pin (which does not seem possible, looking at the schematics), the Teensy LC can manage up to 3.6V, expecially with only 3 mA flowing through the pins, without blowing up (3.6V is the absolute maximum, anyway).
 
It should work just fine. :)
Even if by some blackmagic that 3.3V rises to 3.6V on the data pin (which does not seem possible, looking at the schematics), the Teensy LC can manage up to 3.6V, expecially with only 3 mA flowing through the pins, without blowing up (3.6V is the absolute maximum, anyway).

Thank you!

To still my curiosity I went looking for the datasheet for the Teensy LC, and found this, where I found this table:
teensylc2.JPG

As soon as I have tested it out IRL I will post an update.

Thank you thus far guys!
 
Last edited:
I am starting to think this will work out with the 3.3V supplied to the IR sensor. Do you think, if I tried this (for science), I would find out real quick if it worked or not?

I'm pretty sure it will work perfectly fine, if you power that IR module from Teensy LC's 3.3V pin and connect its output directly to a digital pin.

It's great that you're reading the datasheet and asking questions about the specs. But practically speaking, this is "overthinking" a bit. I'll try to explain, but first I want to emphasize the clear message: just power it from the 3.3V pin and GND, and connect the output right to one of Teensy LC's digital pins. That really is the correct way.

Reading datasheets can be tricky, sometimes even for experts. Often there's little or no explanation of what some spec really means. Some general conventions are followed by most semiconductor manufacturers, but even then they differ, so some experience and interpretation is needed.

In this case, the "Output voltage" spec you're seeing is from the "Absolute Maximum Ratings" section. Usually these specs are meant to tell you how much you could abuse the part under abnormal conditions. These types of specs are (usually) not meant to tell you how the part would actually function normally on its own. They're about what the part can withstand if you do something "wrong" to it. Usually there's a footnote, as in this datasheet, which sort of explains this but also kind of reads like something written by a lawyer.

When it says "(Vs + 0.3)" for output voltage, because it's in the "Absolute Maximum Ratings" section, this does not mean the part will actually output a voltage higher than Vs on its own. It means if you do something "bad" that forcibly alters the output voltage, the part can survive the output going up to 0.3V higher than whatever Vs power supply voltage you're using. Even then, as the footnote explains, doing this for extended times may impact reliability.

You may be wondering how this could ever be relevant, if the part doesn't actually output such a voltage?!

One possible scenario might involve using a very long wire for the signal (and ground). When you send a fast digital signal through a wire, there can be "ringing" which is mostly due to the rapid change in current through the wire (or the ground wire - remember current always flows in a loop) because the wires have small but non-zero inductance. Signals can suffer from "crosstalk" from other nearby signals, usually by capacitive coupling between the wires. For very long wires, you can also suffer from signal reflections or "transmission line effects", where a wire is considered "long" when it's more than about 1/10th of the wavelength of the highest substantial frequency component of the signal (which usually you guesstimate the bandwidth and signal's propagation speed along of the wire as approx half the speed of light). Voltage on wires can also be altered by electromagnetic or radio wave interference, again where the wire length and loop area with the ground wire matter.

Should you worry about this stuff? I'd say "probably not", especially if you're using only a few inches of wire. These sort of high speed effects are very complex to analyze or even understand. They're rarely an issue with this sort of low-bandwidth part.

There are other ways the output voltage could be altered, which also aren't an issue here. For example, if you run the IR sensor with 3.3V power and connect it to a microcontroller which runs from 5V power, and has a weak pullup resistor, that pullup resistor could affect the output voltage.

Or maybe you'll put the sensor on some sort of module that connects with a cable or connector that could be connected backwards or some other wrong way?

These issues almost certainly don't apply to your circumstances. But the authors of this datasheet don't know that. Maybe someone will try to use the part in strange ways that try to force the output above Vs or below GND?

The point is almost all datasheets have this sort of "Absolute Maximum Ratings" section. It's purpose is to tell you how much abuse the part with withstand under abnormal circumstances. If you're designing a circuit to do something that might stress the part, it's meant to tell you how much protection you need to build into your design. It's not uncommon to see designs with special diodes (often called "TVS" for transient voltage suppressor) or other protection measures, because some external condition is expected to possibly force a part beyond its absolute maximum rating. It's also pretty common to see small capacitors added for slow signals, to limit the bandwidth and thus tame these sorts of high speed signal quality problems.

Usually when you use a part in the "normal" way, these sorts of specs are a non-issue.

In this particular case, I'm quite certain you can connect this IR module to Teensy LC's 3.3V power, GND and a digital I/O and it will work properly. It's not actually going to result in a voltage higher than 3.3V, unless you do something like the pretty unusual cases I've tried to explain.
 
Last edited:
Wow, a serious thank you for taking the time to write up that very thorough explanation!! Greatly appreciated!

I did some reading of datasheets back at school, and it still happens from time to time..consequently I am by no means experienced enough to trust what I am able to glean from them..unless they are fairly basic and I properly understand the function of the part.

I am known for overthinking things, so you got me there ;)

Thank you also for pointing out that the Teensy actually has a 3.3V out..not sure why I was going to use a separate voltage regulator..again, overthinking I guess.

I'll be re-reading your answer when I get home, but it certainly looks like I will be moving forward with my, now updated, plans.

Thanks again!

//Ole
 
Status
Not open for further replies.
Back
Top