Jump to content

Gil

Recommended Posts

9BMetrics is an impressive IOS application developped by @Paco Gorina for the Ninebot One. It polls the unicycle to gather technical data (speed, current, voltage, pitch, roll, temperature) at a very fast rate (30 times per second) and stores them in files that you can display graphically on your IOS device or send to your PC for further analysis. 9BMetrics user manual is available here.

While data is being collected, you have a real time dashboard:

IMG_1139.PNG

When data capture is finished, you can display your trip:

IMG_1140.PNG

and have a synthetic summary of data collected during your trip:

IMG_1148.PNG

and also access to very accurate graphs that reveal the power, current, etc. during the trip:

IMG_1149.PNGIMG_1150.PNG

On a PC, you can visualise the data by using a software named Gnuplot which is available for Linux, OSx and Windows (here). You will also need a Gnuplot script, developed by @Chriull. You can download it here (under Windows, you have to change the PATH environment variable after having installed GNUplot unless you prefer to edit a .cmd command file that calls GNUplot with accurate path).

This is the kind of graphs you can get with the gnuplot app:

Capture.JPG

To get such a graph, you use 9BMetrics during your trip. At the end of the trip, you send the log file (a set of files in a single zip file with extension 9bz) to your computer and decompress it in one folder. Then you open a DOS command terminal, choose to this folder the default folder (cd [the path where you uncompressed the 9bz zip file]) and type a command like this one

