Welcome! Log In Create A New Profile

Advanced

basic principle of how the pic drives the motor?

Posted by johnr 
Just a little question in regards to how the PIC controls the motor. I've been looking around on the net at different datasheet and descriptions and think i understand it as:

The 4 output lines which go to the L298N are used to set the direction of the motor and 4 states are possible, coast, forward, reverse and brake. The enable lines on the L298N are connected together and then to the PWM output of the PIC. By varying the duty cycle of the PWM output it is then possible to control the speed of the motors stepping. single stepping is done by only running the PWM for a specified time which results in one step. this is also why the motors are run at 12V instead of the rated 6V so that the motors inductance is reduced and therefore the time taken for the coils to fully energize (current takes less time to get to energize the coils) this gives the motors more greater torque.

so is that how it works??

cheers

JR
Re: basic principle of how the pic drives the motor?
March 30, 2008 02:09PM
No not quite. If you were driving a DC motor with half of an L298 then the motor would coast when not enabled. Forward and reverse would be when the two inputs are different and there would be two brake conditions when they are the same.

With a stepper things are different. It has two coils each one can be driven in two polarities. That gives four states and cycling around then in a sequence drives the motor one way and cycling in the opposite sequence drives it the other way.

A stepper motor is held stationary when a constant voltage is applied, unlike a DC motor which would spin.

The standard Nanotech motors are rated at about 8V and that is about all you get from the L298 with a 12V supply if you load it fully due to the voltage drops from two Darlington transistors.

The PWM reduces the average current and so the torque so it can be used to run the motors cooler if all the torque is not required.

Also it can be used to run lower voltage motors provided the PWM frequency is high enough to not allow the current to build up to more than the L298 can handle during the on cycle. That depends on the motors time constant which is L/R.


[www.hydraraptor.blogspot.com]
so the speed of the motor is controlled by how fast the pic program goes through the stepping sequence (on the 4 output ports) which is outputted to the L298N that provides the current to drive the motor/coils.

On the extruder board is the PWM then used to control the speed of the extruder motor or is it again done by the pic code turning the motor on/off at a certain rate?

thanks for the info and helping my understanding!

JR
Re: basic principle of how the pic drives the motor?
March 30, 2008 03:52PM
Yes when driving a stepper the speed is determined by how fast you go though the sequence. For full stepping the polarity of one coil is reversed, then the other and then the first one again. Each of these changes moves the motor one full step. You can move half a step by turning each coil off between the change in polarity.

To drive a DC motor you use Pulse Width Modulation to control the speed. The speed is roughly proportional to the on time over the total time (on + off).


[www.hydraraptor.blogspot.com]
On the schematics for the PCB 1.3.1 which i am using, pins 12 and 13 of the pic go to a point labeled bread board. So do pins 15 & 16 which are used for the thermistor.

Is this for extra testing?? i read some where about the need to hold pins high on the PIC, are these pins used for that?

cheers

JR
Re: basic principle of how the pic drives the motor?
March 30, 2008 04:10PM
The UCB PCB is designed to be flexible. Older versions of it had a bread board area which was just a matrix of pads to allow people to experiment by adding extra components. This was removed on later versions to reduce the board size and cost but there is still a connector to allow people to connected their own circuits.


[www.hydraraptor.blogspot.com]
Sorry, only registered users may post in this forum.

Click here to login