How To Connect An Electric Bike Controller. E bike controller wiring

How To Test An EBike Controller At Home? (Explained)

Welcome To Electric Bike Tricks As long as you have researched how to test the controller for your electric bike at home, you most likely have a problem with the ebike and suspect that the cause is the controller or trying to make sure that your electric bike controller is working properly. So in this post, I will share with you the correct way to test the ebike controller as well as some useful information that you should know as long as you decide to test the controller at home. “If your electrical information is limited, do not worry, I will share the information with you in a very simple way”

First, let us know What are the components of the Controller and how does it work?

Ebike Controller Component

As I promised, I will simplify the information for you. The controller is exactly like the brain in the human body. Same like the brain communicates with all parts of the body through nerves, the controller of your ebike, uses wires to communicate, the electrical signals, and send the power required for each part of the ebike. There are mostly 9 wires that come out of the controller and are connected to your bike’s parts. Let’s start with knowing these wires before you start testing them.

  • Motor Lines are responsible to send the power to the Motor after receiving it from the battery.
  • Self Learning Lines are responsible for ensuring that the connections between the motor lines and hall sensors and the controller are in the correct connection positions.
  • Throttle lines are the connections between your ebike throttle controller. it’s responsible for sending receiving the order from throttle to motor through the controller.
  • Hall Lines are responsible for detecting the hall sensor in the motor in order to inform the controller whether the motor is OnOff.
  • PAS Lines are the Connections that detect your PEDAL Assist System and transfer the power to it.
  • LightHorn Lines for transferring the required electricity to your ebike light or horn.
  • Brake Lines are responsible for receiving the order from your brake to stop the ebike.
  • Batter Line (-) is the negative part connection that goes into the battery.
  • Batter Line is the positive part connection that goes into the battery.

How does the ebike Controller Works?

As we had mentioned earlier the controller is the brain or if you wish to say the CPU of your ebike.

The controller manages the voltage amperage through the sensors firmware so it controls every function of your electric bike.

It takes the electricity source from the battery, calculates its votages amps then distributes it to your ebike parts.

Check this two Minuets video for more info.

Testing Ebike Controller At Home

As a general rule, you can test your ebike controller by measuring the resistance of the MOSFETs inside the controller. you can tell that your controller is working normally if there is no short between the MOSFETs and the two battery lines.

There are two measuring methods that you can do at home.

Testing Ebike Controller by Multimeter.

In this method, you will need a digital multimeter that has either resistance measurement or continuum feature.

if your multimeter has a resistance measurement feature you will use it during the test then you can consider any wire of your controller that has more than 8 kilohms as a working line has no issues.

However, if you will use the continuum feature then you will hear a peep from the multimeter if there was a short.

Continuity test Meaning if the two parts are electrically connected which is in our case means that there is a short.

Resistance Test Meaning how much is the resistance for the flow of electrical current.

Check out this amazing Multimeter, I love I think everyone should have it (Get it on Amazon From Here)

Now let set up your Multimeter for testing.

  • Make sure that the black probe is connected to the negative terminal which will be labeled as COM the red Prob is connected to the positive terminal labeled as VΩmA
  • To set your Multimeter to Resistance measurement turn your multimeter to this sign Ω choose a low resistance

As we are now ready to test let’s get started.

To test your controller fast I suggest that you test one battery line with all the other lines of the controller first then test the second line with the other lines.

Step-by-step testing.

Turn on your multimeter.

Set it to continuum mode which I prefer as it will tell you if there is a short by giving a peep

Connect the black multimeter probe to the negative line of the battery.

Start testing every line coming out from the controller.

connect, electric, bike, controller, wiring

Please note that every line may have more than one cable so make sure to test every cable

If you heard a peep sound this means that you have a short in this line.

Now Connect the black Probe to the positive line of the battery test every single line coming out of it.

To measure the resistance.

Set the multimeter to resistance mode

Start the same testing steps we did in the continuity test but the difference here is that you will read all the numbers that appear on your screen of multimeter for every cable

Your benchmark is 8 kilohms if you find any reading below this number means that this line has damage not working probably

Testing Ebike Controller using ebike Tester

The best thing to use an ebike tester is that you will not only be able to test the controller but also you will test all the parts of your ebike.

there are a lot of ebike testers on the market also a lot of manufacturers has their own testers so better to check if your ebike manufacturing has a special tester for his models.

Now Let’s get started.

Ebike tester will allow you to test the controller hall signal wire, controller main wire, motor hall signal wire, motor coil, and throttle

