Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: analog pot to analog pot adapter. An EE question.  (Read 2596 times)

0 Members and 1 Guest are viewing this topic.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
analog pot to analog pot adapter. An EE question.
« on: May 31, 2011, 04:09:33 pm »
If given analog pot "A" is difficult or impossible to replace then would it be conceivable to construct a circuit that adapts pot "B"? For instance, a 180 degree 10k pot replace with a 180 degree erm...20k pot. Assuming each pot is of the same type eg linear.

What about half that value? Eg a 5k pot. You would lose some granularity.

It seems to me it would be a common problem but I haven't really seen much on the topic. I can visualize a few circuits that might do the trick.

What are your thoughts?

Ed_McCarron

  • Nothing worse than Picard issuing the self destruct order and the next thing you know it your apartment blows up.
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2404
  • Last login:June 20, 2022, 02:33:39 pm
  • Get your mind out of the gutter. THIS is a dongle.
Re: analog pot to analog pot adapter. An EE question.
« Reply #1 on: May 31, 2011, 10:39:24 pm »
Wouldn't a 20k fixed resistor in parallel with a 20k pot vary from 0 ohms to 10k?  I think you'd lose your linearity, though.

EDit:  If I did the plot right... You'd lose a little linearity.
But wasn't it fun to think you won the lottery, just for a second there???

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 01:14:11 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: analog pot to analog pot adapter. An EE question.
« Reply #2 on: June 01, 2011, 07:27:25 am »
It depends upon the use.  Like Ed said, there are going to be drawbacks of the swap... not mind blowing, but drawbacks none the less. 

That being said, it really depends upon the application.  For a real arcade machine, particularly a classic, it will slightly alter the controls. 

On the other hand if it's for mame or something windows based, you can compensate for most differences both at the joystick calibration in the control panel and within mame itself.

danny_galaga

  • Grand high prophet of the holy noodle.
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8522
  • Last login:Yesterday at 07:20:25 am
  • because the mail never stops
    • dans cocktail lounge
Re: analog pot to analog pot adapter. An EE question.
« Reply #3 on: June 01, 2011, 08:44:41 am »
Wouldn't a 20k fixed resistor in parallel with a 20k pot vary from 0 ohms to 10k?  I think you'd lose your linearity, though.

EDit:  If I did the plot right... You'd lose a little linearity.

Great idea! Your smart 'n' stuff!


ROUGHING UP THE SUSPECT SINCE 1981

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: analog pot to analog pot adapter. An EE question.
« Reply #4 on: June 01, 2011, 11:16:41 am »
Wouldn't a 20k fixed resistor in parallel with a 20k pot vary from 0 ohms to 10k?  I think you'd lose your linearity, though.

EDit:  If I did the plot right... You'd lose a little linearity.

That's why I picked 10k/20k as an example, math was easier. :)

Yeah took me a couple of hours yesterday to figure out how to pull out the graph tools at work yesterday but that's the same graph I came up with too.

IRT @ Howard_Castro

The thought came to me as I was reading a repair article for the 2600 paddles. The solution to sketchy pots is to dissassemble the pots, remove the lubrication grease, clean, the reassemble. This struck me as a one time repair as the grease probably served to reduce wear on the contacts. With no grease, those contacts will will wear out permanently, no more repairs afterwards.

My Hang-On cab may need to have its pots replaced too. They're hard to pinpoint with some people since pot manufacturers changed their nomenclature in a confusing manner after the 80s so what was a Type B then is not the same as a Type B now.

so I got to thinking about what kind of alternative solutions might exist.

Ed_McCarron

  • Nothing worse than Picard issuing the self destruct order and the next thing you know it your apartment blows up.
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2404
  • Last login:June 20, 2022, 02:33:39 pm
  • Get your mind out of the gutter. THIS is a dongle.
Re: analog pot to analog pot adapter. An EE question.
« Reply #5 on: June 01, 2011, 11:00:53 pm »
In hindsight, that also assumes you're using the pot as a simple resistance, and not as a voltage divider.  No clue how that would work.

If the input to the game is just a voltage reference picked off the wiper of a pot wired as a voltage divider (ie, 0v on one side, 5v on the other...), does the actual resistance matter?

