Jump to content
IGNORED

adding a capacitor to paddles to smooth out the signal?


madscijr

Recommended Posts

I've been playing with connecting Atari paddles to PC using a USB interface like this

 

and find that the values on the PC side are "jumpy", 

ie without moving the controller and just leaving it sitting there,

and reading the value on the PC, the value fluctuates.

Not wildly but enough to make my game spastic. 

This problem happens with working paddles that have been cleaned and are not "jittery" on a real Atari, 

and it happens with various brand new 1M Ohm linear potentiometers (which also work fine with a real Atari). 

 

After some googling I came across a discussion where they discuss this problem

and talk about adding a capacitor to "smooth out" the signal:

reading a potentiometer ? (avrfreaks.net)

Quote

 

Also, you may wish to put a 0.1 uF cap from the junction of the fixed resistor and your 2 wire device to ground.

Some pots are scratchy, with intermittant ro noisy contact, and this will help smooth out the signal.

You may wish to average several readings for your real application, once you have it working.

 

 

I have seen a capacitor used with a guitar tone control potentiometer.

 

Would adding a capacitor between pin 7 (+5v) and pin 5 (paddle A), and another one between pin 7 and pin 9 (paddle B), be the way to do this? 

 

Would it work to smooth out the signal or would it no longer be readable by the Atari? 

 

Before I open up my paddle and soldering iron, I thought it might be prudent to ask the experts.

 

Any feedback appreciated... 


 

 

 

 

Edited by madscijr
Link to comment
Share on other sites

As Danjovic stated adding a capacitor, could mess up the timing and therefore the positioning. I would forget the conversation you linked to as...

a) It is talking about connecting to the ADC input of a microcontroller and you cannot be certain of the circuitry being used 

b) It is referring to creating a potential divider with another resistor which is the wrong way to do it anyway

c) The individual instigating the thread clearly indicates they do not know how the controllers work in the Atari and it would appear neither of the respondents know how to do it correctly either as they are all looking at it as a variable voltage and not a variable current.

 

In the Atari and old PC Game port controllers a potentiometer is used as a variable resistor with one end connected to 5V and the other end to the input pin. On the other side of the input pin will be a capacitor to ground and possible a fixed resistor between the input pin and the capacitor. As the potentiometer is turned its resistance changes and thus the amount of current flowing through it into the capacitor changes.

To read its position the capacitor is discharged, and then allowed to charge, either the voltage across the capacitor is read after a fixed time period, or the voltage across the capacitor reaches a point where it triggers an interrupt and a timer is read. Either way Timer value or ADC result give you a digital value that represents the position of the potentiometers wiper that in turn determines the screen position of the players object.

 

In most cases there will always be some small variation in the resulting value even if the potentiometer is not moved, commonly referred to as quantization errors, which could be down to minor changes in timing (one or two clock pulses difference in when the reading is taken) or electronic noise pickup. Sometimes those changes are too small or infrequent to notice, where they do become noticeable there are strategies to combat that, for example with an ADC one could set or clear the two least significant bits of an 8 bit result which will be the ones to fluctuate or rotate a 10 bit result to the right twice which does the same thing. Another method is oversampling, where you read the input say 10 times and then use the average value as your position value.

 

I suspect the heart of whatever you are using is one of these god awful Arduios which makes anyone think they can be an electronics wizard and come up with the next "great" piece of wholly pointless IOT junk. Consequently, in the majority of cases the code is written by people who know little if anything about programming in general, programming micrcontrollers or electronics and who have probably just cobbled something together by copying and pasting code and libraries written by other people who also don't really know how to code and you end up with something that kind of works but often not as well or as efficiently as it could.

I suspect that whatever you are using may not have had any quantization correction included and just basic code to read an ADC input was used or it has not been screened to eliminate noise pickup, hence the jittering        

 

   

  • Like 2
Link to comment
Share on other sites

13 hours ago, Stephen Moss said:

 

I suspect the heart of whatever you are using is one of these god awful Arduios...

Hey One of the links is for a project of mine - and use an Arduino, lol!!!!
Don't worry I am not mad with you, I'm just laughing, as we share a similar opinion in many aspects.

I have built many projects using Arduino boards just because they are cheap, easy to find and deliver a microcontroller on a PCB complete with clock, decoupling capacitors, a convenient 3V ldo regulator and USB power altogether with a programming tool (the bootloader). That makes the project easier to reproduce for other people with less experience on electronics.

 

13 hours ago, Stephen Moss said:

most cases there will always be some small variation in the resulting value even if the potentiometer is not moved, commonly referred to as quantization errors

One of the projects linked used the ADC to read the potentiometer with a pullup resistor, which will result in a source impedance above 10k for the most of the range which is also a bad thing for the AVR (more error produced).

 

For that reason I have used the same method as the PC, Atari and others: Measure the time a capacitor takes to charge using the pot as a current source.

13 hours ago, Stephen Moss said:

Another method is oversampling, where you read the input say 10 times and then use the average value as your position value.

Haven't tested my circuit with a noisy pot. All the PC joysticks that I have used behave well, even after a long stand in the shelf. Nevertheless I should implement some noise reduction on my code. 

Link to comment
Share on other sites

9 hours ago, Danjovic said:

I have built many projects using Arduino boards just because they are cheap, easy to find and deliver a microcontroller on a PCB complete with clock, decoupling capacitors, a convenient 3V ldo regulator and USB power altogether with a programming tool (the bootloader). That makes the project easier to reproduce for other people with less experience on electronics.

That is why they are so popular, although I would be cautious about always relying on the USB power as the primary power source. Yes, it is convenient particularly while the Ardiuno is connected to a PC (which is why people do it) but if the USB bus voltage is out of spec, i.e 4.2v instead of 5V it can cause problems. For example if you are reading an analogue input from a source that has a separate supply your ADC results will be off as the maximum ADC value is now relative to 4.2V not 5V, and any conversion calculations using the ADC value would be based upon it being relative to 5V hence the resulting error. 

I have run into that problem before, although it depends on the end application as to whether to not USB bus undervoltage is likely to be an issue .

 

Also, be aware their IDE can, under certain circumstances, actively prevent you from using the full functionality of some of the Microcontrollers peripherals which is a big no-no for me. They should not be restricting use of the Microcontroller device like that (particularly when undocumented) as it leads to days of frustration trying to figure out why perfectly good code is not producing the expected result.

Link to comment
Share on other sites

6 hours ago, Stephen Moss said:

Also, be aware their IDE can, under certain circumstances, actively prevent you from using the full functionality of some of the Microcontrollers peripherals

Same for ready made libraries which should be used with caution. As you mentioned, your code can be fine but the project might fail because the library lacks the implementatin of some aspect (e.g. clock stretching om I2C). 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...