DS3502 with weird resistance?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

DS3502 with weird resistance?

Post by xeroksuk »

Hi

I've been working on a project trying to use a DS3502 to replace a logarithmic 10k potentiometer.

Existing hardware measures the resistance from the wiper to one of the ends of the pot. It uses 3.3V, and the max current I measure, (when the wiper gives zero resistance) is 330 uA

However, with the DS3502 I get weird values being returned, whether I directly measure the resistance, or the voltage. I've tried attaching the +ve to the RW and GND to RL, with and without RW and RH being connected. Also tried +ve to RH and GND to RW, but that seems to be disconnected.
The only resistance that looks about right is between RH and RL, which is about 10k, but is not very useful.

My suspicion is that the problem is a bad solder joint when attaching the connectors. I've resoldered RH,RW and RL, and they look OK by eye.

(For info I'm controlling the DS3502 from a Arduino Nano. My code changes the wiper value every 0.5 seconds, so I can theoretically see varying resistance values.

Any hints as to what I'm doing wrong or how to resolve it? Is my assumption that I can simply measure the resistance from RW to RL reasonable? And that I should be able to get resistances in the hundreds of ohms with the wiper closed?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: DS3502 with weird resistance?

Post by mikeysklar »

@xeroksuk,

Maybe take a step back and run the simple example we provide for the DS3502 (ds3502_test). Confirm that the Serial printing of values is correct and then manually check the voltage between RL and RW with your meter.

https://learn.adafruit.com/ds3502-i2c-p ... r?view=all

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

Good Suggestion, thanks Mikey. I'll put that together this evening, or maybe lunch time.

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

OK, so that looks OK.

The serial output is:

Wiper voltage with wiper set to 0: 0.00 V

Wiper voltage with wiper set to 63: 2.16 V

Wiper voltage with wiper set to 127: 4.38 V

These roughly tie in with what I'm getting on my voltmeter: 0.00V, 2.03V and 4.09V


I've also tried connection RH and REF on the arduino to a separate 3.3V supply ( the arduino is currently being powered via USB) , with RL going to -ve on that supply. I added a line to the setup: analogReference(EXTERNAL);

I get the following:
Wiper voltage with wiper set to 0: 0.00 V

Wiper voltage with wiper set to 63: 1.87 V

Wiper voltage with wiper set to 127: 4.99 V

Wiper voltage with wiper set to 0: 0.00 V

Wiper voltage with wiper set to 63: 1.93 V

Wiper voltage with wiper set to 127: 4.98 V




However, my voltmeter is showing 0.11V, 1.62V and 3.27V with only a little variation, which is somewhat encouraging.


Not sure where to go from here. The hardware I'm interfacing with only has 2 connectors. I don't know how to convert that to the 3 connectors the DS3502 appears to require.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: DS3502 with weird resistance?

Post by mikeysklar »

Your Arduino Nano is a 5v controller so I could see some confounding factor getting in the way even with AREF being tied to a 3.3v power supply.

I believe you need to set AREF up properly which is to disable Vcc as a reference so you can use your external 3v3 power supply for AREF. Something like:

Code: Select all

analogReference(EXTERNAL)

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

Thanks
I do have that line of code ( I mention it in in the previous post)

I've realised why the voltage being displayed is wrong - the code is multiplying the wiper value by 5. Changing that to 3.3 should fix it.

Obtaining the correct value -which I am- from the voltmeter is probably more important.


However at this point I don't know how to wire the DS3502 up so the external hardware reads it correctly. The flailing about I've done, plugging wires here, there and everywhere hasn't worked.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: DS3502 with weird resistance?

Post by mikeysklar »

When measuring externally with your multimeter you should get usable resistance / voltage readings by connecting:

GND multimeter <--> RL
+ multimeter <--> RW

Your multimeter readings looked close before when measuring voltage.

Do you need to try another meter or meter setting?

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

Ah I’ve got something working now, with the hardware +ve at RH, the hardware’s -ve in RW and the power supply’s -ve in RL. But it only works when the usb is not connected to the arduino.

This is a great step forward, I’ll see what I can do,from here.

Thanks Mikey, your suggestion about going back to basics really helped give me confidence in the product and that my soldering was solid.

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

OK, I think I have a better understanding of my problem, but am not sure how to get the result I'm looking for, it's beyond my electronics knowledge.

The DS3502 is working correctly as a potentiometer. I can put a voltage across RH and RL, and the potential difference between RW and either RH or RL is changed to the correct value as the wiper value is set by the Arduino.


However, the job i'm trying to do is to replace a 10K variable resistor. An existing device is measuring the resistance, as far as I can tell, using a voltage divider with a fixed 10K resistor.

The DS3502 doesn't work as I'd hoped as the internal resistance is not actually exposed to the wiper, like a manual potentiometer. There are weird interactions, I guess the PD across the device's connector is changing, which is affecting the DS3502.

I've attached a diagram of what I think the device is doing. Certainly the results of connecting this circuit to the DS3502 ties in with what I see when I attach the real device. In my simplified circuit, the Voltmeter reads from 1.65V to 3.3V as the controller resistor is moved from 10K Ohms to 0 Ohms.


So the questions are: is it possible to mimic the 10K variable resistor in the controller? If so: how?


I feel it must be possible, given the relationship between voltage and resistance, but I can't work it out. Everything I try gives different results from what I want.

replace_variable_resistor.png
replace_variable_resistor.png (12.21 KiB) Viewed 619 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: DS3502 with weird resistance?

Post by mikeysklar »

It seems like you have everything working correctly. You are able to set the wiper value and see the appropriate drop in voltage when measured.

This device is quite limited to setting and reading of the wiper. What functionality are you asking for that would be any different than using a variable 10k pot?

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

Hi

I just want to reproduce that 10K variable resistor, except controlled by the arduino. It just provides a resistance of between 0 and 10K Ohms.

I can see now that the DS3502 can’t do that directly. My understanding of what constitutes a potentiometer was clearly wrong.

Now I’m hoping that some magical combination of resistors in parallel or series with it could reproduce the effect of that resistor in the context of the test circuit I drew up.

User avatar
xeroksuk
 
Posts: 12
Joined: Wed Aug 25, 2021 12:41 pm

Re: DS3502 with weird resistance?

Post by xeroksuk »

OK, I think I have made some progress.

I broke the connector between the V+ and RH pins on the breakout, and this has helped a lot. I'm now getting significantly more sensible values once I connect V+ to a 5V source.

It now nearly works with my test setup.
If you remember, I'm expecting to measure values from 3.3V to 1.65V as the wiper moves from 0 Ohms to 10K Ohms.
What I'm getting instead is readings from 1.43V to 2.52V. My calculations say that equates to resistances from 2.96K to 12.94K, which looks to me like an additional 2.95K resistance.

Measuring the resistance directly now gives more reasonable values in the range 4.47K to 14.7K rather than the nonsense I was getting previously.

I'm not sure at this point how to get rid of that unwanted resistance, or where it comes from: I'd like it to get as close to zero as possible.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”