Adding Hall sensors for VESC?

erwincoumans

100 W
Joined
Apr 2, 2015
Messages
141
I have hub-motors using the TURNIGY AERODRIVE SK3 – 6374-149KV and each motor has a VESC attached, at 12s (or 6s if wiring parallel).

Being spoiled by the Boosted Board, I'm not entirely happy with VESC performance at startup and low speed braking, so I want to try adding sensors to the motors.
I noticed an older thread (http://endless-sphere.com/forums/viewtopic.php?f=28&t=34816), but I have still questions:

1) Which hall sensor to buy? Would this one work? http://www.amazon.com/gp/product/B00ATNJH20?psc=1&redirect=true&ref_=od_aui_detailpages00
(assuming it is 5V as in the picture and in the amazon answers, unlike the 24V in the description)

2) Where do we need to place hall sensors using epoxy glue exactly? I want to place them in-between the stator teeth, but that would not be exactly 120 electrical degrees (17 physical degrees according to http://endless-sphere.com/forums/viewtopic.php?f=28&t=34816 ?)
There are 12 magnets/gaps on the stator, and 14 magnets on the bus, see picture below.

3) do we need to add a 10k resister somewhere?

4) how to configure/tweak the VESC to use the hall sensors? When I stick the Hall sensors between the stator wires, it won't be exactly 120 electrical degrees I guess. How do we compensate for this? Will VESC 'just work' without any work? Does the order of Hall sensor wires matter?

5) how to route the hall wires outside, perhaps alongside the 3 existing cables?
hub_motor.jpg
Last but not least, does anyone know where to buy a low-KV sensored brushless motor that is compatible with VESC?

Any help is welcome.
Thanks!
Erwin
 
Those look like they mount outside the motor which probably will not work with a hub motor like that. I just made a thread explaining how I did it. It is very tough to get the wiring right, there is no much room to get them out of the motor along with the main lines. I will be doing some testing this weekend just no braking stuff since I still need to make a button for that. http://endless-sphere.com/forums/viewtopic.php?f=35&t=69959

My sensors say s41, I got them from lyen, so I assume any s41 series will work.
 
Thanks for sharing, Silviasol!

Does the motor work with VESC in sensored mode?

What is the spacing between sensors exactly? Does the sensor in the middle have to be reversed?
 
silviasol said:
I haven't hooked it up yet. I put them at 180 degree spacing but I guess you can also do 90 degree spacing.
180 degree spacing, in electrical degrees? Can you please make a drawing or picture that shows the location of the 3 hall sensors?
 
Right now, all 120 degree configurations should work and making it work for 60 degree spacing should be easy. I would like to implement a hybrid mode that uses sensors on low speed and sensorless when going faster since sensorless is better then. Sensors that work with other common ESCs should also work with VESC. However, I think that a board with dual 149kv 6374 hub motors can start well with some tweaking unless the wheels are huge. My friend has an electric bicycle with a sensored hub motor and it works really well without sensors - but I had to change many parameters to make it work since the default configuration was not working well at all.

I haven't spent much on hall sensor support since I don't have any sensored setup and no setup where I miss sensors for performance. Once torque sends me sensored motors and I make a setup where I can do some development on sensored motors I will implement the hybrid mode and do more testing. Before I have done that, I don't recommend using the sensored mode since I haven't spent much time on it yet because my lack of hardware to test on.

So, on to the questions:

1) Which hall sensor to buy? Would this one work? http://www.amazon.com/gp/product/B00ATNJH20?psc=1&redirect=true&ref_=od_aui_detailpages00
(assuming it is 5V as in the picture and in the amazon answers, unlike the 24V in the description)

Yes, they should work. Sensors that work with most hobby controllers and ebike controllers should also work with VESC.

2) Where do we need to place hall sensors using epoxy glue exactly? I want to place them in-between the stator teeth, but that would not be exactly 120 electrical degrees (17 physical degrees according to http://endless-sphere.com/forums/viewtopic.php?f=28&t=34816 ?)
There are 12 magnets/gaps on the stator, and 14 magnets on the bus, see picture below.

If you follow what others have done in other threads, it should also work with VESC. Aligning sensors perfectly is difficult, but even if you get it a bit wrong the startup should work fine. However, after the motor has reached more than about 5% of its full speed, sensorless operation will give more accurate commutations with VESC.

3) do we need to add a 10k resister somewhere?

No. They can be connected to the hall sensor port right away.

4) how to configure/tweak the VESC to use the hall sensors? When I stick the Hall sensors between the stator wires, it won't be exactly 120 electrical degrees I guess. How do we compensate for this? Will VESC 'just work' without any work? Does the order of Hall sensor wires matter?

You can connect them in any order and configure for that, but you must get plus and minus right. Getting plus and minus right is what I meant with not randomly connecting them. The VESC will not compensate for misaligned sensors, but it will work anyway. The motor will run even if the commutations aren't perfect, but less efficiently. Sensored motors that you buy don't have perfectly aligned sensors either. This is why I would like to implement a hybrid mode that goes sensorles after 5% to 10% speed since sensorless is better once the motor has started.

5) how to route the hall wires outside, perhaps alongside the 3 existing cables?
Maybe. In any case, you must make sure that the sensor cables don't short with each other and certainly not with the motor windings since that can kill the VESC easily. That is one of the reasons why I prefer sensorless when it works well enough.
 
