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.

Measure resistance with a PIC

Status
Not open for further replies.

PeterDove

New Member
Hi all,

I have 5V going through a resistor, how would I used the PIC to measure the resistance? Would I just set it up as a voltage dividor with a known resistor value and work it out from that?

Anyone got any circuit diagrams to go with explanations, or just good explanations :)

Thanks

Peter
 
It's not really very clear exactly what you're wanting to do?, you don't have "5V going through a resistor", you may have 5V across it, and a current going through it.

So without more details I can suggest a couple of ways (neither of which may be suitable for what you want):

1) As you said, use the resistor as part of a potential divider, and measure the voltage - requires a PIC with A2D.

2) Use the resistor to charge a capacitor, and measure how long it takes, see my joystick tutorial - any PIC (or other microcontroller) will do.
 
PeterDove said:
Hi all,

I have 5V going through a resistor, how would I used the PIC to measure the resistance? Would I just set it up as a voltage dividor with a known resistor value and work it out from that?

Anyone got any circuit diagrams to go with explanations, or just good explanations :)

Thanks

Peter

Hi, is it that in order to measure a resistor vavlue using PIC, you wanted to use 5V as a source, connect a known resistor in series to unknown, then measure voltage drops across the two then reverse calculate or perhaps use a lookup table to indicate the neaerest possible standard value-- etc.,
almost like orthodox wheatstone bridge-- exceept that you don't have other two resistors to create half voltage?
 
hi peter,

Not knowing over what range of resistance you want to measure, consider this as a concept.

Say, you have a 100uA constant current source, derived from your +5v rail.

Connect the 'unknown' resistor, say, a range of 40R thru 40K from the 0V rail to the constant current source,
ie; the 100uA flows thru the resistor to the 0v rail.

Connect the junction of the CCS and the 'resistor' to the input of the PIC's ADC. [10 bit resolution ?]

The numeric value the ADC outputs is proportional to the resistance value and linear over the range of 40R thru 40K, [ 0.004V thru 4.0V]

Before other members start groaning, I repeat this a Concept, not a design solution.

EricG
Is it for the saddle project ???
 
ericgibbs said:
hi peter,

Not knowing over what range of resistance you want to measure, consider this as a concept.

Say, you have a 100uA constant current source, derived from your +5v rail.

Connect the 'unknown' resistor, say, a range of 40R thru 40K from the 0V rail to the constant current source,
ie; the 100uA flows thru the resistor to the 0v rail.

Connect the junction of the CCS and the 'resistor' to the input of the PIC's ADC. [10 bit resolution ?]

The numeric value the ADC outputs is proportional to the resistance value and linear over the range of 40R thru 40K, [ 0.004V thru 4.0V]

Before other members start groaning, I repeat this a Concept, not a design solution.

It's the way ohms ranges on digital multimeters work, it's a standard technique.
 
hi Nigel,

Yes I know, thats why I suggested it!

As you know, answering some OP's requests is like playing the childrens
blindfold game, 'pin the tail on the donkey'

If Peter can give us more info on what he trying to do I would be
pleased to give a him specific solution.

Regards
Eric
edit:
To avoid any misunderstanding of my donkey reference.

The 'donkey' refers to the 'problem' and the 'tail' to the 'solution' and NOT in anyway to the OP.
The 'blindfold' is the sometimes 'sketchy' description by the OP.
 
Last edited:
I appreciated your answer and will keep it for future reference.
 
I doubt it would be particularly temperature stable, but you could use a fixed precision capacitor and just time the R/C constant.
 
Sceadwian said:
I doubt it would be particularly temperature stable, but you could use a fixed precision capacitor and just time the R/C constant.

THanks everyone for your answers, I will give them a go. Essentially I am measuring the range of 1Ohm to about 10MOhm, this is a pressure sensor which impedes/conducts depends on the pressure applied. It has a range of 1 to 10Newtons.

Cheers

Peter
 
hi sceadwian,

The main reason for suggesting the constant current was to simplify the prog calculations in the PIC.
You can imagine the problems with timing and the maths involved when calculating a RC exponential charge/discharge curve.

The CC method gives a linear ADC value within the working range.

I had a rough idea what Peter was trying to measure on his project.
I think he looking to measure dynamic changes in resistance in real time and relate the resistance to pressure, rather than measuring the value of 'resistors'.

Correctly designed CC sources can be very temperature stable, have a look at the characteristics of the FET versions.



Regards
Eric
 
Last edited:
ericgibbs said:
Correctly designed CC sources can be very temperature stable, have a look at the characteristics of the FET versions.

Well said. A correctly designed CC at 100nA is very good for measuring 10M:eek:hm:, if the OP knows how to put one together.
 
ericgibbs said:
EricG
Is it for the saddle project ???

Yes it is. I may have to work with a simple Voltage divider system because the saddle cloth would have 100's of sensors in the end, and I am worried that arranging a 100uA current for each an every sensor may be difficult.

Any tips?

Peter
 
hi Peter,

Are you trying to measure the overall loading/force/acceleration of the saddle to the horse or specific points under the saddle ?


Eric
 
ericgibbs said:
hi Peter,

Are you trying to measure the overall loading/force/acceleration of the saddle to the horse or specific points under the saddle ?
Eric

Measuring pressure at many different points on the saddle, to create an exact pressure map of the saddle.

Peter
 
hi

Measuring pressure at many different points on the saddle, to create an exact pressure map of the saddle.

If you are using a PIC ?. you will not be able to 'read' all the sensors at the same instant. So you could consider an analog sensor scanner configuration, where the CC source/s are common to all/some of the sensors.

Eric
 
hi Peter,

Attached a sketch of a basic scanner.

Eric
 
Last edited:
ericgibbs said:
hi

Measuring pressure at many different points on the saddle, to create an exact pressure map of the saddle.

If you are using a PIC ?. you will not be able to 'read' all the sensors at the same instant. So you could consider an analog sensor scanner configuration, where the CC source/s are common to all/some of the sensors.

Eric

Would this be similar to the idea of lighting LED matrices? Do you have any examples of it?

Thanks

Peter
 
Hi,

Would you prefer an X/Y matrix ?,
It depends how you want to wire up the sensors.
If so I can modify a photodiode matrix I posted a couple weeks ago.

EDIT: had a quick look, too many leakage paths, can't use steering diodes, XY not really feasible?.

Eric

When you design your final circuit you will have to allow for the ON/OFF resistance values of the analog gates.
 
Last edited:
ericgibbs said:
Hi,

Would you prefer an X/Y matrix ?,
It depends how you want to wire up the sensors.
If so I can modify a photodiode matrix I posted a couple weeks ago.

EDIT: had a quick look, too many leakage paths, can't use steering diodes, XY not really feasible?.

Eric

When you design your final circuit you will have to allow for the ON/OFF resistance values of the analog gates.

X,Y matrix sounds more interesting - I couldnt quite understand the edit you made - are you saying X,Y isnt feasable?

Peter
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top