Pedal assist speed sensor - detect back pedalling

Roncos

1 mW
Joined
Oct 8, 2016
Messages
19
I'm researching a diy ebike project. Today I'm looking at speed sensors. Planning to use teensy 3.2 as microcontroller.

I think the cheap sensors (like the one at the link below) cannot tell direction of rotation. Is this true? I would like to be able to detect back peddling. How do other projects deal with this? Is there an alternative sensor? Easy mod to this sensor? Extra magnet? Or can direction be inferred somehow?

Thanks

Ron

http://www.ebay.co.uk/itm/33-5-Electric-Bike-Pedal-Booster-Assist-Sensor-Bicycle-E-Bike-Assistant-Part-UK-/162206281793?hash=item25c43f7041:g:Y1IAAOSwAuZX3Oad)
 
They only work in one direction, but you can reverse the direction by flipping the magnet disc so that it rotates in the other direction. if you want to detect both forward and reverse pedalling separately, you can use two of those sensors, one on each side.
 
d8veh said:
They only work in one direction, but you can reverse the direction by flipping the magnet disc so that it rotates in the other direction. if you want to detect both forward and reverse pedalling separately, you can use two of those sensors, one on each side.

Thanks for your answer. Are you sure about this? If the sensor is a simple Hall effect sensor then it should work equally well in each direction but not know the direction. How can it ignore the magnets in one direction? What does the physics/ electronics inside the pick up look like?
 
First, the unit that you linked has only 5 magnets - not a good choice. Go for a 12 magnet unit that will allow you detect start/stop pedaling with less crank rotation.

Next, there are two types of PAS units - with either one or two halls. The incredibly cheap models have a single hall and pulse when pedaling in either directon. The better models use the second hall to condition the output so you only get pulses in the forward direction. Unfortunately, in your case you wish to actually get a signal in the reverse direction AND be able to determine direction.

However, if you start with one of the better 2-hall units this capability is easy to obtain by bypassing the internal logic (which is pretty simple-minded) and routing the output of both raw hall signals to your uproc directly. You can arrange/leave pull-up resistors in the sensor head or add them to the chip input ports.
Here's a post about doing that mod on my Mundo build.

80-12_reworkedPasPickup.jpg
The two halls are offset less that the inter-magnet offset and so generate a quadrature signal like this:

QuadratureEncoding.png
As you can see, it's pretty simple to determine the direction by using the RPM signal to enable logic that looks at the direction of transition of the DIR signal (i.e. scan the image right-to-left (REV rotation) vs left-to-right (FWD rotation) and eyeball the red line transition only while the green is high).

Easy-peasy. :D
 
Nice post, Telektik. Very well done solution.

I've only owned the three wire Hall sensors that only has one signal output, so presumably only have one sensor. They have puzzled me ever since I installed my first PAS sensor.

I put that one on the non drive side, and it just happened to work right. Much later, when I went to grease the BB later and inadvertantly flipped the disk, the controller only detected the cranking if I spun it backwards. It figured that the disk had an arrow, and I had to have it spin the right direction. Must have to do with the polarity of the magnetic field.

The next one, I figured I had better put on the drive side. I did, and the disk had no arrow, but I faced the shiny side toward the sensor and it worked.

Now I am at my third sensor. I put it on the non drive side because I didn't want to pull off the crank arm. I played with it off the bike. It seemed like it only worked if the magnet came in toward the pointed end. So I mounted it that way. Then I saw that to work right, the arrow was pointing the wrong way. It's OK. I'll take it. The controller does not detect backward pedaling either.
pas_4.jpg

Finally, my last usage of the orange PAS sensors was as a speed sensor on a rear wheel. I fiddle with it til I get a speed reading. When I'm done, I realize that the magnet comes in from flat end. OK. I'll take it. it works. Today, I learn something new. My controller reads the speed if I spin the wheel backwards too. Remember, this is a different input, not the PAS input.


I could go and think about this info. I worked in semiconductor physics years ago. It's all hazy. If I ever build another ebike, I will just continue to fiddle with the PAS mounting til I get it working right.
 
Yep - the two hall units only have one output that is conditioned internally by the second hall to work cranking only one way. Because there's only a single output, folks think there's just a single hall in there, but there's a little more going on than meets the eye... :)
 
It's the double hall ones that are handed, so be careful. It's the 12 magnet PASs that often have the double hall sensor. On a single hall one, the orientation and direction of the magnet affects the signal patern, which is how the controller can see the direction. Single hall ones are not handed, which gives you more fitting options.
 
In NYC all throttle Ebikes are illegal, only class 1 ebikes, pedelecs are immune, but throttle is very necessary from a stop on heavier/(+fast) ebikes. When the light goes green, car traffic gets impatient with slow to get going bikes and struggling to get away to a decent cadence can be difficult when drivers start getting silly and honking/swerving around :( and much more so if you forgot to gear down before stopping and don't have a CVT or IGH that can shift from standstill!
To that end I noticed that the cheapo single hall PAS, (biggest I've seen was 12 magnet,) will allow the forward signal on a freewheeling backpedal ;) so with an auxiliary PAS grin up/down switch (and updated aux input firmware) I can moderate my takeoff power how I like and reduce power for comfortable cadence (or phantom/ghost pedal to accelerate, which although a little different to most people's standard PAS programming, is nevertheless a workable PAS as throttle workaround, if not quite a 'mod.'
 
Clever workaround!

If you want to go for a bit faster response (more magnets), you could use one of the new Grin 24 magnet sensors, disconnect the direction pin (DIR), and configure the CA for 1-wire operation. The disconnected pin will go high and will always report the same direction so the CA will use the RPM pin regardless of which way you actually pedal.
 
Back
Top