C:\[The path where you installed gnuplot executable]\gnuplot C:\[the path where you put Chriull's script]\9BV4.01.dem

Thanks to this terrific application, you will the be able to check that your riding style or trip does not bring your 9B1 to its limits (esp. peak current) or you will also be able to estimate the influence of tire air pressure, riding mode, feet position, inclination, etc. on the current drawn from the battery. For instance, on the example graph provided above, you can see that the current never gets over 9 amps, which is very safe. All these urban legends on tire pressure, weight and so on are about to be replaced by FACTS!

And... stuntmen will be able to get sure that they draw the maximum from their equipment !!!

Of course, you can use 9BMetrics directly on your IOS device without using Gnuplot on a personal computer. You will have the same information but it will be displayed on separate graphs. 

@Paco Gorina has done a tremendously useful work, included for Ninebot Inc. I propose this thread in order to be able to share about the finalised 9B Metrics application: user experience, wishlist, use cases, and... bugs.

 

 

9b-V4.04.dem

Link to comment
Share on other sites

  • Replies 220
  • Created
  • Last Reply

Many of us have spent hours on this Ninebot sub-forum trying to guess what kind of riding is safe, what level of air pressure is recommended, what istheinfluence of tire pressure on autonomy, what is the best way to climb on a curb, which slope is reasonnable to climb, etc. Thanks to 9B Metrics, you can analyse everything and make sure that your driving style do not demand too much power, current, etc.

For instance, as I am heavier than the mean user, I was always wondering whether I was playing with the limits or not. That was spoiling the pleasure I had to ride my 9B1. Thanks to 9B Metrics, I know that I use the wheel within safety limits (always below 500W with rare peaks to 600W).

So: thank you, thank you and thank you Paco!

Link to comment
Share on other sites

Is this an App that we can download?  I'd be interested to see the Metrics also since I'm a casual rider that weighs 165 lbs.  I do often hit the Tilt Back, and I'm wondering if I've left any room for error too.

EDIT:  Sorry, just answered my own question by using the Search.

Link to comment
Share on other sites

By Monday there could be the new version out and there are some probs mentioned there:

If you want to make some graphs with this version you can use (under linux or with MinGW or cygwin):

9b.awk skript:"

$1<256 { print "Time \"" $0 "\"" >> $1 }
$1>255 { print $1 " " $3 >> $2 }

"

9b.dem skript for gnuplot:"

#set xdata time
#set timefmt "%y-%d-%m %h:%m"
plot     '0'  using 1:($2/100) with lines axes x1y1 title columnhead(2),        \
        '80'  using 1:($2/100) with lines axes x1y1 title columnhead(2),    \
        '38'  using 1:($2/1000) with lines axes x1y1 title columnhead(2),    \
        '71'  using 1:($2/100) with lines axes x1y2 title columnhead(2),    \
        '62'  using 1:($2/10) with lines axes x1y2 title columnhead(2)
    
        pause 1000

"

And then with 

awk -f 9b.awk < 9B_xxxx.txt

gnuplot 9b.dem

you get nice grafics. Just need some more formatting with gnuplot (numbers on second y axis (temp,voltage) , date/time instead of timestamp on the x axis,...)

With the new version awk should not be needed anymore - then gnuplot should work alone...

Edit: Changed x2y2 to x1y2, so zooming in gnuplot works!

Link to comment
Share on other sites

2 hours ago, jer said:

Any chance of an idiots guide ?

 

Thanks

Jer

OK it is simpler than I was expecting .

Search for Ninebot on the app store, load the metric NB app and go.

Fantastic.

Connects better that the factory app as well.

duh

 

Link to comment
Share on other sites

4 hours ago, Chriull said:

If you want to make some graphs with this version you can use (under linux or with MinGW or cygwin):

Thanks @Chriull!

OS X default is 256 open files for normal users so if you have a larger log file to plot, then you run into "too many open files": adding close after each write is needed. Also, older gnuplots (which you may get via MacPorts or similar) like the script below better.

So this should work on OS X. Create a folder for your log file. Into that folder create file 9b.awk and write into it as plain text:

 $1<256 { print "Time \"" $0 "\"" >> $1 ; close($1); }

 $1>255 { print $1 " " $3 >> $2; close($2); }

Then create a file 9b.gnuplot in the same folder and write into it:

 set terminal png medium size 800,600

 set output '9bot.png'

 plot     '0'  using 1:($2/100) with lines axes x1y1 title 'Altitude',        \

        '80'  using 1:($2/100) with lines axes x1y1 title 'Current',    \

        '38'  using 1:($2/1000) with lines axes x1y1 title 'Speed km/h',    \

        '71'  using 1:($2/100) with lines axes x2y2 title 'Voltage',    \

        '62'  using 1:($2/10) with lines axes x2y2 title 'Temperature'

Then open up a terminal window and change directory to that folder: 

 cd myplotfolder

 

Then run:

 

 awk -f 9b.awk 9B_xxxxx_xxx.txt

 

It will create a lot of files with two-digit names with one variable (current, temp, etc.) in each file. Those you could import into Excel, if you rename them with a .csv suffix. But if you require Excel, perhaps best to wait for Paco's next release with cleaner export. Continuing with command line, run:

 

 gnuplot 9b.gnuplot

 

This should create a png image file with name 9bot.png, pasting below my test run in the parking garage, annotated with letters as follows:

 

A: Fast and tight figure eights between two poles, accelerating the 5 m straight part, braking hard into the turns.

B: Speeding until first beep (at 20 km/h).

C: Going up a ramp between two levels, maybe 3.5m. 

D: Coming down the ramp.

 

Notes:

  • The elevation and current seem out-of-phase, either current graph is too early or elevation too late. If elevation is measured by an air pressure sensor, then maybe my tight sealing of the mother board could be the cause... but probably not as that would cause a slower rise in elevation, but it would still start at the same time. Any ideas?
  • Going up the ramp at 13 km/h, current draw seems to be 12A, which with 59V should mean 700W. How can this be with 9B1 C+? I thought the motor was 500W?
  • Misc: Note that voltage and temperature have a different scale - voltage is a steady 59V in the beginning. Temperature rises from 17.7 to 23.9 during the ride. The ride lasts 2 min 59 s. Ambient temperature 10C, my weight 72 kg.

@Paco Gorina this is beautiful, so much fun! Absolutely wonderful!

9bot.png

9B_20160326_181313.txt

Link to comment
Share on other sites

Thanks for your input regarding MacOSX - i do not know anything about its special behaviour.

- altitude is measured by an air pressure sensor inside the iphone - it is just a very rough approximation of the height from what i have seen so far

- 500W motor from a serious brand means that the motor can take this power continiousely. 2 to 3 times this values for a short time are absolutely no problem for the motor.

Link to comment
Share on other sites

About altitude :

- Altitude comes from the barometric pressure in iPhone. It is quite good but it always start from 0. That is, the profile of height is OK, but the absolute height no, you must add the starting Point absolute height.

- Respect to current/sped/altitude, my understanding of EUC's dynamics is

Torque is directly proportional to current (electric motor dynamics)

Torque is directly proportional to acceleration (Second Newton Law)

Acceleration is in part Earth Gravity acceleration and increase in speed. Earth gravity acceleration (in direction of movement) is proportional to g * sin(Alfa) where Alfa is the pendent of the road. Also remember that part of the torque is used to balance the unicycle.

As you see in the graph, current goes up and also the speed before the climb, also during the climb the speed is reduced (negative acceleration)

To have an order or magnitude, effective acceleration to overcame in a 10% climb should be about 0.98 m/s2 and the acceleration needed for going from 0 to 10km/h (about 2.8 m/s) in 3s is 0.92m/s2 so they are quite similar and usually a 10% sustained climb is quite steop.

I have detected more than 1000W in power but only briefly. In fact you could increase the power of the motor till either you blow the MosFets or the motor wire. 500W is a steady state that doesn't kill everything.

It is very interesting to compare pitch and speed, so you know how the tiltback sets in and the histeresis in recovering from the tiliback.

Link to comment
Share on other sites

12 hours ago, Skara said:

Thanks @Chriull!

OS X default is 256 open files for normal users so if you have a larger log file to plot, then you run into "too many open files": adding close after each write is needed. Also, older gnuplots (which you may get via MacPorts or similar) like the script below better.

So this should work on OS X. Create a folder for your log file. Into that folder create file 9b.awk and write into it as plain text:

 $1<256 { print "Time \"" $0 "\"" >> $1 ; close($1); }

 $1>255 { print $1 " " $3 >> $2; close($2); }

 

Good idea to close the files after each output - seems like a proper way. Awk would have about 44 files open without this...

Also there is another small glitch in my approach - awk creates an useless file with the name "Var"

12 hours ago, Skara said:

 

...

 

It will create a lot of files with two-digit names with one variable (current, temp, etc.) in each file. Those you could import into Excel, if you rename them with a .csv suffix. But if you require Excel, perhaps best to wait for Paco's next release with cleaner export. Continuing with command line, run:

With Excel the "problem" is, that point charts are limited to 32.000 data points which are easily reached with one drive - so for making a chart excel is a bit "complicated". But for other things like calculating average power consumption and so on it could be nice...

12 hours ago, Skara said:

 

 gnuplot 9b.gnuplot

 

This should create a png image file with name 9bot.png, pasting below my test run in the parking garage, annotated with letters as follows:

Did you also try it without outputting to a png file - you can look at the graph in the screen, choose the export format and also zoom into the graph. Unfortionately with my version zooming does not work. I just found out, that this comes from my second axis usage. If one skips temp and voltage (62 and 71) on the second axis zooming works without problems.

Also the Time can be shown on the x axis with "

set xdata time
set timefmt "%s"

"

Just have to work out how to show also the date additional to the time and the seconds... Or Maybe the date in the title and seconds + fraction of seconds additional on the axis...

12 hours ago, Skara said:

 

A: Fast and tight figure eights between two poles, accelerating the 5 m straight part, braking hard into the turns.

B: Speeding until first beep (at 20 km/h).

C: Going up a ramp between two levels, maybe 3.5m. 

D: Coming down the ramp.

 

Notes:

  • The elevation and current seem out-of-phase, either current graph is too early or elevation too late. If elevation is measured by an air pressure sensor, then maybe my tight sealing of the mother board could be the cause... but probably not as that would cause a slower rise in elevation, but it would still start at the same time. Any ideas?

From the graph it looks, like you drove without braking to the ramp and used "just" your kinetic energy to go up - the current went down, so you "almost" had no acceleration from the 9bot motor? Could be the same explanation like from @Paco Gorinaabove with other words?

 

2 hours ago, Paco Gorina said:

...

It is very interesting to compare pitch and speed, so you know how the tiltback sets in and the histeresis in recovering from the tiliback.

Interesting point - i always had the "gut feeling" that tiltback takes quite some power compared to normal driving. With the log file looking at the pitch at "highspeed" this difference should be easy to calculate and compare! 

Link to comment
Share on other sites

I have just used the app for 1h45' in various conditions. Street, muddy pathes, slopes. I am now sure that I never reached critical conditions. It is funny to see how your average speed increase during long rides because you get used to the speed so you accelerate without noticing it.

The app is very stable. It could be more convenient when you have a bluetooth pairing code. Currently, it asks for the pairing code twice.

Link to comment
Share on other sites

14 hours ago, Gil said:

I have just used the app for 1h45' in various conditions. Street, muddy pathes, slopes. I am now sure that I never reached critical conditions. It is funny to see how your average speed increase during long rides because you get used to the speed so you accelerate without noticing it.

The app is very stable. It could be more convenient when you have a bluetooth pairing code. Currently, it asks for the pairing code twice.

I have been investigating the double pairing code request and I have it detected. It tryed to connect just at the start of the application which is not correct, it must wait the click of the new run ...

Unfortunately I don't know any way to store the pin code in the application. Seems it is not possible but will rsearch if there is a way to store it only once

Link to comment
Share on other sites

Just in case, my newest gnuplot script:"

set xdata time
set timefmt "%s"
#set format x "%Y-%m-%d %H:%M %.2S"
set format x "%H:%M %.2S"
set key autotitle columnhead
set mytics 2
set xzeroaxis 

files1="0 80 38 97"
factor1="100 100 1000 100"
files2="71 62"
factor2="100 10"
max_speed=20
plot for [ i=1:words(files1) ]  word(files1,i) using 1:($2/word(factor1,i)) with lines axes x1y1
replot for [ i=1:words(files1) ]  word(files2,i) using 1:($2/word(factor2,i)) with lines axes  x1y2
replot max_speed title "20 km/h"
pause -1

"

This is now with the values to be shown on the left y axis in files 1 (Alt=0, Current=80, ...), the factor by which to divide in factor1 and the same for the second y axis in files2 and factor2. Zooming works fine now also with the second axis. X Axis Labels now show the time correctly formated.

Only thing missing is still the labels on the second y axis...

Edit: Found a way to put the correct lines with the [ ] in the post - the plot and replot lines are now correct

Link to comment
Share on other sites

On 3/25/2016 at 5:26 PM, Chriull said:

If you want to make some graphs with this version you can use (under linux or with MinGW or cygwin)

@Chriull: you mean that I do install MinGW (basic package) then I will have a Linux terminal where awk and gnuplot will be ready to run ?

 

Link to comment
Share on other sites

Yes, @Chriull and @Paco Gorina, I now realise I instinctively let the speed drop for steep climbs, so for the beginning of the climb I'm indeed trading kinetic energy for potential energy. I had not noticed this while riding before, but after looking at the curves and riding some more, it is obvious.

I also went on a longer ride with the phone in hand and kept looking at the current draw. Surprisingly, the slower rides up steep hills were not the biggest draw on power, but going near top speed on almost level surface, and then accelerating a little more for some reason, e.g. just to keep balance.  Again, in afterthought it is obvious, but without seeing it, I would not have become conscious of it. I'm certain this insight will translate into safer riding.

I've never been tempted by the iWatch before, but this could be the killer app for me - it's bothersome to look at the phone while riding.

Link to comment
Share on other sites

39 minutes ago, Gil said:

@Chriull: you mean that I do install MinGW (basic package) then I will have a Linux terminal where awk and gnuplot will be ready to run ?

 

There is a "windows version" downloadable from gnuplot which installs mingw. Don't know if this is only a minimal version and awk is included or you have to install mingw by itself..

I have also cygwin installed and everything can be used from the normal windows(dos) command window - but i have no idea from which package it is used ?

Link to comment
Share on other sites

@Chriull: I installed gnuplot Version 5 patch 3, for windows and gawk for Windows.

awk : everything is OK. Files are correctly created.

But gnuplot displays Capture.JPG.

Your previous script works well. Any idea ?

Link to comment
Share on other sites

Oh - there was some prob with copy paste: The plot/replot lines have to be correctly like this:"

plot for word(files1,i) using 1:($2/word(factor1,i)) with lines axes x1y1
replot for word(files2,i) using 1:($2/word(factor2,i)) with lines axes  x1y2
replot max_speed title "20 km/h"
"

Edit: Again the same error - i to type it by hand...

plot for word(files1,i) ....

Edit 2: The forum software seems to cut out everything between square brackets... ;(

So the lines shoult be:"

...

plot for {square bracket open}i=1:words(files1){square bracket close} word(files1,i) ....

plot for {square bracket open}i=1:words(files2){square bracket close} word(files2,i) ....

replot...

"

Link to comment
Share on other sites

3 hours ago, Skara said:

Yes, @Chriull and @Paco Gorina, I now realise I instinctively let the speed drop for steep climbs, so for the beginning of the climb I'm indeed trading kinetic energy for potential energy. I had not noticed this while riding before, but after looking at the curves and riding some more, it is obvious.

I also went on a longer ride with the phone in hand and kept looking at the current draw. Surprisingly, the slower rides up steep hills were not the biggest draw on power, but going near top speed on almost level surface, and then accelerating a little more for some reason, e.g. just to keep balance.  Again, in afterthought it is obvious, but without seeing it, I would not have become conscious of it. I'm certain this insight will translate into safer riding.

I've never been tempted by the iWatch before, but this could be the killer app for me - it's bothersome to look at the phone while riding.

The Apple Watch is Very useful. The phone is secure in the pocket or bag. For the moment power is not in the Watch but if people finds it useful I may add a screen with technical data (Current, Voltage, Power...)

Link to comment
Share on other sites

Everything is OK now. Thank you very much for your support. I enclosed the gnuplot program file for those who would like to try. Also find below the resulting graph.One run.png

The analysis of the graph is very interesting and teach us many things about the way electric energy is used in many circumstances. Would it be difficult to have "Power" in the graph ?

To summarise : Windows users can install gnuplot for windows and gawk for windows (just google for them). The only thing to do after the conventionnal setup is adding the 'bin' directory of each product (in most cases C:\Program Files (x86)\gnuplot\bin;C:\Program Files (x86)\GnuWin32\bin at the end of  PATH environment variable. After that, one can use awk and gnuplot as if he was under Linux, using the Windows Command Prompt.

9B1.gnuplot

Link to comment
Share on other sites

2 hours ago, Gil said:

... Also find below the resulting graph.

Interesting - Voltage is not within the Graph limits. There is something quize wrong with the second y axis :(

2 hours ago, Gil said:

The analysis of the graph is very interesting and teach us many things about the way electric energy is used in many circumstances. Would it be difficult to have "Power" in the graph ?

With this version you would have to "recover" the "missing" voltage values and multiply these voltages and the current for each timestamp in excel, for example...

With the new output format to come it ill be easy - it will be just a multiply of 2 columbs within gnuplot...

Link to comment
Share on other sites

  • esaj pinned this topic
  • Chriull unpinned this topic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...