Shop OBEX P1 Docs P2 Docs Learn Events
New here: how do i control a brushless motor with bs2p? — Parallax Forums

New here: how do i control a brushless motor with bs2p?

A12A12 Posts: 17
edited 2006-10-23 10:36 in BASIC Stamp
i did some search in this forum, there doesn't seems to be much about controlling a BL motor. i seen one post on sending PWM signals to the esc (electronic speed controller)·which in turn control a motor.

i am using the Himax 2015-3600 motor, and am planning to buy a Phoenix 10 esc. my question is, is the pwm signals from the bs2p i had able to control the esc?

also, i am thinking of using a H-bridge to control the motor as an alternative, but i think it is only for brush motors. correct me if i am wrong.


PS: 1st time using basic stamp, sry if i ask dumb qns.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-04 19:14
    Hello,
    ·
    ·· If you just need to turn the motor on/off you could use a simple transistor or MOSFET that handles the rated current of the device.· If you need speed control then that’s another story as you would need PWM.· As for an H-Bridge that is for controlling the polarity of the motor whereas brushless motors are typical only one polarity, so see above control methods.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • SailerManSailerMan Posts: 337
    edited 2006-10-06 01:57
    The Phoenix 10 ESC is controlled like a servo..Use the Pulsout command. The stamp can control the ESC which inturn will control the 3 phases of a brushless motor.
  • A12A12 Posts: 17
    edited 2006-10-06 15:46
    ok, i have decided to use the phoenix 10 for motor control. how do i noe the frequency of the pwm to send to the phoenix, lets say, if i want the motor to run at 3600rpm constant.

    where can i find such info? the phoenix specs doesn't have it. is there some kind of formula out there to get the type of signal needed?
  • WarrlokWarrlok Posts: 77
    edited 2006-10-07 17:16
    it should be normal pulse range 1000 to 2000 with 1500 being neutral. if not maybe 650 to 850 with 750 being neutral ,,,but there are varible tht can help like ramping(slowly speeding up and slowing down). just hooking it up like a servo and using pulseout commands will work
  • WarrlokWarrlok Posts: 77
    edited 2006-10-07 17:20
    PS
    i,m knew too ,,,just got my boebot and just about halfway through the manual,,,
    the guibot program on ur bot disk should help figure out what pwm to use,,,hope this helps
  • A12A12 Posts: 17
    edited 2006-10-08 09:39
    ok, thx alot. i will try it out once i get my speed controller.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-08 18:09
    Hello,
    ·
    ·· Is this a 3-phase brushless motor such as those used in high-end R/C cars?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • A12A12 Posts: 17
    edited 2006-10-10 16:28
    yes, it is a 3-phase motor, but it is used in R/C airplanes. should work the same way as those in RC cars i think. there are 3 wires to the motor
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-10-10 16:46
    The Phoenix 10 esc creates the 3 phase for the motor from DC.
    It converts typical R/C PWM signals to speed control and may do several other functions as well [noparse][[/noparse]like battery protection].

    In sum, the BS2p can easily output the PWM and you merely need to focus on the PBasic code for controling servos. It is the same.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • A12A12 Posts: 17
    edited 2006-10-13 12:39
    ahh, i got a prob. i brought a futaba s3110 servo and wanted to put it in to the BOE-USB pins for servo. but the connector for the servo is a little too big to fit inside the black square casing the BOE has on its pins. so now, i have to place the servo on the breadboard and i need a male/male 3 pin header. problem is i went to 3 electronics store and none of them sell it. i saw a·male/male header thats ard 20 pins. am i suppose to cut them down to 3 pins or what.

    PS: can't connect the speed controller coz of this prob too.

    1 more thing, the servo is rated for 4.8V, so connecting it to Vdd of 5+ volts shldn't be a prob rite.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-10-13 14:48
    A12 -

    Here are a number of different R/C servo extension cables:
    http://www.allelectronics.com/cgi-bin/category.cgi

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-13 17:28
    A12,
    ·
    ·· Most 4.8V servos run up to 6V no problem.· As a side-note, we also carry the 3-pin headers you refer to, but you can cut them down from a longer strip.

    http://www.parallax.com/detail.asp?product_id=451-00303

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • A12A12 Posts: 17
    edited 2006-10-14 09:30
    ok, i finally manage to link up my servo to the bs. i did some testing and found the duration (for the Pulsout) to be from 1250 (cw)· to 3000 (ccw) anything beyond that, the servo starts to vibrate a little. not very good i guess. anyway, doing 1 direction motion is no prob. i run the program twice and changed the duration value and it moves from 1 end to the other in 1 fast motion.

    but when i try to do 2 direction in a single program, the servo moves bit by bit from 1250 position to 3000 position. den i did some more editing and now it just jerks a little back and fro.

    below is my program, can't find anything wrong. i·added·in the DEBUG·in both loops·and the message appears on the screen repeatedly from the Servo_1 loop, never from the Servo_2. (i removed the DEBUG·from the program already)

    do i need some sort of code to exit the 1st FOR loop?



    ' {$STAMP BS2p}
    ' {$PBASIC 2.5}
    '
    [noparse][[/noparse] Constants ]
    Scounter VAR Word····· 'Servo counter
    Main:

    · GOSUB Servo_1···· 'Move servo to open blades
    · GOSUB Servo_2···· 'Initial Position

    END················· 'end the program

    '
    [noparse][[/noparse] Servo Motion ]
    Servo_1:
    · FOR Scounter = 1 TO 100
    ··· PULSOUT 0, 1250····· 'servo connected to pin 0, move to push blades out, 1250, 2125, 3000
    ··· PAUSE 20
    · NEXT
    · PAUSE 1000······· 'Time for blades to open up is 1 second
    · RETURN

    Servo_2:
    · FOR Scounter = 1 TO 100
    ··· PULSOUT 0, 3000····· 'servo move back to neutral position
    ··· PAUSE 20
    · NEXT
    · PAUSE 1000
    · RETURN
  • A12A12 Posts: 17
    edited 2006-10-14 17:42
    oh yes, i finally got my brushless motor running. had a little prob initally, the motor wun run. check all connections, use a multimeter and check and finally remembered that the Pheonix 10 has a safety feature. it needs to recieve 4 secs of full throttle b4 it moves the motor in case of accidental activation.

    took me some time to figure it out. i added a 'High 7' to get that full throttle. just to share wif those using Ph-10 ESC too.

    anyway, now i need to get a tachometer to measure the rpm of the motor. oh well, leaves some free·time for me to figure out the servo prob. great to noe i can control the motor though tongue.gif thx to everyones help.
    ·
  • A12A12 Posts: 17
    edited 2006-10-15 12:40
    ok, i finally got the source of error. my 9v battery is running low. actually used it till the basic stamp can·no longer be run.

    right now, i have a prob wif my speed controller. i tried PWM, PULSOUT and with different settings, but there is no response. only HIGH and LOW will move the motor, which is not what i want. i need to control the speed. anyone had any experience with Phoenix 10? it reacts strangely. sometimes the motor wun run when BS is running. den i switch off the BS and it starts to run.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-10-15 16:15
    A12 -

    Do you have the negative terminal (ground) of the Stamp conected to the negative terminal of the battery? If not, you will never get it to work. They MUST have a COMMON GROUND.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • A12A12 Posts: 17
    edited 2006-10-16 13:31
    wad do u mean common gnd? i use a 9V battery connected to the BOE, and the BS module is in the IC socket. so it is connected to the GND.

    i have my 3 wire speed controller connected by:

    Brown to Vss (on BOE)

    Orange to Pin 7

    Red, no connection since it is a battery eliminator circuit.

    i am assuming the speed controller and the basic stamp are gnd together at Vss, unless i am suppose to gnd the motor (which has its own Lipo battery) together into Vss. Or shld i ground the red wire. hmm, i will try putting a resistor to the red wire and gnd it.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-10-16 14:06
    Hmm. Newbies make this mistake all the time, so that's why we keep mentioning it.

    A "common ground" is where you wire ALL your grounds to. You need a "common ground", because even though the Power system of a Servo can be separate from the Power system of the BS2, the BS2 AND the servo need to 'share' the ground wire (JUST the ground wire) to reference the control signal to.

    So, if you use a 9v battery to power the BS2, and a 'three-wire' speed controller with a different power supply, then you need to insure that the ground of the 'different power supply' is in fact connected to that 'brown' wire you mention, which then connects to Vss (which IS the ground of the BS2's power supply).

    The result is the ground for the 9V battery (aka Vss) is connected to the BS2 (aka Vss) and is connected to the brown wire (ground for signal) which MUST be connected to the ground of the "battery eliminator circuit" you mention above. Voila, a "common ground".

    Now, IF you connect the RED wire (the power supply + line for the servo) to ANYTHING other than the servo, things either heat up or blow up, so don't do that. "Common grounds" are a good thing. "Common supply lines" for + supplies at different voltages is a TERRIBLE thing. And "putting a resistor to the red wire and grounding it" just burns power for no good reason. Don't do that either.
  • A12A12 Posts: 17
    edited 2006-10-16 15:58
    alright! i solve the prob. shlda post my program here, i made a newb mistake right from the start. i placed my END after 2 of my subroutines. i used subroutines to troubleshoot various codings and i assume the Basic Stamp will only execute the subroutines with GOTO, not realising it executes them nonetheless if the END is placed after them. that explains the random results, i was running more subrountines than i had wanted.

    then i figured out that the Phx-10 needs 4 sec of brake signal which simply isn't what·the HIGH function gives out. dun ask me why the motor runs on HIGH, isn't suppose to. this kinda mislead me to think i got through the 4 sec rule. so i tried the PULSOUT to get through it and it worked after a few tries.

    now to try the servo and motor at the same time *tells self to gnd everything together*

    just to reciprocate, this is part·of my motor·code (not guranteed to work for all ESC and motors)

    '
    ··· FOR·i = 1 TO·100····· 'this loop is to satisfy the 4 sec safety·guard on the Phx-10
    ····· PULSOUT 3, 1000··· 'at 1000, this gives a brake signal, trial and error
    ····· PAUSE 20············· 'the whole loop must run at least 4 sec, use DEBUG to·check
    ··· NEXT

    ··· FOR·i = 1 TO 100····· 'this loop makes the motor run
    ····· PULSOUT 3, 2000··· '2000 controls the speed, higher number=higher speed
    ····· PAUSE 20··············'for longer running,·put·this loop inside a DO...LOOP
    ··· NEXT
    '

    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-10-16 17:55
    A12 -

    You may get bettter results in terms of feedback, if you take the time to write in English. That is the official language of this forum, since it is based in the United States.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • DeadZenDeadZen Posts: 1
    edited 2006-10-23 10:36
    I'd like to design·some special circuits, I see we're talking about RC's here...

    Well I for one have recently gotten into the RC industry and man is
    there room for A LOT of improvement, but as I'm relatively new I will
    need help and a maybe a giants shoulder to stand on ;-)

    First I need a sensorless high speed brushless motor controller,
    The reason I don't want to use the phoenix is
    ·· A. its expensive
    ·· B. its limited (little or·nothing for rpm, easing, etc)
    ·· C.·i'd prefer to design and not hack... (even though·I'm·good at hacking) [noparse];)[/noparse]

    Second, I need a way to sense a batteries life, How much juice is left in it?
    ·· 1. Not picky here, even 10 led's in a row to make a funky progress bar would be cool..

    Third, I need a way to communicate to the board from a controller (handheld)
    ·· 1.·For instance, say I want to remotely interrogate the battery meter, the rpm, or maybe the inferred mph
    ·· 2. I don't like the current designs of 75Mhz 27Mhz etc, 3 channels, 4 channels, 5 channels...· (any reason I can't have like 16 or 32?)
    ·· 3. Any reason I can't use a Zigbee? or Something Like that... They have·LONG RANGE (multi-mile)·versions...
    ······ - Maybe a Zigbee to a PIC18Fxx31 to a Propeller or SX? or SX/B? ... not sure here bout options.

    I don't know whether or not I can even use anything from parallax for this,

    I have some assembler knowledge and believe I can get a PIC18Fxx31 to
    do the high speed dynamic commutating needed for high rpm sensorless brushless dc motors..

    I'm a fairly good programmer in the higher level languages and would like to
    apply my knowledge and love for robotics to the RC, like I said there is plenty
    of room for improvement in that industry... Most designs have no fail safes,
    and with the usual designs they tend to break easily over time since there is no
    error checking whatsoever...(except maybe minimum voltage detectors) (boring)

    I started with the Homework Stamp, having finished that and making a few designs not
    in the book to determine my level of competency I now feel like I could bridge some gaps here...

    In object oriented programming I can make a class and extend it with functionality or treat it
    entirely as blackbox... not saying, of course,·that·I (do) treat them like that, but

    In micro controller programming could I configure some components from various manufacturers
    and then put them all together? if so what would be the base? parallax or like microchip? I also
    have seen some things useful from hobbyengineering.com like an SD mem card reader, or like
    roguerobotics.com where they have a uMP3 player (might make a cool command module) of
    course I have questions about integration...

    This may seem like a nightmare for some but I've successfully integrated things in Information Technology
    that have also seemed difficult but I got them working swimmingly (for instance irc over web without plugins)

    I'd also like to know for instance... say I get the Parallax Pro board and get my project "working"
    what options do I have to bring it to market? or produce em outside of the "Project Boards" which
    I'm going to shortly outgrow?

    a point in the right direction or books would suffice, thank you...

    Btw this is my first post... And I' just wanted to say thanks to parallax, nuts & volts and everyone...
    I was in the US FIRST Competition for my school in South Carolina, which
    is where I got the first contact with parallax and I'm still impressed...

    kinda took me a long time to get around to microcontrolling...· was busy with web development ;-)
Sign In or Register to comment.