1. 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.
    Dismiss Notice

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

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by djpubba, Jan 4, 2006.

  1. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    That's easy to deal with. The software lets me flip axis.

    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. :(
     
  2. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    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.
     

    Attached Files:

  3. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    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?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia

    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.
     

    Attached Files:

  6. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    Seems accurate.

    Should we go back to trying to get the LED/LDR pair tweaked? :roll:
     
  7. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    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.
     
  8. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    Here it the basic idea.
     

    Attached Files:

  9. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    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?
     
  10. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    djpubba,
    Was the 100k pot you used linear?
     
  11. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    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.
     
  12. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    Yes. The pot was linear. 50k gave 500 on screen (or close). 75k gave 750, etc.
     
  13. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    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
    ***********************************
     

    Attached Files:

  14. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    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)

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

    Thanks,
    Tim
     
  15. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    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.
     

    Attached Files:

  16. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    But it works now, it's just shifted over to the wrong spot. Seems so close!

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

    Thanks,
    Tim
     
  17. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    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.
     
  18. ljcox

    ljcox Well-Known Member

    Joined:
    Dec 25, 2003
    Messages:
    3,205
    Likes:
    28
    Location:
    Melbourne Australia
    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.
     
  19. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    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. :?: :?:
     
  20. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    If you build the level-shifting circuit, buy a dual op amp and do it this way.
     

    Attached Files:

  21. djpubba

    djpubba New Member

    Joined:
    Jan 4, 2006
    Messages:
    40
    Likes:
    0
    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.
     

Share This Page