Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help me please with our project

Status
Not open for further replies.

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.
 
Are you sure about the LED? It lights up regardless of the temperature? To do this with a micro controller is really beyond the scope of a forum - you need to learn how the micro works and how to set it up. Without looking at the datasheet, I am sure the ADC0 pin shares its function with some other functions. You need to configure it to an ADC input. Then, connect the LED to one pin (via a current limiting resistor) and a transistor to another pin (via a current limiting resistor). Drive the motor off the collector of the transistor and connect the LM35 to the input of the ADC. That is all I am willing to say. The rest is up to you. Forums are not here to do the work for you and the coding is too complicated to explain in this little box I am typing in
 
Last edited:
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.

hi,
Is it required that you must use an MCU for this project.? it would be easier to use a comparator.?
 
hi,

i have design my circuit but i want u to tell me why i am not getting voltages from lm35
also, i want your help for my circuit if it have any problem that i can fix ..
and this is my circuit:

**broken link removed**

and this is my code for the microcontroller "atmega8" ..


#include<avr\io.h>
#include<avr\interrupt.h>

ISR(SIG_ADC)

{

if(ADCH<12)

{

PORTB&=~((1<<PB1)|(1<<PB2));

PORTB|=(1<<PB0);

}

else if(ADCH>12 && ADCH<17)

{

PORTB&=~((1<<PB0)|(1<<PB2));

PORTB|=(1<<PB1);

}

else if(ADCH>17)

{

PORTB&=~((1<<PB0)|(1<<PB1));

PORTB|=(1<<PB2);

}

ADCSRA|=(1<<ADSC); //start conversion

}

int main()

{

DDRB=(1<<DDB0)|(1<<DDB1)|(1<<DDB2);

ADMUX=(1<<REFS0)|(1<<ADLAR); //Make AVcc the reference and select ADC0 channel.

ADCSRA=(1<<ADEN)|(1<<ADFR)|(1<<ADIE)|(1<<ADPS2); //Enable Analog convertor,

//set prescaler to 16

ADCSRA|=(1<<ADSC); //start conversion

sei(); //start interrupt

while(1);

return 1;

}

if you have any question please tell me
 
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?
 
Last edited:
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.

aha ..

i will try to make Aref to be Vcc, and i will try it out on the lab.

What exactly are you seeing at the output? whats you supply voltage?

at the output i am trying to make the fan and led work together if the temperature more than 30 degree " which is pin 14 "
and if it's less than 30 degree the other pin " 15 " will work which will be the led only ..

the supply voltage will be batter that have 5 voltages, and it will be connected to the lm35 and in AVcc.

thanks Misterbenn
 
Last edited:
DONT connect Aref to Vcc! In your code you have INTERNALLY connected Aref to Vcc. You should connect a small capacitance between Aref and ground - this provides a stable refrence.
ADMUX=(1<<REFS0)|(1<<ADLAR);

Be aware that if you've connected this in your current set-up i wouldn't be supprised if you've blow the chip, if your lucky you'll be ok. If you can still program it then that looks good.

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??

One other thought - have you disabled digital inputs and thus enabled analouge inputs?

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.
 
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??

in the datasheet for lm35 it show that it gives 0v to 5v
but when i simulate the circuit in my program it show that lm35 do not sent any voltages .. :(

so i think its 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.

the code: i have copy it form another web, and i have work one the code to help my circuit.

One other thought - have you disabled digital inputs and thus enabled analouge inputs?

yes
 
I imagine the reason the lm35 isn't giving you an output is because of a simulation variable. What temp are you simulating?

I think you should just build this now its easy enough.
 
hi ..

i have do the circuit as you tell me and i have found that i have the same problem ..
and this is the circuit ..

**broken link removed**

.. please, if any one know anything about it, please tell me, its my final project and i will get f in my class if i don't get it .. :(
thanks all.
 
Last edited:
The LEDs and fan should still be connected to ground. Only Aref should have a decoupling capacitor. - Ask yourself how is current going to flow through the LEDs??

please also put a volt meter on pin 2 of U1 ( the output of theLM35) - Doing this we can see what that part of your circuit is doing without worrying about the PIC.

You also could of done this circuit with op-amps rather than a PIC, in this application a PIC is a bit of overkill
 
**broken link removed**

i have done what u tell me to do in the circuit,
i dont what to make it with op-amps because i am computer engineer so they want me to program the chip ^^"

anyway, as it show in the circuit their is 0 volt come from the chip ..
and i dont know why ..
i think that i have to go and program the chip again !!
Or their is something else that going on.

~ for the voltages that get in the chip, it is 1.9v to 0v ..
 
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.
 
amm, i get lost ^^", and sorry about that, it's 5:22 AM here : = |, and i have not sleep until now ..

OK, remove C2. You need current to flow through the LEDs to ground, with a capacitor there the current can't flow.

ok

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 know that i have to have transistor to make the fan work ..
but the problem in the chip which doesn't sent any information in both output and i dont know why ??

and i have connected the fan with transistor but because that their is nothing coming form the chip the fan does not work

I don't see a ground pin on the chip (U2) i presume there is one and that its connected?

... yes the chip most be connected to ground but at the simulation the program do not show pin 8 or pin 7 which is ground and Vcc for this chip

I presume the chip is using internal oscillator?
and the double check the data direction registers on the outputs.

yes it using internal oscillator

ok ..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top