Alight sin/cos encoder of motenergy motor with SEVCON

General Discussion about large electric scooters and motorcycles and other things with no pedals.
Post Reply
User avatar
sanfox   100 mW

100 mW
Posts: 35
Joined: Mar 27 2015 12:14am

Alight sin/cos encoder of motenergy motor with SEVCON

Post by sanfox » Jun 01 2017 8:14am

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
motor.JPG (76.52 KiB) Viewed 8117 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
GRAPH1.JPG (64.77 KiB) Viewed 7735 times
GRAPH2.JPG
GRAPH2.JPG (66.68 KiB) Viewed 7735 times
Using home made oscilloscope attached to soundcard line in measuring waves looks like this.
Oscilloscope.JPG
Oscilloscope.JPG (93.45 KiB) Viewed 7735 times
Connection of soundcard oscilloscope to the motor showed below.
connection to motor.jpg
connection to motor.jpg (153.35 KiB) Viewed 6993 times
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
Peak torque.JPG (27.37 KiB) Viewed 7735 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
encoder commision.JPG (49.29 KiB) Viewed 7735 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.
3. Adjusting the encoder offset

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
UdUq.JPG (53.36 KiB) Viewed 7735 times
3). If the previous steps were performed correctly, you should now see the Ud and Uq items being monitored
UdUq_log.JPG
UdUq_log.JPG (73.67 KiB) Viewed 8117 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
Graph voltage vector.JPG (75.2 KiB) Viewed 7735 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

User avatar
methods   100 GW

100 GW
Posts: 5113
Joined: Aug 08 2008 12:08pm
Location: Santa Cruz CA
Contact:

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

Post by methods » Jun 01 2017 10:13am

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
Increasing battery voltage and controller current limit will result in a non linear experience

User avatar
sanfox   100 mW

100 mW
Posts: 35
Joined: Mar 27 2015 12:14am

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

Post by sanfox » Jun 02 2017 1:51am

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
Ud Uq axes.JPG (34.07 KiB) Viewed 8104 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

User avatar
methods   100 GW

100 GW
Posts: 5113
Joined: Aug 08 2008 12:08pm
Location: Santa Cruz CA
Contact:

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

Post by methods » Sep 24 2017 11:02am

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
Increasing battery voltage and controller current limit will result in a non linear experience

SkateScepterGuy   1 mW

1 mW
Posts: 12
Joined: Jan 04 2015 1:48pm

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

Post by SkateScepterGuy » Nov 14 2017 2:39pm

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?

User avatar
sanfox   100 mW

100 mW
Posts: 35
Joined: Mar 27 2015 12:14am

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

Post by sanfox » Nov 20 2017 6:32am

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

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Apr 05 2020 4:06pm

Can I use a ftdi rs232 adapter usb to access sevcon controller programming? Via Arduino sketch?


Sent from my iPhone using Tapatalk

kiwifiat   100 W

100 W
Posts: 251
Joined: Mar 16 2013 5:49pm
Location: Vancouver, Canada

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

Post by kiwifiat » Apr 05 2020 5:38pm

Robinev wrote:
Apr 05 2020 4:06pm
Can I use a ftdi rs232 adapter usb to access sevcon controller programming? Via Arduino sketch?


Sent from my iPhone using Tapatalk
Sevcon speaks CAN, a USB to RS232 won't cut it. Take a look at this project. https://github.com/dexterbg/Twizy-Cfg
The project demonstrates that is possible to change the configuration of a sevcon without DVT and an IXXAT usb->can adapter but as it stands it is not a replacement for DVT.
“You never know if quotes on the internet are genuine.” - Abraham Lincoln

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Apr 05 2020 6:00pm

kiwifiat wrote:
Robinev wrote:
Apr 05 2020 4:06pm
Can I use a ftdi rs232 adapter usb to access sevcon controller programming? Via Arduino sketch?


Sent from my iPhone using Tapatalk
Sevcon speaks CAN, a USB to RS232 won't cut it. Take a look at this project. https://github.com/dexterbg/Twizy-Cfg
The project demonstrates that is possible to change the configuration of a sevcon without DVT and an IXXAT usb->can adapter but as it stands it is not a replacement for DVT.
Awesome thanks for your feedback. I read it how ever it did not mention flashing dld motor files to it I’m assuming that its another hurdle to figure out. This is great I’ll dig deeper as soon as I figure which pins are tx rx and ground


Sent from my iPhone using Tapatalk

kiwifiat   100 W

100 W
Posts: 251
Joined: Mar 16 2013 5:49pm
Location: Vancouver, Canada

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

Post by kiwifiat » Apr 05 2020 9:14pm

Robinev wrote:
Apr 05 2020 6:00pm

Awesome thanks for your feedback. I read it how ever it did not mention flashing dld motor files to it I’m assuming that its another hurdle to figure out. This is great I’ll dig deeper as soon as I figure which pins are tx rx and ground


Sent from my iPhone using Tapatalk
I mistook your meaning of "programming". I haven't come across any third party solution for flashing DLD files. That said the older IXXAT adapters come up on EBay from time to time for under $300USD.

