bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
No need for special IC, just use uC ADC with voltage divider.
If you plan to monitor remote battery over 1-wire then use 1-wire IC.
Best regards,
Peter
That's good idea any circuit and code example ?
I can't see op amp circuit on it ? can you show me ? is it comparator ?
thanks
Ok, thank you my friend, I'll make experiment for it and get back to you....
In your Blog you have posted images of Blue LCD. In which simulator you got the Blue LCD?
uint16_t read_adc1(void)
{
ADMUX=(1<<REFS0) | (1<<ADLAR) | ADC_1; // Conversion on channel 1, AVCC reference, 10 bit mode
ADCSRA |= (1<<ADSC); // Start conversion
loop_until_bit_is_clear (ADCSRA, ADSC); // Wait for conversion complete
return(ADCH);
}
Which Compiler do you use? Atmel Studio or mikroC AVR PRO? I can give you code which is for mikroC PRO AVR Compiler.
void adc_init()
{
// enable ADC, select ADC clock = F_CPU / 128 (i.e. 125 kHz)
ADCSRA = (1<<ADEN | 1<<ADPS2 | 1<<ADPS1 | 1<<ADPS0 );
//Do a conversion to get rid of rubbish
ADMUX=(1<<REFS0 | ADC_0); //Conversion on channel 0, thermistor input
//Internal VCC Voltage Reference
ADMUX=(1<<REFS0 | ADC_1); //Conversion on channel 0, thermistor input
//Internal VCC Voltage Reference
ADCSRA |= (1<<ADSC); //Start conversion
loop_until_bit_is_clear(ADCSRA, ADSC); //Wait for conversion complete
}
uint16_t read_adc1(void)
{
ADMUX=(1<<REFS0) | (1<<ADLAR) | ADC_1; // Conversion on channel 1, AVCC reference, 10 bit mode
ADCSRA |= (1<<ADSC); // Start conversion
loop_until_bit_is_clear (ADCSRA, ADSC); // Wait for conversion complete
return(ADCH);
}
double resistor_get_voltage(long adcresistence)
{
double t;
t = log( adcresistence );
return t;
}
adc_result=read_adc1(); //read the voltage from ADC1
adcA = ((int)(adc_result*5.0)/1024.0)*1000;
d = resistor_get_voltage(adcA);
if (adcA != 0)
{
adcresistance = (long)(10230000/adc_result-10000);
sprintf(voltage,"%.2f",d);
lcd_string(voltage);
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?