looking for help with an op amp desgin.

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
Hi all, new to allaboutcircuits and moderately new to electronic design. I do have a basic grasp on things but I spend way more time with firmware then I do circuit design.

I'm trying to interface with some old hardware.
1671130977711.png

The main issue is that the impedance is much higher then my ADC can handle so I tried to make a unity gain amp.


I guess I made a few errors..

1) I used a very high clocked op amp. EL2444C . I think this was just bad. So I think maybe this one is better. mouser.com/datasheet/2/389/tsb622-2909743.pdf
Any thoughts on this?

2) I borked up the design I think.

1671130413972.png


The PB5 gives it +5 volts and turns it on. The ground is tied to the MCU and also the ground of the device I posted up top. I had to add these resisters ( they are actually 1 meg ohm resister ) to make it work ( circled). And I didn't add any capacitors(decouplers /by pass). PB6 and PB2 are left floating, its how I can to the X/Y axis in the device above. There is no other way to connect to the trakball device above. If it helps I can turn on the internal resisters but they are like 40k...

3) I have no idea why I need the 1 mega ohm resisters, it may be to balance out some interference or something I do not understand but without them I do not get a reading. Any other value causes noise.

Over all, as is, the circuit does work. but touching the two points I circled with my finder causes the readings to increase. So something is not quiet right. I also feel part of my issue is that the op amp portion is incomplete. I'm not sure if and where I need the caps.

I realize this is not everything one would need to solve me problem, nor could anyone help without having the setup in front of the, but I'm also not expecting anyone here to fix my issues. Maybe just give me some guidance? Reading up on op amps is just getting overwhelmingly confusing but the concept I thinks is simple enough. I need to read +/- values with my ADC but need the resistance to come way down.

If I need to add more deatils please just ask, if I knew what was needed to fix this, I would not ask for help :) So clearly I'm lost with no direction and do not know what would help my situation. This is my first go using an op amp of any kind.
 

Sensacell

Joined Jun 19, 2012
3,135
Your post lacks contextual information that is needed to make any sense out of the questions.

What are you interfacing?

What signals?

etc...
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
Hi, thank you for taking an interest I my design. As I said I'm sure a lot here is missing but it is not always clear to me what Is needed. So just to answer the questions you mentioned.

I had mentioned this
I'm trying to interface with some old hardware.
1671130977711.png
but if you rather know the product its a atari 5200 trakball. I thought maybe it was better to show its schematic then just the product name, because its an odd one at that. There are details about how it works online.
http://www.atarimania.com/documents/Atari_5200_Field_Service_Manual.pdf

but in short when you spin the ball it created a voltage. The issue is the extremely high impedance can not be rad with my ADC.
 

Irving

Joined Jan 30, 2016
3,313
Welcome to AAC!

Your diagram is confusing, but I think your intention is this:

1671213049468.png

You are right in that, if the X & Y output of the trackball were a simple DC voltage, the 180k output impedance of the trackball will struggle to drive the relatively lower input impedance of the ADC, so buffering is the right answer, but I don't understand why you are connecting PB2 & PB6 to the inputs of the opamps? This will have all sorts of odd effects, none good.

However the output of the trackball is a current not a voltage, and there are other components outside the trackball that are needed as described in the text on page 7-5 of the manual. Unfortunately I don't have the time right now to investigate further.
 

Irving

Joined Jan 30, 2016
3,313
It seems the game ports X/Y inputs (pins 10 & 11 on each port, P0-P7 overall) go to the Pokey IC directly, so the additional analog functionality is embedded there. The POKEY outputs a 3v ramp over a TV Screen cycle and the trackball output modifies this though I'm not quite clear exactly how. The result is that spinning the ball emulates (poorly) pushing the joystick in that direction. More research needed on POKEY pot scan outputs.
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
OH ! yes I should have explained that PB2 and 6....Sorry about that. those are the only ports that allow a connection to X an Y. I realize this does not offer a full explanation but trust mem there is no other way. To offer a bit more, the pins from X and Y of that device go to a connector that in-turn routes this to PB2 and PB6. It is done that way because the track ball is not the only device that this circuit uses. When it is communicate with a TB, it leaves those pins floating. Hi-V. So nothing is connected to then in the MCU.

