Build Your Own Arcade Controls Forum

Software Support => Automated Projects => Topic started by: pixel.arcade on December 20, 2012, 11:21:23 am

Title: Drive L298n with mrotate.
Post by: pixel.arcade on December 20, 2012, 11:21:23 am
hello people

Finally decided to put the project into practice to rotate the screen using the arcade excellent program "Mrotate."

In the initial test'm having problems with starting the windows, because during the startup the engine gets mad, let's look at the situation in the video.

Test Rotate screen arcade (http://www.youtube.com/watch?v=NF5PKw4KkZ4#)
Title: Re: Problem at startup windows
Post by: DaOld Man on December 20, 2012, 12:57:51 pm
Ah yes, the main axe to grind with the printer port.
During bootup, windows (and the PC BIOS) does some crazy things. Outputs are turned on and off.
If you have inputs wired to your printer port, try attaching one to the printer port ground, see if it acts differently.

(NOTE: I said INPUTS which are pins 10,11,12,13, and 15, DO NOT connect any other pins other than these directly to the ground! You can fry your printerport if you connect an output directly to ground or +5vdc)

The way I got around this was to use one output that always stayed on after the bootup, to disable the drive so the motor wouldnt turn.
I found on several PCs that this magic output was pin 4.
MRotate, when it first starts up, sets all outputs low.
So the trick was to make pin 4 "kill" the drive if it was high.
I did this with a pnp transistor.
Does your drive have a enable input? If so you can do this pretty easily.
Here is a rough drawing which might explain how I did it:
In this drawing I used printer port connections that are standard, the outputs you actually used may be different.
Pin 2 and pin 3 go to the drive direction inputs.
Pin 5 goes to drive enable input.
pin 4 turns the transistor on and off.
If pin 4 is high, the pnp transistor is turned off, so the drive is disabled by the drive enable input being tied to ground through R2.
When pin 4 goes low, the transistor turns on, so if pin 5 goes high, the drive enable input is turned on through form pin 5 through Q4. If pin 5 goes low then drive enable is turned off regardless if pin 4 is high or low.
This circuit is basically a cheap inverter, inverting pin 4's output
If you dont have a drive enable, or you dont want to use it, you can double the circuit to kill the cw and ccw drive inputs much the same way.
The rule is to find which PP output stays high from power up till windows boots, and use it as the disable output.
This can be tricky, because the printer port reader does not work until after windows boots.
I would try pin 4, it has always worked for me, if you have a spare led and resistor (350-400 ohms), you can hook it to pin 4 and ground and watch it while the PC boots. I would almost bet that it stays lit until yo turn it off in printer port reader.

edit: If you dont want to hook the led to pin 4, a lot easier way to test this is to unhook one of your drive inputs and hook the other to pin 4. Boot the pc, if the motor stays on throughout the whole boot up process then this is the one you want to use to control the drive enable. I say unhook one drive input because if both drive inputs are high, the drive goes into braking mode and the motor doesnt run. That is why the motor stops when windows does it thing and turns on all the PP outputs. (I notice in the video that all the outputs are on when pport reader starts.)
Nice video, I appreciate you taking the time to do it, it helps a lot, pictures are worth a thousand words, videos are worth a million or more.
Instead of the transistor you can also use an opto isolator. All parts should be available at radio shack, let me know if you need part numbers.


Title: Re: Problem at startup windows
Post by: DaOld Man on December 20, 2012, 01:39:01 pm
Ive been thinking about this (where did I put that bottle of tylenol?)
Can you post a link to the drive you are using?
if your drive has an input called NOT ENABLE (may be labeled EN or ENABLE with a line above it), then you may be able to tie this directly to the pport pin 4. If it has  the NOT EN input, if this input is high, the drive should be disabled.
You will still have to find the magic pport output that stays high throughout the whole boot process, and since the pport outputs cant supply much current, and Im basically anal about being cautious, I would put a 400 ohm resistor between the output and the NOT EN drive input, to limit current draw on the pport pin, just in case. (This may not be necessary, perhaps specs on the drive will tell max current draw on that input).
Title: Re: Problem at startup windows
Post by: pixel.arcade on December 20, 2012, 03:52:56 pm
hello great master "DaOld Man"   :notworthy:

The configuration of the pins on Mrotate are as follows: Pin 3 = Enable
                                                                                         Pin 4 = Reverse
                                                                                         Pin 6 = Forward

I am following the design
http://imageshack.us/a/img812/5295/projeto1n.jpg (http://imageshack.us/a/img812/5295/projeto1n.jpg)

I'm using a module L298N, see details:

(http://imageshack.us/a/img339/940/ponteh.jpg)
Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: DaOld Man on December 21, 2012, 02:00:50 am
Only thing Im master of is my dog, and sometimes I wonder about that!. LOL

The number you gave (L298N) is the chip on the drive (it is really the drive, but the other parts on the board interface the real world to the drive and do some vital functions.)
Are those jumpers on the enable inputs? I was wondering how the motor would still run when you had output 3 set low in the video. Do you need to remove the jumper to use the enable?
Do you have a link to the place where you got the drive? Any documentation?
If that jumper is to be removed to use the enable, you definitely want to do that.
Im thinking with the jumper in, the enable is set high all the time by the drive's circuit. But I may be wrong.
Anyway, back to your printer port outputs: If you can use pin 4 to enable/disable the drive like I mentioned in my first post, you will need to select a different output in Mrotate for reverse.
May I suggest Pin3=Enable Pin 5= reverse Pin 6= Forward.
Without drive documentation its kinda hard to tell for sure how to wire the drive.
In your video it looks like there are 4 wires coming from printer port, one of course is ground, but the other three seem to be going to the input pins on the drive. Can you draw me a pic of which pport pin connects to which drive pin?
Im thinking the drive enable jumper needs to be removed and the enable output from pport attached in its place, but in your video it looks like the jumper is still in on the drive.
Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: pixel.arcade on December 21, 2012, 07:47:37 am
Hello ..

The module I bought is a "Generic" which utilizes the characteristics of L298N .

The documentation that was given to me would be the link.
http://www.learn-c.com/l298.pdf (http://www.learn-c.com/l298.pdf)

I will follow the tip above the pin and put the results in detail.

Thanks
Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: DaOld Man on December 21, 2012, 09:52:05 am
Can you post a close up pic of the drive? A pic where I can see what is printed on the board of each connection?
I see in that last pic a jumper "5 v enable". Do you know what that is for?
Documentation is very sketchy and I dont see a pic of your board in it.
But anyway looks like you have the wiring figured out, my concern was that if you are using enable from pport pin 3, then the drive should not have come on unless output 3 in printer port reader was turned on, and in the video, it doesnt look like it is. Thats what leads me to think that the enable jumper on the drive needs to be removed and the pport pin 3 attached to the pin nearest the edge of the board to use drive enable.
Using drive enable is just an option in Mrotate, you can leave that jumper in on the drive and not assign an output in mrotate for drive enable, but to get past your original problem during bootup, you will have to use two transistors, one on each direction input.
Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: DaOld Man on December 21, 2012, 10:24:48 am
Im thinking the drive needs to be wired like this (before adding the pin 4 drive kill transistor).

Am I any where close to how you wired it?

Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: pixel.arcade on December 21, 2012, 03:37:08 pm
Can you post a close up pic of the drive? A pic where I can see what is printed on the board of each connection?

I see in that last pic a jumper "5 v enable". Do you know what that is for?

Finally managed to get back to camera !
if you remove the jumper 5v enable the unit is turned off

A few more tests here, I changed the pins as suggested
The pin "Enable" has two ends, one end happens to use the same engine problem firing at startup.
Checking the "Printer port reader" pins 2-9 are in "HIGH".

I believe the solution is to use the 2 transistors, will be tested based on the design stated previously.
Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: pixel.arcade on December 21, 2012, 04:17:01 pm
Hello DaOld Man  !

This would be the scheme that I follow, which transitor should I use?
Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: DaOld Man on December 21, 2012, 07:38:59 pm
Im betting with the 5V jumper removed, the drive enable does not go high.
With the drive enable jumper installed, I think it gets its high from the on board 5 v supply.
Anyway, if you want to use the drive enable transistor, I would suggest a radio shack pnp transistor NTE2362.
Here is the radio shack link:
http://www.radioshack.com/product/index.jsp?productId=12656341 (http://www.radioshack.com/product/index.jsp?productId=12656341)

And here is the spec sheet with pinout description:

http://www.nteinc.com/specs/2300to2399/pdf/nte2361.pdf (http://www.nteinc.com/specs/2300to2399/pdf/nte2361.pdf)

The resistor to ground in my circuit may not be necessary, since the drive probably already has a resistor to ground on the board, but it wont hurt to us ethe resistor in my print.
Are you sure pin 4 stays high from power on until windows completly boots up?


Title: Re: Engine very crazy to boot windows (was Mrotate).
Post by: DaOld Man on December 21, 2012, 07:45:23 pm
I wouldnt worry about that message popping up in Mrotate about the printer port address. It seems to be working, the method I use to detect if the port address is valid is a little buggy.
Printer port reader has same address and it works, so it should be ok.
I will revisit that popup message on my next Mrotate version.

Also with the drive enable connected to a pport output, that output will have to be set high in pportreader before it will run. I would not connect the printer port output pin to the drive enable, if that enable jumper is installed.
The enable pin on the drive most likely has +5 vdc on it from the drive with that enable jumper installed.
The printer port pins, when low, output a ground, so this could short out the printer port pin.
So, rule of thumb, if you are connecting the enable pin to a printer port pin, do not install that enable jumper on the drive. (You may not be doing this, its hard to tell in the video.)

Here is how im pretty sure that drive enable should connect to pport (Or transistor).
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on December 27, 2012, 08:32:52 am
Hi DaOld MAn!

Using transistor layout everything worked as it should be, the engine stopped with the craziness at startup.

Thanks for the help.  :cheers:

I will continue the project, plan to use a motor windshield, as the project will put more details.
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on December 27, 2012, 12:17:18 pm
Thats great news, glad I could help.

Good luck with your project, looking forward to seeing it.
Title: Re: Drive L298n with mrotate.
Post by: darthpaul on December 29, 2012, 11:00:52 pm
I wonder why I never experienced that problem and I'm using two printer ports to drive two motors, could it be related to the drive he is using?
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on December 30, 2012, 05:22:06 pm
Hello DarthPaul.
Are you using add on pci parallel port cards?
I have found that they act entirely different from the ones on the motherboards.
I bought a cheap one and experimented with it and found that its outputs stayed off until windows boots, probably because the drivers for it wasnt loaded until windows is up, so the start up BIOS ignored it.
If I remember correctly, one or two outputs stayed on after windows loaded, perhaps you are not using these outputs on your setup? Still again, each card may act differently, I really dont know.
The best tool I ever made for this "science" is the printer port monitor box.
Its basically 8 leds and 5 switches connected to a printer cable that plugs into the port.
I can monitor the printer port outputs even during bios boot, and can simulate inputs with the switches.
Extremely handy for the software I have developed for this hobby. (I got to quit calling this a hobby, its been more like a life style over the past few years.)
:droid
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on January 09, 2013, 07:42:08 am
hello DaOld Man !

Continuing the project got a windshield automotive engine, and it uses 5 amps or more for operation and Drive H provides that use only 2 amps of output, plan to use a computer source to power the engine windshield, as do the connection using a relay? I appreciate the help!
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on January 09, 2013, 10:22:12 am
Im not sure I understand.
Your motor draws 5 amps but the drive is only good for 2 amps? Is this correct?
I think you can use both channels of that drive (hooked in parallel), but will need to double check that.
If you can do that, that will still only be good for 4 amps.
You can use relays, but you wont be able to do speed control.
You can also use a drive rated for higher current, but that would be more expense.
So if you dont need to slow the motor down, relays may be your best bet.
Let me know what you decide to do, I can show you how to use two relays, but as I said, you will not be able to do speed control (the motor will run at full speed).
Those windshield wiper motors have a gear box which reduces the speed quite a bit, so it may not be desirable to slow it down anyway.
If you are up to it, you can build the same drive I use, I think its good for 5 amps, I know it runs my windshield wiper motor with no problems at all.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on January 09, 2013, 11:20:10 am
In this first experience I'll bet the engine to breeze through relays, eagerly await the details of your project. ;)
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on January 09, 2013, 07:42:33 pm
Here is a simple circuit using two relays.
This circuit cannot control motor speed, and dynamic braking is built in, so in MRotate, dont use Drive Enable, PWM, or Dynamic Braking.
(You can use dynamic braking, but it's not necessary).
The HORZ and VERT connects to the HORZ and VERT printer port pins you are using (I couldnt remember the ones you used, so I selected default pins 2 and 3 in the drawing).
The NOT ENABLE connects to pin 4, this will disable the drive if pin 4 is high to keep the motor from going crazy on PC bootup.
The relays must have higher amperage contacts than the motor requires, to handle the dynamic braking.
Please note that relays are mechanical devices, and after some time (hopefully a long time), they will fail. They are usually rated for a number of cycles (or uses), after this period they are prone to fail.
But on their defense, relays are simpler than solid state devices and much more robust.
You may want to check out the solid state drive circuit I posted in Circuits. This same drive works great on my rotating rig.

Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on January 10, 2013, 09:04:59 am
Quote
Posted by: DaOld Man
You can also use a drive rated for higher current, but that would be more expense.

I need this solution, the end result is very good, if possible give me the link of this solution, thanks!

Title: Re: Drive L298n with mrotate.
Post by: BadMouth on January 12, 2013, 02:22:04 pm
Not sure where you are located, but I originally ordered one of these from India.
http://robokits.co.in/shop/index.php?main_page=product_info&cPath=73&products_id=15 (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=73&products_id=15)
It was around $15 US shipped.

Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on January 12, 2013, 04:22:52 pm
Not sure where you are located, but I originally ordered one of these from India.
http://robokits.co.in/shop/index.php?main_page=product_info&cPath=73&products_id=15 (http://robokits.co.in/shop/index.php?main_page=product_info&cPath=73&products_id=15)
It was around $15 US shipped.

Looks like a real good deal.
Here is a quick hookup diagram, using Pin 4 to disable the drive.
Since this drive does not have a ENABLE, you can use two pnp transistors to kill the drive if pin 4 is high.
Pin4 high turns off the transistors. Pin 4 low turns them on, allowing the direction pport pins to control the drive.

Important note about this drive! I asked the website if this drive supports dynamic braking. Here is the reply:

Quote
No. Braking is not provided. Please use DC Motor Driver 20A instead which ill support braking.

So, if you use this drive with Mrotate, be sure to turn off dynamic braking in Mrotate. Some drives will self destruct if you use dynamic braking, not sure if this one will, but I dont suggest you try it.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on January 12, 2013, 04:28:50 pm
And what would be the suggestion motor ?
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on January 12, 2013, 04:40:05 pm
And what would be the suggestion motor ?
I thought you said you had already bought a wind shield wiper motor?
Those are a good choice if you are rotating a CRT monitor, since they have a lot of strength.
If you are rotating a LCD monitor, you can probably get by with a smaller motor, which would probably work with the first drive you bought.
Title: Re: Drive L298n with mrotate.
Post by: darthpaul on January 13, 2013, 12:17:31 am
Here is another option for a motor driver http://www.pololu.com/catalog/product/1212 (http://www.pololu.com/catalog/product/1212). I am currently using something similar to this drive with my windshield wiper motor http://monsterguts.com/index.php?act=viewProd&productId=4 (http://monsterguts.com/index.php?act=viewProd&productId=4) and it turns a 21" CRT monitor with no problems.
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on January 15, 2013, 04:27:38 am
I added this to the post above about the drive from India.
Thought I had better make it a new post just to draw attention, if anyone decides to use this drive.

Important note about this drive! I asked the website if this drive supports dynamic braking. Here is the reply:

Quote
No. Braking is not provided. Please use DC Motor Driver 20A instead which ill support braking.


So, if you use this drive with Mrotate, be sure to turn off dynamic braking in Mrotate. Some drives will self destruct if you use dynamic braking, not sure if this one will, but I dont suggest you try it.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on January 17, 2013, 05:38:41 pm
Thanks everyone for the tips and links.

And finally found a motor that will serve the L298 module, because it only supports 2 amps, I thought a junkyard motor for automotive glass, and even tested uses only 1.5 amps and has a good torque to rotate an LCD.
In tests so far I'm having success, I hope it stays that way;)
 
Next stage, create the mechanism with gears.

Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on January 17, 2013, 08:06:07 pm
That motor should be more than powerful enough to turn an LCD. Good luck with your build, and keep us updated.
Title: Rotation screen
Post by: pixel.arcade on February 07, 2013, 05:53:58 pm
Hi ...

The project will slowly walking in a test video with a custom gear.

Teste Rotaion screen para arcade (http://www.youtube.com/watch?v=-pLKavhvYr0#)

Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on February 10, 2013, 11:41:47 am
New Update.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on February 10, 2013, 04:13:46 pm
Update  ;)

Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on February 11, 2013, 02:20:25 pm
Very interesting!
That setup seems to be very quiet.
Keep us posted on your progress.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on February 17, 2013, 08:16:49 pm
Update

basic test
MOV00404 (http://www.youtube.com/watch?v=vf2b-N-OaNg#)

Testing the adjustment of the limit switches
Arcade Rotation screen Test04 (http://www.youtube.com/watch?v=2ZDWST7wpCo#)
Title: Re: Drive L298n with mrotate.
Post by: darthpaul on February 18, 2013, 12:35:51 am
Looking good, I always thought about making my limit switches adjustable but never got around to it.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on February 21, 2013, 07:52:57 pm
Finally the mechanism completed !
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on February 21, 2013, 09:57:04 pm
Looks good!
So now its install in cabinet time?
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on February 23, 2013, 10:19:42 pm
The last test before installing the arcade.

MOV00509 (http://www.youtube.com/watch?v=__3Vs7vJ_VE#)
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on February 24, 2013, 06:50:29 am
Very slick!
It rotates in about 2 seconds, thats very good. Do you have mechanical stops just in case the limit switch fails?
Cant wait to see this baby installed in its home.
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on February 24, 2013, 10:15:26 am
Quote
It rotates in about 2 seconds, thats very good. Do you have mechanical stops just in case the limit switch fails?

Well, it already happened in the tests, the micro-contact keys are soft so the monitor continues to spin and also the maximum set in Mrotate is a maximum of 03 seconds of turning.

Fortunately this only happened in testingn   ::)
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on March 24, 2013, 11:57:25 pm
Finally completed the upgrade screen rotation, here are some facts to be informed for sure.

Special thanks to "DaOld Man" for the patience to answer questions and everything.  :notworthy:
When staff gave suggestions on the subject and all viewing. ;D
Recalling that the mechanism I did was based on the author's video, Thanks ! :applaud:
Code: [Select]
http://www.youtube.com/watch?v=YaDoy2Y87aMopsss Thanks also to our dear "google translator" oh my god!!    :dunno  :banghead:

Demonstration of screen rotation in 00:50 to 03:10.
Arcade_Rotate_screen_demostration (http://www.youtube.com/watch?v=ugZ7CPd-irk#)
Title: Re: Drive L298n with mrotate.
Post by: DaOld Man on March 25, 2013, 10:06:08 am
Impressive! You did a great job!
 :applaud: :applaud: :applaud:

Thats a cool front end.

Did you get the inpoutx64.dll to work?
Title: Re: Drive L298n with mrotate.
Post by: pixel.arcade on March 25, 2013, 12:01:13 pm
Hi.

Quote
Did you get the inpoutx64.dll to work?
I did all the procedures again but without success.
Title: Re: Drive L298n with mrotate.
Post by: TopJimmyCooks on March 25, 2013, 12:47:07 pm
I recommend you do the test with monitor power and signal test in place.  May be hard to route without fouling your limit switches.  Really good implementation of the axle and gear setup.