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: Beginner's Guide (Inputs)  (Read 16074 times)

0 Members and 1 Guest are viewing this topic.

JoeyJoeJo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 51
  • Last login:February 27, 2013, 09:34:56 pm
  • I want to build my own arcade controls!
    • PS4 Hacks
Beginner's Guide (Inputs)
« on: March 06, 2011, 10:45:40 pm »
Is there an "MRotate for dummies" guide? I saw the video of the guy who selected his game and had his monitor automatically turn, now I know that I need one. The only thing is, I don't know squat about motors and whatnot. I've got a 23" 720p lcd tv that I want to use, but I don't know what motor to get or how to wire the motor to the computer. Can someone help out a newbie?
« Last Edit: May 28, 2011, 08:56:22 pm by DaOld Man »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #1 on: March 07, 2011, 07:00:24 am »
There are several posts on here showing how people rotate their rigs.
Since this is a LCD, the very first thing you need to do is test the monitor to see if it will display correctly.
Some monitors (not sure about LCD tv's), have limited angles of view from top of screen down.
The best thing to do is prop the monitor up on it's side and play a vertical game such as galaga or donkey kong, in it's native vertical mode.
While the game is playing, move to the left and right of the screen to see if the picture changes or blurs.
If this is going to be a two player cabinet, take into account the position of the players.

If this passes the test, the second thing you need to do is make sure you have enough room in your cabinet, if you already have a cabinet.
If you havent built your cab yet, you will need to size it for the monitor.
When the monitor turns, it requires more space than when it is stationary.
You have to measure the monitor diagonally from corner to corner (not the screen but the actual size of the case).
This is how wide the inside of the cabinet has to be, and also how much room from top to bottom you need. (Plus an inch or two may be necessary).
Also, take into account that the monitor's pivot point is the center of the SCREEN, and not necessarily the center of the case.
Some cases have an extension for buttons or what-not below the screen.
If you are not going to remove the screen from the case, then you may have to add even more to the measurement to account for the case being off center, due to the extension.

After these two initial steps, you will need to think about the hardware needed to actually hold the monitor while it is turning.


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #2 on: March 08, 2011, 07:03:21 pm »
Most people attach the monitor to a disc, usually cut from wood (MDF or ply), simply because it is easier to cut and cheaper than metal.
On an LCD monitor, the disc can attach to the monitor using the vesa mount on the monitor, remember, you have to insure that the vesa holes are in the center of the screen, if not, the holes will have to be shifted to allow the center of the screen to be in the center of the disc.

The disc is usually supported by bearings or rollers. It's only necessary to have the bearings in the lower left and right "corners" of the disc, however I feel that two in the top "corners" add to the stability of the monitor, especially if the cabinet is to be moved.

The disc must be supported front to back also, to keep the monitor from tipping forward or backward.
Again, bearings or rollers are what most people use.
A metal shaft, in the center of the disc, ran through bearings supported by a block of wood could also be used.

A CRT monitor usually needs two discs, one for the front, with a cutout for the screen, and one in the back, making a "spool" with the monitor sandwiched between the two discs.
These two discs must be attached by wood struts or metal bars, to make sure both discs turn together.
You will need double the bearings for this, because the back disc will rotate also.

You also need to think about how you will attach the monitor bezel, to cover the ugly parts.
I used blocks of wood fastened to the disc, above top and below bottom of the monitor. The blocks extend out to be flush with the edge of the monitor.
I then cut a circle out of poster board, with the. center cut to fit the viewable part of the monitor screen.
This poster cut out attaches to the previous described blocks. This poster board turns with the monitor.
You can then cover all this with another poster, cut to fit the inside of the cabinet, side to side and top to bottom, with a circle cut to expose the screen so that all the screen is exposed when in vertical or horizontal position.
Some people have chosen just to use a smoked glass, but either way, the final cover is the glass (or plexi glass).

I know this is very sketchy, but without knowing exactly what you have, it's hard to say what you need to do, but maybe it will give you an idea how to start.

Next up, choosing a motor and attaching it to turn the disc.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #3 on: March 08, 2011, 07:40:58 pm »
The motor has to be chosen carefully.
You need one that has enough torque (or turning power), to turn your monitor.
Of course the heavier the monitor, the more power you will need to turn it. A CRT is usually much heavier than an LCD of the same screen size, just to note.

You can take a motor that turns fast and gear it down to decrease the speed but increase the torque. This is usually done by a gearbox "transmission" or belt and pulleys.
With either pulley or gears, the small gear or pulley attaches to the motor and the larger one attaches to the monitor disc.
If the gear on the disc is twice the size of the gear on the motor, the disc will turn half the speed of the motor, yet torque will be close to double.

If you attach two gears the same size, one on the motor and the other to a bearing that the disc rides on, then the diameter of the disc, compared to the diameter of the bearing, will determine speed.

You probably understand why torque is important, because you got to have enough power to turn the monitor in both directions without straining the motor or damaging it.
But why is speed so important?

Well, you really dont want a monitor to take forever to turn from horizontal to vertical. After the new has worn off, waiting for the monitor to complete a very long turn can seem like waiting for Windows to boot up.
However, you dont want the monitor to turn real fast either. You have to think about the centrifugal forces exerted on the monitor while it is turning. you dont want to damage anything inside the monitor that might work loose from repeated turns. Also higher speed is harder to stop, so you also can damage the monitor by "slamming" it against physical (or mechanical) stops. Think of it as traveling in a car and hitting a tree. The car stops but you dont.
This is probably an extreme way of thinking, but it's worth a little planning time.
In short, I would say 5-15 seconds of travel time is probably what you need to shoot for, however longer travel times certainly wont hurt anything. And remember, out of the 360 degrees of the disc, you are only turning 90.
(Except in some rare cases (of maybe a cocktail cabinet) needing 180 degrees of travel).

Lets stop here and come back to the motor later.



DNA Dan

  • Guys.. we're not talking gold bars here
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 505
  • Last login:September 02, 2017, 11:39:00 am
Re: Beginner's Guide?
« Reply #4 on: March 09, 2011, 12:34:35 am »
You've inspired me to do this on my cab. I am just starting a build around an HP LP2065. I have some good ideas already but I wanted to get some of the basics on how this is supposed to function. Do you have the software plugin on the front end so when you choose a game and it automatically rotates? What is all the USB and printer port connections for?

I could easily see the design of the circuit just being a powered motor connected to a relay switch. You hold the switch to power the motor in one direction. You hit another switch and it reverses the motor's polarity for rotation in the other direction. What are all the other connections I hear you talking about with the PC? Perhaps I am missing the point of the interface.  ???

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #5 on: March 09, 2011, 05:31:40 am »
Basically what you need:
Motor to turn your monitor rig (I call the disc, bearings, whatever that is used to allow the monitor to turn, "the rig")
A drive that switches the high current of the motor and basically controls it.
A drive can be a simple DPDT switch, or an electronic circuit containing transistor switches.
As far as automatically rotating, an electronic drive is necessary.
A printer port on the computer, or an add-on PCI printer port card. (USB to printer port adapter will not work, however I am working on a USB version of MRotate.)
A program to control the drive such as MRotate.

MRotate offers several outputs and inputs as options that you probably wont need.

Things you will need:
2 outputs to instruct the drive to go forward (or CW) or reverse (or CCW)
2 inputs that attach to limit switches, which when the switch is made, tells the computer that the monitor is fully CW or fully CCW.

The other outputs are:
Drive enable: May be necessary. depends on what type of drive you use.
Degauss: you wont need this for your LCD monitor. (requires a relay)
Turn monitor off while rotating: This is truly a preference. (requires a relay and extra hard wiring).
Parking brake: This is something I have not seen done yet, but you could rig up a solenoid activated locking pin to lock the monitor still while it is not turning. (requires additional circuitry). Also some motors have friction type brakes installed on them. (MRotate3 is the first version to have this option.)

Mrotate is a command line program. This means to rotate the monitor, a command must be given to MRotate from the front end or another program. Example form Windows DOS (or CMD) box would be "C:\Mrotate\Mrotate3 0" to command the monitor to turn to horizontal position. When the horizontal position is reached, mrotate senses the switch being made and it turns off the motor and ends (if no other options such as degauss are selected).

Mala is a super cool frontend and it has a plugin available that was crafted for MRotate.
Mala knows the intended monitor position of each game in it's list, and the Mala plugin (startcom) sends a command to MRotate based on that position.
Mrotate is waiting for other frontend programmers to install this option. (hint hint)

I suggest you read the mrotate3 readme.txt file that is posted on here. It is much more detailed about what you can do with MRotate3.

And BTW, good luck with your project. I am always excited to see how others do the rotating monitor trick.
It is a lot of work, but well worth it, IMHO.

Feel free to download MRotate3 and play around with it. A program called pportreader is included, which will allow you to watch the activity on your printer port. (Just cant activate any inputs with it).






DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #6 on: March 09, 2011, 06:32:19 pm »
What motor to use?

Well, motors come in a variety of flavors. I wont get into the guts of motors, you can find out plenty of info on the web.

There are D.C. (Direct Current) motors. These work on direct current (like your car battery's current).
They usually have very high torque even at low speeds.
These motors are fairly easy to control. All DC motors have a field, which is either an electric magnet or a permanent magnet. The armature rotates in the field's magnetic field.
Simplest DC motors have permanent magnet fields and have only two wires to attach the power to.
To reverse rotation of the armature, just reverse the polarity on the two wires.
Speed can also be controlled by varying the voltage to the motor. You can also pulse the current to it.

A.C. (Alternating Current) motors are little more complex to use for what we want. They require alternating current (like the kind that comes out of the socket in your wall). Most AC motors have a Field winding (called the Stator) that creates a rotating magnet field. The part that transfers rotation out into the shaft is called the Rotor, and it has bars in it that are excited by the rotating field, inducing a current in them, which basically become electro-magnets. The rotor is pushed (or pulled) by the two magnetic fields, the rotors magnets try to match the rotating one of the stator.
Most AC motors are difficult to change rotation, unless they were designed to.
AC motors have good torque at high speeds.
AC motors do not have easy speed control. The speed can be controlled by drives that vary the voltage and frequency to the motor. Some AC motors have multiple windings, that when energized, changes the motor's speed in steps (such as a ceiling fan).

Stepper Motors. Steppers run by coils being energized in steps. The magnet (most commonly a permanent magnet) is mounted to the shaft. The magnet tries to align itself with the energized coils. As the coils are stepped, the shaft also turns in steps.
These motors can go X amount of steps and stop precisely on a degree of rotation.
The big disadvantage to steppers is that they require a controller that can control the coils to get proper rotation.
I was working on one of these to use with a rotating monitor. I even created a version of Mrotate (called MRotateStep) that controlled the motor through the printer port.
I could not find a strong enough motor (without spending my pension) that would rotate the monitor completely without losing steps in the process. Unless you have some sort of encoder feedback, if the motor misses a step it can get way out in the weeds. These motors are very common on CNCs.

Servo motors. Servos move to a precise spot based on a frequency from a controller. These motors are very common among hobbyists for car steering and model airplanes. I doubt you could get one strong enough to turn the monitor, unless you want to pay dearly for it.
We use servos at work that turn grinding rolls that weigh 60,000 lbs, but these are very expensive, and have very expensive drives and run on 480 VAC 3 phase current.

So out of these motors, the winner is: DC motor.
And a very popular motor on here is a windshield wiper motor from an automobile.
These motors are fairly cheap and easy to find on ebay. They run on 12 volts dc, which is a common voltage. (Your computer has it already, but be careful not to overload that source.)
These windshield wiper motors also have a gearbox built on, which reduce the speed and increases the torque.

I have attached two pictures. First is a dc motor very similar to a windshield wiper motor. This motor is actually a motor that was used on an 88 firebird to raise and lower the headlights. This is the motor I used to rotate my first project.

Second pic is a couple of stepper motors. I used the one on the left, which had a gearbox and a brake attached to the motor. This is what gave me the idea to add parking brake control to MRotate3.
The smaller stepper was no where near strong enough to do what I wanted, rotate a 19" LCD.
The bigger one worked, but as I said earlier, it would loose steps during rotation, which is not a good thing.




« Last Edit: March 10, 2011, 04:57:00 am by DaOld Man »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #7 on: March 10, 2011, 05:38:51 am »
To help explain the next section I have attached the following line diagram. Please forgive the fast drawn cheesy diagram, hopefully it will lay out the basic steps in getting your monitor to rotate automatically.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #8 on: March 10, 2011, 04:38:26 pm »
Ok, after you have selected your motor, and how you are going to physically build your rig, you need to choose a drive.
I am only going to demonstrate DC motor drives, for they are no doubt the simplest motors to control.
First pic below shows how to reverse the motor rotation by reversing the power supply's polarity.
Second picture shows how a drive reverses the current flow to the motor, to control rotation.
Third picture shows a DPDT switch. This shows how the switches terminals connect to each other based on switch handle position.
fourth picture shows how you can wire the DPDT switch to control a motor's rotation.

This is probably the simplest and cheapest drive you can build.
This should show you basically how a drive works.
The major disadvantages to this drive are:
Fully manual control. Automatic control is not possible.
You must turn the switch off when the monitor has reached its full horizontal or vertical positions.

Next up I will show how to add limit switches to this drive so it will stop automatically. (So this drive can be automated just a bit.)

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #9 on: March 10, 2011, 08:03:25 pm »
Ok, when you flip the above DPDT switch drive, you want the motor to stop when it has reached its full horizontal or vertical end of travel.
This can be done by installing limit switches that activate by a flag mounted to the monitor disc.
(See previously posted diagram).
The only problem is that when the drive tells the motor to turn back the other direction, it may not be able to do so because the current is broken by the previously activated limit switch.
A fix for this is to install diodes around the switches that will allow the current to flow around the switch, when current is going in opposite direction.
See drawing below.
Drawbacks of doing your rig this way:
DPDT switch must be rated for at least the maximum amount of current your motor can draw, as well as the limit switches and the diodes.
Also, speed control is nearly impossible in this setup, motor will run wide open from start until the limit is made.
And dynamic braking (more on this later) is nearly impossible with this setup.
This may not be a problem if your monitor rig turns slow already.


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #10 on: March 10, 2011, 08:21:18 pm »
You can control speed on this setup, however it is limited.
You can use a variable resistor called a rheostat to vary the voltage on the motor.
You must turn the knob of the rheostat to change it's resistance.
This cuts back the voltage on the motor by adding more resistance in the circuit.
With lower voltage, the motor will turn slower.
At one time, many large DC motors were controlled in this same fashion (yeah I remember them).
But this method has some very serious drawbacks.
The rheostat absorbs a lot of energy, which means it produces a lot of heat.
Because of this, the rheostat has to be large, and is usually open to allow cooling.
The size (or wattage) of the rheostat is based on the maximum amount of current the motor can draw.
A DC motor draws the most current when it is stalled, or the shaft held so it cant turn.
A DC motor also draws a large amount of current on startup, but it is usually only a few milliseconds unless something is jammed and the motor cant turn. If the motor hangs on something, the rheostat could possibly get extremely hot.

Another possible alternative for speed control would be to use a variable voltage power supply for the motor's power.
« Last Edit: March 10, 2011, 08:25:41 pm by DaOld Man »

DNA Dan

  • Guys.. we're not talking gold bars here
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 505
  • Last login:September 02, 2017, 11:39:00 am
Re: Beginner's Guide?
« Reply #11 on: March 10, 2011, 11:58:42 pm »
Hmmm. Certainly not as simple as I thought, but I completely understand what you've laid out. So far my setup will need a GM2 motor with bracket and wheel, secret motor driver, two limit switches, a DPDT switch, some diodes and either a rheostat or a PWM controller. A few questions however:

1) What sort of limit switches should I use? Leafs? Also once they are tripped, the rotation needs to be stopped in this position correct? Otherwise I see the switch being tripped, than the switch pushing back an closing the circuit again. What do people use for this? A weak magnet? A bump in the travel? Whatever it is the amount of power in the rotation needs to be able to overcome this in the opposite direction.

2) What about the diodes? Where are they connected on the switch? Just between the red and black? Also which ones should I get for the setup with the GM2 motor?

