HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Jan 27, 2009, 04:52 PM
Registered User
Joined Oct 2006
99 Posts
Discussion
DIY BLDC ESC for step control

Hi all
I am wanting to design a system that will use BLDC motors with step control. I have some ideas about programming but I mainly do web stuff like PHP so this is a bit over my head, anyway i've put together some semi-ish-pseudo code and tried to basic/C it up a bit.

The gist is I need step control so forwards and backwards, I also need amount of steps, possibly rpm and a 'go' signal for synchronization purposes. I'm guessing it will be best with a sensored motor but because they don't seem very abundant these days probably sensorless with DIY hall sensors.
Code:
main{
if end0 = 0                                (end sensor)
insert code rotate backwards        (return to zero)
goto main
end if
goto signal}

signal{
if instructions exist goto move
do while signal = 0
wait for signal                           (waits for signal from PC)
end while
goto readsignal}

readsignal{
if signal begins with xxxx        (so that multiple controllers can be used)
read instructions into memory (direction, rpm, wait, distance)
check signal integrity
	if signal integrity is good then         (simple check)
	goto communicate(ok)
	else
	communicate(signal error)
	endif
if not
goto signal
end if}

communicate(x as reply){
select case x = ok
signal PC ok
goto move

select case signal error
signal PC signal error
purge instructions
goto signal

select case finished
signal PC finished
purge instructions
goto signal

select case end0
signal PC end0 + distance
purge instructions
goto signal

select case end1
signal PC end1 + distance
purge instructions
goto signal}


