Hiya,
I have a DYU D3F (a 14" mini-e-bike; the handlebar folds down), it has a direct drive motor in...really "as" the rear wheel (the magnets are basically directly part of the wheel, no gearing or freewheeling mechanism), and I'm trying to get this KT24/36ZWSRD-TS02G controller (rated 10A input, 20A phase current, if i read this info plate right) (PCB says "KT-6S5-C") with this firmware to run it nice.
And yes it was a ZWS controller, so I've modified it to have an ACS711 sensor -- i designed a little breakout board and had JLCPCB make and assemble that for me - it's the +-15.5A ACS711 _plus_ a 1milliohm shunt resistor across that to give it a range exceeding 20A (but the absolute current value would need to be calibrated if that was needed - if i understood right the firmware only needs the zero crossing point?).
I put in a 2200 ohm resistor on the main PCB (on the signal line of the ACS711, it had empty pads for that) as that is what the schematic I found showed, but I'm not 100% if that was a good idea (or whether it would work better just directly), or whether an RC filter would be better (the PCB also had pads for a capacitor to ground, if i thought right... could also be resistor divider but i think that's not necessary).
Onto my problem: currently with interpolation enabled, it runs smooth-ish (there's a rough spot somewhere near 15 ERPS) but more depressingly has a max no load speed (wheel in the air, this is all i can do for testing right now) of about 80 ERPS (which if i computed it right, would be like 20 km/h - if you want to go computing, there were 30 changes of the lowest bit of the hall state in a rotation of the wheel, but i think you only count one of the edges, so a "gear ratio" of 15 and a wheel circumference of about 1055mm).
If i disable interpolation, the running sound is a little bit rougher, but it reaches a max speed of about 170 ERPS (which is quite fast).
I did look into (but didnt touch much) adjusting the motor angle (or such), if that would be something to do with this (honestly I'm not sure, and annoyingly i "only" have a PC with serial port, not the bluetooth dongly, so i don't know what the app would say), i did try this:
Code:
// before while(1) in main.c:
printf("%03d %03d %03d %03d %03d %03d\r\n",
ui8_s_hall_angle4_0, ui8_s_hall_angle6_60, ui8_s_hall_angle2_120,
ui8_s_hall_angle3_180, ui8_s_hall_angle1_240, ui8_s_hall_angle5_300);
// in the very slow loop
printf("\r%03d %03d %03d %03d %03d %03d",
(uint16_t) uint8_t_hall_case[0], (uint16_t)uint8_t_hall_case[1],
(uint16_t) uint8_t_hall_case[2],(uint16_t) uint8_t_hall_case[3],
(uint16_t)uint8_t_hall_case[4], (uint16_t)uint8_t_hall_case[5]);
to see how the B phase current while spinning in the air matches up with the hall angles, and i get something like this:
001 043 086 128 171 213 // these are the default hall angles in the configurator for the states
170 128 080 090 128 170 // and these are the current sensor readouts at the appropriate angle
(those are rough values, as this this "visualization" is constantly changing and flattens out to near 128 as i stop the wheel so i cant just copy the line)
And to me, this looks like the phase current is about 60 degrees "late", but i'm not sure how to read that (and yeah, if i try to adjust the motor specific angle that much, i only get a buzzer or erratic behaviour.)
Oh yeah, that readout was with interpolation enabled; if i disable interpolation, the lines are roughly like this:
001 043 086 128 171 213
100 135 165 155 120 090
Here's the configuration as-it-is right now:

(oh i happened to take the screenshot just after testing the current readouts without interpolation, so that's why the checkbox...)
Note: I dislike this form of communication (and the wiki certainly does not tell enough to figure stuff like this out... believe me, i've read through it a couple of times), so if you want to find me elsewhere, I'm @
urja@treehouse.systems on mastodon (where you can also find pictures of the ACS711 mod), and just "urja" on IRC (libera.chat) - do keep the chat relating to this specific problem here, though. (Just so that we don't end up forgetting to atleast post the solution here...)