Need more input.
But wasn't it fun to think you won the lottery, just for a second there???

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19428
  • Last login:Today at 01:14:11 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: analog pot to analog pot adapter. An EE question.
« Reply #6 on: June 02, 2011, 04:50:24 am »
In hindsight, that also assumes you're using the pot as a simple resistance, and not as a voltage divider.  No clue how that would work.

If the input to the game is just a voltage reference picked off the wiper of a pot wired as a voltage divider (ie, 0v on one side, 5v on the other...), does the actual resistance matter?

Need more input.

What he said.  And I can unfortuantely assume for you (judging by the mame drivers) that hangon doesn't have truely analog inputs and does use the post as a voltage divider.  I think you are going to just have to hook some stuff up and play with it. 

If I remember correctly hangon has a fairly good test menu. 

danny_galaga

  • Grand high prophet of the holy noodle.
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8522
  • Last login:Yesterday at 07:20:25 am
  • because the mail never stops
    • dans cocktail lounge
Re: analog pot to analog pot adapter. An EE question.
« Reply #7 on: June 02, 2011, 08:39:39 am »

How weird is this pot you're talking about? Surely there must be SOMETHING in the same range that you could jury rig? Digikey have thousands of types for instance. Might take a while to go through, but if you find the right one, you're set...


ROUGHING UP THE SUSPECT SINCE 1981

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: analog pot to analog pot adapter. An EE question.
« Reply #8 on: June 07, 2011, 08:19:02 pm »
Really, it's just a thought I have. Those were just examples I gave.

My Hang-On is currently blind so replacing the pots this early is pointless. Until a new monitor that doesn't blow up is sourced, all I can do is mechanical and cosmetic work. Electrical work is delayed. :(

The 2600 uses a capacitor then drains it at regular intervals to determine the value of the pot. I can't figure out what I did with the video adapter for that one.??? No matter, it's in pieces now.

MonMotha

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2378
  • Last login:February 19, 2018, 05:45:54 pm
Re: analog pot to analog pot adapter. An EE question.
« Reply #9 on: June 07, 2011, 09:44:13 pm »
What you have to do here depends quite a bit on how the pot is read.  In some cases, the resistance of the pot doesn't matter much, only wiper position.  In other cases, the resistance of the pot is of primary consideration.  Adapting one end-to-end resistance to another is a process that's difficult to do without knowing much about what it's hooked up to.

FYI, the A/D process you're referring to on the 2600 is called a "ramp compare" ADC.  They're cheap but not particularly accurate.  They're good enough for a video game, though.  With most of these designs, the end-to-end resistance does matter.

On a reasonably Hi-Z input ADC (like a SAR or FLASH), the end-to-end resistance is in general not a big deal if the pot is used as a voltage divider.  Anything within an order of magnitude is likely to work reasonably well.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: analog pot to analog pot adapter. An EE question.
« Reply #10 on: June 24, 2011, 12:00:11 pm »
Thanks MonMotha, now I have something to search on with the 2600. I've been reading the documentation but that's not a phrase I've come across yet.

I've been wanting to feed the ADC a PWM signal but couldn't figure out how the  antiquated hardware would respond.

MonMotha

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2378
  • Last login:February 19, 2018, 05:45:54 pm
Re: analog pot to analog pot adapter. An EE question.
« Reply #11 on: June 25, 2011, 01:55:58 am »
Thanks MonMotha, now I have something to search on with the 2600. I've been reading the documentation but that's not a phrase I've come across yet.

I've been wanting to feed the ADC a PWM signal but couldn't figure out how the  antiquated hardware would respond.

Ug, that's a somewhat complicated one.

You may get by with using a resistor to an open-collector IO (or just use a FET to ground and PWM the gate).  The resistor should be fairly small: maybe 100 ohms, but it will depend on the cap used in the ramp compare A/D setup and what kind of charge is put on it at reset.  If your PWM frequency is MUCH faster than the sampling rate, you might get it to work reasonably well.  You'll probably have to play with the duty cycle some.

The idea is that you want to discharge the cap within the A/D at a certain rate based on your PWM.  You do this by draining some charge off it whenever the PWM is "on".  As you vary the duty cycle of the PWM, you'll discharge the cap at a faster or slower rate.

