Shop OBEX P1 Docs P2 Docs Learn Events
Monitoring Hall Sensors for BLDC — Parallax Forums

Monitoring Hall Sensors for BLDC

clloydclloyd Posts: 31
edited 2008-11-02 22:05 in BASIC Stamp
I am trying to figure out how to get the BASIC Stamp to be able to monitor hall sensors on a brushless DC motor in order to control its speed.· These sensors are changing at a very fast rate and was wondering how to constantly calculate the RPM on the motor that I am driving through these hall sensors from the microcontroller.· From my experience with the stamp I have been unable to actually contiunually monitor something else while running other code so if anyone has experience with this or knows how to handle this, help would be greatly appreciated! Thanks again

Comments

  • Carl HayesCarl Hayes Posts: 841
    edited 2008-10-31 20:58
    I've never used a Hall sensor, but I infer it puts out a repetitive change of EMF (voltage, that is). You could trigger a Schmitt trigger which in turn triggers a monostable (one-shot, that is) with each cycle. Then you'd have a continuous train of pulses of uniform height and duration but varying repetition rate. Feed these through an RC filter of long time constant, and the output will be a voltage varying linearly with the pulse rate and thus linearly with the rotation speed of the motor. You can do all that with a cheap Schmitt trigger, a 555 multivibrator, a capacitor, and a resistor. Should come out about two to three bucks, or ten bucks if you get your stuff at Radio Shack instead of Digi-Key or Mouser.

    Then, of course, you measure your varying voltage with the Stamp however you wish, perhaps with an ADC, and the Stamp doesn't have to stay with it, but instead can come take a quick look whenever you want it to.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • $WMc%$WMc% Posts: 1,884
    edited 2008-10-31 22:19
    clloyd

    Have You·looked @ the MLX90217 Hall-Effect sensor from Melexis? It has all the stuff Mr.Hayes spoke of and is in a tiny "to-92" style case "UA". Take a look @ in the Parallax store under sensors. Don't forget the Magnet...p.s. thiers some sample code too.

    _____________________$WMc%_______________________out___________
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-10-31 22:37
    Cool.· Can you give a link?· I don't find the Parallax site particularly easy to find stuff on.· If it has all the stuff I suggested, then there's another engineer somewhere, as good as I am.· I'd like to meet him. turn.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-10-31 22:49
    I just looked at a data sheet for the 90217, and what it produces is a pulse train of constant duty cycle instead of constant width.· Anyway it is a Hall effect sensor, and that's what I infer is already inside the motor that Clloyd is trying to monitor.· If the sensor is inside the motor and is similar to the 90217, Clloyd wouldn't need the Schmitt trigger, but he'd still need the one-shot, RC filter, and ADC.· Still, the 90217 looks like a neat device.· Wonder how much it costs --

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • $WMc%$WMc% Posts: 1,884
    edited 2008-10-31 22:56
    Mr. Hayes

    The link is a mile long and I can't remmeber how to send the link to the forums, But if You plug p# "605-00005" in the search window it will take You rite to it.
    I have used this hall-sensor w/ great results. Also I don't think it was just 1 Engineer that came up w/ this tiny chip....

    ________________$WMc%__________________________
  • $WMc%$WMc% Posts: 1,884
    edited 2008-10-31 22:57
    Mr.Hayes

    $4.99 + s/h
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-01 00:05
    Very nice. Parallax suggests using it with the COUNT command, which I would have suggested too, but Clloyd says he needs the Stamp to go do other things rather than sticking around to count pulses over an interval. That's why I suggest converting the pulse frequency into an analog voltage so he (well, his program) can come around and look at it any time.

    The lack of interrupts is the greatest hindrance to use of the Stamp in many applications, I think. Alas. The Propeller provides a partial solution by -- apparently -- using a multiprogramming dispatcher to emulate a multiprocessor, so you can pay attention to as many as eight processes at once; but interrupts would be simpler and better. The absence of a timer is another liability in the Stamp, only somewhat alleviated by external timer chips (can't measure an interval in microseconds, for example). But we can't have everything, and the Stamp is surprisingly able for the era in which it was introduced. I'm having fun with Stamps, and designing some stuff I think is neat. That's because a friend gave me a huge box of Stamp stuff to play with.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • $WMc%$WMc% Posts: 1,884
    edited 2008-11-01 03:03
    clloyd

    While the BS2's don't offer interrupts and I have gone so long w/ out them, I have learned not to use them.Back in the day Interrupts disrupted to much other code any way.I really don't know how I would use an interrupt now in 2008????. The BS2's have scratch pad RAM MEM and this can be used to buffer the "count" value.Yes it will need a subrutin to get it and clear the buffer before it overflows,But it can be done. Along w/ some other trick code ;this Isn't a hard to task. The Propeller is BAD TO THE BONE , But this is the BS2's forums
    I recomand looking for a way to buffer the value of Your Hall-sensor,No matter what it is .Then simply call the Buffer for the vaule

    If You can come up w/ some Hardware Drawings on what You've ended up w/ ..,post them as a jpeg"image", Keep posting this thread and We/US/I will help You!!!!!

    _______________$WMc%_________________out___
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-01 04:33
    Well, if interrupts "disrupted [noparse][[/noparse]too] much other code", or disrupted ANY other code, every PC and every mainframe woud fail to work. Interrupts do no such thing, of course. I have written interrupt-driven programs on everything from an IBM 709 -- vacuum-tube machine! -- through System/360s, 370s and 390s, IBM 1800, PCs from the earliest days to last week; and I think I can say with authority that interrupt programming (1) causes no problems if done correctly, (2) makes many things possible, and (3) isn't particularly difficult once a few simple concepts (like saving and restoring the environment) are understood. It's a piece of cake, actually, and it saves untold effort in programming around the LACK of interrupts. Of course, badly done, it can crash your machine, which is true of any kind of programming badly done, at least in weak operating systems like those on PCs (MVS is much more robust). One of my four careers (I'm old now, and retired) was as an operating-systems internalist (the other three were design engineer, mostly med-lab instruments; manager; and consultant), and I've done a LOT of interrupt-routine programming. It's fun.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • clloydclloyd Posts: 31
    edited 2008-11-01 04:35
    Yea the BLDC motor that we get should already have a hall sensor on board that would be outputting a square wave at a certain frequency i would presume as you stated above, but yea if i could get that square wave into some sort of analog form then run it through a ADC that seemingly would do the trick perfectly.· I am still somewhat confused on how I would get the hall sensor output and turn it into an analog value; is there·an IC out there that does this? I am assuming there would be but I am very new to this so I just have to keep asking questions.· If possible to be able to scale the analog value based on rpm between 0 and its max rpm output whatever that maybe.
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-01 19:50
    I'll do a little experimenting and see what I come up with.· My old Tektronix scope needs a workout anyway.· Watch this space.

    It's good being retired.· I can play with my toys as much as I want -- and take all the naps I want, too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-11-01 20:30
    Alas, I have several PC cooling fans with speed-sensors that I thought might be the sort of Hall-effect sensors you describe, with which I could experiment -- but apparently they're something else.· Oh, well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i
  • $WMc%$WMc% Posts: 1,884
    edited 2008-11-02 22:05
    clloyd

    Do You have the motor "IN HAND" ???, or are You still lookin to purchase A motor????....w/ out the spec's on the motor/Hall-sensor
    Combo It's hard to give any help....This sounds like an audio project or maybe a laser ? head????......If You can send some " motor/hall sensor" info ...Or the App. You intend to use w/ this motor/Hall senor combo, ...........It will help You to Advace in Your project ....

    ____________________________$WMc%____________________________???????_________________
Sign In or Register to comment.