Page 1 of 1
Reading Resistance....
Posted: Tue Jun 26, 2012 3:55 pm
by Sparkoids
I want to read the resistance of an three (analogue) potentiometers with a PIC then using a Digital Potentiometers controlled by the SPI bus on that PIC recreate that resistance (doesn't have to be particularly accurate) but done digitally.
Before I go ploughing in does anyone have any code for this type of thing already or any ideas of the best way to proceed please?
Thanks in advance....
James :-}
Re: Reading Resistance....
Posted: Tue Jun 26, 2012 4:08 pm
by petesmart
Hi James,
I have been playing around with digital potentiometers. They are really cool

– microchip sell them.
They can be driven via SPI what I2C, and you can cascade quite a number of them. They come complete with 3 terminals just like a normal potentiometer, I have used values of 5K, 10 K and 100 K
You could use an ADC on the micro to read the voltage on the wiper of your input potentiometer – convert that to a byte - then send that byte value to the (output) digital potentiometer.
Attached is the data sheet url - come back to me if you have any questions
http://www.microchip.com/wwwproducts/De ... e=en010497
http://ww1.microchip.com/downloads/en/d ... 11195c.pdf
good luck
best regards,
Pete
Re: Reading Resistance....
Posted: Tue Jun 26, 2012 4:21 pm
by petesmart
Hi James,
further to my post (a few minutes ago) I have found a code example for you.
It is a 2 channel ADC to dualchannel Digi pot. I have not used this for a while, not sure if it works on the hardware still, however it simulates okay in V5. Note I originally created this in V4.
Have a play and see how you go.. I think this is possibly what you are after albeit only 2 channels. Adding another channel is relatively simple, have a go yourself, I'm sure you can do it.
All the best,
Pete
Re: Reading Resistance....
Posted: Tue Jun 26, 2012 4:31 pm
by Sparkoids
Hi Pete,
Thanks for that fella!
Are the Microchip ones easily cascadable?
The only thing that puts me off is that Analogue Devices make one unit that can be a Log or Lin pot but the Microchip is either or...
Thanks again...
James :-}
Re: Reading Resistance....
Posted: Tue Jun 26, 2012 4:42 pm
by petesmart
Yes they are easily cascadable
On the microchip site there is an application note, which describes in detail how to address multiple devices...
I have not had any experience with AD ... Looked at them briefly, then chose microchip...I can recommend the MCP solution.
Best
Pete
Re: Reading Resistance....
Posted: Tue Jun 26, 2012 5:46 pm
by Sparkoids
Hi Pete,
Well your code seems to be exactly what I'm looking for on the channels.
All I need to do it appears is set up two outputs to those digipots and it should be it...
Thank you again - if I have something to start with I find it easy to mess about and hack something together. And then people on this board who are very helpful clean it up for me!
Thanks again....
James :-}
Re: Reading Resistance....
Posted: Tue Jun 26, 2012 10:46 pm
by petesmart
Hi James,
Thanks for the feedback....I used this code to drive a large industrial machine....please be aware that the code needs the appropriate level of error checking if you are going to use it in mission critical situation.
Can you post back your final result/outcome of you project...I am very interested in the end result.
All the best,
Pete
Re: Reading Resistance....
Posted: Wed Jun 27, 2012 10:02 am
by Sparkoids
Hi Pete,
Nothing industrial here!
Thanks for the info - I will let you know how I get on....
Best regards,
James :-}
Re: Reading Resistance....
Posted: Thu Jun 28, 2012 5:08 pm
by Spanish_dude
Best way I can think of is using a constant current and measure the voltage with an ADC.
Nicolas