Acceleration without gravity #7265
Replies: 2 comments 3 replies
-
Posted at 2023-05-14 by HughB location will be GPS lat/lon ? It will take you at least 20 seconds to power on the GPS and get a fix and that is assuming you have downloaded AGPS data - otherwise expect 12 minutes for the first fix. Posted at 2023-05-14 by Mi I guess you not think of GPS but double integration of acceleration. Main thing is that every sensor is noisy. Integration amplifies this noise, so you will have wrong speed. This will change your location all the time without bounds, even if in reality you are standing still. So after double integration you will have very big error after very short amount of time. That could be the Magnetometer if you operate quite close to a strong magnet, but no way to count on earth magnetic field (lots of noise from all kind of metal and fields in the environment) Depending on what you want to do, you might think of instead make use of the gravity, since this is something that can anker you. But of course only if you can discriminate gravity and acc through some other constraints or system model (not magnetometer unfortunately). All this is not specific to bangle but true even for much more expensive sensors. Posted at 2023-05-15 by @gfwilliams Yes, I'm afraid it's an almost impossible problem with only the accelerometer... A Gyro would help no end but the Bangle doesn't have one (Puck.js does). But, one hack that might help you is you say that when you're not accelerating, gravity should be 1, and the accelerometer will be pointing towards the earth. So when that happens you know kind-of where you are. For example:
Posted at 2023-05-17 by AccMagno Yeah, I was wondering why bangle doesn't have gyro. I thought magnetometer is there for that. Posted at 2023-05-17 by @gfwilliams That's interesting - you can put the accelerometer into a higher speed mode as well (check the acceleration recorder source). I would have thought for something like throwing you may well be able to at least get some values that are useful for comparison. Because your arm will be rotating the actual velocity may be different, but it may be some more information can be gathered using the compass as well. Posted at 2023-05-19 by AccMagno I have been using "Acceleration Logger" app and it gets the data in 12.5Hz. What would be the max logger frequency (about a guess) and how I can get "higher speed mode" on? Posted at 2023-05-19 by @gfwilliams Ahh, right - I was thinking of https://banglejs.com/apps/?id=accelrec but that's only available on Bangle.js 1 at the moment. I've just fixed that and it's in the development app loader, so you can check out how it gets the higher frequency by poking the accelerometer itself - right now it runs at 100Hz but you might be able to push it higher. Posted at 2023-05-22 by AccMagno " I have just fixed that.." Where is that? I can't find any new commit on "Acceleration Recorder" or on the " Acceleration Logger" app in development branch :/ Posted at 2023-05-22 by @gfwilliams It was here: espruino/BangleApps@796bfda Posted at 2023-05-22 by AccMagno I could swear that wasn't there for two days. I looked through all your commits and I didn't see that one. Thanks! Posted at 2023-05-22 by AccMagno It works, but it only records for 2s ( or 5 second as code says so). I need to record 30min. What if I increase sample size, like 1800 * Hz. Will my watch burn or something else? Is 256 kB ram enough? Posted at 2023-05-24 by @gfwilliams How's it gone from "I would like to calculate 3-4 seconds " to 30 minutes? Increasing the buffer size is ok, but you have 6 bytes/sample - and lets say you have ~150k free RAM, that's 25000 samples, or 250 seconds at 100Hz. If you want more, you're going to have to save to flash memory. Lots of info on how to do that at http://www.espruino.com/Data+Collection#flash-memory - I don't see a problem writing 100Hz, but you may struggle getting it higher. You're not going to 'burn' your watch playing with settings, but I guess you might crash it and have to long-press to restart. Have a try and see what works. Posted at 2023-05-25 by AccMagno Good to know that I can't 'burn' it :D Then I will test different thinks. "How's it gone from..." ah yeah, sorry for that. The idea is measure now the data and explore it and see how it behaves. Then later I will make an app that shows you live how many throws you have had and speed of the throws and so one. So I don't eventually need to measure 30 min, just now to collect the data from the game. In the future app I need to have live array or list of acceleration data and then update it by adding new one and removing oldest. Then when the app measures spike on the acceleration, it can calculate all the data from the array. But first I need to explore the data. For example I was expecting do see from data, which way the hand is moving (backwards or forwards), but for some reasons I cant see that. I only see spikes on x-axis but all the spikes are negatives, so I need to explored more why. Maybe the hand just turns when there is bull forward. But now I think I will modify the "Acceleration Logger" app and add option to change the data collection frequency, so I can see what is good enough, so when I will make the app, I know what frequency to have and it doesn't use all battery in one call :D Thanks for the "http://www.espruino.com/Data+Collection#flash-memory " link. This was good! I still feel I need to order second watch, just in case my one breaks down ^^ or is there there bangle.js 3 coming with gyro ;)? Posted at 2023-05-25 by @gfwilliams
Well if you want to that's great, but I wouldn't do it because you'll be worried you'll break it - they're made for this. Look at it this way - we've sold around 10,000 Bangle.js 2s, mostly to folks who spend a lot of time messing around with all kinds of things on them, and I don't believe I've had a single one returned that was broken by something done in software.
Not any time soon I'm afraid, I'll be sticking with Bangle.js 2 for quite a while! Posted at 2023-05-27 by Philip
If I am throwing a frisbee, the actual throw probably takes place over a quarter second or less. The acceleration due to the throw could be multiple orders of magnitude greater than gravity. I have heard quotes that a frisbee throw can involve instantaneous force vectors of 150 times the force of gravity. If you just ignore any data point where the accelerometer is reading a vector with a magnitude less than 10 Gs, and then don't even bother to account for gravity, you will probably be able to end up with less than 5-10% error overall compared to if you did account for gravity (which also might not be perfectly accurate, but that's a different problem). https://www.youtube.com/watch?v=x4wnbKYfPLs On top of that, if you have a magnitude limit, you can throw for 30 minutes and end up with only like 10 seconds of actual data that you need to save. Posted at 2023-05-31 by AccMagno just a update:
True. Now I just want to collect data. If the writing to text file takes too much time, I can make it write only when there is a peak. Otherwise I will just update an array on the ram with new values. Lets see. Posted at 2023-06-05 by @gfwilliams The app does a bit more than changing just the poll interval. The poll interval is the rate the accelerometer is checked for new data - but the accelerometer is only recording at 12.5Hz by fault anyway - it needs configuring to output data faster using Posted at 2023-06-06 by AccMagno Yeah I was watching this from the accelrec, but I didn't find any documentation about the options and what to write.
What happens in here? update: reading from the datapage, I can see why you have to turn the acceleration on and off and what are the update options. Posted at 2023-06-06 by @gfwilliams
Posted at 2023-07-03 by AccMagno Ok this project is on hold, because I can't connect to my watch anymore. Have to get new one. There is no possibility to connect it by cable, is there? Posted at 2023-07-03 by @thyttan Have you tried finding the watch with one of the 'nrf Connect' apps? https://www.espruino.com/Firmware+Update#android-ios-app (Or toggled the different bluetooth settings, doing factory reset from the watch etc...?) Posted at 2023-07-03 by @gfwilliams You can't connect with the cable, no (apart from for low level debug access, which is not what you want). But it's extremely likely you can get bluetooth to work again. Sometimes it's even just that your PC gets confused and your computer needs a restart before it'll see the Bangle again Posted at 2023-07-03 by AccMagno I did everything from other forum post: reset settings, factory reset, scan with different deices, all the bluetooth settings ok, no pass code, pinch from the corner... nothing for a 2-3 weeks. It is not the first time, I lost it, but now I think it really break. Posted at 2023-08-09 by AccMagno I got a new one. Testing is continued Posted at 2024-04-21 by AccMagno 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?)
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:
Posted at 2024-04-21 by AccMagno double message. skips this Posted at 2024-04-22 by @gfwilliams
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 Posted at 2024-04-22 by AccMagno Ok. No worries. Posted at 2024-04-27 by AccMagno 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:
Posted at 2024-04-29 by @gfwilliams 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 Posted at 2024-05-13 by AccMagno So I got more data.
Posted at 2024-09-18 by AccMagno update: Attachments: Posted at 2024-09-18 by @gfwilliams 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? Posted at 2024-09-19 by AccMagno Both. I'm also developing a sensor place in the bad also. But this is start. Posted at 2024-09-20 by @gfwilliams 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. Posted at 2024-12-18 by AccMagno 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. Posted at 2024-12-19 by @gfwilliams
I don't really understand what you mean here - communications options between Puck.js and Bangle.js should be basically the same. The The Bluetooth UART provides buffering and slightly faster transfer, so I'd say use that if you can |
Beta Was this translation helpful? Give feedback.
-
So now we are here. Looks good. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2023-05-13 by AccMagno
Hi,
Is there any good ways to get acceleration sensor data without gravity? Like it would use magnetometer to get the orientation and then remove gravity based on it? Some ready made examples.
I would like to calculate 3-4 seconds the speed the watch has and if possible, also a location/orientation.
Beta Was this translation helpful? Give feedback.
All reactions