Jump to content

PWM monitoring and alarms added in Darknessbot


Denny Paul

Recommended Posts

As seen in the Darknessbot 60+ page thread (Apps subforum). Update available in app store.

Cross-posting here for visibility. I have zero to do with development; I am just a fellow enthusiast. However, this seems like a nice safety feature that should be seen by anyone using Darknessbot. It could potentially be an improvement over the smart speed alarms, which are the best app enabled safety feature to date. 

On 6/9/2021 at 11:27 AM, Alla Shkolnik said:

Hi! PWM is the percentage of the motor usage. When you drive at top speed, the motor is operating at the limit of its power. When 100% motor power is reached, EUC will cut out. This is specially true for Gotway/Begode and Sherman as you can disable tilt back. Therefore, if you set the app PWM alarm to ~80% you will know in advance that there is a risk of EUC cutout the wheel when you exceed the speed. 

I'm asking the dev to see how this is calculated exactly, but if it's designed like how it sounds, it should mimic the 80% overpower alarm that most of the wheel manufacturers have in some capacity or another. I imagine that even if it doesn't, it will help people know where the limit of their wheel is at 100% battery. If pedal dip occurs at 95%+ pwm, it'll hopefully let you see when that dip is on the horizon without having to gamble your face on it! If anyone knows how it this statistic is calculated, and if battery percent comes into play, please share!

Some ways it can help someone make useful real life decisions:

Example 1: if you've never surpassed 50% pwm, you'll know you can trust and crank on the wheel more. Maybe time to think about power pads, or squat down and just commit to leaning more.

Example 2: if you're grazing 70-80% pwm on every ride at some point, maybe it's time to consider an upgrade for more headroom? 

I'm 2 years into riding. Now I can graze 40mph comfortably, which was my goal when I set out initially. I've never had a crash to date, and I think this might be a great way to keep that good luck going. Hoping this helps someone!

Edited by Denny Paul
  • Like 3
Link to comment
Share on other sites

4 hours ago, Denny Paul said:

If anyone knows how it this statistic is calculated, and if battery percent comes into play, please share!

KS wheels report this pwm duty cycle % as "inverter load". KS wheels have an 88% alarm based on this value. ?4-5 consecutive beeps?)

For Inmotion i've seen once a graph from the inmotion team from the "internal" data analyzing an oberlean - there they had pwm %, too. No idea if this number is reported to the apps, too.

Battery voltage is "regarded" by this number.

The interesting number for driving (the wheel can still keep one balanced) is the torque which is proportional to the motor current. Motor voltage is proportional to the speed. So the maximum motor current ~ torque at 100% pwm is (Battery Voltage - Motor Voltage)/(Motor Coil and Mosfet, Wire etc Resistance)

4 hours ago, Denny Paul said:

and I think this might be a great way to keep that good luck going

That's a great number to base a wheels alarm! Much better than justt a fixed speed limit.

Only problem is the delay and sample rate - with courageously accelerating one can still hit the limit with the alarm triggering some tenth of a second before overlean. With some 5 samples per second by the wheel send to.the app the alarm could be triggered after the crash or never...

The only "real" way to implement this would be firmware and consider acceleration and not a fixed pwm percentage as alarm threshold.

As afair ?@DjPanJan? had an overlean (he fortionately stood) outrunning some dogs with his ks16x and the 88% triggering just some fractions of a second before.

 

More on this number in 

 and the following posts.

 

  • Like 1
Link to comment
Share on other sites

5 hours ago, Denny Paul said:

Cross-posting here for visibility. I have zero to do with development; I am just a fellow enthusiast. However, this seems like a nice safety feature that should be seen by anyone using Darknessbot. It could potentially be an improvement over the smart speed alarms, which are the best app enabled safety feature to date. 

