Software Support > Automated Projects

Rotating Monitor with Hyperspin (servo based) Tutorial

(1/4) > >>

Servo based Monitor rotation with Hyperspin (or any front end) Tutorial.

In my search for a rotating monitor tutorial with Hyperspin I found it difficult to locate anything that outlined the process.  But by piecing together information from posts on here I did manage it, but I thought it would be helpful to outline what I did for anyone trying to do the same thing.

This tutorial is for a Servo based rotating monitor, I have put in the information needed to make it work with Hyperspin, but if you are using another fronted like Mala there are other posts on here that will help you get the scripting portion completed (see DaOldMan's work). EDIT: Actually since you are using Rocketlauncher to make this work, you should be able to use any front end.

List of parts:

180degree Channel Gearbox Servo:
I ordered the D645MW with the 5:1 leverage ratio, which depending on if you have them put it together runs $100-$130.

4 north and 2 south Neodymium magnets:
$6 total

A 1” “pillow block” bearing(may not be necessary, see below):

1 Hub shaft spacer 3/4” length:

A 1.5” Aluminum Channel:

1 Pololu Micro Maestro Servo controller:

1 battery lead (12”):

1 22awg wire 2 conductor twisted 10’ length (don’t have to buy from here any wire will do)

1 Monitor stand (not necessary, see below)

1 VESA mounting plate:

1 Monitor Arm extension bracket (not necessary, see below)

1 DC-DC converter 12V down to 7.5V(may not be necessary):

Wheel weights (there are cheaper alternatives):

1 Arcade power supply for 12V and 5V DC:

Lots of 6-32 screws of various lengths, with 6-32 nuts and #6 washers.

Depending on if you already have a power supply and how much work and how you design your rig, the cost can be as low as
$174 and as high as $316.

So here’s what I did after much trial and error and discovery:

There are few steps that I think are important no matter how you design your setup.

What size Monitor and aspect ratio are you going to use?
What are you going to use to drive it?
How will you attach the monitor to the motor?
How will you attach the motor to a sturdy structure?
How will you balance the monitor?(very important step, see more below)
What power supply and controller will you use?

I originally bought a Hi-Tec 755MG servo, it was listed as one of the strongest “large” servos. It ending up not being strong enough for my need at 200oz/inch (when using 6volts). I was turning a 30” 16:10 Monitor that weighs 17lbs, and was most definitely not balanced (see pics).

After much trial and error and searching I realized the root of my problems was that the Servo just wasn’t strong enough to smoothly power the system (read torque). I could get it to turn with the 755MG, however it was wobbly when turning slow, smooth when turning fast, but then because of the momentum of the monitor not strong enough to keep the monitor from over rotating when trying to hit a certain rotation positions (see videos below):

So what worked for me was doing the following:

The first thing you need to do is get your monitor balanced, this is a crucial step and can’t be emphasized enough.

I am working with the following structural components:

Monitor stand:

Monitor Arm Extension bracket:

Vesa Mounting plate:

Take your VESA Monitor plate (as seen above) and locate the center and drill a hole for center reference (it's very important that you get this as close to center as possible).

Line up the HUB shaft spacer and use double sided tape or some other method to attach the spacer around the center monitor. Use the holes (non threaded) as guides to drill the 4 holes you will need for mounting. I used 9/16 drill bit (EDIT: 9/64", WOW, sorry about that).  (I actually used a different hub shaft that had come with my previous purchase:

Should look something like this when done (you only need 4 holes):

Next drill a 1” hole (I used a 1" hole saw and lots of metal cutting lubricant, OK it was WD40 ;D) in your Monitor stand extension plate (you can easily just buy a piece of 16 gauge metal with the same dimensions and save some money, but you’ll have to drill more holes). AGAIN it is VERY important to get this as close to center as possible.  The hole should leave enough room that your Servo will have space above to mount. If you are following my exact setup then you will want to attach the monitor stand to the extension plate and leave enough room that the large silver gear in the Servo won’t hit the Monitor stand attachment.

Now that you have your 1” hole, drill 4 holes in the corners of your 1” “pillow block” bearing.


1.) Don't make the mistake that I did (nothing covering the bearing). Put tape over your bearing to prevent small bits of metal from getting in.
2.) Drill as close the corner as you can because you need to make sure the head of the screw will have space to fit.

Should look something like this:

Once that's done, line up your bearing with the hole and double side tape once it’s lined up and drill 4 holes into the monitor extension plate using the holes as guides (9/16 drill bit)(EDIT: 9/64", WOW, sorry about that). (ignore the 4 nuts and screws, we will get to that later)

Use screws and washers to attach the bearing:

Now you need to get the 1.5" Aluminum Channel mounted properly so that the servo can properly align with your bearing.  Screw the 180degree Servo into the Aluminum Channel as so (note that there are two screw holes and you will want to use the ones that put the servo furthest away from the channel face):

Grab your 3/4" hub shaft:

and align it with the Large Silver gear on the servo (but don't screw in yet as the screw heads will prevent you from feeding into the bearing)
Now place your servo with hub shaft and align so that you can now screw the hub shaft into the servo with the bearing being your guide:

(Again ignore the 4 screws and nuts, we will get to that later)

Now your servo should spin freely on around the bearing and it should be screwed to the 1.5" aluminum channel.  Here is where you will want to drill holes for the 1.5" aluminum channel into the monitor arm extension bracket.  Make sure that you have a good alignment so that the spacing of the aluminum channels even on both sides:

(Ignore lower half for now)

Now once you have the position you like tape down the aluminum channel as accurately as you can and unscrew the servo carefully so that you don't move the positioning of your aluminum channel.

(again ignore other holes and magnets as these were from the experimental first plate)

Drill holes in the outer most 4 corners.  Once done use your 6-32 screw and nuts to bolt down the 1.5" aluminum channel:

Now screw in your servo and put hub shaft through the bearing and screw down.  Congrats you've done all the drilling and hard work needed to get this:

(We'll get to those magnets in a bit)

Now that you have all of the drilling done the net part is crucial, BALANCING THE MONITOR:

Attach the monitor to the VESA mounting plate and the hub shaft:

The point here is to remove the Servo and simply have the monitor attached to the hub so that it can spin freely, this is an example of what it should NOT look like:

instead it should balance very easily like this:

Once you've got this step finished, you are 90% done with this project.  The physical components of this have been all but figured out.

This is where you will determine where to put and how many of the wheel weights as you want to balance the monitor so that it will come to a natural stop.  If you SKIP this step the servo will have to work hard to hit the targets and you will most likely get a bouncing monitor like I showed above.

Balancing the monitor in my opinion is probably the most important step as it will prevent a lot of problems down the road.

You will want to place the wheel weights so that they balance the monitor.  It can be somewhat intuitive as in my case where the monitor is clearly overweighted in one direction.  It may not be so obvious in your case but regardless it is likely to be overweighted as an example:

Note how the monitor naturally leans to the left, but with the wheel weights attached to the upper right hand corner it is balanced.

If you've got the above working well you are ready to put it all together.  Place the magnets in the 75mm (see the diagram of the VESA plate for details) slots.  Put the 4 screws (I believe they are 1") through the VESA mounting plate and the hub shaft like so:

then attach to the SERVO to get this:

Attach the magnets to the 75mm mounting holes on the bottom. Put the order of the magnets as 2 north (flipped) and one south (or visa versa), otherwise it may be too strong. Carefully screw the magnets in as you can over tighten and break the magnets.
It should now look like this:

Attach the VESA plate to the Hub shaft:

Here's a view of the Servo in action (towards the end):

Download and install the Servo control center from Pololu.

The motor that we have selected runs at 7.4 volts, so you will want to use the DC-DC converter to bring the voltage down from 12V to 7.5V.

This connects to the 12V power supply and then to the motor.

Connect your power supply to Micro Maestro on the pins that say "bat" on the back:

Now connect the USB from Micro Maestro to the computer

You will want to learn how the Control Center works (I'd follow their tutorial's).

The bottom line is you will set target positions (this is a fancy way of saying what degree do you want the motor to turn).

With the Control Center you will want to define the the minimum and maximum position (in micro seconds, look on the ServoCity Website for this info).  This tells the computer what the maximum rotation is allowed for the servo.

Form there you will want to play around with the position targets to find the vertical and horizontal position that work for you (NOTE, VERY IMPORTANT.  The direction you turn can really affect the outcome, try to see if one direction works EASIER than the other to spin).  This may sound funny as the monitor is balanced, but it can make a big difference on how much wobble you get when it reaches the position.

Once you have your target positions for vertical and horizontal you will want to under the "Sequence tab" hit the "copy all sequence to to script".  Then on the Script tab you will see:

Take note of the positions (i have one highlighted in the picture, in my case it was 5699 and 9245).  You will want to write those down as we will add this to our script later on.

Now to the software part (we are getting close to done, I promise).  You will want to edit your Mame.ahk file in Rocket launcher (If you haven't got Rocket launcher installed you will want to read up on how it works).  The Mame.ahk file is located either through the GUI or through file explorer:

Open with your preferred editor HOWEVER I would highly recommend saving a back up first (you can see I did in mine called MAME Original).  Once you've opened up the editor you will want to add this line that I have highlighted the first is near the beginning, and the second is at the very end:

The code lines if you'd like to copy paste are:

--- Code: ---Runwait, %emupath%\Rotation.exe "%romName%"
process, waitclose, %executable%
Runwait, %emupath%\Rotation.exe "reset"

--- End code ---
Now you need to edit the attached file in this post called "Rotation2.txt".  You need to rename this to Rotation.ahk (website won't allow you to upload a file ending in AHK).  Also take the file named Rotation.txt and rename it to Rotation.ini.

The following is a copy from DNA Dan's post (the guy who got this all working). I have modified the code to fit a servo motor:

Next you need to add two files (Rotation.ini, and Rotation.ahk) to you MAME root folder. The first one is a list of vertical games. The other is the Rotation.ahk which contains the code to send commands to USCCMD (Servo) depending upon the list.

Open the Rotation.ini text file. Any game you want on a vertical rotation needs to go in the line "Set2_vertical=" single line followed by a comma. If someone knows how to do this easily, please let me know. I don't want to type that all out! This file goes in your MAME root folder.

--- Code: ---:
Set2_vertical=005,progolf,1941j,1941,1942,1942b (etc. Add all vertical ROM games here followed by a comma.)

--- End code ---

Finally you need to add the Rotation.ahk to your MAME root folder. This one needs some editing. The line that reads "iniwrite, vertical, C:\arcade\mame\Rotation.ini, controls, PrevState" - you need to change the directory to your setup. This needs to point to Rotation.ini. Same thing for the line that reads "iniwrite, horizontal, C:\arcade\mame\Rotation.ini, controls, PrevState " If you read the code, you'll notice I am using --speed 25. You might want to start this off slower to make sure it works on your setup before rotating at this speed. Once you are done editing, you need to compile this to an .exe in the same location.

--- Code: ---;[Rotation.exe]
#SingleInstance force

romName = %1%
If ((romName = "ace") | (romName = "maze") | (romName = "bang") | (romName = "batman") | (romName = "blasto") | (romName = "bullfgt") | (romName = "cannball") | (romName = "circus") | (romName = "combat") | (romName = "cotton") | (romName = "smash") | (romName = "dday") | (romName = "zero") | (romName = "edf") | (romName = "esb") | (romName = "flyball") | (romName = "gaia") | (romName = "galaxi") | (romName = "gng") | (romName = "grdnstrm") | (romName = "headon") | (romName = "car2") | (romName = "hustle") | (romName = "island") | (romName = "island2") | (romName = "joust") | (romName = "eto") | (romName = "le2") | (romName = "msh") | (romName = "mk") | (romName = "mk2") | (romName = "news") | (romName = "orbit") | (romName = "pass") | (romName = "pgm") | (romName = "phrcraze") | (romName = "popeye") | (romName = "kok") | (romName = "spy") | (romName = "safari") | (romName = "sonic") | (romName = "skyraid") | (romName = "sss") | (romName = "sf") | (romName = "roul") | (romName = "jleague") | (romName = "atetris") | (romName = "tetris") | (romName = "tictac") | (romName = "toki") | (romName = "tm") | (romName = "statriv2") | (romName = "vf") | (romName = "vr") | (romName = "topgun") | (romName = "ws"))
goto horizontalrotation
param := "%romName%"
;reads verticalRoms controlled roms list
IniRead, verticalRoms, %A_ScriptDir%\Rotation.ini, controls, Set2_vertical
;reads state of vertical, horizontal rotation (user added line in "controls.ini")
iniread, state, %a_scriptdir%\Rotation.ini, Controls, PrevState
ifnotinstring, verticalRoms, %romname%, gosub, horizontalrotation

if ( State = "vertical")
else if ( State = "horizontal")
RunWait, %COMSPEC% /c "usccmd --speed 0`,25", ,{enter},hide  (CHANGE your desired speed from 25 to the one you like)
Run, %COMSPEC% /c "usccmd --servo 0`,9378", ,{enter},hide  (CHANGE the position from 9378 to your position)
iniwrite, vertical, C:\Hyperspin\Emulators\Mame\Rotation.ini, controls, PrevState  (CHANGE THIS)

if ( State = "horizontal" )
else if ( State = "vertical")
RunWait, %COMSPEC% /c "usccmd --speed 0`,25", ,{enter},hide (CHANGE your desired speed from 25 to the one you like)
Run, %COMSPEC% /c "usccmd --servo 0`,5815", ,{enter},hide  (CHANGE the position from 5815 to your position)
iniwrite, horizontal, C:\Hyperspin\Emulators\Mame\Rotation.ini, controls, PrevState  (CHANGE THIS TO YOUR LOCATION)

--- End code ---

You will want to edit the location of where the two files will be (You should put them in your MAME root folder).  You will also want to change the position (see above).  You also may want to change the speed and where it says: servo 0' you will want make sure this is the slot on the Micro Maestro that you have plugged your servo into (in the pictures above mine is actually plugged into the 1 slot, so my code on mine actually says: servo 1').

Now that you have made those edits put the files into the folder location that you specified above.  Right click on Rotation.ahk and compile it so that it becomes Roation.exe.

Run Hyperspin and launch a vertical game and your monitor should rotate, and then rotate back to horizontal when you exit.

Here’s mine running:


DaOld Man:
Good work, and a good writeup. Thanks!!

Whoo finally a complete overview of how to rotate a monitor,
Complete with instructions, I've been looking for this for a long time,
Built a Small Fully Working Arcade machine a few years ago.
But unfortunately the rotation still goes with a switch on the back.
Now look if I can use something from this method and whether it works with my

Great tutorial  :applaud: :applaud: :applaud: :applaud:


--- Quote from: gumpie on October 20, 2018, 11:04:51 am ---Great tutorial  :applaud: :applaud: :applaud: :applaud:

--- End quote ---

Let me know if you need help :cheers:


--- Quote from: Arroyo on October 20, 2018, 04:33:26 pm ---
--- Quote from: gumpie on October 20, 2018, 11:04:51 am ---Great tutorial  :applaud: :applaud: :applaud: :applaud:

--- End quote ---

Let me know if you need help :cheers:

--- End quote ---

I will when needed, first need to buy this pcb for the servo, when a deside to, is that it and possable? :applaud:.
i'l show you my schematic verry oldscool.


[0] Message Index

[#] Next page

Go to full version