Lights controller for high beams and fog lights on my Subaru. Uses an AVR ATtiny2313 microcontroller.
Table of contents
Details
This unit is used for controlling additional car headlights, such as high beams and fog/running lights. The module also controls a RGB LED on the dashboard, indicating the status of the lights and used as a alarm LED. It’s connected directly to the cars battery, and sensing the status of the cars built-in park light, low beam and high beam.
Lights
Fog/running lights
The fog/running lights are controlled in such a way that they do not violate Norwegian law. Meaning; they can only be on during the day and must be used together with the parking lights. They can not be used together with low or high beam. Using a switch it’s possible to still use the fog/running lights together with the low beam, but this is only permitted in extreme weather conditions or fog.
The fog/running lights are turned or kept on for one minute after the car has been turned off, to illuminate the front of the car in dark situations. They also have a three second start up delay, so not to put too much load on the battery while starting the car.
High beam
The high beam is activated together with the cars build-in high beam lamps. If the fog/running lights are on they will be turned off, even if just using the headlamp flasher. The use of fog/running lights together with the high beam is according to Norwegian law only permitted when running at low speed (5-15 mph), but this combination is not possible.
I/O
Inputs
- PD0 Parking lights
- PD1 Low beam
- PD2 High beam
- PD3 Switch
Outputs
- PB3 Green LED indication
- PB4 Blue LED indication
- PB5 Signal active
- PB6 Fog/running lights
- PB7 High beam
LED indication
A RBG LED is used for indication of which lights are active.
- Red High beams
- Green bright Running lights
- Green dimmed Fog lights
- Blue Alarm LED
Photos
Source code
- Bascom-AVR source is available in a git repository:
- https://github.com/thomasjsn/AVR-Car-front-lights-controller
Schematic drawing
Parts list
- 1 × AVR ATtiny2313-20PU, DIL-20, 20 MHz, 18 I/Os
- 1 × Capacitor, aluminium electrolytic, 10 µF, 25V
- 2 × Capacitor, aluminium electrolytic, 47 µF, 25V
- 1 × Capacitor, ceramic, 1 nF, 100V
- 1 × Capacitor, metallized polyester foil, 10 nF, (0.01 µF)
- 2 m Control cable, 10-cores, 0.14mm2, 250 V, Ø 5.4mm
- 2 m Control cable, 4-cores, 0.25mm2, 250 V, Ø 4.6mm
- 1 × DIL socket, 16-pin, 7.62mm
- 1 × DIL socket, 20-pin, 7.62mm
- 2 × Diode, rectifier, 1 A, 400V, 1N4004
- 1 × Enclosure, plastic (1551), 35x35x15mm
- 1 × Enclosure, plastic (1591 FL), 100x50x25mm, flange
- 1 × Fuse 5x20 mm, 500 mA, fast-acting
- 1 × Fuse holder, wire, 5x20 / 6.3x32mm
- 1 × Heatsink, 27.3K/W, 19mm, attachable, TO220
- 1 × LED 5mm clear, RBG, 2.1 3.3 3.4V, 20mA, 25°
- 1 × LED lens 5mm, CLB 300 low, Clear
- 1 × Optocoupler, 4-channels, PC817
- 32 cm2 PCB, stripboard, 100x160mm, 160cm2
- 4 × Resistor, carbon film, 0.25W, 330 Ω, 5%
- 1 × Resistor, carbon film, 0.25W, 680 Ω, 5%
- 2 × Resistor, carbon film, 0.25W, 1.8 kΩ, 5%
- 6 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
- 1 × Resistor, carbon film, 0.25W, 6.8 kΩ, 5%
- 4 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
- 4 × Resistor, metal film, 0.6W, 1 kΩ, 1%
- 12 × Straight pin header, female, Single row, 2.54mm
- 14 × Straight pin header, male, Single row, 2.54mm
- 1 × Switch, toggle, 1-pole, micro, on-on
- 15 × Terminal block, screw, 2.5 mm
- 5 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B
- 1 × Voltage regulator +5V, 2 A, L78S05CV
- 14 m Wire, stranded, 0.50mm2, Yellow
Last commit 2024-11-11, with message: Add lots of tags to posts.