Latest EUC World version (2.6.4) also has very similar feature for Veteran Sherman and most Gotway/Begode wheels. It's called safety margin; you can get and record safety margin parameter and also set an alarm that will be raised after safety margin value will drop below some threshold, which by default is set at 20 %. Roughly, 20 % of safety margin equals to 80 % of PWM/motor load.

  • Like 3
Link to comment
Share on other sites

6 hours ago, Chriull said:

Battery voltage is "regarded" by this number....

Thanks for your post, learned a lot. The dev of DarknessBot said in the thread that some companies like KS have their wheels calculate this, but other wheels don’t do this, so they implemented a way for the app to calculate this as a work around. I’d guess other wheels are missing the hardware needed to get this reading, so it’s likely calculated differently than ‘inverter load’ 

I’m wondering if the app calculation takes into account battery percentage / state of charge. To assess that, we need to know how the app calculated specifically.

@Seba thanks for letting us know EUC world has it too, seems very useful! The other thread didn’t seem to get much traction either. Can you tell us how pwm is calculated for gotways/veterans for your app?

Link to comment
Share on other sites

6 hours ago, Chriull said:

Only problem is the delay and sample rate - with courageously accelerating one can still hit the limit with the alarm triggering some tenth of a second before overlean. With some 5 samples per second by the wheel send to.the app the alarm could be triggered after the crash or never...

The way I’m approaching this is I can test to see how much force it takes to get to say 70% pwm, mentally set that as my “don’t crank on the wheel any harder” baseline, and just go by feel from there. The general idea being preventing a pedal dip from happening altogether, not intervening in one.

Link to comment
Share on other sites

13 minutes ago, Denny Paul said:

KS have their wheels calculate this,

It's not "calculated" - the firmware "generates' within the control loop to keep the wheel balanced. It is the duty cycle of the pwm used to switch the mosfets driving the motor.

Here 

is some equivalent circuit for this motor driving per pwm. And the used formulas for this relationships are in this topic, too.

 

Link to comment
Share on other sites

Thanks for sharing. I wonder if Seba and the Darknessbot app dev have based off of the same way that kingsongs currently 'generate' their 88% alarm. If so then I've got some reading cut out for me.

Edited by Denny Paul
Link to comment
Share on other sites

did some Wikipedia reading, as i didn't even know what PWM stood for. Is it "Pulse-width modulation"? Forgive my ignorance @Chriull

Pulse width modulation talks about the general idea that electric appliances do work and stop doing work at a rapid rate, as in multiple times a second, to give the illusion of having a gradient in power. So 50% pwm means that the wheel is actively doing work for equal time as it not doing work. Then at PWM 100%, the wheel is doing work 100% of the time, never taking a break even for a microsecond. So if you're at 100% pwm your wheel is maxed out and wont support any more load, if you add load --> faceplant. 

If so, still wondering if the wheel generates this systemically and the app reports it. Or it's the apps that are doing some approximation through calculating peak wattage or something similar.

Link to comment
Share on other sites

5 hours ago, Denny Paul said:

Is it "Pulse-width modulation"?

Yes

And only the app authors can tell you if the reported number is given to them by the firmware or if the number is synthetic. My guess: synthetic, with no good reason!

  • Like 1
Link to comment
Share on other sites

7 hours ago, Denny Paul said:

 So 50% pwm means that the wheel is actively doing work for equal time as it not doing work.

Almost. The Mosfets are on for 50% of the time, closed for 50%. But the motor coils are inductances, "storing current". So they get "charged" for 50% of the time and keep up the current the other 50% of thr time. So one has "almost direct current" at half the value.

As seen in the link i gave you above with the equilvalent circuit.

In reality it's more complicated, as the bldc is driven with a 3 phase alternating current - which is "constructed" by 3 pwm channels and the three motor coils.

7 hours ago, Denny Paul said:

Then at PWM 100%, the wheel is doing work 100% of the time, never taking a break even for a microsecond.

Yes. In principle. In reality often only 0.x to 99.x percent duty cycle is used due to different design details of the surrounding circuitry.