Yes this TB is odd indeed. I will say though, even with a few side-effects, reading the voltage from the op amp does work. I learned a bit more but still so confused.

1) I think I need a lower speed op amp.
2) the 1 mega resisters are needed, I put a 900k on there and didn't get a reading. But why? a pull down is needed?
3) I added by pass caps to + and - but it didn't change anything.,
4) I added a 300pf parallel to the feedback - but it didn't change anything.
5) Is it normal to use a buffer like this with no inline resisters?

BTW: I do know the author of the TB personally. I can ask him a question but I need to be concise. He doe snot tolerate open or vague questions.

The fact you are thinking this is not to be rad with voltage makes me wonder if its why I'm having troubles.

So here is a thought, the other way the atari reads devices is with a cap timed loop. take a cap and deplete it. Now apply a voltage thru a POT and start a timer till its high. Value = x, now do the y... This is how the "game controller" works. For obvious reasons the TB was not done the same way. but it is conceivable it is generating a resistance and the console uses the same timed loop. I would not be surprised if that were that case. I also wrote the code for the time delay but connecting the TB to it, does not work well at all. That is, moving the TB up,down,left, or right, does not register a change in resistance. However, I did this without an op amp, maybe the resistance is much higher? A typical POt for this application is 0-500k. or maybe 0 t0 one Mega ohm.


Thank you so much for helping, it is very difficult to tackle something new and have no direction.

I do have a scope, but lack the direction to know what to look for.
 

Irving

Joined Jan 30, 2016
3,313
As I understand it, and the various descriptions I've read are as clear as mud, the POKEY IC uses a capacitor charging through the joystick pot, and counts line scans until the capacitor voltage trips a comparator in the POKEY at around 3v - so that woulld give a value between 0 and 225 approx at 60 readings/sec. The TB output is a + or - current pulse that crudely increases or decreases the charge on that capacitor and therefore increases or decreases the line count. A resistor to ground will convert the current to a voltage, but all you'll see are small pulses, not a constant voltage. You need an integrating element somewhere.
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
ok, interesting. I do not see that on a scope. I see a mean voltage and a deflection of + or - 4 or so. Depends on the speed I spin the ball. It clips easily so there is it a finite variation with small movements only. But AFAICT its not pulsing? Let me see if I can get some scope images. Its a 100 MHz so we'd see it is it were pulsing.
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
Here is a scan of a hard spin, it spikes upward then coasts downward. I do see a lot of noise on the line. This is direct to the X lead of the TB. Not connected to my circuit but powered by it.
1671390555689.png
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
or is the noise I see the pulsing? Like a switching power supply? If so, could a by pass capacitor smooth that out? Not sure the pulsing helps me here.
 

MisterBill2

Joined Jan 23, 2018
14,260
I look at the circuit in post #1 and I see no voltage output other than DC pulses. There is an attenuation circuit beyond the gates driving the output, but that is all. So there is nothing that would be useful feeding an A/D converter input.

So the big question is what are you hoping to get from the device and what is the purpose of whatever you want to get. This package delivers rising-edge pulses that decay slower. It is designed to drive a pulse counting input.
 

Irving

Joined Jan 30, 2016
3,313
l knocked up a quick simulation of the TB circuit, X-only, see below. The upper traces are +ve spin, the lower are -ve spin, for 200, 400 and 600Hz - higher frequency = highest/lowest voltage. The range (resolution) compared to the joystick isn't great. I've shown it with the 900k pulldown and a buffer voltage follower (AD822 is very similar to the TBS622).

