This is a circuit to automatically blink the turn signal lights of a car a number of times after a short tap of the turn signal handle. When you tap the turn signal handle shorter than a configurable time, the turn signal lights will automatically blink a configurable number of times.
This feature is often found in newer cars these days, but not in my 2000 Volkswagen Passat. Instead of buying a new car, I decided to upgraded it with an Atmel ATtiny12.
When you tap the turn signal handle shorter than a configurable time (around 300 msec by default), the turn signal lights will automatically blink a configurable number of times (3 times by default). This will not occur when you hold the handle for a longer time. Apart from this automatic mode, every blink period will always be completed, even when the handle is returned during a blink.
The behavior of the software can be controlled by a push button and a LED on the dashboard. You can change the blink count, blink interval, maximum activation pulse width, and the behavior of the LED. These settings are stored in EEPROM.
The circuit is connected to the emergency flasher relay that is integrated in the emergency flasher button in the middle of the dashboard. No existing connections had to be cut. The state of the turn signal lights is monitored by connecting the hot sides via 47K resistors to ATtiny12 inputs. I did not bother to clip the voltage to 5V, but relied on the internal protection diodes of the tiny12.
The signal lights are switched on with MOSFETs, driven by a transistor. An indicator LED lights when a MOSFET is switched on. The dashboard LED and button are controlled by the same two I/O pins that monitor the state of the signal lights by periodically changing the direction of these pins.
The software uses a timer that generates an interrupt every 4 msec. Most of the work is done in the interrupt handler. It takes care of debouncing the inputs, and controlling the MOSFETs and the LED. The main loop only monitors the (debounced) state of the pushbutton, to interpret the button presses.
PB0 and BP1 are normally configured as outputs, to drive the dashboard LED. When the state of the signal lights is polled in the interrupt handler, these pins are switched to inputs for a short time. And when the state of the button is polled, PB0 is configured as input and BP1 is configured as output with a high level.
Visit Here for more.