How to perform the controller test using an ebike tester

  • First, take the controller out from the ebike.
  • take the throttle connection out from the ebike connect it to the controller, we do this to see if the controller will be able to handle the orders from the throttle
  • Now connect the tester controller wires to your ebike controller
  • Turn the tester ON
  • start turning the throttle on
  • if you find the tester lights blinking this means its working
  • if you find the middle light only lighting this means the controller is having an issue.

I Got this tester from amazon for 21 I really liked it’s very easy worked perfectly for more than one year now.

you can check it Here

If you test your controller and find no issue but you suspect it’s a software issue you can check our guide for how to factory reset ebike controller from Here

Conclusion:

As a general rule, you can test your ebike controller at home using either a multimeter or an ebike tester.

For Multimeter testing, you can do two tests Continuity test which will show you if you have a short by peep, or a Resistance test which will measure how much is the resistance and you can know there is damage if the reading was less than 8 kilohms.

For the Ebike test, you will find out if your ebike controller has an issue if only the middle light was lighting but if the controller working the five lights will keep blinking.

Thank you for visiting our website, If you find this post is helpful please feel free to use the social buttons below to share it with your friends.

Useful Posts for Ebike Controler Maintenance.

How Do You Shunt Mod An Ebike Controller? (Answered) This post is a step-by-step guide to MOD your Ebike Controller.

Why is my ebike going backwards? (Answered) explain the reason why ebike can go backward due to ebike controller cabling issue

How to Solve ebike Controller Overheating? (Answered) the reason why ebike controllers overheat solutions to avoid overheating

How To Connect An Electric Bike Controller

Despite flaunting an impressive motor and a high-capacity battery pack, you won’t comfortable E-bike experience unless you set up your controller. Although most off-the-shelf eBikes provide original controllers that are easy to repair and replace, converting a regular bike into an electric bike using an E-bike conversion kit can be somewhat difficult.

Nonetheless, setting up a DIY electric bike controller is really simple. After connecting all the other components (such as the battery pack, motor, sensors, etc.), you need to route the wires closer to the controller and connect them according to the connector design and color of the cables.

If you have any trouble understanding the fundamental cable connections and want to know more about how the controller works, bear with me as I’ll cover these and other topics such as:

  • Understanding the different types of cables in an eBike controller
  • Connecting an eBike controller
  • Testing an eBike controller
  • Basics of programming an E-bike controller
  • Common Functions of an eBike controller

With that said, let’s begin.

Understanding the Different Types of Cables in most Electric Bike Controllers

The thing about E-bikes is that the more expensive and complete the package is, the easier it is to repair and replace. Setting up a controller on a complete E-bike or a fully featured DIY kit is much easier because the connectors and cables on these controllers are designed specifically for that kit or bicycle.

With fully-featured kits or eBikes, cable management is a breeze. On top of that, you don’t have to look around for compatible third-party peripherals (such as ignition switches, displays, etc.), or worry about programming the controllers.

In most electric bikes and conversion kits, you don’t have to understand all the wires coming out of the controller as long as you know about the fundamentals necessary to keep the E-bike running.

These “fundamental” cables are common among every electric bike controller, and these include:

  • Battery Cables
  • Three-phase motor wires
  • Hall sensor wires
  • Throttle/Pedal Assist cables
  • Brake Cables

Let’s discuss their purpose.

Battery Cable

The battery cables are always easy to recognize because these two wires are located closer to each other. Most electric bike controllers have red and black-colored cable sheaths (indicating red for the positive voltage terminal and black for the negative).

These cables transfer from the battery pack to the electric bike controller, which manages the motors, and other loads in the electric bike.

Since these are power cables, they tend to be thicker depending on the power consumption of the electric bike controller; hence, it’s easy to identify them.

So, to recap: if you have relatively thick red and black wires sharing the same connector or situated closer to each other, those are the battery power cables.

Motor Power Supply Wires

After the battery cables, the second-most distinct set of power cables is the ones that feed power into the hub motor (or more specifically: the Brushless DC motor or BLDC). These cables are also easy to spot because have the same thickness with each having either blue, yellow, or green cable sheaths. (Representing the different phases or coils they connect to.)

In almost every DIY electric bike controller, these cables come in separate connectors. They are responsible for delivering current output in a sine wave or square wave (modified sine wave) pattern which makes the motor rotate smoothly. This AC-like pattern is created by the controller after taking in DC power from the E-bike’s battery pack.

Learning Cables

The learning wire or “self-learning wires” are more common among separate third-party sine wave controllers that do not include the hub motor and other accessories. These cables have the same colored sheath and come bundled together.

