HOME SLEEP LAB WITH INFRARED CAMERA

General Discussion on any topic relating to CPAP and/or Sleep Apnea.
User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Wed Jun 15, 2011 5:45 pm

Hello,

I've mentioned in some of my posts how important I thought home sleep videos are. I know some of you are doing them. They're really quite easy. Probably the easiest to set up is a web cam with time-lapse software. Many laptops have webcams built in and many of those have time-lapse software. If you have a webcam, but need the time-lapse software, I got mine here: http://www.nimisis.com/projects/flix.php. It's shareware, cost me $10, I think. If you need the webcam, I used a Microsoft LifeCam VX-3000. Cost me about $30 at Wal-Mart. I recommend a new webcam and not your laptop for this project.

The problem with webcams is that you need some light. Although many are pretty sensitive and are good in low light, still you got to have some light, so when I was recording I usually wore a sleep mask. One more thing to have on your head.

Now here's the neat thing. Most webcams can easily be converted to Infrared, humans can't see infrared, no mask required! I just found out how to convert webcams a short time ago and thought it was so cool I had to share it with y'all.

To modify a webcam for infrared, all you have to do is open it up, take out the infrared filter and replace it with with a visible light filter. I used exposed, developed. photo film negative as a visible light filter. Without the visible light filter, the webcam gathers too much light and the picture is washed out. I put a little circle of film on the outside of the lens rather than inside. For examples, and instructions just google "convert webcam to infrared" and you'll find lots of examples. You can search YouTube as well. This is sooo easy to do!

Now, theoretically, after your webcam has been converted you would need an infrared light source to iluminate your room. You can find them sold on the web, but they're a little pricey. In looking for something that might work, I got out our Christmas candelabras with red lights. You know, those funky plastic things you sit in the window over Christmas. Anyway, I thought they might work so I got out two, each having 5 candles. I figured enough infrared light would be produced by 10 red bulbs to light the room. I think they're C7 bulbs, 7 watts each. Well, it worked so well, I only needed ONE of the bulbs lit to do the trick.

Fooling with this camera is fun, even if you don't use it for sleep monitoring. Here's a video for you to see: https://www.youtube.com/watch?v=WZk-fokc9QU

Enjoy,
Jay

edit: this link takes you down several posts and describes how to build an LED infrard light sourcec; viewtopic.php?f=1&t=65101&st=0&sk=t&sd= ... 15#p609795

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video
Last edited by Jay Aitchsee on Mon Mar 19, 2012 5:32 pm, edited 4 times in total.

User avatar
Otter
Posts: 1063
Joined: Sat Mar 19, 2011 5:02 pm

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Otter » Wed Jun 15, 2011 5:52 pm

Good idea. For the IR source, a 7 watt bulb might still be too bright for some people. But I don't see why the visible portion of the spectrum couldn't be filtered out here too.

_________________
Mask: Quattro™ FX Full Face CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Software: SleepyHead 0.9 beta

User avatar
Lizistired
Posts: 2835
Joined: Tue Dec 14, 2010 10:47 pm
Location: Indiana

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Lizistired » Wed Jun 15, 2011 10:10 pm

Interesting info. Thanks for posting Jay. I need to do this again.

_________________
Mask: Swift™ LT Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Swift FX sometimes, CMS-50F, Cervical collar sometimes, White noise, Zeo... I'm not well, but I'm better.

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Thu Jun 16, 2011 5:26 am

Yes Otter, I agree the 7 watt is a little bright. It's certainly more than needed. You can see the video is a little washed out (but I didn't try to optimize it). I'm not sure visible red has the same negative effects on sleep architecture as white. I know red doesn't negatively impact night vision. In this experiment, the ambient red light in the room was not bothersome to me, but the bulb was bright if I looked right at it.

On the web, there was talk of using "floppy disc" for visible light filter material, but I haven't seen a "floppy" in so long I think they must have meant CD or DVD. Anyway, I'm sure there's material one could use to fashion a shade for this bulb.

Another possibility is night lights, I think they're only 4 watts and I'm sure they must be available in red, though I don't remember seeing one. Of course, the perfect solution is to use an IR light source. I mentioned they were a little pricey, but I think I saw a few under a $100. I think the place to go would be a store specializing in security cameras for info and as a possible source.

Jay

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
Lizistired
Posts: 2835
Joined: Tue Dec 14, 2010 10:47 pm
Location: Indiana

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Lizistired » Thu Jun 16, 2011 11:08 am

Jay Aitchsee wrote:Yes Otter, I agree the 7 watt is a little bright. It's certainly more than needed. You can see the video is a little washed out (but I didn't try to optimize it). I'm not sure visible red has the same negative effects on sleep architecture as white. I know red doesn't negatively impact night vision. In this experiment, the ambient red light in the room was not bothersome to me, but the bulb was bright if I looked right at it.
On the web, there was talk of using "floppy disc" for visible light filter material, but I haven't seen a "floppy" in so long I think they must have meant CD or DVD. Anyway, I'm sure there's material one could use to fashion a shade for this bulb.

