cancel
Showing results for 
Search instead for 
Did you mean: 

ADC current issue

fahadbutt214
Associate II
Posted on June 16, 2016 at 00:25

Hi all,

I want to measure a 18650 cell voltage with the help of internal ADC of STM32F407VG Micro controller.  But the current rating of 18650 cell is in Amperes while my controller pin current rating is in mA. So my Question is how do i measure the voltage of this cell via ADC.

and My 2nd question is what is the best possible way to measure current flowing in a circuit via microcontroller.

Kindly help me out here, 

Thanks.
9 REPLIES 9
AvaTar
Lead
Posted on June 16, 2016 at 09:49

I suggest to start here :

http://www.electronics-tutorials.ws/dccircuits/dcp_2.html

fahadbutt214
Associate II
Posted on June 16, 2016 at 17:10

Hi! I am familiar with this law. The point is if under load conditions a current of Amp is flowing through these cells(2A lets say in a series of 10 18650 cells). Then how much current would flow into my ADC pin of microcontroller? or i could just insert a resistor in series to limit current to mA and ensure pin safety/

Posted on June 16, 2016 at 18:19

Point is you're NOT putting current into the ADC pin, it is measuring a VOLTAGE, and the current drawn will be all that is required to charge/discharge the capacitive sampling circuit. That your battery can supply 10A, or whatever, doesn't mean that is what will flow all the time as soon as you connect it to something.

It is the VOLTAGE you need to concern yourself with, and the range that the STM32 will accept, ie 0-3V for a 3V powered STM32

To measure current you'd need to do a differential voltage measurement across a small load resistor that can carry enough current for your application circuit.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
fahadbutt214
Associate II
Posted on June 16, 2016 at 23:42

Yeah! I know i'm dealing with voltage here for ADC, was just concerned about the current drawn. Thanks for clarification i was also thinking something like that.

Can anybody suggest me some 2-way cheap switches which will be controlled through a GPIO pin of Micrcontroller. I have looked at DPDT relay boards but they are quite huge in size with a bit of circuitary. 

can someone suggest me some better options? 

Thanks 🙂 

AvaTar
Lead
Posted on June 17, 2016 at 09:26

> Can anybody suggest me some 2-way cheap switches which will be controlled through a GPIO pin of Micrcontroller.

With an appropriate driver stage, almost anything electrical can be controlled by a MCU.

Perhaps an old-fashioned relay will do, or a logic-level MOSFET.

More information about the load and required switching characteristics would be helpful.

fahadbutt214
Associate II
Posted on June 17, 2016 at 09:43

I am monitoring voltage of each individual cell via microcontroller in series of 10 cells. And whenever some cell get discharge I want to remove that cell from the circuit via some switching(2-way) i.e: replace that cell by a wire and then add another redundant cell into the series circuit(it can be thought of a reverse process of the previous case).

So, for this purpose I need 2-way cheap and small size switches. Hope its clear now.

fahadbutt214
Associate II
Posted on June 17, 2016 at 09:57

Logic level mosfets are a good choice I have read about them a bit. But how do i combine them to make 2-way switches? is there an IC for such purposes?

AvaTar
Lead
Posted on June 17, 2016 at 12:16

> But how do i combine them to make 2-way switches? is there an IC for such purposes?

 

Driving two of them by the same output ?

Might become a little bit more difficult - one needs to be high-side, and the other a low-side switch. I'm no hardware designer, but example schematics should be around.

But from your description, I would consider relays as well. There are types specifically for PCB mounting, they are cheap, robust, and different terminal configurations are available without a size penalty.

And, because the switches are galvanically isolated, the design would be easier.

fahadbutt214
Associate II
Posted on June 18, 2016 at 12:35

Yes, driving both of them by the same output of the microcontroller