It's been years since I played with transistors. I figured out how to write a simple program to turn on port B bit 0, the pin just West of the Northeast corner if the dimple on the ATTINY2313 is to the West, here. I also had to edit the include file. But then the fucking relay wouldn't turn on. I had the 12V going to the (open) collector, the emitter going to the relay, and PORTB1 going through a 100 ohm resistor to the base. Only 4.something was getting to the relay, and it wasn't activating. Damn. Transistors amplify current, not voltage, and for some reason the relay needed well over 4 volts to activate. So I rewired it, with 12V going to the relay, then the ground side of the relay through the collector-emitter circuit to ground. It fucking worked! Sending a "0" over the HyperTerm connection, 9600 baud with no hardware handshaking, turns off the relay, and a "1" turns it on. Tomorrow, probably, I'll run the wire over to where the radio is set up. Eventually I might add a second, DPDT, relay to switch to the outdoor speakers, and modify the program to take anything from "0" to "3".
Back to blog or home page
last updated 2013-01-10 21:12:27. served from tektonic.jcomeau.com