Another possibility is night lights, I think they're only 4 watts and I'm sure they must be available in red, though I don't remember seeing one. Of course, the perfect solution is to use an IR light source. I mentioned they were a little pricey, but I think I saw a few under a $100. I think the place to go would be a store specializing in security cameras for info and as a possible source.
Jay
I can understand younger geeks having better access to floppy discs than photo film or negatives.
This is too easy. I swapped the filter in my cheapo ($7) webcam in 5 minutes. Then I found out my laptop already has timelapse software with a timestamp. The resolution on the netbook is pretty bad anyway. I pulled an infared LED out of a tv remote and put it on a AA battery box. So it's noon and I'm waiting for it to get dark so I can see if I need more LEDs! Any idea what the appropriate voltage for them is? I'm thinking I could string 6 of them in series if I need to. Thanks again!
I worked shift work in the Army for years so sleeping with a 40 watt bulb burning was nothing but I think the infrared should be better.

_________________
Mask: Swift™ LT Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Swift FX sometimes, CMS-50F, Cervical collar sometimes, White noise, Zeo... I'm not well, but I'm better.

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Thu Jun 16, 2011 11:45 am

Liz, I don't know what the voltage is for those LED's. I would guess 1.5 but I have no rationale for that guess. Can't be more than 3 though, since most remotes use only two AAA 1.5v batts.

I saw on the web gamers were hooking up infared LED's for eye tracking or something, I'd guess somebody has posted a "how to" there that can be found with Google. I'm sure it won't be too hard to track down.

I hear you about waiting for dark. Nice to have fun with with the equipment for a change!

Jay

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
Lizistired
Posts: 2835
Joined: Tue Dec 14, 2010 10:47 pm
Location: Indiana

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Lizistired » Thu Jun 16, 2011 12:08 pm

I was just concerned about too much voltage... that the board probably downgrades what voltage gets to the LEDs. I don't want to overload them and burn them out. I have some resistors I can put in line if needed. I have 9 i-LEDs in various old remotes to play with... and then they won't be taking up space...
The dope choppers will probably zone in on my bedroom though!

_________________
Mask: Swift™ LT Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Swift FX sometimes, CMS-50F, Cervical collar sometimes, White noise, Zeo... I'm not well, but I'm better.

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Thu Jun 16, 2011 2:33 pm

Liz, I had to think for a bit about LED's. They're rated in forward voltage drop and current capacity. They have negligible forward (conducting) resistance. You must use a resistor in series or they will "burn out".
Radio Shack has what appears to be a popular IR LED for about $2.00. It's forward Voltage drop is 1.2 volts, 100 miliamps current capacity. Let's say we use it with a 3 volt batt. We'll put the battery, the led, and the reisitor in series
Rember Ohm's Law, E = IR. Voltage = Current times resistance. So, we have a 3 volt batt, 1.2 volt drop across the diode leaving 1.8 voltage drop across the resistor. The diode has negligible forward resistance and we want to limit the circuit current to 100 miliamps (0.1 amps). 1.8volts divided by 0.1 amps = 18 ohm resistor required.
My guess is most of these IR diodes will be about the same. You might figure 1 volt forward and 50 miliamps max and you would "probably" be safe. Now, as I remember, you also need to exceed the forward voltage to get them to conduct or "turn on". So, for 6 in series, you would need more than 6 volts. Of course, you could put them in parallel. Or, series/parallel. Your circuit design could be limited by the size and numbers of resistors you have.
Now, if you google "LED calculator", you'll find some handy little calculators that will do the math for you. You should also verify everything I say. It's been a LONG time since I worked with these types of things and I don't claim to remember all these things right. In fact, as I think about it, there's a lot of things I don't remember right.
Jay

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
jedimark
Posts: 1300
Joined: Fri Feb 18, 2011 12:45 am
Location: Bundaberg, Australia
Contact:

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by jedimark » Thu Jun 16, 2011 6:18 pm

Hmmm.. I/R webcam support for SleepyHead would rock..

It would be cool to zoom through the apnea events, and see the video frame by frame..

A lot of storage space though. :/

Plus it would need a decent PC to run it.

An idea for the backburner...

_________________
Machine: ResMed AirSense™ 10 AutoSet™ CPAP Machine with HumidAir™ Heated Humidifier
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS50D+/F Oximeter, S9 VPAP Auto/Adapt, PRS1 Auto, Intellipap Auto, SleepyHead :)
Author of the free, cross platform, open-source sleep tracking software SleepyHead.
Download http://sleepyhead.jedimark.net
Source Code http://gitlab.com/sleepyhead/sleepyhead-code

User avatar
Lizistired
Posts: 2835
Joined: Tue Dec 14, 2010 10:47 pm
Location: Indiana

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Lizistired » Thu Jun 16, 2011 7:33 pm

Thanks Jay, I went back and put a resistor in. I'll see how much I get from 1 LED tonight.

Jedimark, I'll be thrilled just to have my O2 and apap data in the same screen! That's great what you've done. Well, maybe if you could link the flow line to the timestamp in the video...

_________________
Mask: Swift™ LT Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Swift FX sometimes, CMS-50F, Cervical collar sometimes, White noise, Zeo... I'm not well, but I'm better.

