Torso position determined via accelerometer!

General Discussion on any topic relating to CPAP and/or Sleep Apnea.
User avatar
MaxDarkside
Posts: 1199
Joined: Sun Dec 18, 2011 4:21 pm
Location: Minneapolis, MN

Re: Torso position determined via accelerometer!

Post by MaxDarkside » Sun Jun 10, 2012 8:15 pm

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)

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS-50E Oximeter, Zeo Bedside, Software: Comm'l grade AI analytics server & tools & SleepyHead
Last edited by MaxDarkside on Tue Jun 12, 2012 10:55 pm, edited 1 time in total.
Do or Die... Sleep Apnea killed me, but I came back. Click for my story
Please visit my My Apnea Analytics blog. Maybe we can help each other.
54 yrs, 6' 1", 160->172 lbs

User avatar
pats
Posts: 289
Joined: Sun Apr 22, 2012 5:52 pm

Re: Torso position determined via accelerometer!

Post by pats » Sun Jun 10, 2012 9:35 pm

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.

_________________
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Additional Comments: Software: SleepyHead.

User avatar
BasementDwellingGeek
Posts: 262
Joined: Sat Nov 05, 2011 12:54 pm
Location: N Billerica, MA, USA
Contact:

Re: Torso position determined via accelerometer!

Post by BasementDwellingGeek » Mon Jun 11, 2012 5:51 am

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.

_________________
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: own home grown SW to make it all work together, SH too.
bdg
(PR System One REMstar Pro CPAP Machine with C-Flex Plus and related humidifier as backup)

There are two types of people in this world. Those that can extrapolate from incomplete data

User avatar
tschultz
Posts: 257
Joined: Sun Dec 19, 2010 9:36 pm
Location: Toronto, ON, Canada, Earth, Milky Way Galaxy

Re: Torso position determined via accelerometer!

Post by tschultz » Mon Jun 11, 2012 6:22 am

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.

_________________
Mask: Mirage™ SoftGel Nasal CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Currenlty using Auto 15-20, EPR 1 with medium response; 95% pressure is 16.8
Adjusting to life with OSA and being pressurized each night ...

-tim
Posts: 710
Joined: Sat Dec 03, 2011 7:46 pm
Location: Melbourne Australia

Re: Torso position determined via accelerometer!

Post by -tim » Mon Jun 11, 2012 9:53 am

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".

_________________
Mask: AirFit™ N20 Nasal CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Resmeds overpriced SpO2

User avatar
avi123
Posts: 4510
Joined: Tue Dec 21, 2010 5:39 pm
Location: NC

Re: Torso position determined via accelerometer!

Post by avi123 » Mon Jun 11, 2012 3:50 pm

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

_________________
Mask: Mirage™ SoftGel Nasal CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments:  S9 Autoset machine; Ruby chinstrap under the mask straps; ResScan 5.6
see my recent set-up and Statistics:
http://i.imgur.com/TewT8G9.png
see my recent ResScan treatment results:
http://i.imgur.com/3oia0EY.png
http://i.imgur.com/QEjvlVY.png

User avatar
MaxDarkside
Posts: 1199
Joined: Sun Dec 18, 2011 4:21 pm
Location: Minneapolis, MN

Re: Torso position determined via accelerometer!

Post by MaxDarkside » Mon Jun 11, 2012 10:09 pm

-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.

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS-50E Oximeter, Zeo Bedside, Software: Comm'l grade AI analytics server & tools & SleepyHead
Do or Die... Sleep Apnea killed me, but I came back. Click for my story
Please visit my My Apnea Analytics blog. Maybe we can help each other.
54 yrs, 6' 1", 160->172 lbs

yrnkrn
Posts: 172
Joined: Sat Feb 12, 2011 1:07 pm

Re: Torso position determined via accelerometer!

Post by yrnkrn » Tue Jun 12, 2012 1:43 am

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

_________________
Machine: AirCurve™ 10 VAuto BiLevel Machine with HumidAir™ Heated Humidifier
Mask: DreamWear Gel Nasal Pillow CPAP Mask with Headgear - Fit Pack (All Nasal Pillows with Medium Frame)
Additional Comments: OSCAR, CPAP=6, https://sites.google.com/view/palatal-prolapse/

