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.

+/-3.5v to 0-100k resistance conversion circuit help please!

Status
Not open for further replies.
Ron H said:
The controls may be backward, as you may have discovered. If so, we'll tackle that next. :cry:

That's easy to deal with. The software lets me flip axis.

Unfortunately, this design will be sensitive to VCC(+5V) variations with time, temperature, individual computer's actual VCC value, and phase of the moon. We might be able to minimize this if you have room for more parts, like an op amp or two and more resistors.

The software's calibration will take care of any varience in the min and max.

This new change lets me adjust the min down to 31 and the max to 999. That's the good part. The bad part is that when I do that, the center is at 57 instead of 500. :(
 
Here is a spreadsheet that does the calculations for Ron's latest circuit.

Change cells E3 and F3 to give the effect of changing the pots.
 

Attachments

  • djpubba.xls
    15.5 KB · Views: 130
ljcox said:
Here is a spreadsheet that does the calculations for Ron's latest circuit.

Yup. Those currents are pretty close to what I get when I measure it. But it doesn't give the desired results. With Ron's circuit, the range that seems to produce the desired results is:


Right -- 1 mA
Center -- 60 µA
Left -- 30 µA

For kicks I measured the current with a plain ol 100k pot hooked up to the PC.

Right -- .49 mA (I have to guess on this since my meter has a dead spot between 400 µA and .5 mA).
Center -- 94.2 µA
Left -- 49.3 µA

Weird?
 
I have not studied your latest post yet. here is an update of the xls to include the deflection figures. The Def figures are partly guess work, based on what you have posted previously.

But nevertheless, it should be reasonably close. As you can see in the graph of Def, it is very non linear.

I expect that this is because the computer uses an RC timer which varies with the pot setting. This will therefore be an expotential function and thus not linear.

Whereas Ron's circuit gives a very linear translation from the voltage in to the current out. I don't know how we can fix this.

I'll look at your latest figures. Please check my latest, ie. confirm whether the Def and current figures are accurate.
 

Attachments

  • djpubba1.xls
    16.5 KB · Views: 173
That's what I was thinking. Try this while and let us know the results.

Look at Ron's original circuit. Remove Q2, Q3, R6 & R7 and connect the LED between +5V and the collector of Q1.

Make R5 = 390 Ohm and R1 2 k.

In the meantime I'll post an outline of a possibly better version.
 
Here it the basic idea.
 

Attachments

  • djpubba.gif
    djpubba.gif
    15.3 KB · Views: 715
ljcox said:
Here it the basic idea.
You can buy a part with two LDRs and an LED in one package. Both LDRs are illuminated by the same LED, so they track pretty well. I used a similar concept years ago (1972?) to make a video gain control that didn't require running the video to a front-panel pot.
Regarding the 100k pot nonlinearity: Any monostable, including the one you are interfacing with, will have a timeout T=k*R*C, i.e., the time should be proportional to R. If the pot is linear, the time should be proportional to rotation angle. In this case, it seems like the 100k pot is nonlinear, and has been compensated for in software. Does anyone see the flaw in this logic?
 
Ron H said:
ljcox said:
Here it the basic idea.
You can buy a part with two LDRs and an LED in one package. Both LDRs are illuminated by the same LED, so they track pretty well. I used a similar concept years ago (1972?) to make a video gain control that didn't require running the video to a front-panel pot.
Regarding the 100k pot nonlinearity: Any monostable, including the one you are interfacing with, will have a timeout T=k*R*C, i.e., the time should be proportional to R. If the pot is linear, the time should be proportional to rotation angle. In this case, it seems like the 100k pot is nonlinear, and has been compensated for in software. Does anyone see the flaw in this logic?
djpubba,
Was the 100k pot you used linear?
 
djpubba said:
I hooked up a 100k pot and it works as expected. What do you mean by "as expected"? When the pot was at the centre, was the screen also at the centre?