However, these “learning” wires have a female and male connector and are supposed to join together. (Creating a shunt/short circuit.)

The purpose of these wires: compensate for reverse motor configurations and throttle setups, making sure the phases and hall effect sensors operate in the correct sine/square wave sequence.

Reverse motor configuration happens when the phases of the motor do not match up with the phases of the controller (despite having the same colored wires). As a result, the motor rotates backward (anticlockwise). To remedy this, you can switch out the phases or join the male and female learning wires together. It will “undo” the initial motor phase sequence and rotate the motor in the opposite direction.

Also, depending on the electric bike controller, joining/shorting the learning wires could reverse the operating principle of the throttle (the motor will only slow down or stop when you twist or push the throttle.)

Therefore, it’s recommended to switch out the phase connectors (and try to get clockwise rotation that way) instead of counting on these “learning” wires.

(To see this in action, skip to 7.50 on this video.)

Hall Sensor Wires

The hall sensors are used to identify the position of the rotor with respect to the stator, and the signals from these sensors are necessary to keep the motor rotating smoothly. The input from the hall sensors determines the output of the phase wires.

Although sensorless BLDC motors exist, without the hall sensors, the E-bike wouldn’t be able to maintain torque or speed properly.

The hall sensor wires are very easy to spot since it comes with five or six small wires sharing the same connector. In some motors, the hall sensor might require six wires, but if you can make these five wires fit inside, it will work seamlessly.

Throttle Wires

Next up, we’ve got the throttle wires. These usually come with three small wires (red, black, and white) connected and sharing a single plug.

The red wire manages positive voltage, the black: negative, and the white wire transfers the acceleration/speed signal from the twist or thumb throttle.

Throttle connectors come in two different interface designs: the SM plug or a waterproof plug that looks like an XLR connector. Here’s where purchasing third-party controllers and throttles can go wrong, so make sure you check the connector type of the throttle before purchasing.

For beginners, I recommend this throttle as you can pick either option. However, if you are somewhat skilled in DIY wiring and want waterproof connections, you can install these adapters between your controller and throttle.

Brake Cables

The brake line cables are also easy to distinguish since the wiring branches off into two connectors after coming out of the same thick wire. Both these branches have the same type of connector and include two wires on each connector (hence, four in total).

The brake cables act as a switch, so whenever you pull on the brakes, the switch closes (gets connected in a short circuit), sending a signal to the controller. (Wherein it stops the motor from acceleration.) It is an important safety feature, and you need to make sure you set it up.

With complete conversion kits, you will be provided with brake levers with the sensor and compatible connectors built-in. However, if purchasing products separately, there’s the option between separate brake levers or a pair of hall sensors with appropriately sized magnets. (Both options include the same amount of wiring, but with the latter, you won’t need to replace your existing brake cable/levers.)

For examples of how to install the hall sensor magnets, check out this video.

Pedal Assist Cables

Certainelectric bike controllers, especially ones that come with a complete mid-drive conversion kit, will include dedicated connectors for the speed sensors. The appearance of these connectors will vary depending on the kit, so check the datasheet accordingly.

The wiring for this pedal assist system often includes a cadence sensor you can fit between the cranks and the pedals or a conventional speed sensor that uses a spoke magnet.

Unfortunately, setting up pedal assist for separate controllers can be difficult, and in most third-party hub motor controllers, this is not even an option.

Other Cables

Apart from the wires mentioned above (which maintain the critical functions of an E-bike), there are optional connectors such as:

  • Ignition Switch
  • Motor Speed Function
  • Cruise Function
  • Headlights, Brake Lights
  • Horn/Phone Charger
  • Display Screen

So before purchasing a separate controller, make sure to check these optional connectors and purchase the required components, if necessary.

How To Connect An Electric Bike Controller

Initializing the Controller

If you convert your E-bike using a dedicated kit or separate components, you need to connect the different components and test them before installing them on your bicycle.

Since it is difficult to test the hub motor, you can install it beforehand and house the bicycle on a repair stand. That way, you can test all the motor functions with all the other components that are yet to be installed.

Connect the battery, throttle, bicycle light, and any other peripherals you want to test and switch on the battery. (Make sure you don’t reverse the positive and negative terminals on the battery).

Here are a few things you need to check:

  • Check the throttle, and see if the signal works in the proper order.
  • Check the motor rotation; it is supposed to be clockwise.
  • Try the brakes. See if the bike’s motor cuts out when you pull on the brake levers (or pull the magnet away from the hall sensors)
  • Check the display, make sure it lights up, and show the correct speed (only works if you install the speed sensor)

