Auto Light
This circuit switches on it's light when it detects 'darkness'
it uses
attiny13a
irf830 mosfet
a potentiometer (I had 10k ohm in my case)
and an array of leds with appropriate resistor.
The Hardware.
The pcb can be made in 2 different ways for 2 different purposes
the first is for external light
the second is for LEDs soldered onboard.
the third picture describes how one should connect the board for external light source.
The ldr should be in the shadow of the light source of this circuit but able to sense ambient light,in order to prevent it from triggering itself off and make itself flash.
the attachment contains fritzing files for you to modify the layout,if you need to.
Downloads
The Code & Uploading It
The code simply turns the attiny13a into a comparator and copaires the voltage coming from potentiometer and ldr
Solder the microcontroller ic first.The image shows the pin diagram to help program attiny13a after it's been soldered onto the board.I used this metod to program it. I used avrdude commandline software to upload the code (.hex file) onto it it,but you can also use ponyprog2000.
Then slolder the rest of the components and refer to second photo.
the code was written in atmel studio and can be easily modified to suit your needs