Fell into a trap, made some interesting findings, and building up a collection of TV-B-On's from testing

A project log for TV-B-On(the box)

The thing you need when your TV remote power button fails.

mcunerdmcu_nerd 02/04/2023 at 05:530 Comments

It's been another busy day of building and testing. 

A minor trap is sprung

I started off with hooking up my logic analyzer to one of my TV-B-On's and firing up Pulseview.  I soon noticed that there were some really long pulses, as shown below.

  I played around a bit more, I noticed the longer I held the push button (that pulls down the reset pin, and thus puts the ATTiny85 into reset), the longer the pulse. I pulled out my multimeter and checked the voltage with the push button held down, and sure enough the voltage of the pin of interest floats a bit when the microcontroller is held into reset.  It's not an issue though as there is a 10K pull down resistor of the base of the transistor to prevent the IR LED from triggering from things like this.  This touches on a key limitation of logic analyzers: they can only show you "high" or "low" vs. showing an actual voltage.  An oscilloscope would have quickly showed what was happening.  I hope to get an oscilloscope one of these days, I've been hesitant to dig down and shell out a few $100.

A bit larger trap spawns

But the logic analyzer wasn't done with me yet.  I also wanted to see the duty-cycle of the 38KHz carrier. I set the sample rate to 3MHz Correction note: I initially set the sample rate to 1MHz and later on to 3MHz, the screenshot below is from when it was initially set to a 1MHz sample rate, thinking that would be more than good enough temporal resolution. Here's what I got: 

I was getting what appeared to indicate that the PWM duty cycle was glichy, and in the case of setting an extremely low duty-cycle, was getting what seemed to be outright missing pulses.  I figured I must have done something wrong in my code.  I checked the datasheet, looked online at various PWM examples, and became frustrated. I got the odd idea of cranking up the sampling rate to 24MHz.  Things now looked as expected. Nothing major in terms of glitches or missing pulses.  Setting the sampling rate to 3MHz and zooming in to the point of showing the actual sample points shows what was happening (recommend click on the screenshot to enlarge):

Ya, there's actually not a lot of temporal resolution to accurately capture a pulse at a 3MHz sampling rate in this case, or even a guarantee that all pulses will be captured as in the case of a very low duty-cycle.  Basic math time. A sampling rate of 3MHz, means that a sample will be taken every 1/3 of a microsecond.  A 38KHz signal has a period of about 26.316 microseconds.  At a 1 percent duty cycle, the pulse width will be around .263 microseconds. Yea, that's a bit problematic.

Here's a result of doing a re capture with upping the sampling rate to 24MHz:

That looks a bit more sufficient in terms of sampling. A 24MHz sampling rate means that a sample will be taken every .0416667 or so microseconds, so in this case no more worries about failing to capture some pulses.

Revelations from additional testing and experimentation

I assembled another TV-B-On, using a 5.6 ohm resistor for the IR LED in place of the 15 ohm resistor value I have been using, giving a considerable boost in current to around 150 mA or a little bit more depending on voltage and the particular IR LED model used.  I plan to boost power a bit more, but I'm probably starting to push the limits of the NPN transistor I'm using and need to switch over to a MOSFET that has low resistance at a low gate voltage.

Onto testing.  At a 1% duty cycle or so, the boosted current didn't seem to provide much in terms of improvement vs. just sticking to the 15 ohm resistor and using a 10% duty cycle.  I could try also boosting the duty cycle and could probably safely get away with doing that as I'm not pulling anywhere close to the rated peak current of the LEDs used.

I learned more about the quirkiness of the TV in the other room that I talked about in the previous log. Further testing from today showed that things work fairly well when turning it on, but it becomes almost impossible to turn off at any distance.  If I had to guess of what's going on, I would say when the TV is powered on a bit of noise gets introduced, which results in the IR receiver circuitry being deafened considerably.  The likely mitigation is cranking things up to 11 and driving the IR close to it's peak current. As mentioned above, I'll likely need to upgrade to a good MOSFET to really crank things up.

I also played around with an IR LED that has a 5 degree beam angle.  As expected, the narrow beam means things have to be aligned well at any considerable distance making it too finicky to use in practice.

Anyways it's past my bed time, so I'll stop rambling on until next time.