User avatar
kteague
Posts: 7772
Joined: Tue May 16, 2006 8:30 pm
Location: West and Midwest

Re: Torso position determined via accelerometer!

Post by kteague » Tue Jun 12, 2012 2:20 am

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

_________________
Mask: TAP PAP Nasal Pillow CPAP Mask with Improved Stability Mouthpiece
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Bleep/DreamPort for full nights, Tap Pap for shorter sessions

User avatar
avi123
Posts: 4510
Joined: Tue Dec 21, 2010 5:39 pm
Location: NC

Re: Torso position determined via accelerometer!

Post by avi123 » Tue Jun 12, 2012 1:42 pm

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.

_________________
Mask: Mirage™ SoftGel Nasal CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments:  S9 Autoset machine; Ruby chinstrap under the mask straps; ResScan 5.6
see my recent set-up and Statistics:
http://i.imgur.com/TewT8G9.png
see my recent ResScan treatment results:
http://i.imgur.com/3oia0EY.png
http://i.imgur.com/QEjvlVY.png

User avatar
MaxDarkside
Posts: 1199
Joined: Sun Dec 18, 2011 4:21 pm
Location: Minneapolis, MN

Re: Torso position determined via accelerometer!

Post by MaxDarkside » Tue Jun 12, 2012 1:59 pm

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.

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS-50E Oximeter, Zeo Bedside, Software: Comm'l grade AI analytics server & tools & SleepyHead
Do or Die... Sleep Apnea killed me, but I came back. Click for my story
Please visit my My Apnea Analytics blog. Maybe we can help each other.
54 yrs, 6' 1", 160->172 lbs

User avatar
MaxDarkside
Posts: 1199
Joined: Sun Dec 18, 2011 4:21 pm
Location: Minneapolis, MN

Re: Torso position determined via accelerometer!

Post by MaxDarkside » Tue Jun 12, 2012 2:10 pm

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.

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS-50E Oximeter, Zeo Bedside, Software: Comm'l grade AI analytics server & tools & SleepyHead
Do or Die... Sleep Apnea killed me, but I came back. Click for my story
Please visit my My Apnea Analytics blog. Maybe we can help each other.
54 yrs, 6' 1", 160->172 lbs

User avatar
avi123
Posts: 4510
Joined: Tue Dec 21, 2010 5:39 pm
Location: NC

Re: Torso position determined via accelerometer!

Post by avi123 » Tue Jun 12, 2012 7:19 pm

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!

_________________
Mask: Mirage™ SoftGel Nasal CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments:  S9 Autoset machine; Ruby chinstrap under the mask straps; ResScan 5.6
Last edited by avi123 on Wed Jun 13, 2012 6:32 am, edited 1 time in total.
see my recent set-up and Statistics:
http://i.imgur.com/TewT8G9.png
see my recent ResScan treatment results:
http://i.imgur.com/3oia0EY.png
http://i.imgur.com/QEjvlVY.png

User avatar
MaxDarkside
Posts: 1199
Joined: Sun Dec 18, 2011 4:21 pm
Location: Minneapolis, MN

Re: Torso position determined via accelerometer!

Post by MaxDarkside » Tue Jun 12, 2012 7:33 pm

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.

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS-50E Oximeter, Zeo Bedside, Software: Comm'l grade AI analytics server & tools & SleepyHead
Do or Die... Sleep Apnea killed me, but I came back. Click for my story
Please visit my My Apnea Analytics blog. Maybe we can help each other.
54 yrs, 6' 1", 160->172 lbs

User avatar
avi123
Posts: 4510
Joined: Tue Dec 21, 2010 5:39 pm
Location: NC

Re: Torso position determined via accelerometer!

Post by avi123 » Tue Jun 12, 2012 8:41 pm

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.

_________________
Mask: Mirage™ SoftGel Nasal CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments:  S9 Autoset machine; Ruby chinstrap under the mask straps; ResScan 5.6
Last edited by avi123 on Tue Jun 12, 2012 9:01 pm, edited 1 time in total.
see my recent set-up and Statistics:
http://i.imgur.com/TewT8G9.png
see my recent ResScan treatment results:
http://i.imgur.com/3oia0EY.png
http://i.imgur.com/QEjvlVY.png