Thanks for the answers Benjamin, I agree that a hybrid mode using Hall at low RPM and back EMF at higher RPM would be great.
Is that just a matter of a simple 'if' switch based on electrical RPM?
Code:
if (abs(erpm) < threshold) useHall else useBackEMF?
I created a simple test circuit to test the Hall sensor separately:
FullSizeRender-26.jpg
On this http://mitrocketscience.blogspot.com/2011/08/hall-effect-sensor-placement-for.html?m=1 useful page it tells that my motor, the 120 electrical degrees also is 120 mechanical degrees, so the hall sensors are placed like this,
all in the same orientation (no swapping of Hall sensors), right?
IMG_3669.JPG
It seems to depend on the windings, but it is not clear what windings the TURNIGY AERODRIVE SK3 – 6374-149KV has exactly.

Is there a way to figure out the windings visually, or just measure the Hall sensors with an oscilloscope and compare with back EMF?
 
Yes, the hybrid implementation is quite simple (not that simple though, some RPM filtering and a hysteresis is required). What I do have to spend more time on is testing the hall sensor implementation in general since I haven't done much of that. I would also like to implement an automatic mapping using the sensorless mode and detect when the hall sensors fail and switch to sensorless completely.

When I modified an outrunner, I put the sensors between three consecutive slots, but I don't know if that always works. It also depends on whether the motor is Y or D connected. I don't have much experience with modifying outrunners to use sensors, so there are many other people who can give better advice on that.
 
Hi

I'm using VESC with E-MAX GT5345/09 170KV outrunner. Since I had some problems with cogging i added hall sensors inside the slots with 120 deg spacing.

First I only used the motor in one direction and everything worked fine. But when I started to drive motor in reverse direction I noticed that it was much louder and in the BLDC Tool I saw that the current for a specific speed was 5x higher in reverse direction. In current control mode it didn't even get more than a certain speed of around 5000 ERPM without load.

After I placed the sensors in the slots I saw that at least one of them is about 1-2 mechanical degrees off center. So my first thought was that this leads to a timing problem, when running reverse the motor really sounds as if the timing is really bad.

But for me the following thing seems strange:
If i switch two motor cables and run detection again the motor works fine in the other direction. The problem always affects the direction that is defined as reverse.
I think if the problem is on the mechanical side the affected direction should always stay the same. Do you think that I am right with this assumption?

Any guess? Do I have to change some of the hall parameters/timing to get it running properly?

By the way, what is the meaning of the hall parameters, my detection results into:
Detected hall sensor table:
-1, 5, 3, 4, 1, 6, 2, -1

Thanks for every help!

Best regards,
fasser
 
fasser said:
Hi

I'm using VESC with E-MAX GT5345/09 170KV outrunner. Since I had some problems with cogging i added hall sensors inside the slots with 120 deg spacing.

First I only used the motor in one direction and everything worked fine. But when I started to drive motor in reverse direction I noticed that it was much louder and in the BLDC Tool I saw that the current for a specific speed was 5x higher in reverse direction. In current control mode it didn't even get more than a certain speed of around 5000 ERPM without load.

After I placed the sensors in the slots I saw that at least one of them is about 1-2 mechanical degrees off center. So my first thought was that this leads to a timing problem, when running reverse the motor really sounds as if the timing is really bad.

But for me the following thing seems strange:
If i switch two motor cables and run detection again the motor works fine in the other direction. The problem always affects the direction that is defined as reverse.
I think if the problem is on the mechanical side the affected direction should always stay the same. Do you think that I am right with this assumption?

Any guess? Do I have to change some of the hall parameters/timing to get it running properly?

By the way, what is the meaning of the hall parameters, my detection results into:
Detected hall sensor table:
-1, 5, 3, 4, 1, 6, 2, -1

Thanks for every help!

Best regards,
fasser

There is probably something wrong with the detection of the hall sensor implementation because I have heard that someone else had this issue. I only have two motors with hall sensors and it works for them, so I cannot reproduce the problem which makes it difficult for me to fix it. I have ordered one motor that apparently has this issue, so as soon as I receive it I will try to fix the hall sensor implementation.
 
Hi

@vedder: Thanks for the quick reply. I thought a bit about what the problem could be:
As is said, one of my hall sensors is not positioned perfectly in the center of the slot. Shouldn't this lead to the problem that the timings are not symetric on direction change? So different timings should be detected/used for the two directions.
It would be interesting for me what the detected hall parameters mean? Is it possible to tune / play around with them by hand?


Some information how I added the hall sensors for everybody:

I used three Honeywell SS411A Hall Sensors, I bought them for $2.50 each at my local dealer here in Switzerland.
Since they were wider than the slots in my EMAX GT5345 Outrunner, I had to carefully remove some stator material with a dremel. As I mentioned before, the result was not perfect since i did this by hand. After that I wired the hall sensors and just glued them into the slot using instant glue.
I'm quite sure that I shorted some of the stator layers with the dremel, so I feared some losses by eddy currents. But the testing showed that the motor temperature acts quite normal.

How I calculated the position of the hall sensors to achieve 120 Edeg spacing, can be seen in the attached picture. After calculation I realized that 120 mechanical deg means also 120 electircal degrees in a 14 pole/12 teeth motor.

Altogether I would say it is quite cheap and easy to add hall sensors and the result is really nice, the startup torque is just great. And I think it will be possible to get rid of the reverse problem as well.

I forgot to take pictures, I will do that as soon as I open up my motor again.

Best
fasser
 

Attachments

  • hall_sensor_fitting.jpg
    hall_sensor_fitting.jpg
    35 KB · Views: 5,126
Back
Top