User avatar
JointPain
Posts: 261
Joined: Thu Apr 28, 2011 10:41 am
Location: Houston, TX

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by JointPain » Thu Jun 16, 2011 7:34 pm

Check out Candle Power Forums for all you want to know about electronics etc. for driving LEDs.

They're more into high-power lights etc., but I'm sure someone would know about low power too.

_________________
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Pressure is 11-14. Old CPAP was a Resmed S6 Lightweight. Also have Profile lite mask. ResScan is actually version 3.14. Now I use Sleepyhead.

User avatar
jedimark
Posts: 1300
Joined: Fri Feb 18, 2011 12:45 am
Location: Bundaberg, Australia
Contact:

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by jedimark » Thu Jun 16, 2011 7:50 pm

Lizistired wrote:Thanks Jay, I went back and put a resistor in. I'll see how much I get from 1 LED tonight.

Jedimark, I'll be thrilled just to have my O2 and apap data in the same screen! That's great what you've done. Well, maybe if you could link the flow line to the timestamp in the video...
It would be awesome.. The problem is making the video fit.. Need a 30" monitor (or a second screen) just to make it look good.

_________________
Machine: ResMed AirSense™ 10 AutoSet™ CPAP Machine with HumidAir™ Heated Humidifier
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS50D+/F Oximeter, S9 VPAP Auto/Adapt, PRS1 Auto, Intellipap Auto, SleepyHead :)
Author of the free, cross platform, open-source sleep tracking software SleepyHead.
Download http://sleepyhead.jedimark.net
Source Code http://gitlab.com/sleepyhead/sleepyhead-code

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Thu Jun 16, 2011 8:21 pm

Jedimark, I don't think you need too much to coordinate, of course I haven't seen your new software yet. I just run the video in Video Player at the same time I'm looking at my ResScan Detail. Now, I use the clock over my head (check the video) to corelate respiratory events with physical events. I can get pretty close. I'm taking one frame every 10 sec with the time-lapes so that's the limiting factor. The clock of my machine and clock over my head are synchronized close enough to tell what's going on. I can advance the video player frame by frame if I want to get down to 10 second detail.
Jay

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video

User avatar
jedimark
Posts: 1300
Joined: Fri Feb 18, 2011 12:45 am
Location: Bundaberg, Australia
Contact:

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by jedimark » Thu Jun 16, 2011 8:32 pm

Jay Aitchsee wrote:Jedimark, I don't think you need too much to coordinate, of course I haven't seen your new software yet. I just run the video in Video Player at the same time I'm looking at my ResScan Detail. Now, I use the clock over my head (check the video) to corelate respiratory events with physical events. I can get pretty close. I'm taking one frame every 10 sec with the time-lapes so that's the limiting factor. The clock of my machine and clock over my head are synchronized close enough to tell what's going on. I can advance the video player frame by frame if I want to get down to 10 second detail.
Jay
Coordinating that would be a sync.. The PC can provide exact timestamps.. I'd record straight from the software.

The problem is the CPAP machines have clock drift.. rather tricky to discover how far it's out (it is possible though with a bit of mucking around)

Seriously a one day job though.. plenty of other cool stuff to do first..

_________________
Machine: ResMed AirSense™ 10 AutoSet™ CPAP Machine with HumidAir™ Heated Humidifier
Mask: Swift™ FX Nasal Pillow CPAP Mask with Headgear
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: CMS50D+/F Oximeter, S9 VPAP Auto/Adapt, PRS1 Auto, Intellipap Auto, SleepyHead :)
Author of the free, cross platform, open-source sleep tracking software SleepyHead.
Download http://sleepyhead.jedimark.net
Source Code http://gitlab.com/sleepyhead/sleepyhead-code

User avatar
Jay Aitchsee
Posts: 2936
Joined: Sun May 22, 2011 12:47 pm
Location: Southwest Florida

Re: HOME SLEEP LAB WITH INFRARED CAMERA

Post by Jay Aitchsee » Fri Jun 17, 2011 6:11 am

OK Jedi, sync the video, sounds great!
Now the next thing that I want to do is count leg movements (PLMD). I've tried some pedometers but didn't have much luck. Primarily because they're designed to work in the vertical plane. There are some that have more than one accelerometer so they work in two planes but they cost a little more and I haven't got around to buying one yet. Another possibility is motion detector circuitry. So, once we get the counter going we want to sync it to the rest of the software and we've just about got the Lab complete!
Just one more thing we need - a way to accurately capture arousals. To me, that seems the hardest. Even the medicos cant seem to agree completely on the definition and method of measurement. It would seem though, that brain wave monitoring is essential. The ZEO has some promise, but I'm not convinced it actually works. I know you did some work with one a while back. What did you think?
Just some things to think about. I don't want you to be getting bored.
Jay

_________________
Mask: AirFit™ P10 Nasal Pillow CPAP Mask with Headgear
Additional Comments: S9 Auto, P10 mask, P=7.0, EPR3, ResScan 5.3, SleepyHead V1.B2, Windows 10, ZEO, CMS50F, Infrared Video