3) For the rheostat or the PWM controller, this needs to go between the secret motor driver and the motor leads correct? What about a voltage down regulator? I assume that secret motor drive needs 5v, so can't I just bump the voltage through a second regulator at say 3v and slow the speed?

Sorry for all the questions. Your help has clarified a lot already.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #12 on: March 11, 2011, 07:58:37 pm »
OK, instead of relays, lets study a very common and cheap integrated circuit called a "Quad And Gate"
A Quad And Gate has 4 And Gates in one package.

Each AND gate has two inputs and one output.

For the output to be high (or + 5vdc), both inputs must be high. (Input 1 AND input 2 = output).
If either input is low (ground) then the output is low.

On the drawing below, the H push button is connected to the input of one gate (pin #2 on the chip).

The Normally Closed limit switch is connected to the other input (pin #1). Both button and switch connect back to +5vdc power supply.

Now notice the output of the same gate (pin #3) is connected to D1 of the drive and also to input pin #2 , through resistor R3.

Also there is a resistor connected between ground and pin #1 (the limit switch input).

Now here's what happens:
With both limit switch and H PB open both inputs are low. How? Well pin1 is low because the resistor R1 is pulling it to ground.
Pin 2 is low because the output pin 3 is low and they are connected together through resistor R3. So the secret drive receives a low on D1. Motor does not run in that direction.

If H PB is pressed and the H LS is still open, input pin 1 is still low (because of R1 to ground), pin 2 goes high, but output pin 3 remains low because pin 1 is still low.
Resistor R3 prevents a short circuit when the PB is pressed, due to output pin 3 being low and pin 2 being high.

The motor still does not run in that direction.

Now if the H LS is closed due to the monitor not being in horizontal position, pin 1 is made high through that limit switch. Pin 3 remains low due to pin 2 still being made low by pin 3 being low.

Now if H PB is pressed, input pin 2 goes high. both inputs are high so output pin 3 goes high.
Drive turns on because D1 is now high.
When H PB is released, output pin 3 feeds back through R3 to keep pin 2 high. Pin 3 stays high until H LS opens.
Then pin 1 goes low through R1 thus setting pin 3 low, thus turning off the drive. Pin 2 once again is made low by pin 3. The circuit is reset and waits for both H LS and H PB to be made high. One or the other alone does not turn on the drive.

The same is repeated on the second gate for vertical. This gate has pins 4 and 5 as inputs and pin 6 as output.

The other two gates need their inputs tied to ground, to keep them from erratically switching on and off, which could induce noise into the circuit. The outputs of these gates (pins 8 and 11) connect to nothing.

Clear as mud?





DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #13 on: March 11, 2011, 08:54:06 pm »
Just for comparison, here is a relay latching circuit which basically does the same thing.
This drawing only shows the circuit for horizontal. You would actually need two relays and repeat this circuit for vertical.
The relay has a coil and two normally open contacts. the coil has to be rated the same voltage as the power supply.
RA and RB are the contacts in this drawing.
Pressing H PB energizes the relay coil, but only if the limit switch is closed (not being made by the monitor disc).
RA latches the circuit by supplying an alternate path for the current to flow when H PB is released.
RB turns on D1 of the drive.
The relay and drive stay on until the monitor reaches end of travel, making the limit switch, which opens and turns off the relay. If monitor bounces and limit switch closes again, circuit remains off until H PB is pressed again.

This circuit has advantages over the AND gates. Most probably being simplicity. fewer parts (no resistors needed.)

But there are some distinct disadvantages:
Size. One relay may be several times larger than the quad and gate, and this circuit requires two relays.
Price. Quad And gates can be had for under a dollar. A relay may cost several dollars each.
Power consumption. The relay circuit will consume much more power than the AND gate one. (This probably wont be a concern because the relays draw no current at all when turned off.)
Noise. Click each time you press the button and when the limit makes.
Power must be constant. Cant vary the power supply to control speed. Relays dont like that. (The AND gate may not be variable either, depends on what type chip you choose.)
Life span. Relays have moving parts. They will some day wear out, but it may be years. Sockets can be used with plug in relays that make the relays very easy to swap out if one fails. (more expense though).
« Last Edit: March 11, 2011, 09:01:27 pm by DaOld Man »

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #14 on: March 11, 2011, 09:27:23 pm »
Brain teaser:
There is a possible flaw in both the above circuits.
What would happen if the Vertical push button is pressed while the monitor is turning towards horizontal? (or vice versa).

And, if something did happen, how would you fix it?

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide? (Electronic drives)
« Reply #15 on: March 24, 2011, 07:28:43 pm »
Your project is looking good. I will be following your progress.

Now, back to the beginners guide.
We have looked at using a DPDT (Double Pole Double Throw) switch as a simple reversing drive. This is about as simple as we can get. But if we want to do this thing automatically, we most certainly need an electronic drive.
Most drives that we would use do this with transistors.
You can think of a transistor as an electronic switch. (It is much more versatile than this, but for our purposes, we will think of it as a switch.)
There are basically two types of transistors that we will explore for this.
NPN and PNP. 

Each transistor has 3 poles (or connections). These are B for Base C for Collector and E for Emitter.
On an NPN transistor, when a small current flows from Emitter to Base, a larger current is allowed to flow from Emitter to Collector.
(Note, Im from old school, and I presume that current flows from negative to positive. Most newer thinking will show current flowing from positive to negative. I dont think it really matters which way you think, as long as it is consistent. So if you subscribe to the positive to negative theory, please just bear with me.)

So with the NPN, you can use a very small current to switch (or control) a much larger current.
You can imagine the transistor as a SPST (Single Pole Single Throw) switch.

The PNP is really the same, its just that the polarities are reversed. A small current flowing from base to emitter allows a large current to flow from collector to emitter.

One  thing you must keep in mind that the current flow on the base must be limited to a small current. This is usually done by a resistor. The current flow on the collector to emitter must be limited to the maximum amount of current the transistor can handle. This is usually done by the load (or in our case the motor).

Below is a diagram that shows NPN and PNP transistors. The drawing is not how the transistors really look, but rather symbols, which are usually much easier to draw than the actual device. The polarities (+ and -) are drawn to show how each transistor would normally connect to the current flow.
You probably already see how these can be used to replace real switches in our drive.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide?
« Reply #16 on: March 27, 2011, 11:13:12 am »
Ok here is the very basic theory behind an H drive.
In my demonstration Im using 4 NPN transistors.
To get the motor to turn forward, a small positive current is applied to the blue forward connector.
This turns on Q2 and Q3.
This allows high motor current to flow through Q3, through the motor from left to right, then through Q2. (The heavy blue arrows are the forward current flow.)

Now if you want to run the motor in reverse a small positive current is applied to the reverse connector.
This turns on Q1 and Q4. You can then follow the heavy red arrows to see that the motor current flows through Q4, through the motor from right to left, then through Q1. This reverses current flow through the motor thus reversing rotating direction.
This is a very basic drive and in practicality would not work in the real world, for instance what would happen if a positive current was applied to both forward and reverse at the same time?
Most H drives also use a combination of NPN and PNP transistors.

Now have you figured out yet why it is called a H drive?
Look at the just the 4 transistors and the motor in this diagram. resembles the letter H doesnt it?


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Beginner's Guide (Using PWM for speed control)
« Reply #17 on: April 02, 2011, 11:31:13 am »
How do you control the speed of the motor if it is turning too fast?
This can be done a few ways.
One way is through gearing the motor down through pulleys and belts or gears, so that the monitor disc turns slower than the motor shaft.
There are two distinct problems with this. It can be harder to build and more expensive than a rig with no gearing, and there is no variable control of the speed.
Most (but not all!) drives can control the speed of the motor by using PWM.
PWM (or Pulse Width Modulation) is the process of controlling motor speed by turning it off and on in pulses.
Think of it as a switch that you (the control) can turn off and on to turn the motor off and on.
While the switch is on, the motor is accelerating.
If you leave the switch on long enough, the motor will reach its top speed.
But when you turn the switch off, the motor decelerates, or slows down.
Turn the switch back on and the motor starts to accelerate again.
Between these on and off pulses, the average desired speed of the motor is determined.
Turn the switch on and off at different speeds and the motor speed will change accordingly.
An electronic drive does this very efficiently and can do it with much more precision and repetition than you could with a switch.

So, PWM is a repeating cycle of on and off pulses to supply an average power to the motor.
The pulses have an on time and an off time.
Varying these two time spans can allow you to arrive at a speed that is just right for your rig.

Relay drives cannot do PWM.

Yet another way to control the speed of the motor is to control the voltage to the motor. Decrease the voltage below the maximum of the motor, and the speed of the motor will decrease.
If you are using relays to control your motor, and you need speed control, then you may have to go the route of changing the voltage to the motor.

I have attached a very rudimentary diagram that basically explains PWM.

Please note that this method of speed control only works with a DC motor that has a rotating armature and brushes.

If you are using an AC motor or a stepper, then that requires a different beast of burden to control speed. (However the first above mentioned method of gears or pulleys should work with any motor).

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Beginner's Guide (Dynamic Braking)
« Reply #18 on: April 03, 2011, 04:39:38 pm »
What is dynamic braking?
It is the process of using the power generated by a motor while it is coasting to stop it quicker.
When the power is removed from a motor, it will not immediately stop. Because of inertia in the mechanics of the motor and the load it is driving, the motor will coast to a stop.
While the motor is coasting, it becomes a generator, actually "putting out" power.

This can be used to our advantage to stop the motor quicker.
If the motors leads are shorted together while it is coasting, it is putting a tremendous load on the motor, which is now a generator.
This increase in load will stop the motor quicker.
To test this, twist the shaft of your motor while the leads are not connected to anything.
Note how much strength you need to turn the shaft.
Now tie the motors leads together and try turning the shaft again.
You should notice that the shaft is much harder to turn, and the faster you turn it the harder it is to turn.
This is called dynamic braking.
It can bring the motor to a smooth and fast stop when the motor is turned off.

How do we implement dynamic braking?

If you use a simple on/off switch, you use a SPDT switch, and wire it so that when the switch is turned off it shorts the motor.
See the first attached drawing.

The second drawing shows how a diode can do dynamic braking. This illustration only works if the motor is never reversed. Why? Because when you reverse the current flow to the motor, the diode would short out the power supply.
Of course we reverse ours, so this would not work for us. However, some electronic drives use diodes to do dynamic braking in either direction, it just takes more than one.
Some drive designers refer to these diodes as "flyback diodes".
Flyback diodes also protect the transistors from back EMF in electronic drives.

Some electronic drives also switch on the both transistors in the top half or the bottom half of the H bridge.
This, along with flyback diodes, allows the current generated by the motor to flow through the transistors.
The drives usually do this by seeing both direction inputs turned on.
Some do it by seeing both directions on and enable on.
And some drives even automatically apply dynamic braking whenever neither direction input is turned on.
And still, some drives do not offer dynamic braking at all.
So, know your drive. Consult manufacturers instructions if you wish to use dynamic braking.

MRotate3 allows you to choose which method your drive uses for dynamic braking. You can also choose not to use it at all.
If your motor stops quick enough when told to do so, then dont use it.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide (Degaussing)
« Reply #19 on: April 05, 2011, 10:01:18 am »
With CRT monitors whenever the monitor turns, it will most likely need to be degaussed.
This is due to the earths magnetic field acting on the internals of the CRT tube. Search for degaussing and you will find tons of info, Im trying to keep these posts shorter so i wont get into the science of why the monitor does this.
But when a CRT needs degaussing, the colors are usually off, to the point where it is very noticeable.
Also, getting magnets too close to the screen can screw up the colors too, so be careful where you place the motor to turn it.
LCD monitors do not suffer from this, just CRTs (Cathode Ray Tubes).
But if you are using a CRT on your rig, you will need to consider how you are going to degauss it.
If your monitor has a degauss button on it, you can remove the cover and solder two wires to this pushbutton.
You can then bring these wires out of the monitor and attach them to a button that is easy to get to on the cabinet.
When the colors mess up, just press the button.
You can also buy a hand held degausser which is a coil that you run over the surface of the tube to degauss it.
But, who really wants to do that every time you rotate the monitor?

And some monitors have the degauss function hidden in an on screen menu. This really complicates things.
Now if you are electronically savvy, and can get a wiring schematic for your monitor, you can still go in and find the relay or transistor that turns on the monitor's degauss coil. Solder a couple of wires to this device and still be able to degauss it by pressing a button.
Just remember that the monitor's circuit has a delay timer that only allows the degauss to happen every so many minutes, to keep from burning up the degauss coil. You do not want to bypass this circuit.

Ok you have two wires that you can touch together to activate the degauss function, but this pushing a button every time really sucks. You want it automated!
This can be done by using a solid state relay to basically short these two wires together.
The relay's input ties back to the printer port and MRotate will activate this relay at the end of each rotation.
See the drawing below.

Sounds like a lot of trouble dont it?
Well there may be yet another way to do this.
Most CRT monitors automatically degauss on power up.
So turn your monitor off while it is rotating. When the rotation stops, monitor turns back on and degauss is activated.
MRotate can automatically turn off your monitor while it is rotating, and MRotate3 can cycle it off and on at end of rotation, in case you want to leave it on while rotating.
More on that in the next post.

Note: Some SSR's require that a current limiting resistor be connected to the input. Since the printer port is only good for around 10 ma, make sure you dont overload it. Check the power requirement on the input of the SSR. Voltage should be 5VDC, current no more than 10 ma.
Also, an opto isolator is a cheaper replacement for the SSR, and you can even use a regular relay, but you will have to use a transistor to switch it, due to the low power of the printer port output.




DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Beginner's Guide (Kill Monitor)
« Reply #20 on: April 05, 2011, 11:43:28 pm »
There is a function that Mrotate has been able to do in all versions. This function is optional so you dont have to use it, but it can be handy.
This function turns the monitor off while it is rotating.
Whats the advantage of this? Well as was discussed in the previous post, turning the monitor off while it is rotating may do away with the need to degauss the monitor, since most PC monitors (CRT) automatically degauss on power up.
MRotate turns on a printer port output which you can wire to relay. The relay turns off the power to the monitor.
When Mrotate senses that the monitor has reached it's destination, it turns off the output, which turns off the relay, which turns the power back on to the monitor. The monitor automatically degausses and you are playing without the screen being skewed or mis-colored.
To do this, you will need a relay with a normally closed contact (N.C.)
This means when the relay is turned off, the contact is closed. When the relay is turned on, the contact is open.
The relays contact must be rated for the voltage of the monitor (120 AC in US and 220 AC in the old world). And it must also be rated for the current that the monitor will draw. (A 10 amp contact should be good.)
This contact wires into one of the power wires going to the monitor.
The relay will also have a coil, that when energized (or turned on), will open the contact and turn off the monitor.
Here is where it gets a little tricky.
Since I have not been able to find a solid state relay (SSR) with a normally closed output, you will have to rely on a relay with a coil.
Now since most relays coils draw more current than the printer port can put out, you will need to buffer it with a transistor. You can also use an opto isolator or even a SSR to turn the relay on, instead of the transistor.
(see diagram below)
If you are not using the printer port, or the software you are using does not support this feature, and you are not controlling the speed of the motor, you can wire a relay in parallel with the motor.
The voltage of the relays coil must be the same as the motors voltage.
This way, when the motor is running, the monitor is off.

In earlier versions of MRotate, I called this function the "Monitor Off Relay".
But in MRotate3, I called it the "Kill Monitor" function. (Kinda like "Kill Bill", only different;)
I may have slipped up on some of the help files in MRotate3 and called it monitor off relay, but I think Kill Monitor is a better term, dont you?

If you are using an LCD monitor you may not want to use this function, but it is there if you want to use it.



DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide (Da Brake)
« Reply #21 on: April 15, 2011, 06:41:23 pm »
With MRotate3, I added another option. This option is for a brake.
Why would you want a brake?
Well, if your monitor tries to turn back to horizontal after the motor turns off, you may need some way to hold it still.
Some motors have a built on brake, which when power is supplied to a coil on the brake, two plates separate, which allows the motor to turn. When power is turned off from the coil, the brakes are returned to the touching position by a spring.
This stops the motor, or at least makes it very hard to turn.
This type of brake is called a friction brake.
And when the coil of the brake is turned off and the plates are touching, it is called "set" , and when the coil is turned on and the plates are separated by the magnetic pull of the coil, the brake is referred to as being "released".
In the first picture below I show a stepper motor that has a brake attached to the end of the motor.
The motor has a gearbox that increases the torque and decreases the speed, but when the output end of the gearbox is turned, it increases the speed of the input, or motor end of the gearbox. The torque is greatly decreased too, so the brake doesnt have a very big job of holding the motor end still.

But what if your motor doesnt have a brake attached to it?
You can still use a solenoid to apply a friction type brake to the monitor disc.
See Figure one.
This figure is pretty general, but it should give you an idea what Im talking about.

There is still at least one more option, which may be simpler.
Instead of a brake, you can use a solenoid to lock the disc in position.
Look at figure two.
The solenoid, when energizes, disengages the plunger from the notch in the disc, unlocking it and allowing it to turn.
One of the disadvantages to this type of brake (actually a lock), is that if the motor stops between 0 and 90 degrees of the disc, you wont have any braking action at all. However you can design your rig to allow the plunger to engage when the notch is aligned with the plunger. (Notice the beveled edges of both the plunger and the disc notches in figure two.)

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide (Da Brake)
« Reply #22 on: April 16, 2011, 11:55:31 pm »
Ok, I drew a quick diagram of how you would hook up the brake circuit.
Of course you will need a power supply for the brake, a transistor to switch the high current of the brake, a diode to protect the transistor from voltage spikes from the brake's coil, and a current limiting resistor to couple the transistor's base to the printer port output.
The transistor needs to be NPN, and it needs to be rated for the amount of current the brake coil will pull.
Also, the transistor you use may not match the lead orientation I show in my simple drawing. Just connect base to printer port (through the 1 K resistor), emitter to ground, and collector to the brake coil and you should be ok.

In the attached drawing, I have on top the component layout, trying to make the circuit look how it would in real life.
Below that is the schematic diagram, showing symbols instead of drawings of the actual devices.
You should now understand why I use symbols, they are much easier to draw and look a lot neater. you just need to know what each symbol represents.

About the circuit:
When the printer port output is low (ground) the transistor is turned off. No current flows between emitter and collector, so the brake coil is not energized (turned off, or set).
When the printer port output goes high (+5VDC), the transistor turns on, and current flows between emitter and collector, energizing the brake coil (turning it on, or releasing it.)
The 1 K resistor limits current flow on the printer port output and diode D1 protects the transistor from spikes when the brake coil turns off.

Next post I will duplicate this same drawing using a solenoid instead of a brake coil.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide (Da Brake)
« Reply #23 on: April 17, 2011, 11:10:36 am »
Here is a diagram showing the same hookup using a locking solenoid instead of a brake.
Notice the only difference in the schematic diagram is the symbol for a solenoid. It looks like a tilted Z, and it is the symbol for a solenoid coil.
Notice also that the diode is still needed on the solenoid coil to protect the transistor.

DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide (Da Brake)
« Reply #24 on: April 17, 2011, 11:22:51 am »
Dont want to use a transistor? You can use a SSR (Solid State Relay) to turn on the brake or solenoid.
This drawing shows only the schematic.

OK, I think I have pretty much covered the brake.
Remember, first decide if you need to use a brake or lock. If you dont need it, then dont waste a lot of time and energy (and money) on it.
But if you do need a brake or lock, then you now know that it is possible.

Lets move on to Inputs.


DaOld Man

  • Moderator
  • Trade Count: (+4)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 5139
  • Last login:December 13, 2023, 12:03:14 am
  • Wheres my coffee?
    • Skenny's Outpost
Re: Beginner's Guide (Inputs)
« Reply #25 on: May 28, 2011, 08:55:50 pm »
Ok, sorry about the long pause between posts.
I think we were ready to move to the inputs.
Why do we need inputs? Well, there is an option where you dont need inputs at all with MRotate.
You can use the built in timers to stop the rotation, you just have to disable the warning messages that would pop up when a maximum time limit is reached.

I dont recommend this because in the real world the time it takes to rotate your monitor can vary. Timers on the other hand are precise. So if something slows down your rotation MRotate could time out too early, resulting in a monitor that is not quite horizontal or vertical when it stops rotating, or the monitor could travel faster, causing the monitor to be past the desired position.

In my opinion, the best way is to have switches that activate when the monitor has reached its end of travel.
A switch works in the real world.
These switches tie back to your computer to signal when they are activated.
While the monitor is rotating, Mrotate is scanning the input pins on the printer port for the pin being activated. When it sees the input change states, MRotate turns off the drive outputs, thus stopping the motor.
The time limits in MRotate are designed to stop the motor after a period of time. If the switch is not activated within that time limit, then MRotate assumes something is wrong, IE the motor or the rig has locked up, or the power to the motor is bad.
So even though the time limits in MRotate can be used to stop the motor normally, the preferred method is to use switches that activate when the monitor has reached its end of travel rotation.
The time limits are really a safety function.

The switches (or limits) signal the computer by changing the state of one of the printer ports input pins.
The printer port has five pins that are easy to use as inputs.
These are pins numbered 10, 11, 12, 13, and 15.
These pins normally return a "high" to the computer when connected to nothing. But when connected to ground (pins 18 through 25 of the printer port), they return a "low".
This is true for all pins except pin 11. Pin 11 is inverted (or opposite). It normally returns a low, but when connected to +5VDC, returns a high.
Using the printer port pins as inputs for our MRotate is very simple. Connect the common on the switch to the printer ports ground and the NO or NC on the switch to one of the input pins.

Refresher:
The printer port pins that Mrotate uses are:
Pins 2 through 9: Outputs (Turns something on)
Pins 10 through 13 and 15: Inputs (Monitors something).
Pins 18 through 25 are grounds.

Now that you understand inputs, Mrotate allows you to utilize 2 as horizontal and vertical limits and 1 as a stop button.
MRotate3 has an added feature of allowing you to use an input to monitor a parking brake.

Next I will discuss more about using NO or NC on the switches.