Page 3 of 6

Re: Torso position determined via accelerometer!

Posted: Sun Jun 10, 2012 8:15 pm
by MaxDarkside
Hi Avi,

This is fun. OK, if our software can run these I think we can get some x,y,z data off of a thumb-drive (lol). (laughing friendly wink)

Re: Torso position determined via accelerometer!

Posted: Sun Jun 10, 2012 9:35 pm
by pats
avi123 wrote:
MaxDarkside wrote:I apologize for getting off topic. My accelerometer should be here Thursday or so. I'm looking forward to playing with it, seeing what I can do, both in mechanics of sleep and what I can do with the data. Thanks for your sharing and guiding hand, BasementDwellingGeek.
Max, you would not be able to do anything with that $89 accels. You need an Electronic Engineer and a Computer Programmer to figure out how to output the electrical signals into a meaningful data, costing you a few grands. Why don't you ask tschults to tell you how to do it since he said: Updating SleepyHead to handle this additional data is relatively easy and would allow for a single program to monitor our sleep.
Why "costing you a few grands"? Computer programmers and electrical engineers can also be sleep apnea patients hanging out in this forum.

Re: Torso position determined via accelerometer!

Posted: Mon Jun 11, 2012 5:51 am
by BasementDwellingGeek
I am part way through PCB layout
Would you care to share any details? Which accelerometer, sample rate, microcontroller? A cost estimate? Is the body temperature sensor integrated?

Have you checked out the MSR line? The MSR145 at 20 x 15 x 52 mm approx. 16 g looked pretty sweet but at $272 seemed like highway robbery.

Re: Torso position determined via accelerometer!

Posted: Mon Jun 11, 2012 6:22 am
by tschultz
BasementDwellingGeek wrote:
I am part way through PCB layout
Would you care to share any details? Which accelerometer, sample rate, microcontroller? A cost estimate? Is the body temperature sensor integrated?

Have you checked out the MSR line? The MSR145 at 20 x 15 x 52 mm approx. 16 g looked pretty sweet but at $272 seemed like highway robbery.
There are a number of off-the-shelf data-loggers available but I want to have full control over the data collection and recording. This way I can adjust raw/vs filtered data to fine-tune the actual data acquisition and recording. I have a few other applications for the hardware platform as it is not specific to only sleep monitoring.

The accelerometer I am using is the ST LIS302DL, http://www.st.com/internet/analog/product/152913.jsp
Yes, my design has in integrated body temperature sensor, and is using an ST STM32L151 microcontroller, http://www.st.com/internet/mcu/product/248831.jsp
Although this is certainly more horsepower than needed it costs no more than a comparable 8 but micro and I can do so much more in code if I chose.

Initially I am expecting to be able to measure body temperature to a resolution of 0.1 degree C.

I have not totaled up the final cost but costs, including enclosure, are approx $50 depending on what battery solution I use. Very small quantities of parts, especially the PCB are the biggest cost factors. Making 10 units results in approx a 30% cost reduction as compared to only 1-2 units. The design can be lower cost if I drop the rechargeable battery and just use an CR2020 or CR2032 battery. I am using the coin cells to keep the thickness down. This is optional at this time based on how the PCB is populated as I have allowed for both power methods.

My initial thoughts are to sample run the accelerometer at around only 50 samples/second but only record a portion of this. Once "noise" is filtered out it does not take much memory to record changes in position. An option to record raw data is certainly possible and only limited by amount of memory and battery capacity (more writes = more power). The memory devices take 1000 times more power when writing than in sleep or standby so I accumulate in RAM and then write to non-volatile in bursts every 30-60 seconds. The exact method is flexible with only a couple of params in the firmware to control it. The code for the micro in written in C so is quite easily modified.

Re: Torso position determined via accelerometer!