Before you figure out where to set up your electric bike controller, it’s highly recommended you install all the other components (such as the rear wheel hub motors, battery, speed sensors, etc.). Because then, it’s easier to determine where all the wires can meet and get connected to the controller.

Figuring Out Where to Fix the Electric Bike Controller

In most cases, you will have to install the battery pack on the down tube (by replacing the water bottle cage), and the battery will have a very short wire. Therefore, you are most often limited to the main triangle area (downtube, top tube, seat tube) in which you can mount the controller.

So, find a spot on the main triangle where the battery line and all the other wires can meet (while also having some slack). If you are purchasing all the components separately, you might need to get additional cable extenders, especially for the motor wires coming from the hub motors to the controller.

(So basically, buying everything separately can be a nightmare and potentially cost twice as much, especially if you don’t have additional connectors, cables, and tools.)

Installing the Electric Bike Controller

The next part is getting the electric bike controller mounted onto your bicycle frame. Unless your kit provides one, you will have to purchase a controller box/case separately.

You can mount the controller directly using screws or zip ties (especially when you take it out for a test ride). Nonetheless, for added protection from the elements and insulating it from the metal frame, I recommend using a dedicated case or box.

connect, electric, bike, controller, wiring

There are tons of options, but make sure the dimensions match that of your controller.

Testing an Electric Bike Controller

If several wires on your new electric bike controller are not working, you can test the connections using a multimeter or a dedicated E-bike tester. However, please note that if you remove the enclosure, it might void the warranty.

Using a Multimeter

To diagnose a short circuit or fault within the controller, you need a simple multimeter with resistance or continuity settings.

First, switch to either setting and test for continuity between the positive and negative battery connectors. (If you can’t reach the metal connections, you might have to remove the cover and carry this out directly on the printed circuit board.)

If the resistor reads less than 8kΩ or the multimeter beeps, you’ve got a short between these two battery leads. After that, keep one lead connecting to the positive battery terminal and test for continuity on all the other wire connections. Finally, repeat the process with the negative terminal. (just to be sure.)

It is only a simple method of checking for short circuits, and if you still find any issues, it might be best to get it looked at by a professional.

Also, you can use an E-bike tester to diagnose the issue.

Picking Out an Electric Bike Controller

Although most controllers are the same, here are some things you should know about when picking a separate controller.

Voltage: Voltage is crucial. Make sure you pick out a controller that supports the voltage of your battery and motor. A 24V system will not work with your 48V eBike and vice versa. Luckily, most third-party controllers are designed to work within a range of 24V-48V.

Power: If you have a particularly high-power motor (such as a 1000W or 1500W), you might need a high-power electric bike controller because of the higher current flow.

Display: Also, don’t forget to pick out a compatible display that goes with the controller. Some kits will sell you the controller and the display screen, so don’t forget to check those out.

Conclusion

Connecting an electric bike controller is quite simple as long as you understand the different connections and where they go. The hard part is mounting it on your bicycle and ensuring it’s compatible with all the other third-party components.

Nonetheless, if you make it through this guide, you will understand what the electric bike controller does and how you can set one up for your electric bicycle.

Andrew Strider is an electric bike enthusiast. He currently owns 5 electric bikes and is an active member of his local electric bike club where he is able to test many other models/brands a few times a month.

When you purchase through our links, we may earn an affiliate commission at no additional cost to you.

How to Remove and Replace an Electric Bike Controller?

Are you looking for a complete guide on removing or replacing an electric bike battery?

We are going to guide you now on removing and replacing the controller. The controller is the inside part of the brain of the e-bike. The controller housing is the battery slides into to connect with the controller. It gets power from the battery, but then what it does is it gets information from your LCD, and then it tells the motor how much pedal-assist or how much power to give you.

How to Replace the E-bike Controller?