7 hours ago, Denny Paul said:

So if you're at 100% pwm your wheel is maxed out and wont support any more load, if you add load --> faceplant. 

Yes! That's the important point to know about this number!

The wheel cannot give more than 100%. It's just us humans trying to do more...

7 hours ago, Denny Paul said:

If so, still wondering if the wheel generates this systemically and the app reports it. Or it's the apps that are doing some approximation through calculating peak wattage or something similar.

Every wheel has this number in their fuirmware - this is the number to control the motor! The duty cycle directly controls the current through the motor coils which generates the torque which keeps us upright.

All KS wheels and now the V11 (with the newer firmwares) report this number directly to the app.

For Veteran and GW wheels they are calculated (by EUC World), as Seba stated.

  • Like 2
Link to comment
Share on other sites

kingsong wheels report dynamic tiltback speed, I think it is the safest value. No matter what the tiltback speed it set at, there is another register that reports realtime tiltback speed, and this drops related to conditions. 

I have it set up to give an alarm when actual speed comes within 5km/h of the variable limmit. this pictute ilustrates that when on 5% battery, and not moving,  the tiltback is autoset at 36khm, it will drop to about 25 when on the move.

 

photo_2021-06-26_17-26-36.thumb.jpg.395e8870f86bda91a2d2dadb0eeb8a1b.jpg

Edited by enaon
Link to comment
Share on other sites

6 hours ago, enaon said:

kingsong wheels report dynamic tiltback speed, I think it is the safest value. No matter what the tiltback speed it set at, there is another register that reports realtime tiltback speed, and this drops related to conditions. 

Yes, tiltback speed is reduced to the speed where the wheel would hit 100% inverter load/pwm % or 0% safety margin.

So this is just another number reported by KS wheels in 100% correlation to this pwm duty cycle percentage.

 

 

 

  • Like 1
Link to comment
Share on other sites

Guys, in DarknessBot only KS reported the PWM number directly. Cause we don't have V11, it's a news for us that now it also provide PWM directly. 
Can you say me what firmware number have this metric? 

For all other brands we calculate in the similar way as Wheellog do it and based it on this sheets and was calculated and tested by Russian concerned users community 🖖

⚠️ Also, be careful. All Gotway/Begode and Sherman EUCs are so unique that no exact calculation can be made for them. We have taken the safest values possible, but we still do not recommend setting the alarms to more than 80%. 

The best is if you try it and later tune the PWM correction to your device, either by combining it with the alarms from the device itself (I know they are very hard to hear at high speeds, but that's the best way), or by combining speed and PWM graph. Properly configured PWM alarms are really the best and safest way to alarm while riding. 

I hope @Seba you also have correction parameters for this feature. Or it would be very unsafe alarm. 

On 6/25/2021 at 12:03 PM, Chriull said:

If anyone knows how it this statistic is calculated, and if battery percent comes into play, please share!

Of course, PWM alarms is based on battery too.  

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
On 6/27/2021 at 12:54 AM, Chriull said:

Yes, tiltback speed is reduced to the speed where the wheel would hit 100% inverter load/pwm % or 0% safety margin.

So this is just another number reported by KS wheels in 100% correlation to this pwm duty cycle percentage.

 

 

 

I was about to start a topic on this because I played with it a bit, but I see Seba is on it for the next version. 

it turns out the number you are talking about on the ks is just speed in a scale of 0-100, nothing to do with battery or power. The needed register for safety is the "current speed limit" register.

Edited by enaon
Link to comment
Share on other sites

11 minutes ago, enaon said:

I was about to start a topic on this because I played with it a bit, but I see Seba is on it for the next version. 

This number is included since quite it's beginning in EUC World's logs - that's were i found them...

11 minutes ago, enaon said:

it turns out the number you are talking about on the ks is just speed in a scale of 0-100, nothing to do with battery or power.

?

This max speed is reduced with battery voltage going down or "more power is consumed" (motor current rises in reality). And only is noticable once max reachable speed is below set tiltback speed.

The value from 0-100 is inverter load - in euc world called safety margin beeing 100-inverter load.

?

Link to comment
Share on other sites

I also call out again on the big boys, Seba and DB, to test out the buzzer register on the gotways. It is faster then the real buzer, the bt register comes some 300ms before the sound, if it works well on the 80%, it is a must for safety. 

 

next week I will test a sherman to see if it has the same buzzer register. 

Edited by enaon
Link to comment
Share on other sites

On 6/27/2021 at 5:49 PM, Alla Shkolnik said:

Can you say me what firmware number have this metric? 

have a look here, I count registers differenlty so I am not sure which one you need, but you can figure it out relatevely to a known one (in mine it is the euc.dash.alrm register, 52 ). 

This reports speed limit on the inmotionV11, not dynamic , it has 3 values, normal, before tiltback, fall. 
https://github.com/enaon/eucWatch/blob/main/P8-testing/eucInmotion/eucInmotion.js

Edited by enaon
Link to comment
Share on other sites

On 6/27/2021 at 4:49 PM, Alla Shkolnik said:

The best is if you try it and later tune the PWM correction to your device, either by combining it with the alarms from the device itself (I know they are very hard to hear at high speeds, but that's the best way), or by combining speed and PWM graph. Properly configured PWM alarms are really the best and safest way to alarm while riding. 

I hope @Seba you also have correction parameters for this feature. Or it would be very unsafe alarm. 

Of course, PWM alarms is based on battery too.  


By any chance could you describe tuning pwm correction to wheel alarms more?

Do You mean adjusting correction up if 80% alarm beeps in a wheel first, or adjusting down when darkness bot 80% alarms beeps first and doing that until wheels and apps alarms synchronize?

DarknessBot shows higher speed vs any gps speed app on my phone. That alone could be the reason why DarknessBot alarms hit much sooner (in my case)

The other mismatch in my Msx vs app is voltage. After unplugging the charger app shows ~82,5V. Multimeter I trust shows 85,2V measured both at charging pins and charger with no load🙁

  • Like 1
Link to comment
Share on other sites

1 hour ago, Ryżu said:

The other mismatch in my Msx vs app is voltage. After unplugging the charger app shows ~82,5V. Multimeter I trust shows 85,2V measured both at charging pins and charger with no load🙁

How much does the app report with the charger connected? Of course once the battery is about fully charged, or there'll will be significant drop on disconnecting.

If such a drop occurs after full charging (charger light turned green) this could be due to bad battery cells.

Or last, but not least your multimeter could be not as trustworthy as you think ;).

About "normal" deviations of reported voltages are up to 1.5V.

 

  • Like 2
Link to comment
Share on other sites

pwm on Kingsongs is just that it seems, width of the pulse. The number it self gives no relation to load, 100% is about 67 km/h on the s18, the ratio to speed is ~1.53, no matter if it is  free spinning or with me on it, and it goes up as battery voltage goes down.

At is is now, it usefull only to detect road bumps, the wheel will free spin and pwm will get up, that is it. 

Is is very usefull if compared to speed, the ratio gives a good indication of reserved power and incomming tilback. 

Edited by enaon
Link to comment
Share on other sites

1 hour ago, enaon said:

100% is about 67 km/h on the s18, the ratio to speed is ~1.53, no matter if it is  free spinning or with me on it

You can ride the S18 at lift cut off speed, which you say is 67 km/h?!

In the shop max speed is given for the S18 with 50 km/h?!

How does this fit?

Link to comment
Share on other sites

2 hours ago, Chriull said:

You can ride the S18 at lift cut off speed, which you say is 67 km/h?!

In the shop max speed is given for the S18 with 50 km/h?!

How does this fit?

I tried to make good video but my phone is not helping, so I just put this up for evidence of trying, it was originally 7minutes long, downhill, uphill etc, mostly blur. :)

