Using PIC 24F to monitor current

Thread Starter

junjia04

Joined Mar 19, 2010
9
I am using PIC24F family, and I am trying to monitor the current of 4 different loads, can I use the same method that mentioned above and just feed each different load to different Analog input
 

SgtWookie

Joined Jul 17, 2007
22,230
This thread has been dead for a long time.
Start a new thread with your question. Post a link to this thread for helpful reference material.
 

Thread Starter

junjia04

Joined Mar 19, 2010
9
thanks for open a new thread for me
I am starting a new microcontroller project and i am still in the hardware design stage. I am completely new to microcontroller, so I just want to have some opinions or things need to watchout
I am still reading the manual of the IC, and I am planning to use the 44 pin PIC24 family:
16 Digital I/O pins will use to control LEDs to indicates Activity of 8 devices, assuming the circuit is going to very straight forward, just diodes and resistors.
8 Analog Pin out to measure the current through the 8 devices, using current sensing resistors
USB OTG device to control the microprocessor
no external oscillator or eeprom is going to be used
anything i miss? what's need to be watchout for?
 

retched

Joined Dec 5, 2009
5,207
Everything should be in the datasheet. But watch out for some standards.. Use protection diodes and be sure to use caps to decouple and bypass. You may want to use mean averages for your ADC samples. They will change quite a bit from sample to sample so take 16 put them in descending order, lose the top four and bottom four and get the mean average of the remaining eight. That will give you greater accuracy and account for transients and the such.

For the current monitoring, be sure to use resistors rated for atleast 2x what you intend to be measuring. I use a 50W 1ohm 1% resistor to measure current as it correlates easily to amperage. 1V = 1A. It makes the math easier in the coding. You can get them for around $5us. Make sure to use resistors for the LEDs.

You should also try not to source or sink current directly through the PIC, you should use transistors to handle the current to keep the PIC from overheating and destroying itself. Remember, If you have a component fail closed, it will start sucking some serious current and destroy the PIC if its connected to the pin directly, so a 5 cent transistor can save your relatively expensive PIC.
 

Thread Starter

junjia04

Joined Mar 19, 2010
9
Cool! it makes a lot clear to me
what do you mean by use the mean average for the ADC samples? Do you mean when I am doing the coding for the current measurement?
Also, just want to make sure, external clock and EEPROM are not needed right? Anything i need to do with the Voltage reference REF+ and REF-?
 

retched

Joined Dec 5, 2009
5,207
what do you mean by use the mean average for the ADC samples? Do you mean when I am doing the coding for the current measurement?
Yes. When coding for your samples collection, be sure to grab a few and AVERAGE them.

If you displayed every sample, it would look something like this:

4.5
3.474
4.7
4.76
3.99
4.6

All over the place. So, in code, you want to take a group, average them and display the resulting average.
 

Thread Starter

junjia04

Joined Mar 19, 2010
9
thanks~ got it, i am currently use a 1.024V reference for easy calculation, and the ref- will be used internal ground. but I am still a bit confusing about the current sensing circuit, I am going to measure something around 0.1A, I am not sure what value of current sense resistor i should use, I am planning to connect the PIC to the current sense resistor through a current limited resistor. Any suggestion for the current sensing circuit?
 

Thread Starter

junjia04

Joined Mar 19, 2010
9
O.. just look at the data sheet
Vref high must be AVSS+1.7V minimum, which means i can't use 1.024V to reference right?
 

Thread Starter

junjia04

Joined Mar 19, 2010
9
Hi All
just one more question
I am going to program up the PIC, I am planning on use JTAG to do that, what tools i can use? is JTAG the best way to program the PIC, or any other better way to debug and program the JTAG?

thanks!
 
Last edited:
Top