We will take that outright controller now and then replace it. It’s a pretty basic job, and it’s not difficult. All we need are two tools of Phillips and some snips. All right.

  • We will go ahead and snip the wires free. They are held by zip ties in three or four places and snip those. There is one down here that goes to the motor. Of course, you want to be careful that you don’t snip the wire itself.
  • Now, we can go ahead, and there are two screws here in the front called Phillips. They are very easy to remove. One and two numbers hold the front panel of the controller housing, and in this black part, you will see a little plastic tab on either side. We can use the screwdriver to push those and pull that front panel out.
  • The front panel comes out, and the controller will come along it. We can pull that right out of the front, and there it is connected to everything.
  • To change the controller,we need to disconnect it from all the wires holding it still onto the bike to replace it with a new one. What we will first start with is we have two leads going to the battery tip. They are black and red like you may have seen in a car.
  • Now We will take the electrical tape off it. And then, the next step would be to pull the leads apart at the clips, which happens when you can pull on the tape just then. The red and the red go together, and then we will unbind the black one. We will remove those apart as well with the black leads.
  • And now, the controller housing is free of the controller. So, we just unplugged the rest part. We have this connection in the yellow one, which goes to the pedal-assist, and the next one is for the throttle. It has a little clip, you push down that little clip, and they will drop apart. And now, the last part is the longest than the others. There is one that goes down to the motor. We want to pull that part, and then there is one more zip tie right there, which is a little slippery.
  • The controller is free now. And then feed the wire that goes to the motor. We have to feed it through the bike‘s frame. There is a little bit of cable management plastic right there, and you need to push that connector part through the frame, and there is one more zip tie. Some extra zip ties ones in; no harm it, and now, we need to move the other wires out of the way. And then, pull it right through the frame’s part it will come out. You will have the controller free of the controller housing and the bike, and then you can replace the controller.
  • Now, you can put the controller back in or the new controller, and now, first, you can connect the red and black lead. It’s going into the controller housing. They are very easy. They snap together like red and red, and then black and black are connected. Then next, there is yellow on that one, and you can match that up with the yellow one for the pedal assist. Put those wires between the rack arms.
  • There is also a little direction and directionality to the clips. You’ll see a little tab that will fit in there and little arrows. You can line up the arrows and then slide those back together.
  • The motor connection will have to be feedback through the frame. So, it will put it through between the seat stays and then down into the bike’s shell on the backside of the seat tube and push it. It is the trickiest part, just getting this part fed back through there. And then, this connection will go up to the LCD monitor and the brakes for the three-way part. Where is my connection?
  • Again find out the way that lineup. You can see a little tab, and there are also arrows, and it’s best to line up the arrows but do it very gently. You don’t want to hurt these parts. They are fairly delicate, and the connections are too.
  • And then, the throttle one’s very easy to see because it looks different than the other ones, snaps together with a nice positive snap. So then, now that we have the motor wire fed through the bike’s shell, line those two arrows up again, gently find the fitting, and then firmly push them together.
  • We have to put the controller back into the controller housing, tuck the wires away, and then the black wires coming out will be centered. And then, you’ll notice on the front plate of the controller housing that there is an opening area. Put where all the central wires are, click the front plate into place, the little snaps, and then we’ll secure it with those two little screws. Put in screw number one and number two, and that’s all there is. We are done.

Many well-known brand-name electric scooters and electric bikes have easy-to-install plug-and-play replacement speed controllers available in the market.

What if a Replacement Speed Controller is Not Available?

Most electric scooters and bikes have speed controllers made or wired specifically for that model. These speed controllers may only have connectors and wiring patterns unique to that model. Suppose a plug-and-play replacement speed controller is not available. In that case, a speed controller with the same Voltage rating and an equal or slightly higher Watts rating may be replaced for the original speed controller as long as it is wired to the other parts of the bike.

How To Install E-bike Controller?

If a speed controller is available, that will plug and play directly into an electric scooter or bike. However, when installing it, be careful because the connectors may be the same. However, the wiring patterns going to the connectors may differ from that of the original controller.

  • Double-check the wiring to ensure it is correct before installing the new controller. The pins can be removed and installed in different locations on the connector if the connectors are correct but the wiring going to the connectors is incorrect.
  • To rearrange the pins inside a connector, use a narrow metal rod to push on and bend the pins locking tab inside the connector, and then gently pull the wire and pin out of the back of the connector.
  • Now, turn the locking tab back to its original position and insert the pin back into the connector in the preferred location.

When the pin is fully inserted into the connector and the locking tab has been correctly bent back into position, it will make a small snap or pop sound to let you know that it has been perfectly installed.

Final Thoughts

We have tried our best to explain how to replace ad install the e-bike controller. If you still have any questions, comment below. We’ll contact you as soon as possible.

How to Tame Your Shady Chinese e-Bike Controller: Self-Learn Hall Sensor Calibration Mode

In my continued quest to discover new ways to EV on the cheap for builders, I’ve worked on demystifying several types of sketchy Chinese motor controllers to assess how applicable they are to little electric rideable things. My most recent favorite has been the “Jasontroller” electric bike controller. Like every other generic Chinese electromechanical product – it has no actual real name (the “Jason” moniker started as an inside joke in our EV contingency and is a bit of a satire on companies like Kelly), no well-known company with customer support to back it, nor any real details about hookup and operation.