Posted: Mon Jun 11, 2012 9:53 am
by -tim
pats wrote:
avi123 wrote:
MaxDarkside wrote:I apologize for getting off topic. My accelerometer should be here Thursday or so. I'm looking forward to playing with it, seeing what I can do, both in mechanics of sleep and what I can do with the data. Thanks for your sharing and guiding hand, BasementDwellingGeek.
Max, you would not be able to do anything with that $89 accels. You need an Electronic Engineer and a Computer Programmer to figure out how to output the electrical signals into a meaningful data, costing you a few grands. Why don't you ask tschults to tell you how to do it since he said: Updating SleepyHead to handle this additional data is relatively easy and would allow for a single program to monitor our sleep.
Why "costing you a few grands"? Computer programmers and electrical engineers can also be sleep apnea patients hanging out in this forum.
No never...


There are some cheap boards that Radio Shack is now selling and I know lots of people who have done impressive things with them. I saw a 3d plastic printer that used one to make a whistle just last week.

The wearable computing people have been doing some interesting things with bio monitoring as well.

Oh, it appears that if you feed data into the file format that the resmed S9 uses, then sleepyhead can quaff it. The format is a version of something used for EKG/ECG machines and it has a date field called a "stardate".

Re: Torso position determined via accelerometer!

Posted: Mon Jun 11, 2012 3:50 pm
by avi123
Has anyone heard of this place but not about sports?

Testing of Body Position Recorder (BPR) in the Home to Monitor Treatment for Sleep Apnea

Link:

http://www.healthcaredelivery.psu.edu/W ... 0Apnea.pdf

Also


Body Position Kit - AC

https://www.shopembla.com/index.cfm/id/ ... 1&system=0

Re: Torso position determined via accelerometer!

Posted: Mon Jun 11, 2012 10:09 pm
by MaxDarkside
-tim wrote:Oh, it appears that if you feed data into the file format that the resmed S9 uses, then sleepyhead can quaff it. The format is a version of something used for EKG/ECG machines and it has a date field called a "stardate".
LOL... I think I remember seeing "stardate" in there. I'm not too sure I'd wish that EDF data format on my worst enemy though. Handy when done right, but I've looked at a variety of devices that generate EDF files and I can tell some of the programmers don't understand how to use it, or, perhaps more likely, I don't understand what the heck they are trying to do. Thank goodness there's an EDF format .NET open source library so one can explore the structures to see where the heck the data is and how to work the time stamps. We use that library to import the 4 ResMed S9 EDF data files per session.

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 1:43 am
by yrnkrn
If you have an iPhone (even an old one will do), there is a $4 app called SomnoPose that records your body position using the built-in g-sensor. You can view posture graph on the iPhone and email the raw data in CSV format. I had used this app for couple of nights and it worked well.

SomnoPose is available on the App Store:
http://itunes.apple.com/us/app/somnopos ... 31385?mt=8

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 2:20 am
by kteague
BasementDwellingGeek wrote:I know every thing I've done seemed pretty obvious to me.


Obvious? Im reading this thread both intrigued and befuddled. I love watching great minds at work. I can't even get in this conversation! lol

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 1:42 pm
by avi123
Max, it does not pay to re-invent the wheel. My last link above shows that sensors for Body Position during sleep are availabe and used routinly in sleep studies. See it again here:

http://www.embla.com/files/embla/downlo ... atalog.pdf

The price of such a sensor ready to use is $250.

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 1:59 pm
by MaxDarkside
avi123 wrote:Max, it does not pay to re-invent the wheel.
I'm not. From what I understand, the accel BDGeek suggested issues an X,Y,Z text file on a USB thumb drive, which I can "snack-up" into our system easily. No invention required. I likely will do some post-processing of X,Y,Z but we're more than equipped in data processing to do that in a giga-plethora of ways... clickie-tap-tap, save away the pre-processing scheme. No coding or nuthin'.

I could be wrong. I've been known to be wrong quite often I'll find out in about 24 hrs from now.

