I built this about a year ago for a friend who was getting his PhD. It’s the 9th/10th Doctor’s sonic screwdriver from Doctor Who. I added an infrared remote control circuit to it (based on the Lady Ada version of TV-B-Gone), multiple UV LEDs in a random flashing pattern, then sealed the thing up and gave it a nice paint job to cover up the seam lines.
I think projects like this are kind of popular among Doctor Who fans: after all, the sonic screwdriver is supposed to be able to do just about anything… That’s a tall order, obviously, but making it do something is a start. IR is nice, low-hanging fruit: you’ve got all kinds of devices out there in the world that will do what you tell them if you just send them the right IR code – no authentication or anything. The parts are cheap, the circuit is small, and it doesn’t take a lot of power to get a decent signal out. I’d love to do another one sometime with more functionality to it, but that’ll have to wait…
The circuit has two parts: the “light show” which drives the seven UV LEDs, and the IR controller which sends codes to turn TVs on or off. The light show is based on my Raven board: I had plenty of these kicking around so all I really had to do was solder a chip on, program it, and wire it to the LEDs. (Well, I also had to trim down the board to fit in the tight space at the head of the screwdriver…) I tried to work out a way to have that board send the remote control codes as well, but there was no way that was gonna work. The thing is, my Raven board is based around a PIC microcontroller, the 16F688 and its pin-compatible relatives. I chose that particular type of PIC because it’s available in a small size with a good number of I/O lines – they’re not terribly powerful otherwise. These chips would have been perfectly adequate for sending the IR codes, but they lacked sufficient storage to hold the data table containing the IR codes. Part of it is an architectural problem with the 16F-series PICs: the only way to store a data table on the chips is to store it as program code, a bunch of 14-bit instruction words, each containing 8 bytes of data. (The AVR microcontrollers, on the other hand, use a 16-bit instruction word, and you can use that to store two bytes of data if you need to store a data table in program memory… The PIC 18F family has that as well.) I made some attempts to compile the program with a smaller version of the data table and squeeze something useful on to the PIC: but it became clear to me that it was going to be too much work, for too little yield. I didn’t want to have to fabricate a new PCB for an AVR that could drive both the IR and the light show, so I went with two circuits instead.
The “Light Show” consists of seven UV LEDs arranged radially around the IR LED in the center. It was hell to put together, but once assembled and epoxied it was quite reliable. The light show sequence picks a LED at random every once in a while and boosts its light level up to some value 50% or greater, and then the LED fades out until it gets boosted again. The sequence is random but every once in a while, by chance or something, it winds up looking like it’s spinning one way or the other. I think the effect turned out a lot nicer than if I’d just produced a spinning sequence or something. It was important to have the light show controller close to the LEDs due to the relatively large number of connections to the LEDs there – that simplified the wiring and allowed me to treat the whole front-end circuit (LEDs plus light-show controller) as a unit.
The IR circuit got stuffed into the neck of the screwdriver – the spherical section just behind the head. I cut out a little bit of extra space inside there, and the circuit was stuffed inside each time I reassembled it. The IR circuit is pretty small and pretty simple: the ATTiny85 is an 8-pin chip, and at SOIC size that’s about 6mmx6mm. The only connections it needed were power, a connection to the IR LED, and a crystal for the oscillator. When I was testing the breadboard version of the circuit I actually tried the ATTiny without the crystal (and set to use its internal clock source) – it seemed to work… Though I only tested it with my own TV. Microcontrollers’ internal clock sources aren’t super-precise, so I decided to play it safe and go with the crystal.
It was kind of a frustrating project: the IR circuit is wired up without a circuit board, which meant that the connections were prone to breakage. At one point I even broke a connection after the screwdriver was reassembled and repainted: I had to tear the thing apart to fix it – and in the process of fixing it other things broke, and I wound up rebuilding the whole circuit plus redoing the paint job. I brought the finished screwdriver with me to Tekkoshocon: I didn’t have a good opportunity to show off the IR feature, unfortunately.
I also had some reliability issues: sometimes the IR circuit wouldn’t do its thing. My first guess was that the IR LED was drawing too much power, causing the battery voltage to drop and the AVR to go into brownout mode. (That’d be a pretty significant drop – the AVR can operate on 3V, and the supply was 3 x LR44 cells, for a nominal total of 4.5V…) To try and solve the problem, I added a hefty capacitor and a fourth cell to the power supply and a constant-current driver to the IR LED – I don’t know for sure exactly what caused the problem, but that seemed to clear it up. Actually, though, my current best guess is that the reason the thing was going wrong is because I was foolish enough to gate my power supply for the microcontrollers through the pushbutton, rather than giving them a direct connection to the battery and using the switch as an input to bring the microcontrollers in and out of sleep mode. I had thought that this would help save power, or something – but the pushbutton really isn’t made to carry power: small changes in pressure or the angle of depression can change the thing’s resistance. I think that may have been causing the brownouts. Anyway, next time I build one of these I need to spend more time in the prototyping stage, and power the breadboard version with the same batteries that’ll be used in the final version – and no more last-minute design changes…
I am planning to build a second one: this time around I’m going to use one AVR microcontroller for both the light show and the IR function. I’ll have to come up with a circuit board design for the microcontroller and possibly one to hold the LEDs themselves. This means more planning up-front: I can’t take advantage of the Raven boards for an AVR circuit, and before I can design the board I need to prototype the circuit again to figure out exactly what needs to be on it… Plus the AVR in question will likely be a surface-mount package with no leads, meaning that I’ll need to use a reflow method to solder it on… But if I can work with that, installing the circuit into the screwdriver should be a snap. I could probably even avoid disassembling the neck.
I made a video demonstrating the screwdriver in action – I think before I make any more videos I need to think about how to present myself better. :)