(Scheduled plug: By the way, I still have alot of stuff for sale!)

Do you guys, like, know eachother?

Most of these generic Chinese e-bike controllers are pretty much the same functionality and firmware-wise, but what appealed to me specifically regarding that model is that it has a reasonably competent sensorless mode, complete with motor current limiting, for driving inertial loads, specifically vehicles. R/C type aircraft and car ESCs just aren’t the same in this regard; more details can be found in my Instructable on the matter. I’ve found that the sensorless mode on the Jasontroller is fine enough for scooters (and their design target, electric bikes) because you can always move just a little to avoid the zero-speed condition that sensorless is worst at. For things where you don’t get to push off, like Chibikart and DPRC, they’re somewhat hopeless. The algorithm is very simplistic and typical of ‘block’ commutation startup – just open-loop power the motor phases until a valid phase voltage waveform is detected. Usually in the case of an inertial load, the slow bobbing of the rotor is not strong enough to cause any significant motion and the startup fails. In the case of a cheap R/C type controller with no current limiting, the controller explodes from having to power a stalled motor.

While the controllers usually do have a Hall sensor connection, the hard part is adding sensors to the motor itself and connecting them correctly. In the past, I’ve accomplished this by both putting them inside the motor as well as outside on 3D printed mounts and cute sensor holder rings. Then, explaining the process of lining up the 3 sensor bits with the 6 internal states of the 3 phase motor usually takes at least half an hour and much confusion – without knowing the way the motor was wound (i.e. you didn’t wind it), there’s 12 possible ways to hook up motors and sensors and some times you have to brute force them all before finding the right one. Additionally, sensors aren’t optimal at anything except low speed anyway because they suffer from hysteresis-induced timing lag.

Optimally, you’d have a controller that uses the Hall sensor feedback just to kick off. Even if the sensor combo was total bullshit, actively driving the motor in one direction and getting some kind of positive position change is enough to begin ramping the motor sensorlessly up to speed.

What I’ve been kind of hiding is that many of the latest generation e-bike controllers, including the Jasontroller (I have enough of an emotional connection with the thing to name it), has this exact functionality. I’ve never explored it until recently when curiosity got the best of me, and I think this is a total boon for everyone who is building small EVs. It is now my goal to explain how the mode is used and what its limits are. There appears to be some confusion on how the mode is used (example and another), and as a result I haven’t seen it frequently mentioned.

We begin with a picture of the rear of a Jasontroller, where the mysterious Chinese sticker is located.

For your entertainment, I’ve fansubbed the Jasontroller below. I’m not gonna claim perfection with my several-versions-out-of-date Chinese language drivers, but hey, who else is gonna give you an English manual?

All of the Chinese e-bike controllers you can find are probably generally wired the same way. The funny thing is, as amusing as these devices are to me and many other EV hackers, I’m willing to bet that literally millions of people use them on a day to day basis and find them nothing too ordinary. These are generic replacement controllers for electric bicycles, moped, and scooters made and used by the millions in China. To people who have one of those things, it’s like changing windshield wipers or something.

Take note of the “Self Learn” wire in the lower right. The instructions on the bottom are basically how to use the self-calibration mode of the controller.

The magic green (may be other colors on your specific variant) wire is usually embedded in the forest of wires these things come with. It’s terminated in a small snap-on connector.

Basically, the controller recognizes that this pin is connected when you first power on. It attempts to run the motor sensorlessly and captures what the Hall sensor waveform looks like, saves it to memory, and then when throttle is commanded, it will power the phases according to what state the motor is in and what it ‘saw’. You can indicate that the motor is being learned in the wrong direction (by unplugging and reconnecting the self-learn wire once) and it will reverse the direction and record the states again, saving that and associating that direction with “forward”.

Nifty. That’s so much software I can’t imagine ever doing it myself. Luckily, some Smart Chinese guy has figured it out (and probably got pirated).

Here’s my Rig of Science that I set up. A 63mm outrunner with my custom Hall holder rig, externally adjustable so I can try and confuse the Jasontroller. The jumper wires that connected the sensor board to the controller was also rearrangeable. Basically, I wanted to see how much bullshit I can feed it and still have the thing work.

The process was basically to train it on a specific sensor arrangement, then swap the sensor combination around and move the board such that the timing is terribly off, and combinations thereof.