If you had access to the sample clock of the A/D, this is fairly easy: just send a hard discharge after the necessary elapsed time to trigger the compare.  However, I don't think you have access to that clock without hacking the 2600.

A constant current sink would work better than a switched resistor to ground, but is more difficult to build.  If you have trouble figuring out what PWM duty cycle you need to get a given input code, you might try using a constant current sink.  There are various ways to build one.  I can describe some, if you wish.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: analog pot to analog pot adapter. An EE question.
« Reply #12 on: June 25, 2011, 08:04:49 pm »
Thanks MonMotha, now I have something to search on with the 2600. I've been reading the documentation but that's not a phrase I've come across yet.

I've been wanting to feed the ADC a PWM signal but couldn't figure out how the  antiquated hardware would respond.

Ug, that's a somewhat complicated one.

You may get by with using a resistor to an open-collector IO (or just use a FET to ground and PWM the gate).  The resistor should be fairly small: maybe 100 ohms, but it will depend on the cap used in the ramp compare A/D setup and what kind of charge is put on it at reset.  If your PWM frequency is MUCH faster than the sampling rate, you might get it to work reasonably well.  You'll probably have to play with the duty cycle some.

The idea is that you want to discharge the cap within the A/D at a certain rate based on your PWM.  You do this by draining some charge off it whenever the PWM is "on".  As you vary the duty cycle of the PWM, you'll discharge the cap at a faster or slower rate.

If you had access to the sample clock of the A/D, this is fairly easy: just send a hard discharge after the necessary elapsed time to trigger the compare.  However, I don't think you have access to that clock without hacking the 2600.

A constant current sink would work better than a switched resistor to ground, but is more difficult to build.  If you have trouble figuring out what PWM duty cycle you need to get a given input code, you might try using a constant current sink.  There are various ways to build one.  I can describe some, if you wish.

My understanding on how the 2600 ADC works and what you're describing seems to conflict. Let me get back to you on that.

Thanks for the offer about the circuit, let me see if I can find some information about a constant current sink and read up on it first. See if I can't save us all some time.

Slightly OT. As near as I can tell the 2600 community is rather interesting. There's a lot of amateur level folks trying to add improvements that are kind of kludging through understanding the old technology. Some are right, some are dead wrong (eg some seem to think the *'s in the circuit schematic stands for a 1-bit buffer. I'm reasonably certain this isn't true, especially for TTL circuits). Then you got this group that seem to be like Randy or Andy but.... well, I don't know. Kind of hard to explain. It's like the difference between BOYAC and KLOV. One group just wants cabs that work, the other is about preservation and neither group wants to admit their own shortcomings. :\

MonMotha

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2378
  • Last login:February 19, 2018, 05:45:54 pm
Re: analog pot to analog pot adapter. An EE question.
« Reply #13 on: June 25, 2011, 09:16:05 pm »
Do you have a better description for how the 2600's analog inputs are set up?  The above should work on a PC joystick input, but I'm not entirely familiar with how the 2600 is set up.

SavannahLion

  • Wiki Contributor
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5986
  • Last login:December 19, 2015, 02:28:15 am
Re: analog pot to analog pot adapter. An EE question.
« Reply #14 on: June 26, 2011, 03:45:59 am »
Not really. I have the schematics and programming manual from Atari Age

Bomarc Schematics:
http://www.atariage.com/2600/archives/schematics/index.html

The link above has schematics for two versions labeled, CX2600 and CX2600A. I have a 1980 Rev8 board so it's closer to the "A" drawing. I have my suspicions there are more than just those two since there are Heavy Sixers, Vaders, Jrs etc. And my board is Revision 8 so....

The paddles schematic is in "Accessories" in the above link.

Back on topic, the pins of interest are 37-40 on the TIA. AtariAge has schematics for it as well:
http://www.atariage.com/2600/archives/schematics_tia/index.html

I'll readily confess I'm still trying to digest that thing. It's the size really. I like to print my schematics out on one sheet and examine them that way. I have a hard time moving schematics in four different directions as I study the circuit. Not sure how EE people can get away with designing entire high end PU's with a bazillion transistors without ever printing any of it out.  :dizzy:

