Go Down

Topic: Looking for some help in stopping this motorized potentiometer midway (Read 5226 times) previous topic - next topic

bluesbud

Yeah, I learned a ridiculous amount working on this project. Thanks for all the help, seriously.

bluesbud

Art show for it is later today. I'll probably put up some nice HQ videos later.

ash901226

dear bluesbud
if your motor controller is the same as a L298 Motor controller ic that have 3 pin to control the motor speed and direction i would like to point out some important info
this is the data sheet for L298
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00000240.pdf

if you go to page 6/13 and go to Figure 6 : Bidirectional DC Motor Control. there is a Table on how to give signal to the motor controller and what actually it does
ok in the table there are Ven which mean Enable, C and D which is PinA1 and PinA2 respectively.
Base on the Table
Enable = HIGH,C=HIGH,D=LOW then Motor will run in full speed at one direction
Enable=HIGH,C=LOW,D+HIGH then the motor will run at full speed on the other direction
Enable=HIGH,C=D, motor will hard stop. Mean that you have a hard time turning the motor
Enable=LOW,C&D Dont care(dont mean a thing if left high or low) Motor Flywheel, Essentially the motor is disconnected from the circuit. you can easily turn the motor shaft.

ok lets say driving the motor is the same as driving a car. If we were to pulse only the enable pin, and C and D would be at different state,its an equal to push fully the gas pedal, then release, do this a couple dozen of time and you essentially controlling the speed of the motor,
let say that your pulsing the C or D instead of Enable, its like your both your feet is at the brake and the pedal, first your push the gas to the max, then you push the brake to the max. yes you are controlling the motor but, you are wasting allot of energy in that kind of setup.

in your code
Code: [Select]
int Speed=map (pos,posRead, target,255,0);
     analogWrite (enablePin,Speed);
     analogWrite (PinA1, 30);        
     analogWrite (PinA2, 180);

what does this means.Your actually pulsing all the enable,PinA1 and PinA2. yes the motor will rotate, but there will be time that all the pin would be high and making the motor want to stop. there will also be time that the Enable is low, which make the motor Free wheeling . and there will be time that the motor will rotate to a certain direction. but all and all, i hope you would consider my explanation so you could make the motor run at its optimum speed.

ash901226

yes, i actually learn allot from this project. Usually i would charge you for the service that i gave to you. haha but for you this time it on me, just hope you post that vid you promise as my payment. haha

bluesbud

Ah, okay that makes sense. I was actually using analogWrite initially for the logic pins and digitalWrite for the enablePin in order to slow the motor down, since it was going so fast.

Here's a little video from the other day. More documentation to come in a bit.  Might've been my soldering or something, but it kept breaking down during the show.  I kept having to restart the programs. Additionally, something happened with the midway feature again.

https://www.youtube.com/watch?v=JXkHI_2WEGQ&feature=youtu.be

ash901226

can you explain to me more about this problem and the program that you use?

Go Up