What I found was the following:

  • If sensors are present and the controller hasn’t been trained before, it will use the factory programmed motor state model.
  • The sensors must be 120 or 60 degree space electrically – if there is significant inequality in the spacing, the process incrementally gets worse and worse with spacing error until it just errors out.
  • If the sensors are incorrect (do not result in continuous motion) or throw an error for any reason, it will automatically try to switch to sensorless mode.
  • Once “trained” for a specific sensor arrangement, it will retain that and use it for any other motor it is connected to until trained otherwise, pursuant to the above rule.
  • The sensors are only used for low-speed and stall conditions. There is an audible transition to sensorless mode – the motor sounds “smoother”, lacking the hard-switched sound of the sensored mode.
  • Sensored mode does not bypass the internal hardware “speed limit” as a result – the processor is still only capable of running the motor to a relatively modest speed.

There were moments where I got the controller “stuck” in sensored mode, but I can’t consistently replicate the problem. It seems to happen only when the sensors are horrifically off-timing that, I assume, the sensorless algorithm cannot lock in, but why it doesn’t just ditch the sensors at that point is not known to me.

Additionally, another weird symptom that happened several times but I cannot replicate reliably is that if only 2 sensor wires are swapped, it catches on and figures the problem out. The first start is false and runs sensorlessly, but the next start is properly adapted to the new sensor arrangement.

The fuck? Are these things actually sentient and just messing with me instead of vice versa?

Basically, what I found is that if you line up any sensor with a slot (placed in the middle), the controller will figure it out just fine. For any sensor over a slot, there’s a valid combination that will result in motion, maybe not in the intended direction (but that is what the “reverse learn” switch is for, right?). In the above picture, the rightmost sensor is centered over a slot. I don’t have any info on how this motor wound, so which slot it is is completely not known!

If a sensor is not centered in a slot, then the startup gets rougher and rougher with increasing error until it just switches to sensorless. The transition between sensored and sensorless mode also becomes less smooth.

summary

Here’s a video where I demonstrate how to use the auto-calibration as well as illustrating what happens if a sensor is not located over one slot.

conclusion

Suddenly, the Jasontrollers have become alot more favorable to me. I’ve had a few of them die running all-sensorless into an R/C type outrunner because the current limiting circuit is just not fast enough for those motors, which are generally super-low inductance (current changes very quickly).

Not even Kelly controllers can do this sensor auto-recognition thing right now, and they are currently my go-to for when someone asks me what controller to use for their brushless setup. Calibrating sensors and adjusting timing is one of the worst “black box” magic processes that people have to do, and they matter alot in having smooth vehicle operation.

This neat little feature will save alot of time and effort in vehicle construction. All you really need now is a way to mount sensors to the motor.While I now favor external sensors for outrunners due to their ease of adjustment, the controllers having an automatic sensorless switchover after a certain speed means that embedding sensors in the middle of a slot (inside the motor, by taking it apart) is completely reasonable. This would be an option for people who do not have, or want to make, an external sensor-holding jiggie thing.

I’m probably going to try throwing Halls in DPRC‘s 50mm outrunners in order to truly test this hypothesis under load.

Of course, now I also really want to start selling these sensor holders and boards. Perhaps that will be a product line parallel to RageBridge…

Why should I go to the length of adding sensors to my motor to use this feature?

Most commercial sensorless motor controllers usually fail at zero and low speed because they depend on having a voltage feedback from the motors to determine rotor position, only possible with continuous motor motion. This means you have to be moving before you can move. While this is okay for, say, scooters and bikes because it is totally reasonable to push off with a foot before hitting the throttle, the same is not true of go-karts, robots, wheelchairs, etc. which you cannot really push off without compromising the function of the vehicle. These MUST have a “zero speed” torque on demand.

What should the motor and sensor arrangement be?

connect, electric, bike, controller, wiring

The sensors should be spaced 120 or 60 electrical-degrees (both industry standards), mostly because they divide equally into 360 degrees. Incorrect spacing will probably just result in the controller bailing out to sensorless mode anyway. The way to tell is if the motor has very little startup torque or just twitches helplessly. One sensor should be aligned with 1 slot between the windings on the stator and the controller will be able to figure out the rest. This is true for a standard 12-tooth stator with fractional magnet to slot ratio, anyway – other motors are currently not determined. If the sensor is not aligned with the slot, the startup and switchover transition become rough and rougher with positioning error.

Is this really simpler than running a normal, all-sensor-commutated controller like a Kelly?

Oh hell yes. There is no more playing the keep-it-change-it-flip-it game with sensor vs. phase combinations.

So, simpler, and I believe potentially better. Hall sensors introduce significant timing lag at higher speeds, and the optimal sensor position also changes with speed and load. Having the sensors there only for startup solves the low end torque issue, while driving the motor sensorlessly at high speeds effectively means you drive the motor more according to how it wants to be driven at a given speed and current draw.