move{
if (distance > 0){                (use distance variable todo step control)
if (wait = 1){
wait for go signal from pc
if (direction = forwards){
distance -= 1
insert actual forwards moving code   (1 step not complete rotation)
	if (end1 = 1){                        (check end sensor)
	goto communicate(end1)}
}else{
distance -= 1
insert actual backwards moving code  (1 step not complete rotation)
	if (end0 = 1){                         (check end sensor)
	goto communicate(end0)}
}
}else{
goto communicate(finished)
}}
I know it's messy and horrible but I tried. I'd be glad of any input anyone could give me

Thanks Adam
Rufe0 is offline Find More Posts by Rufe0
Last edited by Rufe0; Jan 28, 2009 at 01:12 PM.
Reply With Quote
Sign up now
to remove ads between posts
Old Jan 27, 2009, 05:01 PM
User
Colorado
Joined Oct 2004
1,424 Posts
Have you considered using a stepper motor - which as its name implies, is designed to do what you want to do.
rmteo is offline Find More Posts by rmteo
Reply With Quote
Old Jan 27, 2009, 06:24 PM
Registered User
quax's Avatar
NRW, Germany
Joined Apr 2004
711 Posts
Hi Adam,

what programming language is that? It's really new to me

cul
quax
quax is online now Find More Posts by quax
Reply With Quote
Old Jan 28, 2009, 03:03 AM
Registered User
Joined Oct 2006
99 Posts
Yeah kinda my whole point in the project is to show that brushless motors could be used and would be just as good.

And yeah I'm sorry it went all wrong. It's meant to be pseudo code so anyone can understand it but it just made it even harder to read
Rufe0 is offline Find More Posts by Rufe0
Reply With Quote
Old Jan 30, 2009, 12:43 AM
Registered User
Indianapolis
Joined Jul 2006
123 Posts
You will need more than the hall sensors for positioning. You wil need an encoder of some sort preferably a high resolution optical. Just a closed loop brushless servo!!!!!!!!

With just the hall's you will only be able to sense potision to the resolution of the # of poles. Its not likely to be done on typical hobby style brushless motors anyway, at least not with much step resolution.

BTW, you wont be proving anything, this has been done already and has been used for years in certain industry. Its just not used for applications that need holding torque such as a stepper or normal DC servo may be used, their designs just dont really allow it.

Keling sells motors and controllers pretty darn cheap.

Also, a stepper is pretty much exactly what you are trying to do anyway.

Steppers are brushless DC motors, just with many many more teeth/poles than typical "brushless DC" motors. However, they are indeed essentially the same thing. Steppers are designed for holding torque, and brushless DC for speed/ running torque.


Stepper have the benefit of not needing positional feedback in many application as they only rotate a known amount per step.

If you need such a motor/controller for something I suggest just using a stepper, it will keep you from banging your head trying to re-invent the wheel and are pretty cheap and can be extremely precise.
Jappa_Indy is offline Find More Posts by Jappa_Indy
Reply With Quote
Old Jan 30, 2009, 06:37 AM
Registered User
Joined Oct 2006
99 Posts
Well actually I was planning on useing a 12pole connected to a 12:1 worm gear which would give me 144 steps or 2.5degree which is as acturate as steppers and is 10times more acurate than the device needs to be anyway
Rufe0 is offline Find More Posts by Rufe0
Reply With Quote
Old Jan 30, 2009, 06:58 AM
Registered User
earlwb's Avatar
USA, TX, Grapevine
Joined Dec 2008
13,585 Posts
There are two main types of stepper motors, bipolar and unipolar, they use different methods as to being driven.
Since you are wanting to use PHP that means you are using a PC. I have never heard of someone using PHP for this, PHP is a website webpage kind of programming language. But maybe that is a first. I don't remember anyone doing it yet.

Here is how to drive a small stepper motor via the parallel port:
http://electronics-diy.com/stepper_motors.php
Note the webpage uses PHP but they show how to get a Visual Basic .Net example for driving it. You would need to figure out how to get PHP to send bytes to the parallel port. I don't know if you can though. But maybe using printer commands would be possible.

This is about the simplest way here, it uses the parallel port on your PC.
http://shop.vetcosurplus.com/catalog...oducts_id=1565
But if your PC doesn't have a parallel port, then that is a problem.

The other method is to use a stepper motor driver like this here:
http://www.hobbytron.net/product574.html
You can modify the kit to be driven by a PC i/o port of some type as desired.
The motorola stepper motor driver IC is pretty neat, one can hook up more powerful driver transistors on the outputs for larger stepper motors too. There are a whole slew of different stepper motor driver IC's out there. They use these chips in all sorts of things.

A PIC stepper motor controller kit with tutorial is available:
http://www.imagesco.com/kits/pic-ste...oller-kit.html
Most microprocessor companies have a similar kit or examples for driving a stepper as well.

Here are some more kits here:
http://www.ozitronics.com/motor.html
They have a Visial Basic example driver program for one of the kits too.

This is a way to drive old hard drive disk motors from a PC:
http://www.epanorama.net/circuits/diskstepper.html

Here is another example of of a stepper motor controller circuit kit:
http://www.sunrom.com/index.php?main...roducts_id=194
earlwb is offline Find More Posts by earlwb
RCG Plus Member
Latest blog entry: My new Gaui X5 Rc Helicopter
Reply With Quote
Old Jan 30, 2009, 10:40 AM
User
Colorado
Joined Oct 2004
1,424 Posts
Quote:
Originally Posted by Rufe0
Well actually I was planning on useing a 12pole connected to a 12:1 worm gear which would give me 144 steps or 2.5degree which is as acturate as steppers and is 10times more acurate than the device needs to be anyway
While this may give similar resolution (NOT accuracy) to a typical 1.8 degree/step stepper motor, you won't get anywhere near the same accuracy when you take into consideration things like the backlash of the worm drive.

If you only need about 15 steps/rev, get one of these tiny (0.78 dia. x 0.56in.) $1.50 unipolar steppers (20 steps/rev) to play with. Driving a stepper is much simpler/cheaper than a brushless/hall combo.
http://www.allelectronics.com/make-a...MOTOR/-/1.html
rmteo is offline Find More Posts by rmteo
Reply With Quote
Old Jan 30, 2009, 11:32 AM
Registered User
Joined Oct 2006
99 Posts
Very usefull earlwb thankyou


rmteo this motor will be a few watts maximum, what if you want a few hundred watts, stepper motors become very expensive
Rufe0 is offline Find More Posts by Rufe0
Reply With Quote
Old Jan 30, 2009, 11:43 AM
User
Colorado
Joined Oct 2004
1,424 Posts
What torque rating do you need? More data on your application is needed to determine the most appropriate solution.
rmteo is offline Find More Posts by rmteo
Reply With Quote
Old Jan 30, 2009, 01:16 PM
Registered User
Joined Oct 2006
99 Posts
Well lets say one possible combination I am looking into is 150.64oz-in at 1250 rpm
Rufe0 is offline Find More Posts by Rufe0
Reply With Quote
Old Jan 30, 2009, 01:31 PM
User
Colorado
Joined Oct 2004
1,424 Posts
In your previous post you indicated that you requirement is about 15 steps/rev, so are you saying that you want to be able to do 18,750 discrete steps per second (15x1250)?
rmteo is offline Find More Posts by rmteo
Reply With Quote
Old Jan 30, 2009, 01:37 PM
dammachines
United States, DC, Washington
Joined Feb 2004
1,408 Posts
Quote:
Originally Posted by Rufe0
Well actually I was planning on useing a 12pole connected to a 12:1 worm gear which would give me 144 steps or 2.5degree which is as acturate as steppers
As mentioned before 1.8 degrees/step is a common resolution for the stepper motors themselves, but half stepping is quite easy to do giving you twice the resolution. In fact most stepper controllers provide for even smaller microsteps - I believe the ones on my CNC machine are 10 microstep...

A 150 oz*in stepper shouldn't be too much money - but I don't know about getting that torque at 1250 rpm.
dmincin is online now Find More Posts by dmincin
Reply With Quote
Old Jan 30, 2009, 02:03 PM
Registered User
Joined Oct 2006
99 Posts
rmteo the BLDC I mentioned is a 12 pole and would run at 15000rpm which would be 180,000 steps/min 3000steps/sec
Rufe0 is offline Find More Posts by Rufe0
Last edited by Rufe0; Jan 30, 2009 at 02:09 PM.
Reply With Quote
Old Jan 30, 2009, 02:16 PM
Registered User
earlwb's Avatar
USA, TX, Grapevine
Joined Dec 2008
13,585 Posts
Well, the real stepper motors do not run at 15,000 RPM.
A Nema34 motor turns around 100-200 rpm, but if you overload it severely, maybe 1500 rpm before it overheats.
Some small motors do quite well at 50 rpm using 1/2 step mode at 5v for example.

if you are wanting 15,000 rpm you are talking about a seriously good quality brushless RC airplane or heli motor. The little itty bitty brushless motors only turn around 7,000 to 8,000 rpm.
What specific brushless motor were you wanting to use?
You said it had 12 poles, and other information about it? Make model etc.
earlwb is offline Find More Posts by earlwb
RCG Plus Member
Latest blog entry: My new Gaui X5 Rc Helicopter
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Which CPU is better for self developing ESC for BLDC chancehuang Power Systems 5 Nov 02, 2005 12:12 PM
ESC for Soarstar/Poppy sgil2001 Beginner Training Area (Aircraft-Electric) 1 Jul 04, 2001 10:31 PM
Which ESC for 2 480s? Mrstacy Electric Plane Talk 1 May 28, 2001 02:45 AM
MX-80 esc for twin HP 200/25/4 marshall Electric Ducted Fan Jet Talk 3 May 24, 2001 07:16 PM