In my spare time, I've been examining the Programming documents. This is what the STELLA PG says about the pots:
Quote
12.1 Dumped Input Ports (INPT0 thru INPT3)

    These four ports are used to read up to four paddle controllers. Each paddle controller contains an adjustable pot controlled by the knob on the controller. The output of the pot is used to charge a capacitor in the console, and when the capacitor is charged the input port goes HI. The microprocessor discharges this capacitor by writing a "1" to D7 of VBLANK then measures the time it takes to detect a logic one at that port. This information can be used to position objects on the screen based on the position of the knob on the paddle controller.

I thought the TIA measures the amount of time it takes to discharge the pots but I found the following blurb (while writing this post) later in the PG that re-words and it's a little clearer IMHO. I missed this last time I examined the PG, not sure why.....

Quote
B. Dumped Input Ports (I0 through I3)

    These 4 input ports are normally used to read paddle position from an external potentiometer-capacitor circuit. In order to discharge these capacitors each of these input ports has a large transistor, which may be turned on (grounding the input ports) by writing into bit 7 of the register VBLANK. When this control bit is cleared the potentiometers begin to recharge the capacitors and the microprocessor measures the time required to detect a logic 1 at each input port.

    As long as bit 7 of register VBLANK is zero, these four ports are general purpose high impedance input ports. When this bit is a 1 these ports are grounded.

This makes a lot more sense really. I had a hard time wrapping my head around what I thought was some kind of bizarre negative logic. Now that my head is on straight.....

If I got the logic right, a PWM by itself will never work properly. With a 50% duty cycle, the charge in the cap will never reach 5v since 1/2 the time it's held high and 1/2 the time it's draining off any excess charge and averaging the voltage to ~2.5v. An analog pot will eventually pull the cap all the way to 5v or near enough while the TIA holds the pin in a HiZ state.

Is that right? Even with a FET, I'm still draining that cap.
« Last Edit: June 26, 2011, 03:50:47 am by SavannahLion »

MonMotha

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2378
  • Last login:February 19, 2018, 05:45:54 pm
Re: analog pot to analog pot adapter. An EE question.
« Reply #15 on: June 26, 2011, 04:17:16 am »
Ah, I see.  It's the inverse of a PC joystick port.  Rather than having software charge the cap then measure how long it takes the RC circuit made up of the joystick pot and internal cap to discharge, the software trigger discharges the cap and measures how long it takes to CHARGE.

You can still do the same thing, fortunately, you just have to do it high side.  Use a PFET (a PNP will also work, but you won't get all the way to the rail) and again a smallish resistor.  Looking at the schematics, this resistor isn't strictly necessary, but it may save your console if you hook things up wrong.  Hook up the paddle input (pin 5 or 9) through that resistor and PFET to the power rail (pin 7).  Whenever the PWM signal is low, the cap will be allowed to charge through the resistor.  When the PWM is high, the cap will not charge.  You can, as with my previous post, vary the rate at which the cap charges by varying the PWM duty cycle, though the sense is inverted (higher duty cycles cause slower charge and therefore read as though the pot is at a higher resistance than lower PWM duty cycles).  Note that your PWM signal needs a logic level equal to whatever's on pin 7 of the 2600.


There's another way to do it, though.  This method avoids all the analog stuff.  Rather than use a PWM signal, you can just use some timers and an IO line that you vary between an input and a logic high output.  Monitor the status of the paddle "analog" line.  Wait for the 2600 to "discharge it" (it goes low).  After a certain period of time, which you can vary to adjust what position your fake paddle represents, you perform a hard charge by temporarily driving the line high for a short amount of time - just long enough to charge the cap and trip the input.  Then return to a listening state and repeat the process when the 2600 discharges the cap.

You could work out what time delay you need to emulate a given pot resistance mathematically if you determine (experimentally) the threshold at which the 2600 reliably reads a "high" on those inputs.  Then work out how long it takes an RC circuit (R=1800+RPot, C=0.068uF - values taken from the 2600 schematic) to charge to that threshold for the RPot of interest.

In this case, your logic high only needs to be high enough that the 2600 to register it.

Either method should work.  Which way is easier depends on your definition of easy.