Here’s a collection of projects I’ve been to lazy to write up.
My monitor stopped working with a weird set of symptoms. The analog input still worked, but digital was dead. I also found that if I booted my computer with the digital cable connected to a working display, and then later moved the cable to the bad monitor it worked fine.
So, It seemed nothing was wrong with the monitor, the computer just couldn’t see it. I ended up reading up on DDC and EDID. Basically, every modern monitor has a small amount of memory (an I2C EEPROM) connected directly to the DVI cable. As long as the monitor is connected to a video card, even if its unplugged, the ROM enumerates the capabilities of the display. If the video card gets no answer from the ROM, it assumes there is no display attached. Somehow my ROM went bad.
To find some more clues, I took my monitor apart. In the picture, the two 8 pin atmel chips are the ROMs. One connected to the DVI cable and another connected to the VGA. After a some probing and reading the datasheet it was easy to see that the analog chip was write protected but the digital was not (why dell? why?).
Reviewing X11 logs, I found out my monitor was being rejected due to a bad CRC in EDID data. After some more searching I found a bit of software which could program the EEPROM over the DVI cable. I corrected the CRC, and my monitor started working again. I have no idea what part of the EDID went bad and I suspect I still have some garbage in the ROM, but the monitor lives again.
X11 almost bricked my monitor! or was it that NVidia driver? I blame Dell for not write protecting the EEPROM.
Building a Sound card
The first step was getting a PCM stream to the AVR. For this I wrote a simple shell script which used ALSA record command to pipe a raw PCM stream out the serial port. I also ran the data through a perl script which maximized the amplitude (loudness) of the sin wave.
The code which ran on the AVR was pretty simple. I basically set the duty-cycle of the PWM to match PCM’s data point. Since the AVR is a digital device with no DAC, the PWM is probably the best source for generating an AC signal. In the image you can see two signals. The blue is the digital signal (PWM) I created, and yellow is what that signal looked like after passing through a capacitor. As the PWM duty cycle increased, so did the amplitude of the sin wave. The wave wasn’t perfect, and it didn’t sound great either, but it worked. I watched a few minutes of TV in VLC with the sound coming from my breadboard.
The SD card was great because the WRT54G doesn’t have much space, and I needed to install a few big packages. This was an easy mod, as its already pretty well documented. Basically a few GPIO lines on the CPU are re-purposed to control a SD card over SPI. For SPI mode SD/MMC there is a great write-up here. The overall mod is covered here.
I also added an LCD display to the router. The WRT54 has two internal serial headers, so I decided LCD4Linux plus a little extra hardware would work. I ended up writing a simple firmware compatible with the “LCDTerm” LCD4Linux driver (source). The hardware has only a few components; an AVR, HD44780, and couple of PWM’s for back-light and contrast software control.
Fixing my Roomba
Since I didn’t have too much luck identifying the bad sensor, I turn to the Roomba Open Interface Spec. When the Roomba isn’t vacuuming its a neat robotic platform, providing software access to all its sensors and motors. I hooked my buspirate up to the roomba and was able to read the back the sensor data.
Turned out the right bumper was showing a collision. I took the Roomba apart to diagnose the problem. The sensor was in good physical condition and clean. It consisted of an IR LED, and receiver. When the bumper was pressed a piece of plastic slid in to break the beam. Looking at the good sensor as a reference, the IR receiver appeared to be a varistor plus resister voltage splitter.
I wasn’t sure what to do next, based on the voltage change, the LED or or varistor were probably bad. I happen to have a replacement IR LED which fit exactly, so I swapped it out. I think I was lucky, because once i swapped the LED, everything worked.