Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Jdog on July 05, 2010, 09:50:45 AM

Title: Measure current with microcontroller
Post by: Jdog on July 05, 2010, 09:50:45 AM
Hello. I have a microcontroller that is powered by batteries that are recharged by solar panels. I want to be able to measure the current output of the solar panels that are powering it, to see if one of them gets damaged, covered with something, etc. I have seen this: http://www.societyofrobots.com/sensors_currentsensor.shtml (http://www.societyofrobots.com/sensors_currentsensor.shtml) but I am not so sure that those sensors are what I want. Does anyone know of a circuit I could use with an ADC port on the microcontroller to do this?
Title: Re: Measure current with microcontroller
Post by: Soeren on July 05, 2010, 12:09:43 PM
Hi,

You left out the important details...
Min. and max. current?
Min. and max. Voltage?
Title: Re: Measure current with microcontroller
Post by: TrickyNekro on July 05, 2010, 01:05:00 PM
Google for resistor based current sensors....

All you typically need is a very small resistor and a high gain amplifier...

How high is the gain is depended on your current demands and the value of the resistor,

The gain is easily adjustable so it's recommended over the resistor change.

You SHOULD by the way calculate the wattage of the resistor, which is the current that goes through multiplied by the voltage drop on the resistor.

By judging using as a power supply the solar panels, you shouldn't need "big" resistors (wattage)...

Some AVRs have a 100x gain on some ADC channels (see the datasheet)
You may be able to get away with it, if the current demands aren't great ;-)
Title: Re: Measure current with microcontroller
Post by: Jdog on July 05, 2010, 08:07:03 PM
All you typically need is a very small resistor and a high gain amplifier...

How high is the gain is depended on your current demands and the value of the resistor,

The gain is easily adjustable so it's recommended over the resistor change.

You SHOULD by the way calculate the wattage of the resistor, which is the current that goes through multiplied by the voltage drop on the resistor.

By judging using as a power supply the solar panels, you shouldn't need "big" resistors (wattage)...

Some AVRs have a 100x gain on some ADC channels (see the datasheet)
You may be able to get away with it, if the current demands aren't great ;-)

I am using a PIC micro controller, to be specific the PIC16F1827. I don't quite understand how a resistor and high gain amplifier could be used to measure current though. Could you explain?


Here are the specs for the panels:

Peak Power (Pmax,W): 270 W
Power Tolerance (%): ±3%
Max Power Voltage (Vmp): 35.5 V
Max Power Current (Imp): 7.61 A
Open Circuit Voltage (Voc): 44.5 V
Short Circuit Current (Isc): 8.30 A
Title: Re: Measure current with microcontroller
Post by: waltr on July 05, 2010, 09:08:58 PM
Quote
I don't quite understand how a resistor and high gain amplifier could be used to measure current though. Could you explain?

Ohm's Law, E = I*R
Make R small so that E is small (voltage drop) then amplify E to get into the range of the ADC input.
Title: Re: Measure current with microcontroller
Post by: Soeren on July 05, 2010, 09:36:29 PM
Hi,

Here are the specs for the panels:

Peak Power (Pmax,W): 270 W
Power Tolerance (%): ±3%
Max Power Voltage (Vmp): 35.5 V
Max Power Current (Imp): 7.61 A
Open Circuit Voltage (Voc): 44.5 V
Short Circuit Current (Isc): 8.30 A
With these numbers, I'd go for a Hall Effect current sensor in a solar setup.
http://www.lem.com/hq/en/component/option,com_catalog/task,displayserie/serie,FHS%2040-P--SP600/output_type,/ (http://www.lem.com/hq/en/component/option,com_catalog/task,displayserie/serie,FHS%2040-P--SP600/output_type,/)
Digi-Key should be able to sell you such a beast.
Title: Re: Measure current with microcontroller
Post by: Jdog on July 06, 2010, 09:21:00 AM
Quote
I don't quite understand how a resistor and high gain amplifier could be used to measure current though. Could you explain?

Ohm's Law, E = I*R
Make R small so that E is small (voltage drop) then amplify E to get into the range of the ADC input.

Ahh, I understand now, thank you.

With these numbers, I'd go for a Hall Effect current sensor in a solar setup.
http://www.lem.com/hq/en/component/option,com_catalog/task,displayserie/serie,FHS%2040-P--SP600/output_type,/ (http://www.lem.com/hq/en/component/option,com_catalog/task,displayserie/serie,FHS%2040-P--SP600/output_type,/)
Digi-Key should be able to sell you such a beast.


That looks perfect. I just have one question though. On the site, where it says primary nominal value, is that the minimum current it can read? And then it also says the secondary signal is in mV so I would then have to amplify that to logic levels right?