I have searched and tried for a while now, but have several questions about the circuit.
My test-program on the ATmega8 looks like that:
int main() { DDRD = 0xFF; while(1) { PORTD = ~PIND; _delay_ms(1000); } }
and should turn the halogen-light on and off every second. The idea is: After it works like this I am going to expand the software and start using Timers and PWN.
I am using a computers power supply to connect my circuit (5V) and the halogenlamp (12V). I was told to use a IRLZ34N MOSFET to control the 12V-Line using a 5V-Signal. Try and error did not help me finding a solution and many google-searches didn't either. The circuit looks like this:
12V+ -------> LAMP(IN) LAMP(OUT) -------> MOSFET(DRAIN) 12V- -------> MOSFET(SOURCE) PORT[D0] -------> MOSFET(GATE)
My questions are:
- Why does the MOSFET get so hot? What does this have to do with the gate?
- Is there an easier way to realize this? Costs does not matter, because I just need this circuit once.