mmakki2002
New Member
a LM35 temp sensor attached to ADC0. When the temp is less than 30°C , LED lights up, if temp is greater than 30°C, LED lights up and dc fan work.use ATMGA8 Microcontroller.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
a LM35 temp sensor attached to ADC0. When the temp is less than 30°C , LED lights up, if temp is greater than 30°C, LED lights up and dc fan work.use ATMGA8 Microcontroller.
You've connected Aref to ground but in your code selected it as Vcc - this would short out your chip.
Other than that it looks like it should work.
What exactly are you seeing at the output? whats you supply voltage?
ADMUX=(1<<REFS0)|(1<<ADLAR);
have you measured the LM35 output / how have you done this? For example have you confirmed if the LM35 isn't producing a voltage or is it just the AVR??
And one final question - did you build this code yourself or is it copied? no shame in copying as long as you know how it works.
One other thought - have you disabled digital inputs and thus enabled analouge inputs?
OK, remove C2. You need current to flow through the LEDs to ground, with a capacitor there the current can't flow.
Also in real life the chip wouldn't be able to drive the fan directly, requires far to much current and you'd burn out the chip. So you'd need a transistor. Not sure if that matters in the simulation?
I don't see a ground pin on the chip (U2) i presume there is one and that its connected?
I presume the chip is using internal oscillator?
and the double check the data direction registers on the outputs.