It would certainly be possible to flash DLD files without an IXXAT and DVT but you would need some fairly good programming skills to do it and be able to read the routines from within DVT that handle that specific task. DVT is written in TCL, https://en.wikipedia.org/wiki/Tcl. It is easy to open the original DVT files to look at what is going on in the background. There is an OpenCan library for Python so if you have the skills it would make a great project.
“You never know if quotes on the internet are genuine.” - Abraham Lincoln

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Apr 05 2020 10:46pm

kiwifiat wrote:
Robinev wrote:
Apr 05 2020 6:00pm

Awesome thanks for your feedback. I read it how ever it did not mention flashing dld motor files to it I’m assuming that its another hurdle to figure out. This is great I’ll dig deeper as soon as I figure which pins are tx rx and ground


Sent from my iPhone using Tapatalk
I mistook your meaning of "programming". I haven't come across any third party solution for flashing DLD files. That said the older IXXAT adapters come up on EBay from time to time for under $300USD.

It would certainly be possible to flash DLD files without an IXXAT and DVT but you would need some fairly good programming skills to do it and be able to read the routines from within DVT that handle that specific task. DVT is written in TCL, https://en.wikipedia.org/wiki/Tcl. It is easy to open the original DVT files to look at what is going on in the background. There is an OpenCan library for Python so if you have the skills it would make a great project.
Thanks how about the dvt software is that in got hub?


Sent from my iPhone using Tapatalk

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Apr 07 2020 9:25am

kiwifiat wrote:
Robinev wrote:
Apr 05 2020 6:00pm

Awesome thanks for your feedback. I read it how ever it did not mention flashing dld motor files to it I’m assuming that its another hurdle to figure out. This is great I’ll dig deeper as soon as I figure which pins are tx rx and ground


Sent from my iPhone using Tapatalk
I mistook your meaning of "programming". I haven't come across any third party solution for flashing DLD files. That said the older IXXAT adapters come up on EBay from time to time for under $300USD.

It would certainly be possible to flash DLD files without an IXXAT and DVT but you would need some fairly good programming skills to do it and be able to read the routines from within DVT that handle that specific task. DVT is written in TCL, https://en.wikipedia.org/wiki/Tcl. It is easy to open the original DVT files to look at what is going on in the background. There is an OpenCan library for Python so if you have the skills it would make a great project.
One shot and dshot signals won’t work with pmac motors?


Sent from my iPhone using Tapatalk

kiwifiat   100 W

100 W
Posts: 251
Joined: Mar 16 2013 5:49pm
Location: Vancouver, Canada

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

Post by kiwifiat » Apr 08 2020 3:38pm

Robinev wrote:
Apr 07 2020 9:25am

One shot and dshot signals won’t work with pmac motors?


Sent from my iPhone using Tapatalk
Please rephrase your question I don't understand what you are asking.
“You never know if quotes on the internet are genuine.” - Abraham Lincoln

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Apr 11 2020 10:32am

kiwifiat wrote:
Robinev wrote:
Apr 07 2020 9:25am

One shot and dshot signals won’t work with pmac motors?


Sent from my iPhone using Tapatalk
Please rephrase your question I don't understand what you are asking.
Sorry the last question was meant to be about benefits to sin cos signals.? is regen? All I see benefits ac power. I favor dshot2600 in my rc race freestyle drones. These signals are much more informative and responsive.


Sent from my iPhone using Tapatalk

kiwifiat   100 W

100 W
Posts: 251
Joined: Mar 16 2013 5:49pm
Location: Vancouver, Canada

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

Post by kiwifiat » Apr 13 2020 7:56pm

Robinev wrote:
Apr 11 2020 10:32am
Sorry the last question was meant to be about benefits to sin cos signals.? is regen? All I see benefits ac power. I favor dshot2600 in my rc race freestyle drones. These signals are much more informative and responsive.

Sent from my iPhone using Tapatalk
I have never heard of dshot2600 nor does a google search provide any meaningful information. I can say the a sin/cos encoder is one method of providing accurate rotor electrical angle to the nearest degree which is a prerequisite for FOC controller operation. I doubt that there is an RC motor on the planet that is fitted with a sin/cos resolver due to the weight penalty.
“You never know if quotes on the internet are genuine.” - Abraham Lincoln

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » May 13 2020 3:04pm

Dshot2400 is for brushless dc motors using telemetry it’s a square wave signal mostly used in fpv drones esc....


Sent from my iPhone using Tapatalk

User avatar
Inwo   10 kW

10 kW
Posts: 660
Joined: Dec 13 2016 12:01pm
Location: SE MN. USA

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

Post by Inwo » Jul 19 2020 4:17pm

Is the second encoder offset set to Zero for Motenergy motors? No offset number is supplied with motor.

http://odynesupport.com/odyne/odsconten ... 091917.pdf

encoder configuration pmac sevcon.gif
encoder configuration pmac sevcon.gif (71.28 KiB) Viewed 3267 times

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Aug 01 2020 7:15pm

Have you encountered dvt not able to detect a node signal


Sent from my iPhone using Tapatalk

Robinev   100 W

100 W
Posts: 106
Joined: Feb 22 2020 3:37am

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

Post by Robinev » Aug 10 2020 4:40am

Sweet I figured it out like a big boy. I’m an idiot


Sent from my iPhone using Tapatalk

Post Reply