the midle number is the speed, the bar under it is what euc calls health and has reverced, the pwm DB number, and the number to the left is (pwm/speed)*10, so that I can get an idea of what is happening. 

The ratio is ~15 (1.5*10) in contant conditions (the packets for speed and pwm come at different times slots, so a half a sec is needed to get the same condition values), irelevant of actual speed or up/down hill current, with variations that follow the voltage. My guess is that is it the width, is doen't know how much current flows, so no idea of load, but indicates where the software will dissengage. This will never happen on normal conditions, tiltback will kick in first, so the number as is stands is a report of road bumps, freespins. So, 100% is max speed that the width of the pulse at 84 volts allows as is set up in software, it will then disengage. 


Yet, this "cut off speed" register in revevance with the actual speed, can provide a very nice CVT style rev meter, the ratio will get to 2 when voltage drops bellow 20%~ on mine, regardless of the actual pwm number, I have a 4p battery setup, so that gives insight before the speed limit register can. It is an excellent register safetywise, just needs different aproach. 

 

 

Edited by enaon
Link to comment
Share on other sites

19 hours ago, enaon said:

The number it self gives no relation to load, 100% is about 67 km/h on the s18, the ratio to speed is ~1.53, no matter if it is  free spinning or with me on it, and it goes up as battery voltage goes down.

17 hours ago, enaon said:

The ratio is ~15 (1.5*10) in contant conditions (the packets for speed and pwm come at different times slots, so a half a sec is needed to get the same condition values), irelevant of actual speed or up/down hill current, with variations that follow the voltage.

I'm not sure if i am getting your point - you write about a pwm percentage to speed ration of 1.5. No matter of speed, load, etc.. Just changing with battery voltage?

As I understand pwm % (https://forum.electricunicycle.org/topic/7855-anatomy-of-an-overlean/?do=findComment&comment=314654):

For each shown PWM percentage at some specific speed v one can deduct v / lift cut off speed (in %) from PWM %. This resulting number is the "duty cycle" corresponding to the acutal used torque. Maximum available torque at some specific speed v is proportional to 100% - (v / lift cut off speed (in %))

So as picture

gxxi8rD.png

I've taken your examples with 76 km/h beeing lift cut off speed and shown PWM beeing 1,5 time the speed (in km/h). So your used torque is "comfortably low" for this figures - showing nice riding?

17 hours ago, enaon said:

what euc calls health and has reverced, the pwm DB number,

Health? Afair KS called this number, once it was reported with FW ?2.0? inverter_load. You are sure that "health" is not something different?

Quote

and the number to the left is (pwm/speed)*10, so that I can get an idea of what is happening. 

 

I still do not understand why you are interested in PWM % / speed? It just gives one linearly increasing torque over speed!

And as the following is right (as it is defined),

19 hours ago, enaon said:

pwm on Kingsongs is just that it seems, width of the pulse.

just divided by the length of a whole period, so one gets a percentage,

the following statement

19 hours ago, enaon said:

The number it self gives no relation to load

is just against everything we know by now.

Edit: The PWM % show ones "postion" in % between not driving and hitting the max torque over speed limit (overlean). It tells one "how far (speed and burdenwise" on still can go until one overleans.

Edit 2: As written in the above given link, if one adds the actual speed in percent of lift cut off speed + the actual motor current (torque, load, acceleration) as percentage of the maximum possible motor current at the actual speed one gets the PWM %.

As the max torque over speed limit is a linear relation (the read line in the graph above) it is a "combination" of torque (load, burden, acceleration) and speed.

You get to this point because the factor of pwm % and speed stays at 1.5, just changing by battery voltage?

As you wrote, your video is still quite blur and hard to get anything. You have logs showing your idea so one can follow and understand your statement easily?

Edited by Chriull
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...