Close

She's Lost Control Again? IR Remote and Microcontroller Shenanigans

A project log for Keritech "Little Red Devil" Single-Ended EL84 Amp

A single-ended tube stereo amplifier with a modern technology twist

keri-szafirKeri Szafir 01/06/2023 at 16:260 Comments

It was Monday when I bought a RC-5 remote for the Little Red Devil and was doing final tests on the amp, and to my disappointment, the remote control didn't work. Of course I wouldn't ship a non-functional amp, so I took a deep dive and checked what was going on... The relay and motor control outputs worked fine, there were pulses visible on a scope when I tested the IR sensor's output. So, was the code faulty? I looked into reading the RC-5 remote control commands, managed to decode them with an Arduino but not with the ATTiny45 microcontroller I built the board around. Why? It took me a few days to close in on the problem. First I thought it was I/O ports being assigned some special function rather than being usable as GPIO pins, but I could use any of them for controlling a LED, no problem.

At some point I noticed that whenever I tried to flash a LED, it would shine a lot longer than it was supposed to. 50ms should be a really short pulse, right? Right... and yet I saw a LED shine for half a second or so. The timing was clearly off. Time to read into the microcontroller's fuse bit configuration and see if something was wrong there, and it turned out my chip's fuse bit config wasn't the same as default here: http://eleccelerator.com/fusecalc/fusecalc.php?chip=attiny45&LOW=6A&LOCKBIT=FF which was 0x6a for the lower fuse, and I had 0x62. Stupid as I am, I reprogrammed the chip to 0x6a, locking myself out of it, because now it expected an external crystal oscillator on pins 3 & 4 in order to work. So, off to a parts store, grab a crystal and two caps. Done. Restored 0x62. Problem persisted. Then, oh well... what if I disable the CLKDIV8 bit for frequency down-scaling? I did, and I tested the chip, and it was waaaaaay more realistic timing-wise, what was supposed to be 50ms pulse lasted a lot shorter than before, closer to what I would expect. Then, I uploaded the proper remote control code, tested it and tadam! It worked. Both the input selection and volume control. Winner winner, chicken dinner. The last thing I did was adding some code to store the last input selection relay state in ATTiny's built-in EEPROM, so that whenever you turn the amp off and on again, it would restore the previous selection rather than having to set it every time. The remote control is working fine now.

Discussions