Edit: So... from the measurements I've taken, the magic area that gives me the movement range I want happens when the LED is getting between 1.0v and 1.5v. Center will be 1.25v. Right now my circuit gives me from .5v to 1.5v. So how can I shift it so that I get 1.0v to 1.5v going to the LED instead of .5v to 1.5v? See below

I have looked at your previous posts and realise I did not answer this question. You can shift it by about 0.5 V by inserting a diode in the "-5V" connection. Anode to the "-5V" and cathode to gnd.

If necessary, you could connect a pot (20 k or greater) in parallel with it to allow fine adjustment.
 
We may have to forget LDRs. Here are excerpts from a couple of spec sheets. Note the response times, especially turn-off times. A feedback loop can deal with turn-on, but turn-off is basically open-loop, I believe.

PS I have a few of these, but I haven't tested them.

********************************
Part Number = CLM8500/2
Description = Light-Dependent-Resistor-Output Optocoupler
Manufacturer = Various
Number of Input Channels = 1
Number of Output Channels = 1
Input Type = LED Lamp
Photocell Type = LDR
P(D) Max.(W) Power Dissipation = 125m
V(BR)Out Min.(V)Breakdown Volt = 100
I(IN) Min.(A)Control In. Curr. = 15m
V(IN) Min.(V)Control In. Volt. = 2.8
r(on) Max.(ohms) On-state Res. = 1.0k
r(off) Min.(Ohms)Off-state Res = 1.0M
t(off) Max. (s) Turn-off Time = 150m
t(r) Max. (s) Rise Time = 5.0m
Viso Max.(V) Isolation Voltage = 2.5k
Package = Axial
***********************************
 

Attachments

  • vtl5c4-2.png
    vtl5c4-2.png
    18.9 KB · Views: 654
ljcox said:
I have looked at your previous posts and realise I did not answer this question. You can shift it by about 0.5 V by inserting a diode in the "-5V" connection. Anode to the "-5V" and cathode to gnd.

If necessary, you could connect a pot (20 k or greater) in parallel with it to allow fine adjustment.

This seems to just chop off the lower .5v instead of shifting it.

I'm fairly optimistic that if we can shift the range of the original LED/LDR circuit so that far left gives 1v, center gives 1.25v and far right gives 1.5v, it'd work.

A refresher on what I'm getting now versus what I'd like:

Existing LED/LDR circuit:

Left - 1.6v (150 deflection)
Center - 1.1v (880 deflection)
Right - .7v (940 deflection)*

*The deflection stays the same from .7v-1.0v, leading me to believe the LED doesn't start emitting photons until about 1.0v.

Target:

Left - 1.6v (150 deflection)
Center - 1.25v (500 deflection)
Right - .9v (940 deflection)

ljcox said:
Here it the basic idea.

Do you reckon that'll have the range I'm after?

Thanks,
Tim
 
Are you guys paying attention? :D
150ms seems too long for the response time. If you can get it to work, more power to you.

Below is, I think, my last gasp. It is adjustable for the 46-1 range required, and should reach the min and max current needs. Its output is also a linear function of the input pot position.

EDIT:
I changed the schematic. I had specified an LM358, but it won't work here. You should probably just use a rail-to-rail I/O op amp. I can suggest one if you can't find one.
 

Attachments

  • vectrex_to_100k_1.png
    vectrex_to_100k_1.png
    9.7 KB · Views: 605
Ron H said:
Are you guys paying attention? :D
150ms seems too long for the response time. If you can get it to work, more power to you.

But it works now, it's just shifted over to the wrong spot. Seems so close!

Below is, I think, my last gasp. It is adjustable for the 46-1 range required, and should reach the min and max current needs. Its output is also a linear function of the input pot position.

I'll give this a try tomorrow. Will hafta make another trip to the store.

Thanks,
Tim
 
djpubba said:
ljcox said:
I have looked at your previous posts and realise I did not answer this question. You can shift it by about 0.5 V by inserting a diode in the "-5V" connection. Anode to the "-5V" and cathode to gnd.

If necessary, you could connect a pot (20 k or greater) in parallel with it to allow fine adjustment.

