-
• #27
double message. skips this
-
• #28
is there way to see how much space I have?
require("Storage").getStats()
Ideally if you're writing data that fast, you could look at writing binary data - see the second example on https://www.espruino.com/Data+Collection#flash-memory
It looks like we don't support a poll interval less than 10ms (100Hz): https://github.com/espruino/Espruino/blob/8f3a9cb52/libs/banglejs/jswrap_bangle.c#L2487
So you can't do above 100Hz. I'm not sure what happened with 400Hz but maybe it failed with out of memory before it got started.
The Accelerometer does have a built-in FIFO which we don't actually use at the moment.
It might be possible to change the Espruino firmware to use it, but also you could probably use
accelRd
to read the data directly from the FIFO at a much lower level, and then you don't need to change PollInterval at all. -
• #29
Ok. No worries.
Yeah, I was just wondering how the 400 hz first worked and then not :D
But the 100hz looks much better than the 12.5 hz. I was just wondering am I missing something with 100hz, what can I only see with 200 or 400hz.
But I will test with this and will report in here.
By the way Gordon, thanks for everything. Really nice to have this tool. And thanks for all the effort you put in <3 -
• #30
I'm getting now some weird values. Image of values In some point, the x value reverses to positive value from negative. Any ideas why? Something to do with int16Array format?
And any idea why there is a scale of 5000 and that multiplied with two like in line 27:
accelx[i] = a.x*SCALE*2;
-
• #31
The scale is there to ensure that the values which were fractional can be saved in the Uint16Array (which is much more efficient memory-wise). I have no idea why it's 5000 though.
The strange values will be because you're approaching such high G that the value is going above 32767 (the max range of uint16array) and wrapping over.
Maybe just try using a smaller number for SCALE and that'll fix it
-
• #32
So I got more data.
- The number two in the scale value is for 8g mode. If you don't add that, it the values will be wrong.
- The scale value has nothing to do with the hitting the limit. When the sensor hits the 8g limit, it starts to flip from -8g to positive 8g value. Don't know why.
- The timestep is not always 10ms. Sometimes it is 20 or something else, so I have to save also the timestamp.
- If you take the magnitude value, its limit is something around 10,5 g. But if you get the x,y and z value and and calculate the value from that, you can go over that limit(if the x, y or z value don't hit the 8g limit). If the sensors magnitude value hits over 10,5 g, it goes to zero
- Got some results and made a video.
The results look good. I can get really good data.
Now with this data I can start to build my own "throw" app. Lets see how that will go. I will post results in here.
- The number two in the scale value is for 8g mode. If you don't add that, it the values will be wrong.
-
• #33
update:
Now I have two new puck.js sensors! Lets see what I will to with them.
I also made web interface for bangle.js based on this: https://github.com/AkosLukacs/PuckStreaming
My app works little different: every time watch detects throw, it send the record to the web interface. Next step is make same communication with puck.js, but it looks like the code for puck is little harder than bangle.
I already made a holder for buck, so I can measure forces with puck. (see the picture)
I also update the video to make it more clear, what happens.
https://www.youtube.com/watch?v=XkkYb0-aGRo
2 Attachments
-
• #34
That's great! Thanks for the update!
So the plan is to put the Puck into the things that are knocked over, rather than the thing that is thrown?
-
• #35
Both. I'm also developing a sensor place in the bad also. But this is start.
Should I start a new thread as "project" ?
Need to see how can get puck.js connect to webpage same way as bangle.js and send the data it has recorded. -
• #36
It's up to you, but it seems as this thread is already started you might as well ask here as it'll be for very similar things.
-
• #37
I use bluetooth command in bangle to send the data package, but in puck.js you can use bluetooth and nrf to send data. Witch one is better in this case? I will send data only when throw is done.
Wondering also can I use same method to record acceleration as in bangle.js ( add/replace value in array with new one) or should I use something else. -
• #38
but in puck.js you can use bluetooth and nrf to send data
I don't really understand what you mean here - communications options between Puck.js and Bangle.js should be basically the same.
The
NRF.*
methods are for bluetooth, and are available on both.Bluetooth.print
/etc is still Bluetooth, but is Bluetooth UART.The Bluetooth UART provides buffering and slightly faster transfer, so I'd say use that if you can
Now I'm back and started again. I was testing the Acceleration Recorder app and that is good one. It is recording everything with 100hz and it works. I tried even with 400hz, but then the file size got too large and it could not write the csv file ( is there way to see how much space I have?)
But then I was trying to get it work with 200 hz and it started to give me a error:
I did manage try it with 2.5 pollInterval, but suddenly I can't anymore try anything else that 10 ms pollinterval. Any ideas why? Here is the edited part of the code: