I'm trying to calculate the resolution needed for a trackball in Mame.
That can be a difficult thing to wrap your head around and work through.
The wiki entry is not as clear as it could be regarding trackballs, but near the top there are links to three related threads that provide more info.
http://wiki.arcadecontrols.com/index.php/Spinner_Turn_CountMy spinners are 1200ppr which I'm sure I read somewhere was correct, or close enough.
That is the resolution of the TT2 and SpinTrak spinners.
- Unless you're using those spinners to generate your trackball X- and Y-axis quadrature waveforms that fact isn't relevant to what you are trying to do.
The trackball however has a 2 1/4" diameter pool ball, turning against a 5mm shaft, so there's a big ratio.
Yeah, that's almost double the ratio of the standard Happ 2-1/4 trackball with a 0.362 inch (9.1948 mm) roller and a 24 tooth encoder wheel.
One thing to watch out for is if that ratio gets too high, the encoder wheel might turn so fast that you get backspin.
- See post
here for more detailed info about backspin.
Some basic maths will tell me the ratio, and I'm assuming 1200 is the target.
Don't assume that 1200 is the target.
AFAIK that's the resolution chosen for the TT2 and SpinTrak spinners so they would be be a suitable replacement for all spinners including the geared ones for Arkanoid.
Most spinners and trackballs are much lower resolution.
Am I correct in thinking that as it will be quadrature each hole in the wheel will actually be 2 pulses?
Assuming you have a properly paired encoder wheel and opto spacing, quadrature waveforms have 4 phases per tooth/gap.
- The good spacing image shows the encoder wheel at the left edge of Phase 1.
- Data line A is transitioning from high (not blocked) to low (blocked) and data line B is in the middle of being blocked.
- As you rotate the encoder wheel clockwise, the blocking and un-blocking of the optos will produce the quadrature waveforms shown.
This is all being 3D printed so I can trial and error but I'd like to be fairly close to start with.
Get the encoder wheel and opto spacing right
then you can adjust the sensitivity in MAME.
- I'm guessing you plan to use Happ Red Boards instead of trying to design your own optical circuit, right?
To work out the correct opto spacing and encoder wheel measurements:
- Calculate the number of degrees for each tooth/gap on your encoder wheel. For example, a 24 tooth encoder wheel ==> one 360 degree rotation of the wheel is divided into 24 teeth + 24 gaps ==> each tooth and each gap is 7.5 degrees wide. (360/48 = 7.5)
- How many teeth gap between optos? The image above shows a 2.5 tooth gap. (2.5 * 7.5 = 18.75 degree gap angle)
-- More info about this gap value
here.
- Use the known distance between the optos and the gap angle to calculate the radius from the center of the shaft to the opto position.
-- Split the triangle defined by the two optos and center of the shaft into two right triangles.
-- You know the gap angle and the distance between optos so divide those values by two and apply them to the angle (θ) and "opposite" of one of the right triangles then use the sine
trigonometic function to solve for the hypotenuse which is the radius from the center of the shaft to the opto position.
Scott