This seems to just chop off the lower .5v instead of shifting it. No it should shift the minimum voltage from the pot by 0.5V thus giving you about 1 V min as you want. it will also shift the max voltage a bit.

I'm fairly optimistic that if we can shift the range of the original LED/LDR circuit so that far left gives 1v, center gives 1.25v and far right gives 1.5v, it'd work. That's what the diode is intended to do.

A refresher on what I'm getting now versus what I'd like:

Existing LED/LDR circuit:

Left - 1.6v (150 deflection)
Center - 1.1v (880 deflection)
Right - .7v (940 deflection)*

*The deflection stays the same from .7v-1.0v, leading me to believe the LED doesn't start emitting photons until about 1.0v. Yes, I have not looked at the spec for an infrared LED, but a red one needs at least 1.6 V. So 1 V sounds reasonable.

Target:

Left - 1.6v (150 deflection)
Center - 1.25v (500 deflection)
Right - .9v (940 deflection)

ljcox said:
Here it the basic idea.

Do you reckon that'll have the range I'm after? Ron's point re the LDR delay and the open loop issue is relevant. So it may not work very well. I had not looked at a LDR spec, so missed this point.

Thanks,
Tim

Sorry, I've been out since this morning so I'm just catching up.

It is not clear from the above whether you have tested my diode suggestion.
 
Ron H said:
Are you guys paying attention? I've been out.
150ms seems too long for the response time. Agreed. If you can get it to work, more power to you.

Below is, I think, my last gasp. It is adjustable for the 46-1 range required, and should reach the min and max current needs. Its output is also a linear function of the input pot position.

Ron's looks good but, as far as I can see (some would say - not far), it has a linear transfer function, so the non linearity in the computer will affect the results as before. However, it may be possible to introduce some non linearity to compensate.

Tim, please measure the results at 10 or more points in the range, ie. say at 000, 100, 200, 300, etc. versus either the pot angle or the current out of Ron's circuit. Then we can produce a graph of the computer non linearity and hopefully be able to compensate for it.

I did this with a circuit I designed for a bloke in the UK. He wanted a LED display to alter its brightness with the ambient light. So it is dim in the dark, medium in medium light and bright in bright light. So I used an LDR to detect the light level and thus adjust the LED current. All I needed to off set the non linearity was 2 resistors and a diode.

I assume that the reason why the computer appears to be linear with the 100 k pot but non linear with Ron's current source is because the software is compensating for the expontential RC charging waveform. Yes, Ron, I know that T = k RC and a constant current should not matter, but there has to be a reason for the non linearity.
 
But it works now, it's just shifted over to the wrong spot. Seems so close!
What concerns me is speed, such as in a gaming situation. Will this controller be used for games?
Maybe having a human in the feedback loop will compensate for the slow response time. :?: :?:
 
If you build the level-shifting circuit, buy a dual op amp and do it this way.
 

Attachments

  • vectrex_to_100k_3.png
    vectrex_to_100k_3.png
    10.2 KB · Views: 488
No it should shift the minimum voltage from the pot by 0.5V thus giving you about 1 V min as you want. it will also shift the max voltage a bit.

I tested it before saying that. It doesn't shift by any significant value. It just crops it to 1v. So I get 1.0v far left as desired but center and far right are the same as before the change -- no shift.

Not knowing what I'm doing, I decided to try making a resistor ladder between 0v and +5v to get +2.5v and fed that into the -5v pin on the Vectrex controller so that my input voltage range would be +2.5 to +5 instead of 0 to +5, hoping that would shift my output voltage range. It did something completely different than I expected. It gave me +1.3v on the far left, +1v center and +1.6v far right. :shock:

Ron's point re the LDR delay and the open loop issue is relevant. So it may not work very well. I had not looked at a LDR spec, so missed this point.

Judging from how the game controls with the LED/LDR circuit, the response time is more than adequate for proper gameplay. It's just in the wrong spot -- the right side of the controller.

I'll still try Ron's circuit.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top