Note that your shady-ass generic Chinese e-bike controller may be different. I can only account for the controllers retailed by “bobzhangxu” on eBay at the moment. However,

That lead image. Be prepared for a massive Beyond Unboxing post in the next few days where I will attempt to catalog several different shady e-bike controllers and see which ones can perform this training routine! I literally went on eBay and bought 1 of every controller that was under 30 with free shipping or under 40 with shipping. There are 7 in total. The intention is to make an index like my copier motors spreadsheet.

thoughts on “How to Tame Your Shady Chinese e-Bike Controller: Self-Learn Hall Sensor Calibration Mode”

Wow. This is ridiculously awesome, I can’t wait for the Beyond Unboxing post. Will it include testing for maximum electrical RPM?

You’re doing a valuable service for the community. I commend you on that. There’s a lot of lore caught in the interwebz, so it’s nice to see some truth.

Posts

  • Bots
  • Events
  • BattleBots 2016
  • BattleBots 2018
  • BattleBots 2020-21
  • Dragon Con
  • East Asia 2014
  • Electric Vehicle Design
  • Postmodern Robotics
  • Shop Ninja
  • Done!
  • caddiebike
  • Candy Paint Gold Teeth
  • Chibi-mikuvan
  • Chibikart
  • Cold Arbor
  • colsonbot
  • crabmower
  • CRJ Wallbanger
  • D.P.R. Chibikart
  • dewut?
  • Emergency Quadrotor
  • eNanoHerpyBike
  • Fankart!
  • Kitmotter!
  • Land-Bear-Shark
  • LOLrio Kart
  • Make-a-Bot
  • Melon-scooter
  • Melon-scooter 2
  • Melonbike
  • Nuclear Kitten 5
  • Null Hypothesis
  • Overhaul 2
  • Pad Thai Doodle Ninja
  • Pop Quiz 2
  • Project RazEr
  • RazEr REV2
  • RazEr rEVolution
  • RazErBlades
  • Roll Cake
  • sadbot2016
  • SEGFAULT
  • Snuffles
  • Stance Stance Revolution
  • Straight RazEr
  • Susquehanna Boxcar
  • Test Bot 4.5 SP1
  • Tinycopter
  • TinyStar
  • Tomy Omnibot
  • trashcopter
  • Twelve O’Clocker
  • Überclocker
  • Überclocker 4
  • Überclocker 5.0 – 30Haul
  • Überclocker ADVANCE
  • Überclocker Remix
  • your waifu is trash
  • IDIocracy
  • Overhaul 1
  • Overhaul 3
  • Ballcopter
  • Chibicopter
  • Chuckranoplan
  • derpdrive
  • ME2. X
  • The Next 3D Printer
  • Wigglecopter
  • mikuvan
  • murdervan
  • spoolbus
  • vantruck
  • Beyond Unboxing

parts and stuff

  • Adafruit
  • AndyMark
  • Digi-squee
  • Harbor Fright
  • Hobbykong
  • Little Red Saw
  • McFaster-Carr
  • MonsterSqueeterParts
  • Robot Marketspace
  • Some Electronics
  • Sporkfun Electronics
  • SuperDuperMagnetMan
  • Surplus Centroid

read this

  • Adafruit Learning System
  • FUNdaMENTALS of Design
  • Gizmology
  • I is for Current
  • Machine Tool Archive
  • Mini-Lathe
  • Motor Winding Generator
  • My Instructables
  • Practical Machinist
  • RoyMech
  • Tatjana van Vark
  • Theoretical Machinist

Recent Posts

  • Operation IDIocracy: The Rebuildening, Part IV – The Road to Reassembly 2023-05-13
  • Operation IDIocracy: The Rebuildening Part III – The Quest For head 2023-03-27
  • Operation IDIocracy: The Rebuildening, Part II 2023-03-12
  • Operation IDIocracy: The Rebuildening, Part 1 2023-02-26
  • Operation IDIocracy: THE BIRTHENING 2023-01-20
  • The First of the Year! Operation IDIocracy: Time for the Teardown 2023-01-01
  • How Haven’t I Built One of These Yet? The Tale of Melonbike 2022-11-28
  • Operation IDIocracy: The Terroristic Reign of Snekvan; Adding Instrumentation, Boost, and Fuel 2022-11-20
  • Operation IDIocracy: You 3D Printed the What? Intake Adapter, Charge Air Hose Routing, and Exhaust 2022-10-07
  • Operation IDIocracy: Oil Return and Bilge Pump 2022-10-01

Leave a Comment