## Alight sin/cos encoder of motenergy motor with SEVCON

General Discussion about large electric scooters and motorcycles and other things with no pedals.
sanfox
100 µW
Posts: 8
Joined: Mar 27, 2015 12:14 am

### Alight sin/cos encoder of motenergy motor with SEVCON

I try to make instruction “How to alight sin/cos encoder of motenergy motor with of without SEVCON”.
Information collected from different sources. Guys, who have deal with it, please confirm this information or correct it.
At the picture below you can see encoder location inside of the ME1302 motor.
motor.JPG (76.52 KiB) Viewed 1069 times
So to tune the encoder we must go thru several steps.

1. Mechanical alignment by measuring values with oscilloscope.

Note from motenergy drawing below.
“Sensor timing: with BEMF oscilloscope probe attached to M1 and ground probe attached to M2, the BEMF rising edge zero cross should lead the sin wave (sensor pin A to sensor pin C gnd) zero cross by 20 electrical degrees of the BEMF waveform.”

As the rotor has 8 magnets (4 pole pares) by one rotation of rotor we have four electrical rotations of BEMF. So the 20 electrical degrees of the BEMF equal to 5 degrees of rotor rotation. That is not so simple to hit this value. At the graphs below you can see waves comparison in two scales of x – axis.
GRAPH1.JPG (64.77 KiB) Viewed 687 times
GRAPH2.JPG (66.68 KiB) Viewed 687 times
Using home made oscilloscope attached to soundcard line in measuring waves looks like this.
Oscilloscope.JPG (93.45 KiB) Viewed 687 times
Connection of soundcard oscilloscope to the motor showed below.
connection to motor.jpg
2. PMAC encoder commission by Sevcon DVT macros.

a) Set peak torque to 0.0 Nm – this should prevent torque being applied to the motor during testing and alignment. This is only necessary if your setup allows you to rotate your motor by another means i.e dynamometer. If this is not possible and you will use the Gen 4 to spin up the motor then leave this set to its current value.
Peak torque.JPG (27.37 KiB) Viewed 687 times
b) Commission Sin Cos Encoder (Check of sinusoidal curve amlitudes )

1). Turn the controller off then on again.
2). Spin the motor with manual power (hand spin the motor).
3). After spinning – use the helper and bring up “pmac encoder”
encoder commision.JPG (49.29 KiB) Viewed 687 times
4). Click “commission sincos encoder”.
5). Turn the controller off then on again.
6). Check sine and cosine peak and trough voltages:
- Peak voltages should not exceed 4.5 Volts.
- Trough voltages should not descend below 500 mV.
- Peak to trough swing on sine and cosine should exceed 1.0 Volts.

Note from motenergy drawing:
“If timing the sensor using a Sevcon controller, the encoder position should be within +/-3 degrees of zero.”
1). Verify that peak torque is still set to zero.
2). Ensure that Ud and Uq values are being monitored via a TPDO.
UdUq.JPG (53.36 KiB) Viewed 687 times
3). If the previous steps were performed correctly, you should now see the Ud and Uq items being monitored
UdUq_log.JPG (73.67 KiB) Viewed 1069 times
You can now specify a “Filename” (bottom right of the screen capture), while preserving the .csv extension and you are ready to take a trace using the control buttons at the top of the window. Press the “Reset” button (looks like a rewind button), followed by the “Start trace” button (looks like a play button) to start a new trace.
1) AT THIS POINT YOU ARE READY TO TAKE A TRACE
2) In order to be able to read the Ud and Uq values accurately, you need to turn the electric motor externally (using a power drill for example, or the vehicle’s own inertia). If possible to use some external power to turn the motor, then you can start a trace as explained above and collect the information (use the “Stop trace” button – looks more like a pause button). If that is not possible, then you can drive the motor using our Gen4 controller and when reaching full speed, select neutral or remove motoring torque to the Gen4 controller and start a trace as the motor starts to decelerate. Note: You must have 0 neutral braking set and the bridge still enabled to successfully trace this,
3) Once the trace was stopped (it is automatically saved in the “C:\C6944\DVT\veh_if_log” folder), you can use the built in utility (“PMAC Encoder” button on the main page of the DVT Helper) to look at the offset angle.
Graph voltage vector.JPG (75.2 KiB) Viewed 687 times
4) Click on the “Graph Voltage Vectors” button in the “PMAC Encoder Alignment” window and you will be prompted to select the trace file you collected in the previous steps. Once you select the appropriate file, you will see a new window that shows the encoder alignment. In the screen capture above, the encoder is slightly misaligned (you see the graph points form a bar tilted slightly to the left of the Y axis). To correct the encoder alignment, pick a point in the middle of that bar made of multiple points and click the mouse on it). You will see an alignment value display in the textbox below the graph. Press the “Subtract Calculated Angle from Offset” button to commit the new alignment value to the Gen4 controller.
5) Recycle power to the Gen4 controller key switch and repeat the test to verify that the encoder is properly aligned. If the motor is spinning in the forward direction, a well aligned encoder will produce a bar that is positive and along the Y axis in the graph above.
3250 km in hybrid mode
My car discription at http://www.evalbum.com/5316

