peteg's blog

A talking clock.

/hacking/avr | Link

Hacking AVRs is too easy these days: without any real snags I got an LED flashing on one of the pins of an ATmega328P. From there it was a short step to hooking up an SPO256-AL2 General Instrument speech synthesis chip from circa 1980 and getting it to talk. Making the AVR listen to the SPO256-AL2 required me to read the AVR manual: the AVR's GPIO pins have distinct registers for reading inputs (PINx) and setting outputs (PORTx), unlike the ARM in the ts7250.

I bought the SPO256-AL2 at a good price from a bloke in Melbourne. Email me if you want his details.

Slightly harder was getting the AVR to talk to the DS1307 real-time clock hanging off the TWI/I²C bus. As it didn't just work, I put off debugging this until I could borrow an oscilloscope from Andrew T. He lent me a venerable BWD 539D that was probably abused to within an inch of its life in the electrical engineering laboratories back when I was an undergrad. Suffice it to say that even with my inexpert knowledge it quickly showed the TWI/I²C bus was alive, and with some minor software fixups things came good.

On that front I started with something not too far from Peter Fleury's venerable TWI/I²C code, and ended up with something a bit cleaner and more abstract. There really isn't much going on with that protocol.

Today I wired up a DS18B20 one-wire temperature sensor in parasitic-power mode. It worked immediately using this driver after some minimal configuration and plumbing. Too easy.

My next step is to add an accelerometer, specifically this cheap one from Farnell. I think it is pretty crap as far as accelerometers go, being intended more for the user-interface sort of application I need it for: tap, double-tap, I'm-this-way-up, don't-shake-me-so-hard. Soldering it will be fun, and I need to figure out how to do the level conversion between the 5v required by the SPO256-AL2 and the DS1307 and the 2.8v this accelerometer wants on the TWI/I²C bus. SparkFun's tutorial makes it look not impossible.

After that I hope to put all this stuff on a PCB and polish the software. The power consumption is a bit crazy, with the SPO256-AL2 chewing about 75mA at 5v, as one would expect from vintage TTL technology. It could probably be simulated by a low-end AVR for a milliamp or less now.

Here's a sample of it saying the time and the temperature. The code is at github.

On another note, this bloke has a super-cheap approach to USB interfacing, viz using those USB-RS232 cables that don't do level conversion. I'm off to buy a cache of them from eBay. Possibly cheaper is the mostly software approach.

The Killer Inside Me

/noise/movies | Link

Wow, I have no idea what Winterbottom is trying to do now. As noted by Paul Byrnes, this is something in the vein of No Country for Old Men (etc) but even more brutal. Suspense was a bit hard to come by after the first half as the main character really does only have one modus operandi, and isn't that clever. Pullman has almost a cameo role, somewhat to my chagrin, and the ending is too Romeo and Juliet.

Completely unnecessary.