Thanks.

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 2:10 pm
by MaxDarkside
I'm not your typical xPAP'er, Avi. When I joined this forums, when I was diagnosed, I said in here that Sleep Apnea has picked on the wrong guy. I now get Zeo sleep scores averaging in the 80s, much better than my age group's average and I'm targeting 2.5 AHI. I'm presently at 2.55, almost perfectly on target, though it could be more consistent. I can't control everything I have software tools and technologies at my fingertips that probably no OSA patients have, ranging from broad ranging data access, real-time data historians, multi-source extraction and integration, billions of permutations of point and click pre-processing, non-linear universal regression modeling, clustering technologies, cause and effect analysis (time-based, model sensitivity, ...), estimation and prediction (both off-line and streaming on-line while I sleep for real-time data sources), condition-based constrainable non-linear optimization technologies, etc. Getting to maximal "Day Time Feel" is a bit of a challenge because that's a changing-during-the-day subjective judgment, but my tools can handle that if I have the discipline to record how I perform and feel (the hardest part).

Thanks.

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 7:19 pm
by avi123
MaxDarkside wrote:I'm not your typical xPAP'er, Avi. When I joined this forums, when I was diagnosed, I said in here that Sleep Apnea has picked on the wrong guy. I now get Zeo sleep scores averaging in the 80s, much better than my age group's average and I'm targeting 2.5 AHI. I'm presently at 2.55, almost perfectly on target, though it could be more consistent. I can't control everything I have software tools and technologies at my fingertips that probably no OSA patients have, ranging from broad ranging data access, real-time data historians, multi-source extraction and integration, billions of permutations of point and click pre-processing, non-linear universal regression modeling, clustering technologies, cause and effect analysis (time-based, model sensitivity, ...), estimation and prediction (both off-line and streaming on-line while I sleep for real-time data sources), condition-based constrainable non-linear optimization technologies, etc. Getting to maximal "Day Time Feel" is a bit of a challenge because that's a changing-during-the-day subjective judgment, but my tools can handle that if I have the discipline to record how I perform and feel (the hardest part).

Thanks.
You are doing great!

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 7:33 pm
by MaxDarkside
avi123 wrote:Hey Max, what if I post here Vanguard Wellington fund's annual returns of dividend income and capital gain (or total of both) and also the annual CPIs, and you would calculate if an investor who retired at the beginning of 1972 and withdrew in the first year 4% or 5% and in the subsequent year boosted (or reduced) the dollars withdrawn by the previous year's CPI. After how many years was the account exhausted? And also do a Monte Carlo Simulation to show the % of failures in 10,000 iterations?
Another calculation that I am interested in is if the retiree used only the distributed cash income for expenditures and left (reinvested) the capital gain distribution in the Wellington fund, then, what shape of the cash stream graph, in real terms, was it for the next 30 years? Do it for rolling 30 years since the beginning of 1972 till end of 2011.
Any chance?
Actually, we have a presence in finance, it's one of our bigger sectors. Companies such as Standard & Poors is a customer, for example. Probably could do that, as well as forecast 3500 securities, deciled by likelihood to rise and fall and allocate assets in various portfolios to minimize risk vs. maximal return. To do what you ask, we'd need to setup a contract... (double wink).

Edit: we also support real-time streaming financial feeds (bid/ask quotes), numerous simultaneous bar-building methods and send the bars onward into adaptive autonomously self-performance-managed trading systems. Our historian handles about 50,000 quotes per second, modest but effective and highly flexible.

Edit 2: Anyway, enough of this. That should be sufficient to indicate that I can get x,y,z data off a thumb drive accelerometer and do something useful with it without reinventing the wheel much.

Re: Torso position determined via accelerometer!

Posted: Tue Jun 12, 2012 8:41 pm
by avi123
Max, please don't tell me that you compete with SAS and Jim Goodnight?
That's a NO NO.


Has SAS chairman Jim Goodnight cracked the code of corporate culture?

Michael Lee Stallard, Jun 18, 2010, 05.43am IST

Tags:
SAS|
NASA|
Jim Goodnight


Most of the leaders I meet believe the people they lead are aligned with strategy and engaged in their work. The data suggest otherwise. The Conference Board released research in January that concluded employee satisfaction and engagement in America were at the lowest point since it began surveying more than 20 years ago.

The report also concluded that the downward trend began long before the Great Recession. Another well-respected organisation, the Corporate Executive Board, released research last year that concluded 75 percent of the employees were not engaged and giving their best efforts and of the 25 percent who were engaged, 60 percent were not aligned with organisational goals.