1671459537427.png

Adding C4, an 0.047uF capacitor, across the 900k resistor cleans it up a lot and may give you better results at the risk of slowing trackball response.

1671460472265.png
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
ok, I want to make sure I understand you right. It looks like the suggestion here was adding a cap in the TB circuit, is that right? I can do that for an experment but the device I'm making is a project that I want to work the TB as is. From the traces there it does indeed look like what I see, so woudl there be a way to achieve the same fix outside the TB circuit? I could also go a head is test this idea, it should not take much effort, the board is very easy to get at.
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
but now that I think about it, when I first started this I was looking at the signal on a analyzer. This is where I learned I need a scope, and the scope is where I learned I need a buffer. But I wonder now that it is buffered, can I use the signal? For exmaple if the pulse accurrances are x us apart when spun slowly, and x * x when spun fast, maybe I can just use the GIOP to sample that?
 

MisterBill2

Joined Jan 23, 2018
14,260
The signal from the trackball circuit is pulses. There is a bit of RC filtering or some such, but it is still pulses of DC . The trackball circuit could have the one resistor replaced with a diode and then the voltage would ramp up with the pulses.
But it the input is looking for an analog voltage you are TOTALLY OUT OF LUCK.
And we still are not told what the desired input signal is. Voltage relative to the desired position? Or voltage relative to the speed of the trackball? Or something else??

Look at that circuit!! It is all digital ICs with a 5 volt supply.
 

Thread Starter

ulaoulao

Joined Dec 15, 2022
12
whoops was that on me?
" And we still are not told what the desired input signal is. Voltage relative to the desired position? Or voltage relative to the speed of the trackball? Or something else??"
Sorry. Absorbing all this info can sometimes cause me to miss things. So the desire here is to know at least if the ball was spun and the direction, at most (hopeful not required) the amount it was spun. I have the option to use the ADC with the buffer (Thinking this is out now) or the GIOP pins. The Chip I'm using is an AVR so it can use a 5v TTL or -5 to +5 volt ADC. I do have the option of adding components on the the device receiving the input signal but space is a bit limited to about 5 mm by 10 mm.

yeah I did notice that it was a digital circuit but didn't come to this pulse conclusion on my own, however, now that you point that out Duh, indeed.

I really appreciate you taking the time here to explain and troubleshoot this with me.


Going back to the original design. Here is a sister controller
https://old.pinouts.ru/InputCables/JoystickAtari5200_pinout.shtml
the TB works on the same port and as you see they comment in this page about the analogs.
" The analog joystick is very much like having a .... "
So I'm really confused on what the engineer was doing here... It is very clear at this point this TB is a digital device that makes and generates pulse. The 5200 port pins it connects to are intended to read a resistance. ( charge capacitor code) and I'm sure the console enters a "trackball mode", of which it does I do not know. I also have the link to the 5200 schematic where the pins come in.
https://atariage.com/5200/archives/schematics/Schematic_5200_IO_Low.html
that is pins 10 and 11. And they go to a 4052 chip?
Are we just simulating voltage here with a digital circuit?

If this question is taking a turn for the worse just say so, but at least I know why my initial design didn't work out well and i tank you for that.
 

Irving

Joined Jan 30, 2016
3,313
ok, I want to make sure I understand you right. It looks like the suggestion here was adding a cap in the TB circuit, is that right? I can do that for an experment but the device I'm making is a project that I want to work the TB as is. From the traces there it does indeed look like what I see, so woudl there be a way to achieve the same fix outside the TB circuit? I could also go a head is test this idea, it should not take much effort, the board is very easy to get at.
No, the 900k resistor is outside the TB as per your original diagram (or maybe it was 1Meg on the diagram - anyway the value isn't so critical). All the capacitor does is filter the pulses to give a more stable DC voltage. Looking more closely, the trakball range is 0 - 500Hz; above 500Hz the voltages wrap around due to the fixed output pulse width of the 555 (approx 1.1mS, same as the 4538B in the original schematic) and/or the 5v rail output limit of the opamp. At no spin the output is 3.2v. The chart below gives this new look:

1671538302364.png
 

MisterBill2

Joined Jan 23, 2018
14,260
I have been trying to understand the output circuit of that trackball board. it looks like an attempt at some sort of charge pump is intended, but poorly implemented. with no pulses the output voltage would be stable at some value, while depending on the direction of rotation there will be strings of pulses tending to either charge or discharge the 0.1 MFD capacitors, and that is intended to emulate a control stick output. But it is a signal with a lot of ripple and it does not appear to be suitable for most analog inputs.
Certainly it is intended for one specific input circuit arrangement.
 

Irving

Joined Jan 30, 2016
3,313
I have been trying to understand the output circuit of that trackball board. it looks like an attempt at some sort of charge pump is intended, but poorly implemented. with no pulses the output voltage would be stable at some value, while depending on the direction of rotation there will be strings of pulses tending to either charge or discharge the 0.1 MFD capacitors, and that is intended to emulate a control stick output. But it is a signal with a lot of ripple and it does not appear to be suitable for most analog inputs.
Certainly it is intended for one specific input circuit arrangement.
Exactly so, normal thinking does not apply here. Reusing this very specifically designed to a price and market TB - which had to work with the same setup as the existing joystick controller - was a bit of lateral thinking and kudos to the guy that figured it out, but its not what you need if you jst want a trackball.

If I was to do this for real I'd tap off the original encoders and add my own logic and keep it purely digital.

" The analog joystick is very much like having a .... "
So I'm really confused on what the engineer was doing here... It is very clear at this point this TB is a digital device that makes and generates pulse. The 5200 port pins it connects to are intended to read a resistance. ( charge capacitor code) and I'm sure the console enters a "trackball mode", of which it does I do not know. I also have the link to the 5200 schematic where the pins come in.
https://atariage.com/5200/archives/schematics/Schematic_5200_IO_Low.html
that is pins 10 and 11. And they go to a 4052 chip?
Are we just simulating voltage here with a digital circuit?

If this question is taking a turn for the worse just say so, but at least I know why my initial design didn't work out well and i tank you for that.
The TB is a digital device right up until the outputs of A4a and A5c (X axis) where they drive an RC network that converts the digital pulses to a crude analog sawtooth.

1671539506227.png

They don't go to the 4052 chips which are multiplexers for the digital keypads on the joystick & TB, but they become the internal P0P1 (XY TB1) and P2P3 (XY TB2) analog signals to the POKEY chip on pins 12-15. If you look carefully on the schematic (2 port example shown below) you will see the same 0.047uF capacitors on the P0-P3 lines that are used to scan the joystick pots.


1671541465410.png


Here's a simulation of the POKEY with a joystick Pot X1 at 10, 50 and 95%
1671542797662.png
1671542970006.png1671543023738.png1671543138403.png

and with the same circuit attached to the TB... it works but its horribly non-linear. No wonder gamers weren't much impressed!

1671544110631.png
 

MisterBill2

Joined Jan 23, 2018
14,260
But the pulses from the trackball electronics are a constant width, so the whole thing is a charge pump that is not very effective. One thing that could change that would be making the circuit more effective by adding diodes. The situation with the present circuit is that the CMOS devices source current when they output a high and sink current while they are low. That means that the result is going to have very large amounts of ripple. Evidently that is what the input for the original was designed to work with.
So now the question is what is the device to be controlled expecting?? In all systems with sensor inputs the circuit must be able to use the input from the sensor connected.
It will be fairly simple to rearrange a few components and get a DC level with much less ripple, but that may not be what the input is seeking. The level could rise or drop as the ball was spun, but the response time may not satisfy gaming.. The revised output might be good for driving an RC car, though.
 
Top