methods
10 GW
Posts: 4986
Joined: Aug 08, 2008 12:08 pm
Location: Santa Cruz CA
Contact:

### Re: Alight sin/cos encoder of motenergy motor with SEVCON

OMG... this is solid gold.

Thank you for taking the time to post this!
This is very valuable information for those attempting to get up and running. I am going to cross-link it with some other Sevcon related material.

thanks,
-methods
"One test is worth a thousand opinions"
(of course... that is fechter's signature... and .... too important not to repeat)

sanfox
100 µW
Posts: 8
Joined: Mar 27, 2015 12:14 am

### Re: Alight sin/cos encoder of motenergy motor with SEVCON

Encoder angle from voltage vectors
During forward rotation, points without field weakening must locates on the Ud axis or a little to the left of it. When the field weakening starts, points begin moving further to the left.
So a properly configured encoder will prevent voltage in quadrant 1!
Ud Uq axes.JPG (34.07 KiB) Viewed 1056 times
Maximising the Output Efficiency

Making small changes to the offset angle of only one degree at a time is a good way to see how the alignment of the encoder affects the efficiency of the motor. The above method does not provide an exact encoder offset value. This is due to a cross coupling effect where it is normal for some q-axis current to be seen on the d-axis and vice versa, even for a perfectly aligned motor. However, by keeping a constant torque demand and monitoring the motor speed instead, you can get a better idea of what adjustments should be made to the offset.
Remember, the main objective here is to get maximum motor output for a given input. Keep the torque demand constant and perform more adjustments to the offset angle. You should find that for different offsets, the motor speed will stabilize at different values. It may take a while for the speed to level out, but with some experimentation you should be able to find a more accurate offset value.
You can graph the voltage vectors to double check the encoder angle after using this technique.

This process slightly reminds for me an ignition distributor tuning at idling speed alignment on internal combustion engine.
3250 km in hybrid mode
My car discription at http://www.evalbum.com/5316

methods
10 GW
Posts: 4986
Joined: Aug 08, 2008 12:08 pm
Location: Santa Cruz CA
Contact:

### Re: Alight sin/cos encoder of motenergy motor with SEVCON

Back to the top...

Since we have a member with only 4 posts who clearly described a way to solve a tough problem that a lot of us run into....

At Calfee Design we use an automated calibration station that works by measuring freewheel power while adjusting timing to converge on the correct setting.

At Motenergy they clock the magnets using a jig... so every one is the same.
For Early Zero motors the magnets are randomly set and require both angular clocking and amplitude (depth)
For later Zero motors (and Motenergy) the amplitude is solved with a better chip.
No idea if later model Zero motors still require clocking...

But we are seeing a lot of these in the field, DVT is tough to use, and this should help bound the problem.

Rumors are there is some software out there that Zero Dealers use to calibrate the Encoder while the bike is fully assembled.
Super useful ah?

I am desperately hungry to refactor some of the tools I have seen (written in Python) (over to) LabVIEW... but my days of running 100 - 1000 hour projects for free are over. I have to work to eat, so I focus on what pays... then I have kids... startup companies... and of course big wave season is coming.

-methods
"One test is worth a thousand opinions"
(of course... that is fechter's signature... and .... too important not to repeat)

SkateScepterGuy
1 mW
Posts: 14
Joined: Jan 04, 2015 1:48 pm

### Re: Alight sin/cos encoder of motenergy motor with SEVCON

Sanfox, thanks for posting this. VERY helpful in setting up the encoder angle. I was able to get mine set up though oddly enough when I had it set "properly" with 0 degrees of offset my motor would make a weird grind / groaning noise on moderate to hard acceleration. With several butt dyno test rides I found a happy medium of 6 degrees offset where the motor seemed to work fine, was close to 0 but wouldn't make any noises or controller cut off on hard acceleration.

Unfortunately, I always get this fault message. 0x46c2 "Sincosin Tracking Warn". Even if I have the encoder offset set perfectly on the vertical line.

Any ideas what would cause this?

sanfox
100 µW
Posts: 8
Joined: Mar 27, 2015 12:14 am

### Re: Alight sin/cos encoder of motenergy motor with SEVCON

I thihk that the warning means sin/cos voltage values is out of normal commission range.
sincos mistake.JPG
3250 km in hybrid mode
My car discription at http://www.evalbum.com/5316

Ingo
10 mW
Posts: 22
Joined: Nov 03, 2016 6:22 am
Location: Germany

### Re: Alight sin/cos encoder of motenergy motor with SEVCON

hi,

someone disable or rewound a ME1302 or 1304 ?