Picaxe08 speed control and direction of a motor

Tomasu

New Member
Hi. I have a doubt regarding picaxe08.
I'm currently doing a work with picaxe08 that consists in programing the speed control and direction of a motor (servo).

Here's the esquematic:


My principal doubt is: Can I use command pwm in picaxe08?
If yes, is this programation correct for what I'm trying to do?

loop:

servo 4,75 ; moves servo to one side

pause 2000 ; wait 2 seconds

servo 4,150 ; moves servo to central position

pause 2000 ; wait 2 seconds

servo 4,225 ; moves servo to the other side

pause 2000 ; wait 2 seconds

goto loop ; returns to the beggining

If not how Am I suposse to control the speed of the motor if I can't use pwm? :confused:

Cheers :D

Note: I don't know if this is in the wrong section. If it is sorry :p
 
Last edited:

Wrenow

Senior Member
OK, first let's separate the apples from the oranges.

The servo command is for servos, it is not exactly a pwm command, per se. It is designed to give hobby servos the positioning commands which the electronics in the servo use to command the motor to go the the commanded position.

What it looks like you are trying to do from the schematic is that you are trying to control a motor, not a servo, in a form like an H-bridge for forwards and reverse. There are lots of posts here on motor control, if you will do a search, and there may be one that is appropriate.

Alternatively, there are plenty of ESC's (electronic speed controllers) at your local hobby store that do the same job based on the servo signal as you are asking about. however, it changes the speed of the motor, and does not stop it at a particular position the way a servo does.

So, I guess it boils down to - are you trying to make a servo, or are you trying to control the speed of a motor?

You might find the article Radio Basics at http://ntxbg.org/howto.php useful, as well as ESC's Lessons Learned.

If you are planning on trying to build your own servo sfrom scratch, it is not trivial, and remember you will need some sort of positional feedback so the Picaxe knows when to stop.

I hope that helped answer your question, though I am not sure....

Cheers,

Wreno
 

Tomasu

New Member
Actually this is a work that a teacher of mine ask me to do which consists in the control of the direction and speed of a motor.
Since according to my teacher we can't use the command pwm I don't have any clue how to do this.
Any sugestion would be nice, since I have to show the work until tomorrow LOL.

Cheers.
 
Last edited:

212

Senior Member
This is way over my head, but maybe I can help get someone to think of the answer if I say something somewhat related. Take a hobby RC set, and take the motor out of one of the servos, but leave the wires still connected. Or just take the gears out to see... Now when you control the servo with the transmitter, it does not move anything, but you can change the speed and direction of its motor. I once made a tiny boat with a servo motor for power is why I know this :)
 

hippy

Ex-Staff (retired)
Actually this is a work that a teacher of mine ask me to do which consists in the control of the direction and speed of a motor.
Since according to my teacher we can't use the command pwm I don't have any clue how to do this.
The hint as to how one would normally do it is in the question - PWM. But as you cannot use the PWM command you'll need to do what PWM would do but in some other way.

The first thing is to determine what a PWM signal looks like and how it's used to control speed. Then, ask yourself how you can create a signal which is similar to what a PWM signal should be ?

If I read it right, this has to be done by tomorrow - Looks like you're going to have a very long night ahead of you :)
 

premelec

Senior Member
Is the motor a 'servo' as used by hobbyists? Or just a DC motor? If it is a DC motor you CAN use the PWM or PWMOUT function to control the speed and use the other parts to cause the current direction through the motor to reverse with the same speed control - still you have a way to go... good luck...
 

Rickharris

Senior Member
Does anyone have this book: http://www.hvwtech.com/products_list.asp?CatID=90&SubCatID=249&SubSubCatID=254 ?

If yes can you give me the programation because my work is from that book :D

Cheers.
No I don't have the book but I bet the answer is in there if you look hard.

The circuit diagram you show is right IF you are controlling the speed and direction of a DC motor.

The programme is not.

PWM (Pulse width modulation) turns the output on and off quickly - If it is on for half the ti9me and off for half the time the motor will run half as fast as if the output was on all the time.

Question is how to do this with simple commands - High - Low - Pause goto

The direction of the motor is controlled by the 2 outputs from the picaxe - if one is high and the other low the motor turns one way - If you swap the high - low it turns the other way.
 

eclectic

Moderator
Tomasu.

The circuit is on page 146 of the book.

David Lincoln gives a very good explanation on page 146.

The PROGRAM for this circuit is on page 145.

The ANALYSIS for the program in on pages 147 - 148.

I will not print them. The book is copyright.

e
 

Tomasu

New Member
I know that the program is on that book lol, but the problem is...i don't have the book.
Just a tip please: what instruction do you use instead of pwm? Cause my teacher said I can't use pwm in picaxe 08. My main problem to resolve the programation is that one.

Any help please? :p

Cheers.
 
Top