# Sleep and Dreams > Research >  >  REM Detectors (again)

## Placebo

I'm trying my damndest to investigate alternative methods of detecting REM.
In theory, I'm doing well. In practice, its damn hard to find the right sensors for this stuff, without paying big money for the displays and equipment. I just want the damn electronic sensor   :Mad:  

Does anyone have ideas on how to source finger sensor electronic components (ECG), finger oximeter components, galvanic skin response (GSR) components... or anything along that line?

I have a kickarse idea for a novadreamer replacement, but I guess the above question should pretty much tell you where I'm going with this...

*PS*
The reason I want to do this, is 'cos LD has to be my LIFE before I get decent consistency of them. I would like to have periods of LD relaxation, while still enjoying LD's with no effort. I do believe in learning how to attain LD's naturally, but I have a life outside of DV sometimes  :wink2:

----------


## Seeker

The easiest way is still an IR transmitter/reciever pair connected to a sensitive operational amplifier.  The difficulties lie in keepint it from getting erroneous reading.

One idea that was floated a couple of times is to just forget about detecting REM and just doing it with a timer.

If you keep a fairly regular sleep schedule, it should be possible to predict when you are in REM and fire off the flashing.  For example, I get up at 6am every morning and always awake remembering a dream, therefore, if I set it to 5:30, there is an almost 100% chance I will hit a REM phase.

If I could get away with it, I would set up things to flash a couple of bright flashlights on me.  Problem is, I don't sleep with things on my head and my wife wouldn't like flashlights going off all night long  :Mad:

----------


## Placebo

I like the idea of detecting REM  :tongue2: 
Rather that, than be woken up in the night cos of a damn flashlight
I also don't like the idea of sticking IR in my eyes

Anyway, my idea was to have a glove with finger oximeter or pulse meter to detect REM, and a vibration or tiny shock in the palm of the hand as the external dreamsign
I may still do it, but there's a lot of snags to the idea

----------


## Malan

I have an idea about flashing, but I haven't tested that yet :

If you have your computer in your bedroom (or a sceen / TV in your bedroom connected to your computer in an other room), and if like Seeker you can predict when you are in REM you can try something :

You can make a 1024x768 flashing picture between 15hz and 10hz like this : http://gbacorp.free.fr/malan/images/ld.gif
Then go to the control panel, open the task manager, and create a new task sheduled at the time you think your are in REM (note that the configuration wizard only allow .exe files, so choose any file and when you finish the settings, edit the task and choose the file you have create, or my file "ld.gif")

So, your computer will open the flashing picture at the time shuduled, in your REM state. Your file must be open in full screen (no problem with ACDsee, or Internet Explorer [F11]), if you have another software, try to find the way to open files in full screen mode (or nearly).

Finally set a black wallpaper on the desktop and go sleeping. The picture is flashing 80 times and stop

You can test if you want  :smiley:

----------


## Howie

I have read of a PET (positron emmission tomogrphy) for brain imagaging and an FMRI, functional magnetic resonance imaging. But I don't know much more than their names or if they would be of any help.   Hope so.

----------


## Placebo

Thanks, but they're unlikely to help since (1) they're damn expensive and (2) they involve putting contraptions and gunk on your head normally

----------


## Seeker

> _Originally posted by Placebo_
> *Anyway, my idea was to have a glove with finger oximeter or pulse meter to detect REM, and a vibration or tiny shock in the palm of the hand as the external dreamsign
> I may still do it, but there's a lot of snags to the idea*



How will that detect REM?

----------


## Placebo

Pulse rate(definitely) and blood oxygen (I think) change drastically between delta and REM. Thus can be used to determine REM.
Like I said it has snags, like determining that change requires some logic, and thus some digital electronics
And it has to be adaptable to determine the high and low levels for each individual

On the positive side, it means with a little extra work, you could gather information about the vital statistics of a person while sleeping, and determine their REM cycles  :smiley:

----------


## Seeker

OMG!  That could work!  Not too difficult either.

Control algorythm something like this:

Wait for pulse to drop below 72
Arm device
Wait until a pulse > 75 has been detected for more than 30 seconds
Start flashing

Heartrate monitors are very cheap.  Most athletic stores sell them and they are popular with joggers.

----------


## Howie

Any objections to moving this to the Research team?
I see this going some where.

You are surtainly not short on ideas placebo.

----------


## Placebo

[quote]Any objections to moving this to the Research team?
I see this going some where.

You are surtainly not short on ideas placebo
Hehe, thanks. Go ahead ... thing is, I notice people don't always check out the research section
Wonder if there's a way to fix that...

Seeker, when you say heartrate monitors are cheap... like.. how much?
The cheapest I find is 20 dollars, and (1) thats too much for my exchange rate - I was hoping for something closer to 10 dollars, and (2) how the hell would I figure out the raw data coming from the sensor?

Hope I don't buy a sensor and then blow it  :tongue2:

----------


## Seeker

I'll research it a little, yeah, $20 is about the cheapest and you would have to dismantle it.  All you really need is a pulse alarm, something that would energize a relay or something when your pulse got above a certain level.  You would just have to remember to arm it just before sleep.

----------


## Placebo

I think it'll be a little more complicated because everyone's pulse is a little different, depending on health, how much coffee they drank, etc
But thats the basic idea, yes

We can call it the DreamCatcher glove, and sell it on DreamViews!  ::D:

----------


## Mickeys_Elbow

Better get the patent quickly!

And the heartrate monitoring between different users could easily be solved with a little smart programming into the device making it keep a record of the person using it and determining their average heartrates. That is if you are serious about creating this device for more people than just yourself.

Personally I think it is a very good idea and could be the inexpenssive alternative to the damnable Nova Dreamer!

----------


## Placebo

Thanks  :smiley: 
It's turning out to be a pain to organise. As soon as I've got money again, I'm gonna take a drive to an old friend of mine who's one of those wierd old knowledgeable men  ::D: 
He'll be able to give me some ideas, I'm betting

----------


## Seeker

I have access to small industrial controllers.  It would be a snap to program the logic into one of those to take care of monitoring and administering the vibrations.  Unfortunately, the smallest of these devices is about the size of three cigarette packs.  A little big.

----------


## Placebo

No worries - a few altera chips will probably do the trick.
It's the sensors that are a problem so far

That guy I want to visit is quite impressive with electronics and mechanics, his advice might be invaluable

----------


## Howie

Here is a recent post CHEAPEST light machine in the world (DIY)

Thought it might have some similar interest to your Idea Placebo.

----------


## MeusOpusMagnus

I like the pulse idea quite a lot and i have a few ideas about solving things (however my electronics skills aren't the most elaborate)...

here's the deal, you can do mostly ANYTHING with a computer and you don't have to worry about programming chips (PIC being the easiest to use, and it's still a pain in the ass to get going)... so, if you take one of those heartbeat monitors from a watch and you figure out how to connect it to a port, you've got yourself a chance of having the rest of the work software based (which a lot more people can do than electronics).

i would assume an lpt port would be able to both power the sensor and record the feedback. all you have to do is setup a program much like the dream maker (is that what it's called? the rem goggles with IR detection and dos-operated software?) to record the rate of the pulses and show a graph at the end of the night... this would show you when individual people have rem's (assuming you'd see it in a graph) AND you'd know what the critical value for signaling is... from there on you can either have a pair of goggles stuck to your face (using the same lpt, built following instructions as in the link that was posted above) or you could make the computer signal to you.

i think light signaling would also be the best option simply because it's been proven to work better than any other stimuli.

----------


## Placebo

Thanks for the link, I actually didn't see that thread  :wink2: 
I've been pretty lazy about browsing the forum lately

Good job on the glasses - I may try make one

I know what you're saying with the computer, and since I'm a programmer myself that would make sense
However it results in one of the following:
1) Wires to your body (read: not good while sleeping - would like to avoid this)
2) Wireless technology (read: increased complexity + cost)

A friend of mine has already programmed a few chips so the idea was to rope him into helping me program it
All it needs to do is to record information, and to detect REM
Then it will be possible to plug the device into a computer and download that information for analysis
The last idea is optional, since it would cause more work for me :

That causes other problems:
1) Standalone power. Not so tough in a world of batteries  :tongue2: 
2) More complex circuitry + higher cost. But then again, you'd have had to detect REM with the pulse monitor anyway  :tongue2:  That's not going to be as simple as the glasses. This is more like a problem with using pulse monitors

To use the light sensors means:
1) You have a device on your face
2) You have lights in your eyes - not exactly 'unintrusive'
3) You have wires

Now, I'm not saying the idea of light is necessarily a bad idea ... because the pulse may in fact not be a very reliable detector for REM
The light sensing is likely to be easier and more reliable perhaps
And so far, it's the only feasible device in existence
But it means having that device in your face, and lights in your eyes. I'm not that keen on that personally

I'm just throwing points around, hoping for some new ideas  :smiley:

----------


## Howie

Maybe you could put the settings down as low as they can go and put a dog collar around your neck ajoining it to your REM. Then have it  jolt you when Rem begins.    ::lol::  


 ::shakehead2::

----------


## MeusOpusMagnus

> _Originally posted by Howetzer_
> *Maybe you could put the settings down as low as they can go and put a dog coller around your neck then ajoining it to your REM have it *jolt you when Rem begins. * *



  ::laughhard::  

it's true about the wires being nasty, but they would allow for more data recording than a programmable chip would (the more memory the chip has the more expensive it is). i like the idea of a mask because two red leds aren't all that "shocking" when they start flashing, especially since red doesn't dilate your pupils. i also like the idea of a device linked to the hand because let's face it, it's easier to sleep with an oversize watch than... oversized glasses (no one sleeps with glasses on anyway)... and in that case i see how wires could be REALLY problematic.

so yeah, it's a tricky one.

my best bet i think is still with a mask, get the rem detection happening at the side of the forehead and have one wire moving away from your face... in which case it would be a lot like sleeping with headphones on.

but i have another, more important question:

how reliable is the rem pulse method ? i know i build a kvasar and junked it...  it took me one month to convince the guys at hamamatsu that i was an electronics company and i needed two samples of the IR sensor... and i ended up breaking the pins on both samples after some 3 weeks of trying to get the ir led and the sensor placed right... it picked up blinking, but not subtle rem movement (IR light is not dangerous for the eyes btw)

anyway... maybe we could start by finding a way of hooking up one of those wristwatches to the computer and figuring out how the data acquisition would happen (how the monitor send the information) and just how reliable rem detection would be (which would involve i guess sleeping with wires attached to your hand for a few nights)... then go on with the research ?

(i'm really interested in this project because i've lost all confidence in ir detection)

----------


## Placebo

> _Originally posted by MeusOpusMagnus_
> *my best bet i think is still with a mask, get the rem detection happening at the side of the forehead and have one wire moving away from your face... in which case it would be a lot like sleeping with headphones on.*



I have trouble with headphones too  :tongue2: 





> how reliable is the rem pulse method ?[/b]



I'm honestly not sure. We would need to test it I guess
And not just one subject, you'd need to test multiple subjects





> i know i build a kvasar and junked it... *it took me one month to convince the guys at hamamatsu that i was an electronics company and i needed two samples of the IR sensor... and i ended up breaking the pins on both samples after some 3 weeks of trying to get the ir led and the sensor placed right... it picked up blinking, but not subtle rem movement (IR light is not dangerous for the eyes btw)[/b]



After all that ... hahaha





> anyway... maybe we could start by finding a way of hooking up one of those wristwatches to the computer and figuring out how the data acquisition would happen (how the monitor send the information) and just how reliable rem detection would be (which would involve i guess sleeping with wires attached to your hand for a few nights)... then go on with the research ?
> [/b]



Yep. The problem I see is that its not gonna be easy to figure out what the wristwatch (or whichever device we butcher) pulse monitor sensor interface is like. Power, inputs, outputs etc
I was trying to source the sensors, but damn it's hard to find in my country

Another problem I face is that I'm not an electronics whizz
I have friends and work colleagues that might be able to help though





> (i'm really interested in this project because i've lost all confidence in ir detection)[/b]



Is this because of the IR sensors that weren't sensitive enough?
There's a chance that IR detection is more reliable :/

I've been thinking more about the benefits you could get from the pulse idea
- We'd be able to activate it in slightly deeper sleep, etc ... possibly inducing lucidity at steadily lower levels of sleep. Maaybe.
- You end up with nice analog output data, that you can use to determine how healthy your sleep is (knowledge is power)
- It's more comfortable on your hand, than on your face. Perhaps a wire on your hand won't be too bad?

On the negative side... 1. Complex to work with and 2. A little more costly (I think)

When I get money in again, I'll try get myself a cheap finger pulse meter, and butcher it

----------


## MeusOpusMagnus

http://www.bioscience.org/2003/v8/s/1105/figures.htm

bpm's don't sound too promising. 



the burts frequency and burst amplitude change significantly, but the BPM's stay almost the same. So you'd need better monitors than the average pulse watch that you can buy in a sports store. but if the difference is higher than say... 7-10 bpm's (on average) it could still provide a decent reading.

and my beef with IR detection is not that it's not reliable, it's just hard to get right (at least from my experience with the kvasar)... maybe on smaller eye surfaces it's not as reliable as on bigger eyes, i dunno. the only way it would become very reliable would be to have two ir sensors that compare data, either on both eyes or on the same eye.

maybe i'll try getting another ir sensor and give the kvasar another shot, but it was a real pain getting it.

----------


## Placebo

Thanks for the info - very useful  :wink2: 
I guess we need to figure out if a cheap pulse meter is capable of detecting small variances like this :/

Sorry for my ignorance, but what is 'burst frequency' and 'burst amplitude'
I did a quick google and only found that it is a 'function of cardiac frequency'

----------


## MeusOpusMagnus

To my knowledge a burst is a breath... I may be wrong though, but it seems plausible in this case, since we do breathe faster and deeper in REM (i know this from watching my girlfriend sleep)... (yeah, she knew i was there, i'm not THAT psycho  :wink2:  )... measuring that probably means you have something strapped around your chest that measures the expansion, which is probably more expensive than all the options covered in this thread.

----------


## MeusOpusMagnus

::D:  http://private.addcom.de/KeithWilson/Proje...jects/hemon.htm = GOD!!!

again, it uses a PIC 16F84... but the program comes with it, you just have to program the chip (if you don't want to spend big money on a chip programmer you can build one very easily, i built mine that way... but it only works on this old 486 i have, since the power output on newer computers is not always as reliable)... but yeah, my knowledge in electronics is limited to building things from schemas and instructions, i can't create circuits... Modifying things shouldn't be THAT hard i figure.

This one has a display which is probably not necessary (so away you do with a whole bunch of components there)... 

looking at this: http://circuitos.tripod.cl/schem/r100.gif measuring the heartbeat is easy as hell using the IR (again, damn those IR sensors hehe) on skin... If this is reliable, the only thing the pic does in the above schema is counting the impulses, doing some simple math and printing huge numbers on the display... which we don't need. we need the pic to do the math and flash some leds or (alternatively) start a small offcentered motor (vibrations) or whatever else. so we'd still need the pot that determines the trigger level (pulse1.gif i think it is in the zip file)...

It just got a whole lot cheaper (rather than butchering a watch, a pic costs about 3-4$ depending on where you buy it, maybe even less)... and the rest of the stuff is dirt cheap.

But I still think i'd keep the pic out and use an lpt port to begin with... i'd record BPM's over one night's sleep and then figure out how the pic would work... in my ideal case it would still be a mask, shining the IR led on the forehead, having two red leds to send the light signal and (again i go with the printer cable) one single wire connecting to a computer (i just like computers  :wink2:  hehe)... a second version would be eliminating the computer and telling the PIC to do everything (and even record some data in its flash memory, which you could then read using the serial programmer you'd need to program the pic anyway... the problem then is the very limited data storage of the PIC and the fact the pic wouldn't just give you a nice graph of BPM's over one night's sleep the computer would AND you'd have to remove the pic --> shove it in the programmer --> download the data ---> put the pic back... which isn't really as much a problem of the time it takes as it is of breaking the pins on the chip... unless you put the serial port + programmer on the mask (or device if you still want to attach it to the hand) which wouldn't take THAT much more space, but it would increase its size, as would a vibrating motor or other signaling devices as opposed to two leds (and maybe two resistors) which are significantly smaller)

also keep in mind an LPT port eliminates the need for batteries, the circuit getting its power from the port itself  :smiley: 

Either ways, i think this is a great start, whichever way the device is going to go  :smiley: 

Man, i have to start learning C++ now... The only language i "know" and i've known since i was like 7 thanks to my dad is basic lol... the light machine mentioned earlier uses qbasic in my case, over a 486 laptop (which is a lot quieter at night than my P4, damn these huge processors!)

----------


## MeusOpusMagnus

::shock::  how about GSR !!!

Galvanic skin response: "The frequency of GSR and sweat rate on the dorsal side of the hand were significantly lower during REM sleep than during NREM sleep." ( http://www.ncbi.nlm.nih.gov/entrez/query.f...6&dopt=Abstract )

The "new novadreamer" by Wellness Tools (keep away from that site, again, it's complete fraud!) was supposed to use an EMG to determine skin tension, but GSR is just as good i suppose (to my understanding it's almost the same thing ??? not really sure what EMG is)

this is a simple "lie detector" which is basically a GSR: http://www.hackcanada.com/ice3/wetware/lie...or_circuit.html

and another one: http://www.hackcanada.com/ice3/wetware/lie..._circuit_2.html

The idea is the same: connect a GSR unit to a computer, gather data over a time period and build a device accordingly. using this may be a lot better than BPM's, you just attach a sensor to your finger... or, you could use both, seeing they're not that hard to build, but then you need some clever programming.

basically you just set a trimmer to a certain value, and then the gsr drops below that you turn a motor on, or a bunch of flashing leds or anything you want... the trick being adjusting the trimmer to rem (since you'd only know if it works if you're in rem)... that's why i think in order to be completely failproof you basically need to measure the difference in GSR rather than just the value (as it could be different from night to night or person to person) in which case you need the pic or the computer.

wow, i'm on fire  :wink2: 

now i have to go take my dog to the vet  :Sad:  i think he might be sick.

----------


## Placebo

Good work, especially on finding those diagrams
How the hell did you find that? pure google?

I rule out (perhaps prematurely) GSR because it seemed like a costly route
The prices I got on pulse monitors were far cheaper

But we have quite a few options here. Nice.
I agree with your first step with the LPT port - whether we use GSR or heart rate... perhaps we should test both. It does mean more work though  :tongue2: 
Okay perhaps we test the easiest and cheapest one first (heart rate?). If it works just fine, then no need for the other

The details on where we take it from there can be tackled when we get there 
We might decide to stick with wires for a while - it does uncomplicate things  :tongue2: 

As for C++, I could help you out there
I program in C++ as a profession  :smiley: 
The electronics is the problem for me...   ::|:

----------


## MeusOpusMagnus

yeah, just googling around

pulse rate it is for now then  :smiley: 

so most pulse monitor watches use ECG apparently, not the IR light method (which i assume is less accurate), perhaps we should look for ECG stuff.

this is where i got the schematics from: http://www.commlinx.com.au/schematics.htm there's a whole bunch of pages like that lying around the net, with the weirdest (and most useless) electronic devices imaginable... i figure building the ecg detector would decrease the cost by a lot, the only hard part being a way to change the signal from analog to digital (simple chips do that)... from there on it's just a matter of having either a serial or an lpt port read the impulses and generate the graphs or whatever.

and it's good that you're a programmer  ::D:  do you have experience with peripherals? i know the lpt has the 8 data pins that basically have 1, 2, 4, 8, 16, 32, 64, 128 and 256 values, and by combining the pin values you can get the computer to read basically any numeric value you want to send to it, but i was wondering if there wouldn't be a "steady" pulse/second way of using just one pin... for instance if you send 20 impulses one second and 35 the next, the software will make a time vs value graph and work from there (because in the end we don't care about the real value of the readings as much as we care about the changes in these values)...

just brainstorming.

i'll try to figure out if there's a cheap way of building an ECG monitor that uses one sensor (medical ones have tons of them on the arms and legs and chest, but those monitor a lot more things than we really need).

as for the GRS, the lie detector bit works like that. i'll try looking more into both actually, see which one is easier and cheaper to build first.

here's a good starting page (most of the links are broken though)

http://openeeg.sourceforge.net/doc/links-biopsy.html

(edited :smiley: 

AN UPDATE:

it seems IR led detection of pulse is far, far easier to build than ECG monitoring, and a GSR monitor as well is very easy to build (http://web.media.mit.edu/~msung/vitamon.html - if you look at the schematics on this page you'll see a very small GSR monitor that uses around 10 components or so)...

I'd leave ECG out for now, unless we butcher an ECG watch, take out the display and attach the wires connected to the display to a port and monitoring from there, which sounds very simple, but might end up in simply butchering a 40$ watch (unless we find it for cheaper).

----------


## MeusOpusMagnus

i'm spending more time on this project than i should i think  :wink2: 

http://arsenal.media.mit.edu/notebook/arch...ves/000209.html - it's a project for a wireless (blue tooth) GSR device... interfacing it with blue tooth technology is a whole other problem so if you leave that out for now, what you have here is a GSR device that's already converted from analog to digital and ready for port reading (i assume serial, but maybe it would work on lpt as well?)

arguments for using gsr rather than light:
1 - gsr more reliable than bpm
2- an IR light probe would require constant distance from skin, which would be hard to mentain while sleeping
3- it's easy to build this: http://arsenal.media.mit.edu/notebook/medi...a/16bit-sch.jpg is all there is to it. we could probably get the 3V from the LPT or Serial port and return the signal to the data pins. The problem now is the sensors and the placement of the sensors. Ideally i think they'd be connected close to the light or signaling device, so somewhere on the forehead... but if runs electricity through you rather than reading what's already there, you don't really want that on your face... so then i'd put it on the fingers, which creates a problem cause you'd have two wires or you'd have to give up the mask and have the light coming from somewhere else, or use a vibration signal, which could be a small motor attached to the wrist. But that's for later...

for now, the cost is a lot cheaper than a ECG watch (total cost for building the GSR unit is about 10$, including the printer or serial cable and the glasses (if you buy 1$ glasses hehe). say 15$ if you want to make it sleek and put it in a box.

so it's just a few components... i could give it a shot and see what output it gives or if it even works right.

if you have no experience with electronics, i could try building two and shipping one over.

----------


## MeusOpusMagnus

i just HAD to... what kind of project doesn't have diagrams explaining what we're trying to get ANYWAY ?

3 different proposals for approaching the device (in it's 1st incarnation):







i like the 1st one best, but i assume there really is no difference between turning a led on or a small off-centered motor, so basically all 3 designs are the same in software design/electronic unit and the only thing that changes is the layout, which is really just a matter of putting things together.

 ::D:

----------


## MeusOpusMagnus

possibly useful links:

http://www.maxim-ic.com/appnotes.cfm/appno...mber/3315/ln/en (i2c LPT port adapter software writing in C)

http://www.maxim-ic.com/appnotes.cfm/appno...ote_number/3230 (how to build the hardware)

from this point on i'll try to figure out if the above schematic for the GSR and the schematic for the LPT can work together (i'll try to get some help on this) and i guess from there on it would just be a matter of building it. 

Note how it only uses 2 of the 8 data pins of the lpt port  :smiley:  meaning we could shove in an lpt light machine at no extra cost  :wink2:

----------


## Placebo

I've been sick the last two days ... but DUDE, you're obsessed  ::D: 
Not that I'm complaining, it's good progress

I prefer option 3 mainly because at the end of the day, I would idealy like a self-contained glove
Until we eliminate the wires that obviously won't happen, but I would like to find out if the vibration will actually work to trigger lucidity

If we could use bluetooth - that would be incredible
No wires, but PC operability
However as you said, either complexity or cost will increase if we do that

I'll invite my electronics loving friend around this weekend to go over the ideas, and see what he thinks
If you do manage to build a device, shipping one to me would be pretty helpful
The shipping cost would be the main factor here I guess
Our exchange rate isn't great either   :Mad:  
Perhaps it would be easier to bribe a friend to build it for me  :tongue2: 

Once I have a device, I could experiment with the software and try fine tuning things
I'd love to see my stats on the screen  ::D: 

I haven't finished looking at all your links, will do so today probably
Things are pretty hectic on my side at the moment, with me being sick and transferring 2 properties at once

----------


## MeusOpusMagnus

yeah, i've kinda been obsessing a bit  :wink2: 
that's what happens when i actually have papers to hand in for school... i always find myself busy with ANYTHING but the school work hehe (though i did get the paper done in time).

I'll wait and see what your friend says, and I'll also go check for the availability of the components (most of which seem to be standard everyday things). It sucks that for the gsr schematic i don't have the exact part numbers, but i guess if i go to an electronics store and i say  "I WANT TO BUILD THIS!" and point, they'll know better than me what i need.

And indeed, blue tooth would be amazing, it we build it and it works and we think it should go wireless, it's a pretty sweet option (it might not be THAT expensive).

----------


## Howie

> _Originally posted by MeusOpusMagnus_
> *How about GSR !!! 
> 
> Galvanic skin response: \"The frequency of GSR and sweat rate on the dorsal side of the hand were significantly lower during REM sleep than during NREM sleep.*



I am *serious* here. But I almost hate to go here.
*But again seriously.* While dreaming both male and female have a increase blood flow to there private parts. 
So you were talking skin response. I dare to say it but it would be rather simple to detect a male erection. For a female I guess you would have to go with skin temerature or GSR.
Just  a thought.

----------


## MeusOpusMagnus

> _Originally posted by Howetzer+--><div class='quotetop'>QUOTE(Howetzer)</div>
> 
> 
> 
> 
> 			
> 				<!--QuoteBegin-MeusOpusMagnus
> 			
> 		
> ...




 ::laughhard::   true, an erection would be pretty easy to spot  :wink2: 

but those don't signal REM as much as the fact you're asleep... more than that, they most likely happen in the morning, when the bladder expands and puts pressure of the veins (which is really why most guys will have an erection in the morning and not because of dirty dreams) so it doesn't have to do much with the fact you're dreaming.

gsr though is way easy to detect. we already have schematics for a simple gsr unit that turns the values into digital I2C AND we have an LPT port mod which is supposed to take the I2C digital value and send it to the computer... the only thing i'm worried about is how well these will link up together. Picking up the skin response is as easy as metalic foil wrapped around the fingers with wires going out, so there's no problem with the sensors  :smiley:  add a bit of velcro and you're going hi-tech  :wink2:  hehe

yeah, i think we're under 15$ with the cost

say, one day when we're that much wiser and richer, we turn this into the ideal blue-tooth-usb driver wireless mask... the cost would still be under 80$, perhaps even less (a usb blue tooth connector is about 40$ and for the mask to send the signal you need a blue tooth chip, an antenna (which is really just a wire) and a bunch of smaller components... but then (from what i've seen) you'd need a 9V battery, which is kinda bulky).

either ways... it proves that connecting a gsr unit to a computer costs about 15$ instead of 900$ they charge for a medical device... sure, the medical device might be more precise, but not 800$ worth of precision...

----------


## Howie

> _Originally posted by MeusOpusMagnus_
> * true, an erection would be pretty easy to spot Wink
> 
> but those don't signal REM as much as the fact you're asleep... more than that, they most likely happen in the morning, when the bladder expands and puts pressure of the veins (which is really why most guys will have an erection in the morning and not because of dirty dreams) so it doesn't have to do much with the fact you're dreaming.*



This is out of _Exploring The World OF Lucid Dreaming_. Chapter 7 (Adventure and Exploration)

"As you woulld expect in a land of complete freedom, sex is a very common theme in many people's dreams. "
"There are both psychological and physiological reasons why the lucid dreaming state tends to be a hotbed of sexual activity. In terms of physiology, our research at Stanford has established that lucid dreaming accurs during a highly active phase of REM sleep, associated, as a result, *with increased vaginal blood flow or penile erections.* These physiological factors coupled with the fact that are freed from all social restraint ought to make lucid dream sex a frequent experiance.

Maybe more information than you care to here but for the sake of research I wake up with an erection after dreaming.

----------


## MeusOpusMagnus

after doing a bit more research i realize you're right. erections do indeed occur during rem sleep and the reason people wake up with them is not (as i said) bladder expansion as much as the fact they wake up from (or close to) an REM period.

but i guess there's no fundamental difference in having a probe attached to your finger or having one attached to your penis. i think it would become more complicated (and potentially more uncomfortable) for females though. Yeah, i dunno... mesuring blood flow would probably be as easy as the IR reflectivity of the skin? maybe temperature would rise ? (though i don't know if the difference in temperature would be accurate enough for REM detection). I'm also not sure how many would be willing to attach a probe to their private parts when going to sleep (ESPECIALLY if you're sharing the bed with your girlfriend, boyfriend, wife, etc)... Speaking for myself here, but i think i'd be a bit embarassed   :Oops:  It's even worse for teenager oieronauts or even parents.

but yeah, i'm just as convinced now that erections would probably be a good way of detecting REM... it's just... strange a bit when you're not in a lab setting.

as for the GSR, i got all the parts e(xcept for two from the gsr amplifier, which i couldn't find and i'm looking for alternatives) for 35$ canadian... This includes 8$ for 2 boxes to house the projects (which really are just fo' sho' and overly priced) and WAY TOO EXPENSIVE resistors (1,20$/pack of 4 instead of 20c per pack of 5 that i usually pay)... I was just a bit lazy in shopping around and the place i usually go to didn't have everything i wanted. I wrote to the guy who designed the GSR amp i'm trying to build, asking for a few hints and I'll talk to my dad tonight (he's into electronics) to see if he can help me out a bit.

This should be fun  :smiley: 

Placebo, if i get them built before you ger a chance to, i'll ship one over. I don't think the shipping will be that much and I'm willing to cover the costs, given that you'd have to spend some serious time doing the programming.

----------


## MeusOpusMagnus

More progress:

I just ordered samples of the ADS1110 from Texas Instruments. For the other missing part I contacted Carson Reynolds and he told me I could use a zener diode instead, or anything that regulates the voltage to 2.5V. So i'll figure out what's easier and cheaper and get that going.

Anyway, TI estimated shipment by Sunday so I hope by the end of next week I'll be able to start work on the GSR amplifier. For now i have everything i need for the LPT connector, and I'm starting work on 2 of them.

 ::mrgreen::   ::banana:: 

Any ideas for the name we're giving to this baby?

(edited: actually, TI just shipped the 4 A/D Converters just a few hours ago, and they meant i'd GET THEM by Sunday, which is way way cool. Maybe by the end of next week I could ship Placebo a completed copy of the device and see if he can come up with something)

----------


## MeusOpusMagnus

> _Originally posted by Kaniaz_
> *Novadreamer two. Half the price, no fuctionality!
> 
> (Okay, I just couldn't resist having a bash. )*



 :tongue2:  as things are right now, for about 20$ you could get:

- Continuous GRS computer monitoring for REM detection
- REM Signal Light/Sound/Vibration (Sound by computer, light/vibration on the body)
- Biofeedback (from the GSR) for a light machine - probably different pitch in noise
- 3 LED/eye light machine (6 of the LPT pins are spare)

Match this up to open source software already out there (like the linux version of bwgen) and you can shove a sound machine in there with no extra programming.
sounds more like the pumped up version of the dream maker wellness tools wants to sell for 1000$ + the GSR biofeedback unit you can buy for 50-60$

I dunno, if this really works we'll have a VERY NICE toy on our hands.   ::mrgreen::  

and, for another update: the first LPT interface is done. I'm going to give it a run now (if it works without having any I2C imput) and I'll post the results whenever they're good hehe. Took a while to make, but it's looking good so far.

----------


## MeusOpusMagnus

hehe are you going to edit my post now too ?   :tongue2:

----------


## Placebo

> Any ideas for the name we're giving to this baby?[/b]



Assuming we stuck to the hands, and not the mask, I was going to call it the DreamCatcher glove  :wink2: 
I thought it had a nice ring to it

And dude, you're going way faster than I have the ability to. I just got over a bout of sickness, and my work is overloaded  :tongue2: 
I'm still going to speak to my friend about the electronics, for ideas
But by that time, you'll probably already have a good idea of a layout...

And yeah, this toy would be nice and extendible and damn useful for a variety of things  :wink2: 
We could try make the mask optional, and have binaural beat technology in there as well as the glove motor

----------


## MeusOpusMagnus

DreamCatcher works with anything though, it's a good name  :smiley:  It could be "DreamCatcher Glove" or "DreamCatcher Mask" since as i said, the difference between one and the other is simply connecting a motor instead of leds (maybe a few extra components but nothing seriously complicated). But it's true with both the leds and the motor it would be even nicer. Given that we have 6 LPT data pins free, we could use one for the motor and 4 for the leds (2/eye). We'd have the mask and the glove use different wires, so that you could have either one or the other or both on at a time. If you're just going for the biofeedback there's no problem having the wires since you won't be sleeping with them on for 8 hours.

As for going way fast... no worries, process has been CONSIDERABLY slowed down by... you guessed it... hardware debugging. Something's not connected right and i should have thought better about it before I made it so small (it's not as small as the penny size one, i'm using regular components rather than those real tiny ones that come on rolls, but it's still small for clumsy fingers like mine.)

Anyways, it'll take a while before it's done. If your buddy drops by, this is what i'm trying to make (there are perhaps parts that can be taken out, or simplified, etc):

http://hybrid.concordia.ca/~victord/design.bmp
(forgot to mention, it's powered by 3V (i'm using 2AAA))

I also shoved in the optional LED on the LPT connector, mostly for testing purposes, if i get the led to go on and off i know i got it working and for now it doesn't work.

And good luck with your work load! As i said, it'll go a lot slower from now on.

----------


## Placebo

Hey Meus

My friend dropped by and said he is quite out of practice with electronics
Nevertheless he reckons that you could simplify your circuit quite a bit

I have a few questions myself on it:
1) What kind of streaming/frequency is going to be outputted to the 2 pins on the port? What would I be reading exactly, and how fast?
2) We couldn't quite make sense of that bit of the diagram between the A to D converter and the parallel port. What does it do exactly?

The difficulty with GSR might not be in the sensors, but rather in the nature of the data.
With heart rate we can get a relatively slow pulse, which is easy enough to push through to one pin
With GSR... it is an analog stream that would need to either be converted to a frequency pulse or written to the 2 port pins in several separate steps (more complication?)
Hence my question above on what you are actually sending to the port from the GSR digital signal

Since you're using GSR, perhaps I could convince my friend to help me rig up a heart rate monitor to my PC on this side. One complication is that my PC isn't in my bedroom.
The circuit in HeMon for that is pretty cheap and easy to build, and I reckon I could manage it on some veraboard and wires  :smiley: 
The more difficult bit for me is perhaps to do the writing to the PC port

My friend also reckons that the serial port is a lot neater and easier to use, especially on the software side
Have you considered it? What are our reasons for the parallel port again?

Regarding using the device for 8 hours sleep... this is important to me to be able to do it
I would like to be able to analyse the data of a person's sleep cycles over an entire night 
And possibly glean some information on my own sleep patterns based on various factors, etc
Perhaps the wires on my finger won't be such a problem ...



Thanks for the hard work so far  :smiley:

----------


## MeusOpusMagnus

I'll try to touch on all the points.


1) What kind of streaming/frequency is going to be outputted to the 2 pins on the port? What would I be reading exactly, and how fast?

I don't know exactly what kind of numbers the output will be. I know the I2C has a clock line and a data line and it sends (and recieves) 16 bit info.
http://www.maxim-ic.com/appnotes.cfm/appno...mber/3315/ln/en - this page has all the info + C files already made to just include in the programming. Either ways, I2C is a VERY common technology, so i'm sure figuring this out won't be hard (the hardware debugging software i got shows the imput it's getting, so we can toy around with it and figure out how it works, because I'm sure you can get it to just use an echo command, where you send an impluse and it replies with the value it's currently at.
LPT ports are very fast, so that shouldn't be a concern.

2) We couldn't quite make sense of that bit of the diagram between the A to D converter and the parallel port. What does it do exactly?

You mean the dotted lines ? It just links the GSR amplifier to the parallel port "translator". The parallel port circuit is basically one 74H05 chip with a bunch of resistors, it's just meant to transform the signal from I2C to LPT language (hex).

3) The relatively slow pulse/vs incoming flow of information:

Well, with a continuous flow, you could have the biofeedback be continuous if it ever were to be implemented. Dealing with it for rem detection wouldn't be too hard, you could just take one sample every x seconds and build a graph.
It's not an analog stream anymore, because the ADS converts it to digital and the second little unit converts it to printer port impulse.

4) the HeMon circuit is indeed cheap and easy to build but there are a few considerable problems with that: because the difference in heartrate between regular sleep and REM sleep is not very significant you'd have to be very precise in monitoring the heartrate, which would imply the same as any other REM IR sensor, and that's having a constant distance from the skin to the sensor, which might be a little tough when you're sleeping. It might work nonetheless, but then with the distance between sensor and skin and the size of the led and photosensor you'd have about an inch of stuff going up from your hand, which would have to be hardmounted to keep the distance the same... So it gets a little tricky if you want a glove.

5) Serial is indeed easier to use, but it won't allow for as much development as LPT would... You'd be stuck with the number of pins and if you'd want a light machine or something else, you'd have a hard time integrating that without more circuitry, whereas the lpt you have 8 separate data pins that you can control as you please. So the advantages of the LPT port are really in the versatility it offers, we can expand a lot more having that.

6) The way the device will take shape (right now) is a small box which will have a bunch of wires coming out. What I'll do is I'll stick the port straight to the case so that you can use a male-female lpt cable as long as you want to do the readings. Then you can put the box wherever. From the box, you'll have the wires for the probes coming out and a number of leds (that won't be mounted, to save on shipping space). Those you can either mount yourself, or (i'll have them number) just pretend they're mounted. You don't have to worry about the leds or the motor for the time being, we'll just go for the reading. But basically you'd turn on a motor the same way you'd turn on the led (and i'll have to check for small motors or stuff like that and how to connect those with the circuit)... So if you can turn on one led, you can just replace it with a motor in the end... for starters you'd basically just have one wire going to your hand.

and for some extra news from TI, i got my chips yesterday at 10 (they took less than a day to deliver, i was really shocked hehe). This is our first problem because they're just SO DAMN SMALL heheh, i'll have to figure out a way to mount them nicely on a regular board. At the same time, it's absolutely great, because the entire box could be reduced to really not much if we wanted to make it computer-free... but i'm really attracted to the computer idea, it seems like a great way to record data (if we make this open source and we get software help from numerous other people, this could develop in a very nice research tool)... if it works right, of course.  :smiley: 

I'm still debugging the printer connector (no worries, if that one's messed up i have parts to build 6 more hehe) I'm thinking it might be something that has to do with windows XP, because i can read and write from it, i just don't get the right values and the software they provide just crashes. So I'll try to figure that one out and as soon as i'm done with those i'm starting work on the GSR...

I'll probably get some help to test the GSR with the oscilloscope and then i'll stick it to the printer port and see what that reads.

but you can certainly build a heart monitor and see how that reads out. You'd still need an analog to digital converter and those usually spit info out in I2C (from what i learned lately) so you might still have to figure out a way to resolve the computer connectivity issue.
If you use a watch and you butcher that up it might be as easy as connecting the wires that go to the display to the printer pins of the printer port or serial port, but i'm not very sure about connectivity issues there (you might need some extra parts and i wouldn't know much about those).

i also thought the GSR was good because unlike the other gsr schematics out there, this one's self calibrating, so you don't have to waste time every night with a skrew driver trying to calibrate your unit and then worry it might change during the night.

it would actually be nice to have someone who REALLY knows electronics on the team, then we'd have a much easier time... there are things that just go way past me and i can copy them, but i can't explain them... When i'm in trouble i just go to my dad and he helps sometimes (he's in electronics) but he's a busy guy. But i have a good feeling about this, i think it's going to work nice.

----------


## Placebo

> I don't know exactly what kind of numbers the output will be. I know the I2C has a clock line and a data line and it sends (and recieves) 16 bit info.



Alright, that makes sense. The link to the C++ examples will help a lot too  :smiley:  and the fact that it is common technology...
The programming side of things is probably the least of our problems anyway - I'm pretty capable in that area





> because I'm sure you can get it to just use an echo command, where you send an impluse and it replies with the value it's currently at.
> LPT ports are very fast, so that shouldn't be a concern.



Perhaps that can work
The speed of the LPT shouldn't be a problem, no. It was more a concern with the streaming, realtime GSR information on a parallel port
The parallel port doesn't support event notifications/callbacks I don't think





> You mean the dotted lines ? It just links the GSR amplifier to the parallel port \"translator\". The parallel port circuit is basically one 74H05 chip with a bunch of resistors, it's just meant to transform the signal from I2C to LPT language (hex).



We figured it had something to do with conversion to the LPT in some form
So basically it uses hex, and a clock/data system to stream it in 2 bit 'packets'
Sounds complicated for electronics, but if that works.... we can always revise our decisions later since this is essentially prototyping





> you could just take one sample every x seconds and build a graph.
> It's not an analog stream anymore, because the ADS converts it to digital and the second little unit converts it to printer port impulse.



Fair enough





> but then with the distance between sensor and skin and the size of the led and photosensor you'd have about an inch of stuff going up from your hand, which would have to be hardmounted to keep the distance the same... So it gets a little tricky if you want a glove.



I've seen monitors that use clamps on fingers or ears
Perhaps we could use the same mechanism to keep the distance?

I have higher hopes for GSR anyway, but I might still play around if I can get the time





> So the advantages of the LPT port are really in the versatility it offers, we can expand a lot more having that.



Alright, fair enough. One concern I still have is with drivers or software to read the parallel port effectively. Eg. see the trouble you're having on XP





> The way the device will take shape (right now) is ..



Yeah, I understood you to mean all that anyway  :smiley: 
That's fair enough for the time being





> and for some extra news from TI, i got my chips yesterday at 10 (they took less than a day to deliver, i was really shocked hehe). This is our first problem because they're just SO DAMN SMALL heheh, i'll have to figure out a way to mount them nicely on a regular board. At the same time, it's absolutely great, because the entire box could be reduced to really not much if we wanted to make it computer-free...



Sounds good  ::D: 
And good luck  :tongue2: 
Amazing delivery time...





> but i'm really attracted to the computer idea, it seems like a great way to record data (if we make this open source and we get software help from numerous other people, this could develop in a very nice research tool)... if it works right, of course.



I like the idea of processing information on the computer. But I don't like the idea of wires
The perfect compromise would be wireless communications  :tongue2: 
But that's pricey and complicated

I was considering the possibility of cellphones
Either USB data cables to a cellphone for data recording onto a MMC card, or preferably wireless comms with something like bluetooth (read: again, complexity and cost  :Sad: )
It probably won't happen, but it's a nifty idea anyway





> but you can certainly build a heart monitor and see how that reads out. You'd still need an analog to digital converter and those usually spit info out in I2C (from what i learned lately) so you might still have to figure out a way to resolve the computer connectivity issue.



I'm toying with the idea... if I can get the time and help from someone else with electronics knowledge ...





> If you use a watch and you butcher that up ...



I looked around, but that's a very pricey option. Perhaps it's just my area, but I can't find a cheap watch with heart rate monitor attached





> i also thought the GSR was good because unlike the other gsr schematics out there, this one's self calibrating



Good point  :wink2: 
And I have greater hope in GSR as our winner





> it would actually be nice to have someone who REALLY knows electronics on the team, then we'd have a much easier time...



Indeed  :Sad:  





> When i'm in trouble i just go to my dad and he helps sometimes (he's in electronics) but he's a busy guy. But i have a good feeling about this, i think it's going to work nice.



Well at least your dad can help on the odd occasion  :smiley: 
And I think it will eventually work. Hopefully without wasting too many components.
I can't wait to actually get some use out of it  ::D:

----------


## MeusOpusMagnus

yeah, i'm a bit worried about windows XP as well... i rebuilt another lpt port connector and i have the same problem as before (the software given just crashes). I'll try reading up a little more, see if i can figure things out, but i think it has something to do with 2 resistors that end up being placed in parallel (if you follow the design given)... i'll send them an e-mail soon.

you can also buy one of these lpt port thingies for 150$   ::shock::  they have a few extra memory parts, but yeah... 150$!!!

----------


## MeusOpusMagnus

new development  :smiley: 



this is what it looks like so far. Tonight i'll start work on the second one because the LPT connector works fine... it's XP that was the problem. I ran the program in windows 98 compatibility and it didn't crash anymore, it started to perform the test and then said failed... So i installed win 98 on another machine i have (an old 486) and it worked just fine, the tests were good, the led went on and off.

there are ways to make it work in xp, there is a driver for that might fix the problem (for another type of lpt communication device) and it's very minimal... it won't change anything, it's just going to take down the paranoid protective measurments XP uses on communication ports, which isn't there in other systems (well, the driver just acts on the LPT port, not on all ports)....

So i'll try figuring out what's going on and if there's a way to easily go around it... if not i have a few buddies who might be able to help (one of them was writing drivers in C a while back, he could probably write a small transparent driver in no time if this one doesn't do the trick). i'll figure it out whenever i get a bit more time and i'll let you know what's happening.

----------


## Seeker

I've not been following this, so forgive me if this is a stupid suggestion.  Have you guys thought of using the RTS line on COM1 to get the data in?  I've used this approach in the past.

If I am remembering correctly, it is simple to monitor both this pin and DSR as well.

----------


## Placebo

> _Originally posted by Seeker_
> *I've not been following this, so forgive me if this is a stupid suggestion.  Have you guys thought of using the RTS line on COM1 to get the data in?  I've used this approach in the past.
> 
> If I am remembering correctly, it is simple to monitor both this pin and DSR as well.*



I believe Meus has. And I mentioned the option to him.
He prefers the flexibility in the number of pins. We have freedom to add to it
My argument is that its easier to design for, and is a lot faster
Of course speed is not an issue at this point

Since I have virtually no electronics knowledge, I can't really get much of a say on that end of it  :smiley:

----------


## Seeker

Only reason I mentioned it is Windows NT - XP make it extremely difficult to control the hardware directly.  They have added functionality for easy access to the control lines on the rs232, but for some reason have not made it quite as easy for the parallel port.

I've sait it a hundred times:  Damn the hardware abstraction layer!

----------


## Kaniaz

> _Originally posted by Seeker_
> *I've sait it a hundred times:  Damn the hardware abstraction layer!*



Damn windows in general. You can't write cool shell scripts like you can in Linux.

----------


## MeusOpusMagnus

i got the program and the device working in linux under wine, before making any progress with win XP, so yeah, i think we can go for serial now. As i see it, if we want to use both serial and LPT eventually we can, because both cables go to the box and not to the face or hand, so you can add as many wires between computer or box... i was hoping the LPT wouldn't be such a drag to get working under XP... most of the I2C to computer devices out there are LPT based anyway, so i would have expected an easy solution... but i guess i was wrong.

anyway, for serial i found this: http://zebra.tky.hut.fi/~jap/Electronics/I...r/SerialI2C.pdf
the problem is that it needs 5V so we have to switch the 2 AAA batteries for a 9V or something and regulate that. Does the serial give anything out ? (the gsr AMP uses 2.5V)

----------


## MeusOpusMagnus

hmmm...

http://www.logix4u.net/inpout32.htm

and

http://www.hytherion.com/beattidp/comput/pport.htm (or strait to the C source http://www.hytherion.com/beattidp/comput/pport/test.c )

i still have a weakness for the LPT port because of the voltage requirements, the ease with which i built the hardware and the fact there does seem to be some support for winXP (as easy as copying one DLL in your system directory)

anyway, check out the source code and see what you think and if it seems doable i'll ship you the LPT unit in about a week (maybe even less). if not i'll try to get a serial one going.

----------


## Placebo

If the DLL actually works, then, yes, it's do-able  :smiley: 

I need to test it, maybe later today. And get a device to shove into the parallel port to test  :tongue2:

----------


## MeusOpusMagnus

it'll be there soon... i'm trying to debug the GSR amp right now (i built it last night), it seems the op amp i got is a different one than the one listed, so when i attached the pins as explained it obviously didn't work. I got the schematic for the op amp I have but there's some weird things happening with the resistors (so i might have burnt the one i'm using or made some bad connections).

i'll try to get a complete unit done by the end of the week, but i also have some school work due beginning of next week so i can't promise anything. but i'll try  ::D:

----------


## MeusOpusMagnus

hehe, i just got a call from the TI representatives in Montreal, inquiring about the device I'm building and how many I'll potentially mass produce  ::D:  I knew ordering samples would have a catch to it  :wink2: 

anyway... I'm almost done with one of the units and halfway done with another one. I have the ADS chip to connect, some wires, and the motor + leds... and that will be about it. I'll test the output with an osciloscope i guess, see if it gives anything out. I think the debugging software the LPT connector comes with also has a read function, I could probably use that as well.

I'm just afraid I might send you a unit and you'll have trouble with the programming not because of the port or anything, but because the unit doesn't work properly... which would suck. I'll just make sure it reads some changes when I breathe faster or something, I know i was using a voltage meter to measure my GSR and when you breathe faster it went up.

anyway, I'll attach 4 LEDS and a motor to the printer port you'll be testing on, but the wires will be short, so you'll have to make them longer when you decide to mount them... The GSR wires as well will be short, so you'll have to extend them. I figure the best way for the unit to work is to have both light and skin signaling and you can use either one or both.

----------


## Placebo

Sounds good. Not suprising about TI  :tongue2: 
As for the device - it would be troublesome if the device is faulty when it gets to me   ::?:  
I could probably sort something out, but it would be a much better idea to avoid that  ::D: 

I can extend the wires, no prob. The light and skin signalling is a bonus for me at this stage  :wink2:  so cool
First step is to see the data. But if I can start playing with the signalling, that's great too

I've decided to wait for your device and then put the work into programming
It's just such a pain in the arse for me to do anything with electronics with the limited knowledge I have  ::D:

----------


## MeusOpusMagnus

hmm... do you have access to a Win98 computer ? Testing the device out as soon as you get it would be pretty easy if you did. There are a few things you'd have to change though, to make sure the LPT port can communicate two ways:

- You go in Bios and change the port type from standard printer to ECP and the DMA you set to 3 (unless it's already done)
- In win 98 you go to the device manager, and change the resources to basic configuration 000

this would set us on the same page (i tested on a laptop with win 98 and on a 486 with win 98 and it worked in both cases). From there on we could figure out the rest. I tried this in XP and running the program in win 98 compatibility mode, but still no luck. It's all up to that little DLL driver now  :smiley:

----------


## Placebo

Unfortunately I only have win2k and winxp
But don't worry about it, I'll find a way around the damn abstraction layer  :smiley: 
Ring 0 drivers here we come  :tongue2:

----------


## MeusOpusMagnus

well... i'm not sure what i'm supposed to get or if what i'm getting is right, but i'll look into it.

i finally got the gsr amp hooked up to the lpt interface and in to the computer. Running the debug software, when i switch the sync on and i read the I2C with ACK, the hex value changes between 00 and FF... somewhat randomly... it only does when I send an ACK though, so I assume you have to send and recieve constantly to make some sense of what's coming through... i'm pretty confused and i know nothing about data transfer.

 ::?:   i'll try to get some help. but if this is what it's supposed to do, all i have left is adding the LEDs and the motor and it'll be on it's way pretty soon...  :smiley: 

just about now i wish i'd know more about electronics...  ::undecided::

----------


## Placebo

Haha... well we're doing the best we can (And I think you're doing quite well so far  :smiley: )
About the data transfer, I'd imagine that with 2 pins that it has it's own unusual way of slicing up the data
I'll have to figure out how to read I2C values :smiley: 

I wouldn't worry about the apparent randomness, but it would be a good idea to see if we can read the useful, decoded data
This is actually a catch-22 because technically that's my job  :tongue2:  But on the other hand, changing the electronics on my side isn't such a great idea.

Um... well.. if you can find a driver and program that will pump out the data, then good - I'll look around for one too
Otherwise we'll just have to hope for the best and if there's a problem I'll have to fix it on my side  :wink2:

----------


## MeusOpusMagnus

hmmm... i don't know if it has to do with me not building the device right or me not knowing how to use the debugging software right, but something's not doing the trick. To my knowledge, i double checked everything in both parts, the LPT connector responds fine to win 98, the GSR amp doesn't seem to have any anomalies in the hardware. I think i might be getting the address of the ADS1110A0 wrong, it's 1001000, which in hex is 48. But it still doesn't change the reading when i enter that. Maybe i'll give it a shot on another computer and if not i have to get someone to help me out....

----------


## MeusOpusMagnus

as it turns out i think the ADS converter is burning my amplifier chip (LM741). We checked the amplifier part with an oscilloscope and realized the IC's output pin (6) wasn't giving anything out. I changed it, measured it to make sure it worked, which it did... and then I connected the digital converter again. Turned the switch on, measured it again and nothing.

I'll be trying to connect the ADS straight to the computer (skipping the amplifying part) and see if that works.

----------


## MeusOpusMagnus

no luck, i'm getting the same random numbers i was getting before (and i wouldn't mind that, but the randomness doesn't even change when i connect the probe to the ground or if the probe floats in the air, so something's obviously not good there).

----------


## Placebo

> _Originally posted by MeusOpusMagnus_
> *but the randomness doesn't even change when i connect the probe to the ground or if the probe floats in the air, so something's obviously not good there.*



Hmm.. yes. That's not good  :tongue2: 
At least you found the problem with the amplifier...  :smiley:

----------


## MeusOpusMagnus

i'll figure something out... i mean, how hard is it to make a simple voltmeter and to get the signal into digital? I just need to find a different analog to digital converter that won't fry up my amplifier (at least i THINK that's what fries it up, it has a momentary 100mA probably when it initializes and the op amplifier only supports up to 40mA)...

I don't get it though, ANYTHING that's called GSR anything costs hundreds of dollars... you can buy a digital voltmeter that you can plug in to a computer for 70$... and you can buy a small voltmeter for something like 15$ from radioshack... switch it to low current and you're measuring yourself some GSR.

Maybe i can try to figure out how those plug in to the computer.

----------


## MeusOpusMagnus

Shit! I'm so dumb!

I assumed an LPT connection and all that crap was good and easy to do, you know, change the analog signal to digital and shove it in the computer through the printer port...

we don't NEED to  ::D: 

i was browsing around for GSR units at "low" prices, hoping maybe i could possibly rip one off and steal some technology... For 160$, the GSR2 is one of the "cheaper" ones out there... which is way, WAY too much for me. BUT! it comes with computer software, which made me wonder, since it doesn't seem to have any serial or lpt ports.

Then i found this:

http://webideas.com/biofeedback/calmlink/

basically the GSR2 gives you sound biofeedback, based on the voltage the sound changes. They then take the sound and plug it straight into the computer through the line in jack. All you have to do is plot a graph showing sound frequency against time. No need for digital conversions.  ::D: 

I'll use the op amp i have for the GSR, keep away from the I2C analog-digital, shove the sound in through the line in. We can still use the LPT port for the goggles or motor or both, but these can be built separately... 

Also, i think the open EEG project already has some sound card software for their EEG device, we could probably give those a shot, work with the existing code and just add the new features we may need. Might be easier and faster.

 :smiley:  finally, some cheering up... i was pretty pissed when i realized all that work turned out to be a dead end. So we're back on track and no need for you to figure out the hex values and all that crap.

----------


## MeusOpusMagnus

oh, and to find out what the real voltage values are for the sound frequency we get, i could just measure some of the values associated to a certain sound frequency, but this will happen when we start working on the software.

i don't know how this can translate into wireless though. Wireless headphones might have what we need but i don't know how those work really.

----------


## MeusOpusMagnus

and we're on our way (again)  :smiley: 

i just ordered two samples of the AD7740 which is a small voltage to frequency converter (basically does the job for us) coming at a very cheap price (under 1$ us). I just have to make sure I don't burn any of them (i could only order 2).

I could directly connect a headphone jack to the voltage we're getting right now and we'd basically get white noise at different volumes, but i have a feeling the volume approach is not very accurate.

I'll be getting it by Wednesday so I'll start working on it on thursday or friday.

----------


## Placebo

Sounds good - similar to a suggestion my friend gave me. Never really thought about the line in option  :tongue2: 
If the range of volume is not accurate enough (ie. if it scales down our values), then we could determine the min and max values we are expected to receive from human skin. And crop the values within that range. That way the volume can be spread over a smaller set of values and provide a more accurate value in that range  :smiley:

----------


## MeusOpusMagnus

with the voltage -> frequency converter we shouldn't have to worry about scaling and everything... basically the output will always be the same for the same input...

say your GSR measures 0.35V and the output is 1000Hz, we'll have a scale to go from. I think the maximum input for the part i ordered is 2,5 V (which i don't think anyone's skin could produce)... I don't remember what the maximum frequency is, but it's a pretty wide range (i think it starts at 50Hz and it goes into the KHZ quite a lot)...

So we should be good with the accuracy and scale.

The part is taking longer to arrive (estimated shipment is the 7th) so we'll have to wait a bit longer to see.

----------


## White Shadow

What the fuck is this all about?  ::D: 

WS

----------


## Placebo

[quote]What the fuck is this all about?  ::D: 
Try reading it - it makes perfect sense  :wink2:

----------


## White Shadow

Takes too much effort. I was hoping for a summary!  ::D:

----------


## Placebo

[quote]Takes too much effort. I was hoping for a summary!  ::D: 
We're making a cheaper and more useful Nova Dreamer with different technologies

----------


## MeusOpusMagnus

[quote]



> Takes too much effort. I was hoping for a summary! 
> We're making a cheaper and more useful Nova Dreamer with different technologies



or tring to, for now  :wink2:  It seems the parts only got shipped today, so the estimated shipping date is now the 7th (did i already say that?). On the site they said the items were shipped in full a day after i placed the order, but the shipping date was the 2nd... and the estimated delivery date the 7th... it's just weird.

i just found out yesterday the makers of GSR2 are from montreal, and not that far away from me. I'll go stare through their window, see if i can steal some technology  :wink2:  actually, i'll just call them and ask them about their pricing, the internet retailers must make lots of money with these producs, but i'm pretty sure they're sold to them for a lot cheaper.

either that, or i'll go stare blankly at their store, out in the cold, until they take pity on me and give me some stuff OR get angry at me and start throwing their products at me so i go away.

----------


## Placebo

> _Originally posted by MeusOpusMagnus_
> *either that, or i'll go stare blankly at their store, out in the cold, until they take pity on me and give me some stuff OR get angry at me and start throwing their products at me so i go away.*



Sounds good to me... so when do you start on that  ::D:

----------


## MeusOpusMagnus

i would have started the staring today, full time... but they don't have a store per-se... it's more of a warehouse...  ::D: 

but i called them... it's 75$ canadian for the GSR2, no shipping (since i pick it up) and i guess i'd have to pay the taxes, which takes it to about 85 or so... which is roughly 60$ american, or what you pay for it when you buy it online (though i save on the shipping)...

it's tempting... but i have no money right now AND i'm hoping the one we're going to build will do the trick quite nicely... for a whole lot cheaper. But if all fails, i'll probably buy it and we can figure out how it works, steal a bit from the technology, change some stuff here and there (so that we can't get sued lol) and make "our own" version... we could build on it for the REM detection and light machine/motor and everything else, rather than starting from zero...

bah, i'll just wait for my parts, then we'll see.

I'll try to find a window to their warehouse   ::cry::  ... and i'll pick a cold cold day...  :wink2:

----------


## MeusOpusMagnus

really weird, but whatever hehe. I got the two parts today, so i'll be reading up on the way it works and i'll see if i can hook up the old gsr amp i built to this... it shouldn't be too complicated.

i also found this on the net: http://www.pbs.org/saf/1310/teaching/teach.pdf
it's a silly classroom (teaching kids to be afraid of the media in a pretty chaotic way) but it shows how to build a very very simple temperature meter like the one in the gsr2/temp package (kinda).

----------


## Placebo

Well, thats an alternative approach - it's not strictly GSR
If we go for temperature, that should be easy enough  :wink2: 
I could probably rig that up myself  :tongue2:

----------


## MeusOpusMagnus

well, you'd still have to get it into the computer somehow (unless you have a multimeter that has a serial connection) so it's basically the same project as the GSR we're trying to build (which I redesigned from scratch with my dad). I'm going to the library today, to pick up a book on electrodermal equipment, it seems they might have a schema that explains how a GSR should be built.

We have a trimmer through, it's pretty hard to make it self calibrating if you want it to be precise (considering GSR changes from person to person) so you'd have to turn this little knob until a red light goes on (and then off as the gsr value will change again)... this way you'll know the device is calibrated in your range.

The only thing i need to find out is just how much the value will change, because right now we have a maximum amplitude of some 6-7000 Hz for the sound (which is plenty), but we might only use 500 (for instance) if the GSR fluctuates just a little. Once i figure that out, we'll know if we need to amplify the voltage so that we get a wider range (a few thousand hertz) or not.

It's really not very hard to build, we just have to make sure the design itself is accurate enough to measure GSR half-decently (we don't need extreme precision, but it can't be way off either).

I'll see what that book gives me  :smiley: 

(how hard is it to figure out the sound frequency on the computer from the microphone jack or the line in ? would it be hard to write a small program that shows you on screen the value of the sound imput in hertz ? kinda like a small window with a number on it that changes in real time ? this would be the first step towards the gsr monitor (the next being plotting the value you get every x seconds) and wold help in figuring out the frequency range i'm getting. )

----------


## Placebo

Good question, I haven't really thought about it.
It can't be too hard however  :wink2: 
I'll get on it as soon as possible

----------


## White Shadow

Okay, imagine I'm a layman. ...What are you actually trying to build? And why?   :tongue2:

----------


## Placebo

For the time being, we are building a device that measures skin conductivity and/or temperature and/or pulse.
This data will be pumped into a computer, and plotted over time.
Do this when you go to sleep, and bam, you have a recording of your sleep cycle responses, and should be able to see the various stages of your sleep including REM.
Then we change the computer program to detect REM while you're asleep, and to output a signal to either (1) power a vibration motor in your hand or (2) flash LED's in your eyes.
Learn to do a reality check when you feel a funny feeling in your hand, or see a funny pattern of light - and you're lucid

This is useful for:
1) Research of sleep, and lucid dreaming
2) Inducing lucid dreams

Eventually we hope to turn it into a wireless device - but we're not sure how yet.

----------


## cerebusdreamer

Really cool!

I do not like too much having the device hooked in a computer. I prefer the novadreamer approach (just one device, no computer, etc).

But, if it's a way to go, go for it. If a can help in some ways, please tell me. I do not write applications anymore but could be a very good beta-tester   ::D:

----------


## MeusOpusMagnus

the device could probably go wireless very easily using a PIC microprocessor... the trick though is seeing how GSR actually changes during REM... if it's the frequency in rise and fall, we'd measure distance between peaks and signal REM... if it's a matter of the value in GSR, we measure that and signal REM accordingly... but this is what we're trying to figure out first and foremost, how we can use a simple (and reliable) REM detection that doesn't need calibration.

Turning it wireless shouldn't be TOO hard... we skip the voltage to frequency part, we skip the computer connectivity and we shove the voltage (with minor modifications probably) straight into a PIC. IF however we still want the computer (which would allow for many benefits, such as biofeedback, light machine, etc) we'd have to figure out a way to either make the sound wireless (through a wireless earphone port probably) or... something else...

For now, we're taking the baby steps  :wink2: 

And speaking of baby steps, i took two books out of the library that show me how to build medical-grade GSR's (the ones that sell for muy muy expensive)... Of course, they only cost some... 10$ to build, at most. The tough part to build though is the sensors... Not that it's that hard, but because you need to use silver for the probes. Of course, we don't need THAT much accuracy (and either ways we're not measuring the GSR per-se, though we'll get a pretty close value if we do the math... we're measuring the fluctuations in GSR.)...

So, all this to say two things:

1) I have a pretty good idea of how to build a good and reliable GSR amp, do the proper math and actually know the values in ohm of the skin resistance (from the frequency)... This will be computer math mostly, but at least i have a good understanding of how the computer math will be done... which i'll basically explain once i finish the device and I make sure the values I'll be passing on won't be theoretical only... All i need now is a way to figure out how to build a 32 khz (i think it was) oscillator for the frequency calibration hehe.

k... and the second point:

2) One of the books explains how to make sensors, what the good size for sensors is, where to place them, etc.. I'll scan the instructions (along with the important GSR schematics) and we can follow those instructions for the sensors, using something else instead of silver. (maybe when i build the sensors we'll be using, I can simply draw instructions to build them the way I did)...

So, the books I'm now recommending for electrodermal anything are

"Techniques in Psychophysiology" and "Electrodermal Activity in Psychological Research"... Both of which contain instructions for building a GSR and information on building the probes, like diameter of contact and issues to consider.

... just wanted to report on the daily development I guess  :wink2:   ::D:  we're getting real close... just like before lol, but i think this time we won't have problems with things I don't know anything about (ie I2C and HEX values and addresses) so we can't possibly get stuck... I hope hehe. Wow, I actually UNDERSTAND all of the electronics involved now, which is considerable progress I suppose....

----------


## cerebusdreamer

Congratulations again!

When I said about that I don't like the device connected to a computer, I said "connected at all. I thing that just the device alone, by itself. You can carry in everywhere, do not have to bring a computer with you, the entry barrier ($, etc) is lower, etc... And I can put it in my pocket and use it, for exemple, in a hick in the mountains. Just the device, as simples as that.

But yes, I understand the value of a computer controlled device. The device can have only the detectors and the computers are "almost" everywhere (ubiquitous).

As I said before, If I can help, just drop a note!

Ho, and I forgot. What's a GSR??

----------


## MeusOpusMagnus

we'll see about the stand alone unit once we get there  :smiley:  the ideal case i think would be to have a microcontroller operate the device, with enough flash memory to record some significant data... then you could use it in the mountains, but if you'd still like to see a graph of your night's sleep, you could plug it into the computer, do the transfer of data and see it on screen... kinda like the super nova dreamer i suppose... or maybe the real time computer connectivity would be switchable, on and off... if you just want rem detection you wouldn't get all the fancy data, but i you happen to have your computer around, you can push a button and make the connection happen... but we're still pretty far away from there... and the GSR is the reason why hehe.

GSR (galvanic skin response) is an old (and aparently out of date since the 70's or so?) term wich refers to the electrical activity on your skin (the skin itself acting as a series of resistors)... To clear up some of the confusion, the proper terminology is now electrodermal response, which can split into several types of response... you can have SCL (skin conductivity level) or SCR (skin conductivity response, which is the change in conductivity level)... or SRL (skin resistance level) and SRR (skin resistance response)... and so on... GSR used to refer to the SRL and SRR, since it measures the resistance of skin.

What we're building is something that measures the resistance level, since it's of higher value... at the same time, the resistance level is a function of the conductivity of the skin, so by knowing the resistance and knowing how much electricity you run across the surface of the skin (0.5V) you can figure out the conductivity as well... So with one pretty sensitive unit, you can figure out both... The reason is because, apparently, during REM sleep, electrodermal activity is different than at any other time of day. For now, we're just trying to figure out HOW it's different and how this change can be used to detect REM... 

"EDA consistently
decreases during the six minutes preceding a REM period and can be used to detect
REM-phase onset (Koumans, Tursky, & Solomon, 1968). An early study by Broughton,
Poire, and Tassinari (1965) found that when EDA does occur in REM sleep, it is often
accompanied by bursts of eye movement activity (REM)."

From what I read, there is also a lot more electrodermal activity in deep sleep, which then drops significantly when you enter REM... We're hoping this drop will be enough for us to detect REM.

The problem of course is that they don't say WHAT exactly changes... which goes back to measuring distance between peaks or amplitude of response... but this we'll figure out when the time comes... For now we just need a somewhat reliable "GSR" unit...

Which brings me back to the new design. We'll have to use a trimmer pot (it will appear as a tuning knob outside the box for now) in oder to center the signal for each individual... I'm combining the design from the wireless GSR that I posted earlier (with the operational amplifier) with the design that splits voltage across a resistor and your skin. The trimmer pot will be used to change the resistance of the resistor that's in series with your skin, so that if your skin for instance has a natural level of around 200Kohm it won't show on the graph very high up as opposed to someone who's resistance level is... sat 30kohm, which would show up very low on the graph.

This is simply to calibrate the software easily. If the fluctuations in skin resistance are about 25kohm, then the range of the graph should have to be say... 50 kohm at max, instead of 250 kohm... and to determine the 0 or the middle value you'd have to do a quick calibration till a LED light goes on (which is simple, you just turn until you turn a led on and that's basically it, you start monitoring).

If we skip this, then the graph would have to have a variable range, and i don't know how practical that is with the programming (a variable range in a graph would be awesome nonetheless, because you'd be able to zoom in and pick up small fluctuations as well as big ones).

But for now we'll have to have the trimmer pot (it's possible to just take it out and replace it with a set resistor, but it wouldn't be as precise and it would complicate the programming i think)

I'm hoping this weekend I'll be able to start working on the hardware. We'll switch to a 9V battery (we have to get a 3V or a 5V for the voltage to frequency part, and i thought instead of 3 AAA for 3V we might as well go for one 9V and reduce it to 5V)...  I have most of the parts (except for a few for the oscillator clock, which I hope I can get soon)...

And yeah, if Placebo can get a small program to show up sound frequency on screen, that would be great.

And Cerebusdreamer, do you know stuff about either programming or electronics ? given a schematic, would you be able to build your own device or have someone help you build it ? As soon as I get the first two done (one for me and one for placebo so he can do the software) and I know they work (in that I can see a fluctuation in frequency on screen) I'll draw up schematics and plans of construction for both the device and the sensors. (that's another thing, it would be nice if the sensors would have jacks so you can plug them in, rather than have them stuck to the unit... this way you'd be able to change the sensors when they wear out without having to open it and unsodder or cut wires, etc)... Hmmmm hehe yet another idea. I'll try to find simple jacks as well then. Headphone jacks or something would work (this of course would be optional)

... what is it with me and long posts? I guess I'm just overly excited about most things most of the time...

----------


## cerebusdreamer

> And Cerebusdreamer, do you know stuff about either programming or electronics ? given a schematic, would you be able to build your own device or have someone help you build it ? [/b]



Yes, for sure! After you guys pass the very earlier stages and have something that do something :-) I'd like to build my one and help debuging and suggests improvements!

----------


## Placebo

Great!  ::D: 
About the trimmer pot ... another alternative is to have the software mark the point at which you are awake, and plot the change. When the resistance returns near waking levels, then we are either (1) dreaming or (2) awake.
Advantage: no variable pots
Disadvantage: it can trigger after you've woken

Just a thought.

PS - if you run into problems with the amount of power for vibration (eg), you can use a cap to charge up before activating the motor. Also just a thought  :smiley:

----------


## Placebo

After some research, it turns out that it's a bit of a pain to determine the frequency on the sound card.
But I found some source code, and here's the binary (EXE)

I haven't had the time to change it so it displays a single value, but the graph may give you some pointers if you need it soon  :smiley: 
Tomorrow I can have a closer look. I suspect it uses waveIn functions, and buffers the data

PS: More info on the program = http://www.relisoft.com/freeware/freq.html

----------


## Placebo

Hmm ok. Now that I have the program figured out, and I'm logging values, plotting them on a history graph..... I'm confused about what I'm meant to be plotting. Frequency probably isn't it.
You're gonna plug pure analog values across through the line in/mic ... right?
That means I should be measuring average intensity of values. I think. After all, those values are technically 'voltages'
My head hurts  :tongue2: 

Someone clear it up for me  ::D: 

[EDIT]
Okay, I hit the books, and now understand the whole thing quite a bit better.
From what I can understand, you're just gonna stick the analog straight into the sound card. That's going to change the samples individually which means I need to examine the amplitude of each sample.
If I record a reading every eg. 1 second, perhaps I should average it out over that second. That's quite a lot of samples :
Otherwise, if any value is reliable enough, I can simply read a sample when I feel like it, and trust it to be true... right ?

I can always try both, with options. And give you the program like that  :smiley: 
I'll finish a pre-beta test version by about tomorrow probably

Other than displaying and logging to file the obvious values of eg. current amplitude, etc, it'll display the waveform, the fast fourier transform and a chart of amplitudes over time which auto scales to fit. (eg. 6 hours or 1 minute will both fit the full size of the chart).

The latter one is the one I created and is most useful visual for our purposes. Over a night of sleep, it will ideally look like a sleep phase chart (with the different sleep stages causing the amplitude to rise and fall).
And of course, the log file will be useful too - mainly because it will be in CSV format and importable into Excel ... to be manipulated and charted all we like.

At least we're getting somewhere! I'm excited  ::D:

----------


## MeusOpusMagnus

wow!!!!

i mean WOW !!! hehehe, that program looks so cool, if we get ours to use the bottom display i'll be a very happy kid. You're doing amazing in figuring these things out, and at this point, you're running ahead hehe.

as for the values, yes, you're plotting frequency versus time: what i'm doing is taking the voltage across the skin which gives me the resistance of the skin. this voltage goes into an operational amplifier which compares the "answer" to a standard 0.5V, makes the difference (0.5-0.47 for instance) and it then amplifies the answer by 100 or 1000 times (this i have to figure out). So what you get is a value that shows the difference between 0.5 and skin current. The higher this difference, the higher the frequency amplitude... the smaller the difference, the lower the amplitude. By doing the necessary math we can convert this back into the resistance of the skin and have a scale on the side of the screen going from whatever kohm to whatever else... But you don't have to figure out the value of the resistance for each frequency value, you're just plotting the frequency amplitude. You could plot averages though, if for one second you take the average value rather than the one point at the beginning of the second, it would certainly be a lot more precise, i just don't know how hard it is to do. For the data recording, i think taking samples ever x seconds is a good idea too, you could make that a variable and allow the user to punch in the settings (for 20 min sessions you could go with a smaller value, for 8 hours you'd use a larger value).

The trimmer was going to be used to center the signal to 0, but if you can do it automaticlly (AND the autoscaling   ::shock::  ) then you're a god and we don't need any trimmers... For people with less amplitude, you can just "zoom in" to see the details. I'll still have to use a trimmer in my design to figure out what the optimal value of the resistor would be (i'll take measurments on my family and whoever else is willing) but it won't be necessary for everyone.

Ok, so I really have to build this thing faster (it's taking a bit longer because i had a few other things come my way and i'm also trying to find some of the components)...

This is the plan so far:



(once i build it i'll provide a complete list of parts and i'll draw a schematic that shows you which pin goes where and what the parts actually look like)

it uses a 9V battery... We can either use voltage regulators for the 1V and 5V values, or we can go with a zener/resistor combo (which is what i'll be doing cause voltage regulators are pretty hard to find around here, especially below 5V... i have no idea why). Once i get that in, i'll update the schematic. Also, the oscillator part is still lagging behind, i don't know where i can find the crystals i need or if there are easier alternatives... I have an very good operational amplifier that has filters and amplification built in (from aircraft boards), I'd love to use it, but i don't know how available it is... so this is why it's taking a bit more time.

for the probes, i'll look for simple plug in connectors, but this is optional. As a general (and important rule) the surface contact of each probe should be 0.125 cm square, that's about 0.3 by 0.4 cm. From there on, construction is optional, whatever goes with the way you work. I'm going to punch holes in electrical tape and stick it to a small sheet of conductive metal. This way, the only part of the metal touching the skin is the one that shows through the hole. I'll use velcro to make them tight (you don't want them TOO tight on your fingers lol) and relatively long wires.

this is getting really exciting...  ::D:   ::mrgreen::

----------


## MeusOpusMagnus

here we go... the beta version of the design, i'll buy the missing parts by wednesday (and i'll hopefully get most of it done wednesday) and by the weekend i hope i'll have the values for the trimmer pots so i can replace them with simple resistors.

if all goes well, by the end of the weekend i should have an updated schematic and one finished unit. and if all goes great, i'll have the second unit (without trimmers) as well.



the 32kHz crystal needs to use 1uW. It takes a bit of research into the component schematics to build after this design, so I hope with the simplified one (i'll just draw the components and number the pins and show how to connect them) it will become easier to read, it's not as complicated as it looks.

----------


## MeusOpusMagnus

:smiley:  i just downloaded a pcb making software, so i'll try make a pcb for the design. should be cool

----------


## Placebo

Sounds good.. getting there  :smiley: 
I need some clarification on this.... is it the frequency AMPLITUDE, or the FREQUENCY?
In other words, if you stuck that jack from the device into a oscilloscope, would you get a sine wave? or a straight line?

See.. if I have to decode the frequency, that's a lot more complex. Thankfully not impossible since I already have some free sourcecode to determine the fourier transforms (its like a multi-dimensional map of the frequencies)

Let me try explain it another way: the digitiser in the soundcard works by taking voltage readings, and converting it to a positive or negative number. I then read all those values (called samples).
If you open sound recorder in windows - that green line is the samples I'll see.
If you record yourself singing a note, you'll see that they form a sine wave with negative and positive values

So ... are you going to be providing a sine wave note, with frequency? Or simply an amplitude value on the samples.
Is that line in sound recorder going to be dead straight, or form a wave?

Another problem. If you are giving me amplitudes only,  I have to determine how the negative values work. Hopefully you will end up giving me only positive values  :tongue2: 

For the time being, my amplitude chart is using the average absolute amplitude of the samples, averaged out over each second, and distance between each point of the chart. So if you are giving me a nice sine wave, I don't think it's going to work  :smiley: 

When I get some time, I'm going to try convert the sourcecode to Borland C++ 4. I have a free compiler from them. That way it's both legal, and much faster to develop in. The disadvantage is that Borland pisses me off from time to time :

----------


## MeusOpusMagnus

yeah, sorry, my bad... 

when i said frequency amplitude (which is kinda stupid) i meant really the value of the frequency and not the amplitude of the sound.

so, to simplify: you'll be getting only positive values of a hissy noise (i think) of various frequencies of the same amplitude (amplitude being volume). What you have is good. You basically plot the value of the frequency in kHz over time.

I hope this makes it clearer...

----------


## Placebo

You're using an analogue to frequency chip right?
In that case, it actually complicates things - I don't have it right  :wink2: 
I'll have to make a moving average of the average frequency.

Let me explain, a sine wave looking sample like this....

... is a frequency.
I read it in, in a format like this:



I get each sample (point along sine wave) individually as a positive or negative number. Which means I have no clue what frequency it is just an individual value.
Only by analysing the whole damn thing do I know it's a frequency

In comparison, a flat line is not a frequency, but an amplitude of constant strength.
I was hoping for the latter, but from what my co-workers say it sounds like I'll be getting a frequency

I can probably work around it, but as a system it's not a good idea  :wink2: 
Way too much processing and instability in the decoding.
We have to consider an alternative at some point. My co-workers highly recommend a A to D converter and a UART (to serial port)
The sound version might be okay for now though... :

----------


## MeusOpusMagnus

hmm... didn't think processing sound frequency would be that complicated... i think i'm still a bit confused so i say we wait a while till i get one built then we see what it produces exactly...

from what you posted, you're getting too many samples... technically, the amplitude of the sine wave is always the same, the frequency being the distance between peaks, right ? if you just take the interval between peaks, it gives you the value you need. the amplitude of the sine wave doesn't matter, it's going to be constant.

the program you showed me did a good job. it seemed to show both frequency and amplitude (the redder the value, the higher the amplitude?)... we just care about the blue stuff that was getting shown, maybe in our case it's going to be an orange or a yellow (same amplitude so we'll have no variation in colour i don't think) only the positionning of the noise along that line will change...

say this is a generalized view of what we'd be getting (i was playing a song here, so there's A LOT more info than we'd have):



what you need to plot are the maximum values, the points and resulting line in red. and if you DO need to take all those samples along the sine wave (but i don't think you have to, we don't care about the amplitude) to find out the frequency, you don't need to store those.. you take samples for... wow, 1/100th of a second or not even (at 1000kHz you have 1000 of those waves in a second, it's crazy), then take the average value and wait for one or two seconds, and do that again. I realize taking all these values is MAD (especially if we get sounds at 3000kHz or 6000kHz)... i was hoping you can just take a few consecutive zero values (say 10 or 20) and average the time between them... you multiply that by 2 (between two zero values you get half a wave) and you get the frequency of the wave.

there MUST be some sort of easy way to do this, all those plugins for winamp and windows media player are driven by both frequency and amplitude, and they monitor both in real time without significant CPU usage...

i guess an analog to digital might be a good idea, we could give it another go eventually.

i could also make the amplitude change rather than the frequency (technically speaking, shoving voltage into a speaker will increase it's noise output) but that's less reliable from person to person and would need some fine tuning. Frequency gives us a wider range and more precision.

anyway, i think it's some sort of misunderstanding between us, so the best thing to do is just wait for the device to be built and then we can keep on going... there's no point in you doing extra work if in the end you might have to rework (large?) parts of that.

the little exe you posted before will give me a decent reading for now... once i get something on that, i'll do some screen captures and show them to you.

----------


## Placebo

Yeah, alright, I think there was some misunderstanding  :smiley: 
BTW, that bottom chart doesn't work the way you describe  :wink2:  ... that one shows frequencies in straight lines, not waves
Only the top green line one shows sine wave. The thing is that multiple frequencies can be produced at once on the chart.

Yeah, I agree we should perhaps wait to see what the device spits out, and take it from there

----------


## MeusOpusMagnus

yeah, but that's what i was saying... it shows different frequencies at different amplitudes (since it's a song)... we don't care about the wave, we're could be getting anywhere between 1000 and 15000 kHz (or waves/second) so displaying these for any reason won't help much with anything. What we'd get i think would probably look like this:



the brighter blue are the peaks of the lines... if you refer them back to the scale, you get the frequency value. I think what you meant is that the red line in my previous post won't get plotted by itself (everything underneath it gets filled in as well)... and that's fine, but we don't really need all those filler points tho, so we only need to graph the peaks... i generalized in the red one and cut a lot of the peaks out, but this image should make a bit more sense...

No ? I thought I had it, but I could be wrong.

As for the unit, there's nothing very complicated about it, so I'll try to get all the missing parts tomorow and build it.... i'd do it now, i don't really feel like going to school  :wink2:  but i have responsibilities it would seem  :wink2:

----------


## Placebo

That's not exactly what I meant, but I think we should just wait and see what it does  :smiley:

----------


## MeusOpusMagnus

sounds like a plan  :smiley: 

i actually went to school AND i bought the missing parts, so we're doing good. i'll start putting it together tonight, by tomorow night it should be done if no major debugging issues start happening.

----------


## MeusOpusMagnus

ugh... first problem: component sizes: the trimmers i need to figure out what future values will be for some resistors are too big and that voltage to frequency chip is just... a killer.. it's so small i can barely solder to it and if i do, i have to make sure it won't go anywhere, cause if it does, the pins will most likely break. so i guess i'll build this one on separate boards and connect each part with wires. this will help with debugging.

once i have that i can build two more without trimmers on smaller boards. there's a big problem in the design, because i don't think the voltage to frequency converter we're using comes in a regular sized package, only the small surface kind... it's good, because the design can go REALLY small scale... but it's also bad, because to the average person building it, this might be a problem.

i'll look for alternatives eventually.

----------


## MeusOpusMagnus

slow but steady progress:


i got two of the three chips down (the one left is the voltage to frequency, and i'm trying to get everything perfect before i plug that one in, i'm afraid of burning it and i only have 2) and now i have to make the probes. the voltage is splitting right (0.5 across the skin) so now i have to check the resistance of the skin... the black electrical tape with a small metallic thing on it is the beginning of a probe. i'm connecting a wire to the back of the metallic stuff (which goes under all of the tape) and wrapping it all with velcro. once that's done i have to see how much comes out of the operational amplifier and amplify that voltage accordingly (if i need to)...

i know i'm taking long to make this thing, but it's coming along.

(also, if anyone's trying to build it, i changed some of the parts... the LM7805 for instance (which is ridiculously big) i replaced with a NTE 977, which is a lot smaller and does the same thing)

----------


## Placebo

Good stuff.

I've been chatting to Seeker, who had a whole lot of good ideas.
If you blow the voltage to frequency chip, don't dispair:
Essentially you don't need that voltage to frequency converter or an A/D converter chip.
Simply use a cheap LM555 timer or equivalent and generate a pulse from the voltage. Either the duty cycle or the pulse can be variable to indicate the value. 
Then stick it straight into the CTS line of COM1
In addition, I can then use COM1 to activate the motors/LEDs, with eg. the RTS line.
I'm sure you're familiar with the 555 timer, but if not : http://www.uoguelph.ca/~antoon/gadgets/555/555.html
You'd just need to tweak the voltage before and/or after the 555
This seems simple, cheap and easy  :smiley: 
We would need to run some tests to see what the highest/lowest frequency would be that I can calculate over COM1


Here's a few links that could help:
http://www.bobblick.com/techref/projects/a...555/a2d555.html
http://www.aggsoft.com/rs232-pinout-cable/...connections.htm
http://www.electronics-lab.com/projects/misc/013/

----------


## MeusOpusMagnus

that sounds like a really good idea...

i'll just finish this one since it's almost done, see what it does.

then i'll see what i can do with a timer (or even just a variable oscillator using a watch crystal) to see if it simplifies the design. it would probably be a good choice actually, because you could shove the resulting output into a microcontroller of sorts.

----------


## MeusOpusMagnus

I did a bit more work (finger probes are done) but nothing significant... I have to put this on hold for a few days, it's the last 3-4 weeks of school for me so it's a pretty hectic time. Sometimes it's ok, but every now and then it gets real busy, and it so happens that these few days it's been real busy.

I'll come back to this as soon as I can, sorry about the delay and the slow development.

----------


## Vangeloff

is this device being made or has it stopped.. iwas realy looking forward to buying one if they worked well..

----------


## Placebo

Well, while Meus is busy, his side is on hold.
I've been working on it in my free time though
Progress = I have a lie detector, and a 555 A/D converter and a serial connector. Nice velcro finger thingy and little black box.
I just need to try tweak them to all work together  :tongue2: 
Until I get that right, I can't say if it's all a deadend...

After all, I suck at electronics. That's why Meus was helping  ::D: 

I'll try push a little harder, since I now know theres a bit of expectation out there  :smiley:

----------


## MeusOpusMagnus

I've been so out of it lately, i'm sorry about that...

I finished my session ok, crazy crazy schedule and I had to work on posters/marketing for this theatre play at the same time, and right after i jumped straight in two weeks of working 65 hours/week...

BUT... it's all (slowly) coming to an end and I'm starting to be able to breathe.

The lie detector is a good start... for what i had in mind we're using a lie detector too. The serial too might be a good idea, I'm just crap at programming, so I don't know how to approach the serial issue. It's basically what we had before I jumped on the whole sound/line in. I'll try and think about it a little harder. I still think I'll just end up buying a GSR device, and all we'd have to do is reverse engineer it and then come up with something "different"... I'll start saving up.

I didn't forget about it though, so I'll get back to this as soon as I can (by the end of this week I should be back to the soldering iron)...

----------


## Placebo

Yeah, I haven't forgotten either.
I have a half complete lie detector and serial connector at home :/
I've just been distracted and lazy

----------


## Zetetic

I've been lurking for a while, watching this thread, and I'm very interested as well. I'm sure I'm not the only one.

----------


## dreamtamer007

You might think this is science fiction but in truth I think its just a matter of time before someone invents a devise that will do what I'm about to explain. Years ago when I was helping my brother build his house I purposely dropped a coin in a specific location date side up before the concrete of the basement floor was pored. I recorded the type of coin and the date and predicted that someday there will be a tool sensitive enough to detect and read the date on the coin. Well it would be similar to radar and if a device like that tracked and image of your head and being connected to a computer could easily sense the REM period. A few light sources not even connected to the head could flash from many different directions so that there would be no need to attach anything to the body. It would give the computer a heliographic image to work with. It would require some form or radar. Maybe a devise that is similar to the tool used to see stuff on the ocean floor.

----------


## MeusOpusMagnus

ok, so i saved up and I'll buy a GSR 2 next week, for inspiration. I'll figure out how their design manages to calibrate itself and provide a good reading range and (since that will eliminate trimmer pots) we'll have  a much more simplified design.

----------


## Placebo

Sounds good. Unfortunately I'm snowed under at work, and haven't touched it again

----------


## lord soth

hey placebo. I have an idea for detecting REM. it should be simmilar to the novadreamer. using an optical mouse you can sense the movement of your eyeball even without touching it. when the mouse senses movement it gives more power to the LED. making it brighter ect. if you were to take 1 optical mouse and create a simple electronic circut, making the mouse use an infared LED when under normal power, and a bright blue LED ( or red if you are a conformist) when the mouse is giving more power to the LED, the blue one will be turned on.


if you have an optical mouse at the moment you can try this, stick it up by your closed eye, and let it sit until the light gets dim. move your eye about and watch as the light gets brighter.

i just dont have a free optical mouse to use thats the problem

 ::|:

----------


## mtfuji

This seems like a great project. If you need any help, I would be more than happy to assist. I'm pretty good at programming, but really crappy at designing electronics. And right now, after having my first couple of serious LDs, I got devotion running out of my ears. :-) (Actually to the point that I'm almost regretting I took computer science at the university and not psychology.)

Maybe you got tired of it since you haven't posted in a while. I hope it's temporary... If you need any help, please tell me.

----------


## Placebo

Well perhaps I got tired of the electronics, since I suck at it... but really I'm just snowed under at work. So the little bit of leisure time I get, I simply can't motivate myself to do MORE technical work  :tongue2: 

Anyway, the work stress is beginning to die down. Give me a week or so, and I should be able to continue with this. I guess I'll have to irritate the hardware nerd at work  :smiley: 

About the optical mouse idea, I know about it. The problems are as follows:
1) The light is DAMN bright, and will probably wake you up
2) The mouse light + sensor would have to be right up against your eyeball, it seems. And it'd have to be a good (sensitive) mouse. This would be uncomfortable, and seems to hinder my eyeball from moving.
3) I was trying to keep away from using a face mask. I'm not a fan of that idea.
4) I wanted to be able to get some statistical data to record your sleeping state through the night. I can't do that with an optical mouse trick.

----------


## Uncharted

I am new here. I have read most of the thread on REM Detectors.  I am wondering if an EEG biofeedback machine like this one 
http://mindpeak.com/index.asp?PageAction=V...WPROD&ProdID=24
which monitors Brain, Heart, Muscle information could be used to accurately determine REM sleep?  According to what I have read it can, but have never used one.  The one at the mindpeak link above also has optional glasses that blink with LED's just like a NovaDreamer.  
http://mindpeak.com/index.asp?PageAction=V...WPROD&ProdID=17

However this is all very expensive, $300 for the glasses!  :holyshit: 

Perahps there is a cheap basic system that can monitor some bio response associated with REM (skin temp [somewhere on the body] pulse whatever...REM Is associated with more than just eye movements)....that could be used with those glasses.  I don't know enough about biofeedback.

This is interesting news article about dream detection thru the fingertip...
]http://www.ats.org/news.php?id=66[/url]

----------


## Uncharted

For some reason the link in my previous post did not work right, but I think this one will. Interesting article about a newly developed (medical) device that reliably identifies the onset and duration of REM sleep by tracking changes in the blood flow through the finger.

http://www.ats.org/news.php?id=66

----------


## Placebo

Thanks for that link. I really appreciate it.
Now if I could get my hands on it  :tongue2:  
$5,400!!

----------


## Seeker

I've been thinking of a different approach to this.  The mechanism I'm thinking of is kind of like a dead-mans switch.  Here is the general theory:

You hold this switch in your hand, it must have a very light tension.  When you fall asleep, your muscles relax, releasing the switch,  It starts a timer for maybe 5 minutes.  After the timer has expired, the lights start flashing.

You would use this device late in the night, after 5-6 hours of sleep.  

The switch could be a capacitive device or resistive.

----------


## Placebo

Nice idea... quite low tech, and it needs a WBTB, but sounds great.
I'd play with a vibration on my wrist instead, but same thing applies.

Hmm. Anyone gonna try this besides me?

----------


## Seeker

Well, since you have a vibrator on your wrist, you could place one contact there as well, a small metal object could be the other contact, forming your switch.

When you detect a drastic change in either resistance or capacitance between the two contact, then you know the person has fallen asleep.  Let me search for a few simple circuits.  This is much easier than the sensitive electro-galvanic stuff we were doing earlier.

http://www.discovercircuits.com/S/s-capacitance.htm

Hmm, maybe easier would be to hold a mercury switch in you hand.  When you relax, the hand falls over tripping the switch.

So many options, so little time....

----------


## Placebo

Uh just to add to the mix:

- It has to count down after the trigger is released - eg. 5 mins
- It should preferably only vibrate for 1 second, then stop.
- And preferably repeat that 1 sec eg 3 times, after eg. 5 secs

That makes it a tiny bit trickier, but as you say a whole lot easier than before.
You could build this into a gardening glove, with a small battery and cellphone vibrator (I have a broken cellphone)

[EDIT: The main reason I like this idea btw, is because it should be quite easy. I still would obviously like to figure out how to detect REM with electrodermal response or blood at a later stage]

----------


## Seeker

So easy and could be self contained if built in a garden glove.  Sure beats being wired to the computer.  Or course, the switch could be made optional.  Just wake up and arm the thing.  i usually fall back asleep a few seconds after waking at 6am.  This is my WILD time anyway and I;ve had a horrible time staying awake through it lately.

----------


## Middlerun

Could somebody perhaps write a short summary of the ideas in this thread? There's a lot of good ideas here but reading through all 9 pages is a bit much.

Anyway I really like the dead-man switch idea. I might try it now that there's a decent electronics shop nearby.

----------


## Uncharted

Yes the switch is an interesting idea, however there are many stages of sleep, not all of them are REM, so the flashing lights 5 min after you fell asleap would be useless in many of the stages of sleep.  Of course its a great idea if you are in the right stage of sleep and you have it timed right.
  [example of sleep stages]
http://www.sleepdisorderchannel.net/stages/

----------


## lord soth

muscles dont always relax after you fall asleep. i have seen my sister dead asleep on the couch, holding a huge biology textbook upright in her hand, which was over the edge of the couch. it was funny looking   ::lol::  

i think the best way to detect rem is sensitive heart monitors, or actual eye movement, the latter being the most reliable.

I do have the idea of using an optical mouse to detect your moving eyes... I am working on a circuit that takes out the annoying red LED when it isnt needed, you could even use a wireless mouse to send eye movement data to the computer...

----------


## Placebo

> _Originally posted by Uncharted_
> *Yes the switch is an interesting idea, however there are many stages of sleep, not all of them are REM, so the flashing lights 5 min after you fell asleap would be useless in many of the stages of sleep. *Of course its a great idea if you are in the right stage of sleep and you have it timed right.
>  *[example of sleep stages]
>  * * * http://www.sleepdisorderchannel.net/stages/*



Exactly, the idea was to go to sleep for 6 hours first, so that you are far more likely to be in REM within a few minutes of going back to sleep.
You wouldn't be able to use this idea to go to sleep in the evening - the signal would trigger in delta phase (deep sleep)

----------


## Placebo

Thanks kimpossible  :wink2: 
Yes, I'm very interested in your progress. You seem to have a lot more resources available to persue this, and I'm eager to see how it goes.
As for me, realistically I can only get into things properly again from about Jan 2006
I really need to get things settled down on my end  :smiley: 
One big advantage you have is that you are far more knowledgeable on electronics than I.

So you're going to try a EEG? Should be interesting, but I worry that it will be quite intrusive.

Please keep us up to date  :wink2:

----------


## Placebo

Sounds exactly as I had in mind originally, before the dead man's hand compromise
The difference is that you have the resources and knowledge I do not  :wink2: 

Once again, PLEASE keep me up to date. After all the original drive was begun by me, so I'm intensely interested in the outcome and progress - even if I'm not in an immediate position to do it myself.

----------


## Seeker

This circuit looks to me like it will deliver an analog voltage to the PIC.  What Placebo and I have been looking at originally was either a PWM or a VCO that delivered square waves to the CTS pin on the RS232 port.  Do you have a cheap to build circuit that does this?

Perhaps we can use the circuit you provided as the frontend to the VCO.

----------


## cd27

are you useing tubes? aren't those hard to find nowadays?

cd

----------


## Seeker

> _Originally posted by kimpossible_
> *Yup, it's delivering analog (ma) to the pic. *The pic I'm using (picaxe 18X) is a DIRT CHEAP part with 3x12bit a/d *8xD (I/O) and seriel out.
> *



Gotcha!  Man, I've got a whole stack of micro industrial controllers sitting in front of me that would be perfect for this.  Unfortunately, retail on the cheapest of them is around $200.


BTW, you never answered my PM.

----------


## cd27

haven't answered mine either.....batteries huh? i didn't think they put circles around em liek that. oh well, they jsut seemed to resemble tubes, like cathode stuff.

cd

----------


## visor

Hello all! I went through most messages and got an overview of your project. At the moment I'm not too excited about the method of your choice, because for an easy project it sure seems to take a lot of effort and I don't think it's necessary that reliable. I want to pursue PIR and tactical/visual (possibly audio too) cueing.

Does anyone have sources for suitable PIR sensors and Fresnel lenses? I'll try to contact someone who has a Remdreamer and ask them what parts they used for starters.

Don't let me discourage you, stay on it, because if it will work out, the visorless design will be pretty cool.

----------


## visor

> _Originally posted by kimpossible_
> *It does work, and rather well. *Atleast for me. *My neighbor started testing it last night, so I should know more there shortly...*



Weird... well, good news then. I have a GSR machine with computer output, I suppose I could somehow use it then? You said you had some software ready, maybe I could try it. Do you have the source online?

So you're saying that it's impossible to hold the mask in place.. That novadreamer anecdote sounds weird. How don't people return their units if they work that badly? (are they really happy to pay $600 for something that doesn't work). The reason could be that their PIR was useless.

What kind of vibration you use in the glove?

----------


## Nunika

Did you get any results? 

I'm electrician and programmer , but newbie in psihology and lucid dreaming.

I'm planing to make a device with microcontroller that will log skin resistance at night. 
I will post results and hope you'll help me to understand them.

----------


## Howie

> _Originally posted by Nunika_
> *Did you get any results? *
> 
> I'm electrician and programmer , but newbie in psihology and lucid dreaming.
> 
> I'm planing to make a device with microcontroller that will log skin resistance at night. *
> I will post results and hope you'll help me to understand them.*



Hello Nunika!
 I see this is your first post! Welcome to Deam Views And the research Team!

To give your efforts due credit you should begin your own post in regaurds to your research.
This Experiment may help you a lot. There is a ton of information in here.

----------


## kimpossible

I removed most of the specifics of my efforts as I'm planning to build the device commercially.

----------


## Lucid Mind

> _Originally posted by kimpossible_
> *I removed most of the specifics of my efforts as I'm planning to build the device commercially.*



   Thats good ! I think. It seems to work at least.Best wishes! And dont get greedy!
 ::wink::

----------


## MeusOpusMagnus

I GOT IT !  :smiley:  ... well, he did  :wink2: 

all we needed was to wait... until SOMEBODY ELSE builds it.   ::D:  

http://www.fuzzymonkey.org/newfuzzy/softwa...inheartmonitor/

after re-reading the thread i realized how uselessly complicated the design i was going for was and i started reading about the 555 chip... THEN i realized heart rate... though i don't think it changes significantly with REM sleep, might be a good experiment. so i started searching on google, and eventually found the link above. it provides BOTH the interface AND the software so, if heart rate gives no results in terms or REM detection, we can slowly toy with both the hardware and the software until we get a reading of electrodermal activity (which i know for sure changes drastically... or at least i think i know for sure  :wink2:  hehe).

point being:

1- this is simple to build
2- i can test it right away after it's built
3- it basically measures electrodermal activity at two points, eliminates the noise (from point 3?) and outputs the clean pulse voltage.... if we compare the voltage from the two probes with a CONSTANT one, we have electrodermal activity (i think?)... someone please let me know if i'm wrong... i think this is right though... the "noise" varies throughout the day, and this is what we actually want to monitor, the average noise and not the heart rate... 
4- there is already software built for it, we can just modify it or add to the features (which i don't think the developper would mind at all)

if it doesn't work, we can toy with the software so that we get a more general reading... and then we can butcher the hardware and monitor sleep... until we notice some significant changes... or someone with an understanding of medical science and electronics sheds some light on what exactly it is that we are doing  :smiley: 

i'll get back on this (i have some, though not a lot, spare time to toy with... i'll try to buy the parts i need this friday and get going with it)

----------


## kimpossible

My experiements with heart-rate (5 people) to detect REM were abject failures.  Sensitive enough and you couldn't eliminate the noise...  You're looking at sub 0.1%.  Maybe really good FFT software on a multi-processor machine. . .

----------


## MeusOpusMagnus

yeah, heartbeat is really crap at detecting rem... it goes down a bit during regular sleep, and it's comparable to waking states during rem, but the difference is very small... not to mention the fact heartrate cycles render any kind of monitoring (other than average over periods of time) completely useless...

i just realized that now. AND i also realized that the diagram uses an amplifier that looks at very small differences and amplifies them... if i were to take out one of the values, i'd have a HUGE difference, so the amplifier becomes somewhat pointless, i could probably do with a more generic amplifier.

i still think i'll buy that gsr2 and see how it works, but i'm afraid it won't be very useful either... i'm starting to have doubts when it comes to these type of measurements for a few reasons: they require good electrodes... i tryed toying with home-made ones and they just don't do the trick... they're not very reliable. not only that, but the electrodes have to be fairly fixed, meaning you're looking at tape or whatever way of fixing them, and slight changes would offset the calibration... to add to that, the entire process of putting them on/taking them off seems somewhat annoying, especially if you plan to do it fairly often.

so i dunno...

i'm starting to think the best and surest way is still IR detection... it's called RAPID EYE movement because that's the most noticable feature of the sleep period...

i'm curious as to how your device works kimpossible (not specifically, if you're planning to release it comercially, but as an overview) and how that proved to be effective (are there no problems with different values from person to person, etc?)

----------


## kimpossible

My GSR system has had amazing accuracy across six people.  Compared to EEG and Camera (two highly accurate systems), I run 97%+ accurate detection over 300+ nights of sleep, with zero false-positive detection.  (I miss some, but I don't detect what isn't.)

I run some pretty heavy-duty processing on the built-in processor - including FFTs to get that kinda accuracy, though

----------


## MeusOpusMagnus

well, with that accuracy... it sounds awesome.

...

when is it being released ?   ::D:

----------


## Placebo

I was beginning to think you'd lost interest, and I was considering contingency plans  :smiley: 
Great to hear about the accuracy !

----------


## MeusOpusMagnus

i've been reading up on the 555 timer lately and it might do the trick (i think).

there are two things we could measure, and i don't know which would be the best way to go:

1- the difference in skin resistance to a "fixed" point ("fixed" meaning it can be calibrated) -> 555 timer -> serial port (i don't know much about the serial port, so i'll have to look this up a bit more)
2- the true value of skin resistance (which would directly control the 555 timer... in which case the calibration would be software based)

i think the software based calibration is the better idea (given that we're aiming for as few components as possible to begin with), but i don't know how reliable the hardware will be (given that, depending on the construction and placement of the probes the resistance will be different)

i'll do a bit more research on the 555 timer (i really thought the voltage -> frequency was a good idea, but this seems so much easier...) i know i'm going through ideas and approaches faster than i can actually build any of them, but i think this is promising.

i'll start by building a simple led flasher and i'll play with the capacitor values. the idea is to use my own skin resistance to flash the led (with a fixed 250 kOhm resistor, a 0.1 uF capacitor and a variable skin resistance between 10 kOhm and 500 kOhm, we get a range in frequency from 12 Hz to 65 Hz... a soundcard would not pick that up, most skrew up under 20 hz or so, but for serial port it should be ok... if we need more accuracy (which we probably will), we can boost that up in the kHz so that we get a bigger range... 

for testing purposes, i'll try to keep it even lower than 12 Hz so that i can see the LED blink.

 ::D:  

if this works, we'll have a very very simple device to build. i don't know if the 555 connects directly to the serial or if it needs some sort of converter (does anyone have a quick answer/schematic that may save up on searching?)

kimpossible, since you used 6 subjects so far, does the resistance level vary a lot across individuals, or is it somewhat similar? also, given your experience in electronics, if you have any comments on what i just said (am i completely off anywhere ?), it would be greately appreciated (actually any kind of help would be appreciated)

----------


## MeusOpusMagnus

oh yeah, the only small problem that may add some components is the voltage value we're willing to run across the skin... from what i read 0.5 V was the optimal value, so i'd have to figure out how to make that work with the 5 V of the 555, but it shouldn't be a big deal.

----------


## Placebo

Hmm, looks like we're gonna end up with two prototypes  :smiley: 
Welcome back Meus

----------


## MeusOpusMagnus

:smiley:  i have all the part for the 555 timer circuit, i'll be experimenting tonight with with a LED. I'm working both tomorow and the day after, but I should be able to tell you how it goes pretty soon.

----------


## kimpossible

The 555 is pretty antiquated.  I think you'll find that you can't keep it from drifting to the point of being useless.

Time to start thinking about looking at a microprocessor - like a PIC.

----------


## MeusOpusMagnus

actually the 555 seems to do the trick for now. I wired up a basic led flashing circuit, and with a 200 K resistor and my skin resistance (about 200-250 K) i see variations in the flashing rate as I hold the "probes". I'm using a 1 uF capacitor and a large resistor, in order to see the led flash (with a 1K resistor i can't see the flashes anymore, and with a  5K i can make out some very quick flickering)... if we use a 1k resistor and 0.1 uF we should have a high enough frequency to provide for (somewhat?) accurate readings...

i WOULD use a PIC and I realize how much easier and more accurate it would be, but... i don't know that much about electronics or programing, and i don't have the required time to learn these things.

the schematic i used was the astable one on this page: http://ourworld.compuserve.com/homepages/B..._Bowden/555.htm
I used R1 - skin, R2 - 200 K and a 1uF Capacitor, which gives (with my skin) a reading of about 2Hz. My girlfriend however has twice my skin resistance (in the 450+  K range) which takes the frequency down to about 1 Hz
to wire up the led, i just connected a 470 ohm resistor from pin 3 to a led. (pin 3 to resistor  to + LED).

the problem right now is that we use about 3-4V across the skin... it's not a lot, but i don't know about long term effects of that. I'm using a 9V battery, and there are a few ways to go around it, with the easiest being a voltage regulator... if i drop the voltage to 5V, we'd get some 2-3 V across the skin, which is slightly better and which the timer can take (some timers apparently can go down to 3V, but i don't have one of those, and i don't know about their availability... i want to keep this as simple as possible.)

anyways, if anyone's willing to help connect this to a computer, it would be great... if not, i should be able to figure it out eventually.

next steps:

- small capacitor (1 or 0.1) across skin to filter out noise (i have to buy some 0.1 uF ones cause the lowest i have is 1)
- 5v voltage regulator (i have one)
- figure out how to connect it to a computer and get some readings. (given that the output is either ON or OFF, i figure this should be easy, but i don't know anything about the serial port... i'd go with the line in option on the soundcard, but now i think this would just complicate things for nothing)

so yeah  :smiley:

----------


## kimpossible

"see the difference in flashing"

You realize we're talking about fractions of 1% for the range of difference between rem and sleep, right?

----------


## MeusOpusMagnus

no i don't actually... that's why we're trying to build it, so we can record a few nights sleep and see if it offers a simple alternative to eye movement. from what i read, the shift in skin resistance was easily noticable, but my sources may be wrong, or i may have misunderstood the articles i've read.

but instead of opting for elusive replies, given your knowledge in the field, i don't see why you don't try to help us out. there's no reason why you can't keep your existing design, comercially produce it, but also help with ours...

----------


## kimpossible

Sorry - I can help point you in the right direction, but I'm not going to gut my own devices by designing another for you.  That'd be kinda silly.

I thought I was giving you some pretty clear pointers, actually...  

In order to see enough delta for reasonable self-calibration, I needed to amplify the signal more than thirty-fold.  At that kinda SNR, you're going to need something to take the edges off.

Also, what are you looking at for a sample-rate?


As far as asking for my comments:  I offered some.  The 555 drifts significantly.  You pushed that aside "oh, it's working fine for me" but you don't have any measurable data to confirm that.   The actual drift is about 1% with another +-1% for the supply.  If you figure another few percent for the voltage regulator, you're going to have calibration issues.


Skin resistance varies from person to person.  In my tests, I've seen my own vary throughout the night from 1.3MOhm to 105kOhm.  The range I've seen on my test subjects is from 52kOhm to 3.3MOhm.

----------


## MeusOpusMagnus

well, the idea was that all the necessary calculations could be software based for now... the immediate aim is to get a raw signal (even if it's really noisy) into the computer and see what it gives us... this way we'd know how much we need to clean it up, how much should be hardware-based and how much can be software.

there is no real need for amplification at hardware level (at least not yet, i don't know what will happen once we get some readings), because knowing the capacitor and the resistor values, we could estimate a somewhat acurate value for the skin resistance (especially if the 555 frequency can be recorded at two or three decimal numbers) This would be used for the calibration (which again would be software based)... of course, the accuracy of the 555, resistor and capacitor will play a big role, but i hope the difference will be fairly noticable, else we're just looking at problems, starting with the home-made probes (which can't be that constant or accurate to begin with)... 

the sample rate could also be software controlled... if i get a pulse to the serial port, varying from say 20 hz to 60 hz we can figure out at what rate we need to check the information... i don't know how fast a serial port is, but i trust a pentium 4 can perform more than just the necessary calculations in real time and decide from there what values need to be taken into consideration for REM detection (average over a few seconds, or whatever)... the software could also probably provide the necessary amplification... if the overall shift in skin resistance is say only 30 K, which would give us... let's say, a 10 Hz range (at two or three decimal numbers, or however much the computer will allow)), we'll have at least 1000 points to play with on a time graph, which should be, again, fairly accurate... if the shift is less than that, we're probably running into trouble...

the idea is that rather than amplifying the signal and trying to get rid of noise and playing with very small values for GSR detection, i'd rather just scrap it and pick another feature that may provide fairly accurate REM detection, like breath rhythm/intensity measured with a strap across the chest... and if that's not enough either, maybe even combine two less reliable detection methods.

what i'm interested in is the easiest, cheapest way to (somewhat reliably) detect REM... even if i get a 50% detection rate, i'd be satisfied... it means 50% more chances of having something signal to you... which is way, WAY better than nothing   ::D:  . Either ways, even if the REM detection is not reliable enough, the unit could still be used as a biofeedback/meditation tool.

so yeah, for now the idea is to get SOMETHING into the computer, however unreliable it may be, which is why i need to figure out how the serial port works  :smiley:

----------


## MeusOpusMagnus

> _Originally posted by kimpossible_
> *As far as asking for my comments:  I offered some.  The 555 drifts significantly.  You pushed that aside \"oh, it's working fine for me\" but you don't have any measurable data to confirm that.*



I didn't push it aside, i said it works for now (i got a LED to flash, which I didn't have the night before hehe   ::mrgreen::  ) ... it might not be very reliable, but i wouldn't know about it it. That's why i need to build it, to have measurable data (which, as you pointed out, i don't have yet). I don't know if it's going to work or not... but i do know i have no idea how to make a PIC work... which sums up to: if simple electronics won't work for me, i can't build it.

As for skin resistance... a 3 MOhm reading would probably be very poor in terms of accuracy (the smaller the resistance, the better the reading with the timer), but maybe that can be fixed with some variable resistors for calibration further on down the road.

Either ways, i'm doing this for fun... if it works, i'll be delighted and i'm sure some people will find it useful... but if it doesn't, i have nothing to lose (other than a few $ and a bit of time).

and i'm not trying to be mean by saying you could contribute a bit more, but i honestly think it wouldn't take away from your target market... there are plans for the Kvasar out, and i don't know many people who built one... in fact, there are people who'd pay close to the price of an REM Dreamer or a Nova Dreamer to have it built for them.
I certainly do appreciate the input you're offering (especially in your last post, considering skin resistance values).

----------


## Placebo

Actually, she did contribute quite a lot, until recently when she removed her posts.
Her prototype thus far is very successful. I just hadn't heard much about it in a long time.

----------


## MeusOpusMagnus

i probably missed all of the posts that are now gone... aaanyway.

i was looking at the plans for the dream weaver (i'm planning to build one too, i just ordered the specific led/phototransistor part that i needed, along with replacement parts for my kvasar, to see if i can pick that up again) and i realized the game port might be, for the time being, an easy alternative to the serial (till i figure that one out... it seems to be fairly complicated compared to the game or the parallel port).... i'll be visiting my parents soon and i'll pick up my old laptop (the one i have right now doesn't have a game or lpt port), which is a 486 that i'm not afraid to experiment on by plugging in all sorts of random home-grown products  :smiley:  it's limited to dos/win 3.1, but from what i hear win xp comes with all sorts of restrictions on the ports that we'd have to work around (so i have to figure that out too)...

the plans for the dream weaver are here: http://www.cerebrex.com/0ldGraphics/drwevr.zip

from an ld4all post, the sensor can be replaced with a CNY70 and the 2N22222 is drawm wrong, with the emitter and collector mixed up... but the game port reads straight from the phototransistor, meaning i could probably hook up a transistor to the 555 timer and plug it in ? i'll have to look at it a bit closer, but it might do the trick.

----------


## Krrish

Oh my god. I havent noticed this thread. Actually I havent given it any importance since it is in the research section. I thought the reasearch is only for lucid gods. But this is really interesting and it is my subject.  ::banana::   ::aphiusiscrazy::   ::dancingcow::   ::coolspot::  

I was designing a circuit to detect REM using a different method. Wait.. I have to read all the posts !!!! ( I wont be patient enough to read all those previous posts. If someone can post a summary, it will be nice.)

----------


## Zuarko

What about this experiment? Have you find out something? I'm thinking another idea that also includes this one. I thought about a NovaDreamer but sounds, lights, touchs... and all in a REM state.

I would like to know (if possible) if you have discovered something. My idea about the REM detector is this: A timer will wait until you are sleep and near the first REM. That is, timer = time you need to fall asleep + time since falling asleep to first REM. 

I got some electronic knowledgment, if you need help with timers (those 555) or connecting it to the computer just let me know.

----------


## Placebo

This project is on hold indefinitely, at least for me.
Perhaps one day I'll pick it up and continue. Perhaps not.
I get disillusioned when the people with all the data and prototyping decide to F off with it all...

----------


## icuurd12b42

My electronics is limited but I do remember 2 basic facts you could use to your advantage.

The inductance of a coil changes when a body part gets close to it.
The capacitance of two plates also changes if your interact with it.

The eye is not symmetrical so, in theory, it could affect the fields when moving.

Using the inductor technique:
place a small coil directly in front of one eye. Close to it. Measure the inductance. When it fluctuates for more than a minute, you got rem.

Using the capacitance technique:
place a small plate on both sides of one eye. Measure the capacitance of the crude capacitor. When it fluctuates for more than a minute, you got rem.

----------


## Zuarko

Pretty good ideas icuurd12b42.

 I was thinking in another way. Some people (me for example) couldn't sleep with something similar to a mask in their faces, it's horrible for some of us! Another thing is that some people feeling bad when they think about some IR over the face for so long (I can say that that IR leds are non harmful at all)

My idea was to use those IR with a temporizer. The temporizer will activate the device when the REM state is suppossed to appear (a little before 90 minutes, am I wrong?) and it will activate a "robotic-arm" (let's call it a stick with the IR on it) that will go next to the face of the dreamer and tries to detect the REM state for a period of time. I've opened another topic with an application for this device where it's supossed to interact with the dreamer giving him some stimuli (not only visual)

----------


## icuurd12b42

The problem with detecting REM using the eye is that you have to follow the eye. A mask does this naturally. Until it falls off or you tear it of while sleeping that is.

An unattached device would have to follow the face of the sleeper as he switches side and position.

If your device is unattached though, you may be more resourceful as many options are now available. Remote Face tracking and REM detection is possible using a CCD camera on a robotic arm and computer though the concept seem very costly.

I think the cheap solution is a NovaDreamer type mask with coil inductor to detect REM.

I used the NovaDreamer myself. I found the LEDs used to interact with you were way too bright. I would use a vibrating pin on the forehead instead. If you keep getting bit on the forehead by mosquitoes, you know you're dreaming.  ::lol::  

The electronics inside the NovaDreamer are so old school, you could have made one 30 years ago.

In the same size package, you could have a micro computer. A pic as mentioned. To drive the detection coil's data acquisition for REM detection. Once detected, drive the vibrating pin or LCD to make you aware. The awareness method does not need to be fancy. I believe the more complicate it is, the more convoluted it would be in the dream, making you less aware as the tool would turn on you and start driving the dream as opposed to making you aware.

I also liked the idea of the glove mentioned here. Sort of reminded me of a ST Voyager episode.

----------


## phoenelai

> _Originally posted by icuurd12b42_
> *The problem with detecting REM using the eye is that you have to follow the eye. A mask does this naturally. Until it falls off or you tear it of while sleeping that is.
> 
> An unattached device would have to follow the face of the sleeper as he switches side and position.
> 
> If your device is unattached though, you may be more resourceful as many options are now available. Remote Face tracking and REM detection is possible using a CCD camera on a robotic arm and computer though the concept seem very costly.
> 
> I think the cheap solution is a NovaDreamer type mask with coil inductor to detect REM.
> 
> ...



Agreed, I'm surprised nobody has updated that circuit board. Its huge for today's technology. I can't believe they were charging what they were charging ($699) for such a huge piece of old technology. If someone really invested in new development I'm sure the new one's would be much lighter and comfortable.  ::shakehead2::

----------


## Seeker

> _Originally posted by Placebo_
> *I get disillusioned when the people with all the data and prototyping decide to F off with it all...*



I hear you there Placebo!  That person was going to market the product and make gazillions of dollars on it.  So far nothing, makes me wonder if they really did it or were just making it all up.  I bet we have a backup of it around here somewhere.  If so, I'll see about restoring it.

----------


## icuurd12b42

> _Originally posted by phoenelai_
> *
> 
> Agreed, I'm surprised nobody has updated that circuit board. Its huge for today's technology. I can't believe they were charging what they were charging ($699) for such a huge piece of old technology. If someone really invested in new development I'm sure the new one's would be much lighter and comfortable.*



Wow. did you pay that much? I was lucky to get it on sale. When I looked at it I was a bit discussed with the 5$ circuit board. On the other hand, cuicuitry aside, It would have cost me more that what I paid to build one. Integration to mask and final prototyping is costly when you only build one.

I got it in a package. When I counted all I got with the mask, I was not too angry with the purchase. The package was 250$ if I remember right. I figured the mask, in the package, I paid the equivalent of 150 bucks for it.

----------


## visor

I think both the coil and capacitance ideas have the downside of needing some sort of mask, where as the brilliance of the GSR circuit was that it would be non-intrusive. So is there any reason to think more about them - like simple design?

Here's a project where they build a very small GSR. Unfortunately, not all the data is there so it's impossible to use it as it is.

http://bentham.k2.t.u-tokyo.ac.jp/notebook/?cat=3

Here is some other GSR construction link:

http://web.media.mit.edu/~carsonr/pdf/gsr.pdf

----------


## Placebo

Thank you, I thought the unintrusive glove was an excellent idea too.
Maybe I'll try to make it again one day. Maybe.
I'm no electronics whizz

----------


## icuurd12b42

I think REM detection is not required if you can set up a simple time based alarm. Then I thought about Vibrating Watches. Simple. They have those.


http://ca.search.yahoo.com/search?vc=&p=vi...t&tab=&ei=UTF-8

I found a cheap one that vibrates for 20 secs and you can set the amount of time before the next repeat.
http://www.azhearing.com/cgi-bin/shopper.c...ction&key=VL300

----------


## visor

Has anyone tried taping their cell phone to their hands? The vibration could be too much so the watches are certainly a good option.

The reason I didn't try that before was that I thought REM cycles had some variability from person to person.

But I have neurofeedback equipment. So after recording a few nights, I can see what my rhythm is.

Still, I'm pretty sure that there's added benefit from getting the vibration EXACTLY when your brain goes to REM.

----------


## Placebo

> _Originally posted by visor_
> *The reason I didn't try that before was that I thought REM cycles had some variability from person to person.*



It does vary a bit. Which is why I don't like the time system.
Besides if you can detect when you're going into REM, you can find out more about your sleep health.

And the vibration was generally the idea for the glove.
I didn't like the idea of electrical shock or pain.

----------


## visor

I got these ideas for the detection of REM from a patent. I don't know about if they are right. They might be easier to implement than GSR.

 The sensor for detecting a phasic event can be vibration sensitive, e.g., for toe twitches, or an electromyographic (EMG) electrode to evaluate muscle tone, middle ear muscle 
activity, eye twitching, or other phasic activity.

Muscles undergo flaccid paralysis during a REM cycle.

Besides, I found this fascinating patent. It claims that using photic stimulation (with LEDS for example) on parts with a lot of surface veins, it is possible to increase the length of REM periods (NREM periods shortening). In their tests they achieved a mean change of +47 %.

The invention features REM detection but I understood it might work even if it would be on the whole time. And any light source is ok. That means it should be fairly easy for anyone to do. 

http://v3.espacenet.com/textdes?DB=EPODOC&...7&QPN=US6669627

----------


## visor

Zuarko, 'ya there?

http://bentham.k2.t.u-tokyo.ac.jp/media/16bit-sch.jpg

There was not enough information on the site I posted about this circuit. What is the 
ZRC, and what are the LSP1 to LSP4? LSP1 and LSP2 are the data outputs right?

It uses I2C interface. How do you use that, do you have any experience with that?

Here's another circuit:

http://ralphhilton.org/emeter/Mk4.htm

----------


## visor

GSR

+ very handy to use
- places demands on the quality of the circuitry

EMG

+ cheap (around $10 excluding the breadboard and the batteries)
+ detection of REM possibly fairly easy
- setting up electrodes is a bit of a hassle

A very simple EMG circuit which might still be sufficient for our purposes. It outputs to a microphone input. It needs some custom code which I haven't looked for yet.

http://pni.unibe.ch/Chip.htm

----------


## visor

http://www.pubmedcentral.nih.gov/articlere...i?artid=1389709

"It was recently reported that epochs of non-REM sleep (NREMS) with low muscle tone represent a partial correlate of REM sleep (REMS)."

I'm glad I didn't pursue the EMG route any further.

----------


## Rainbow Werewolf

Maybe use a monitor like that for a night, keeping data somehow, and see what heartrates plateau at. That would allow for sensitivity adjustment.

And if you were to memorize morse code, then you could introduce phrases into the dream   :smiley:  






> Better get the patent quickly&#33;
> And the heartrate monitoring between different users could easily be solved with a little smart programming into the device making it keep a record of the person using it and determining their average heartrates. That is if you are serious about creating this device for more people than just yourself.
> Personally I think it is a very good idea and could be the inexpenssive alternative to the damnable Nova Dreamer&#33;
> [/b]

----------


## Rainbow Werewolf

Um, yes you can with Cygwin. It does bash scripting.





> Damn windows in general. You can&#39;t write cool shell scripts like you can in Linux.
> [/b]

----------


## skybluelucid

I&#39;m new to the forum so I&#39;ve not seen this topic before.

A few thoughts: to me, vibration is an indicator of danger (think someone shaking you to wake you up). I wonder if it might not be better to use some sort of peltier(?) device to gently cool your finger tip or wrist or something? (Or am I totally confused as to what a peltier device does&#33;?)

Second, for pure prototyping, why not check out the Basic Stamp by Parallax?

----------


## visor

Nice to see people notice this thread.

This project is currently on hold. I did measure my EEG for few nights but there were nowhere as clear patterns as the literature indicates. Maybe my Aspergers has some to do with that. Too bad. I will try it again later.

Werewolf, I really don&#39;t think the heartrate is the way to go. But I could be wrong.

Skybluelucid. The method of signaling is like the icing on the cake. We&#39;re nowhere close to choosing that. Having said that, you may be right about the undesirability of vibration. I think people should get to choose their method of signaling.

The parallax seems expensive if it&#39;s up to 89 dollars, but I&#39;m not sure.

----------


## Rainbow Werewolf

How about resistivity of the skin, does that change when you enter REM?

----------


## visor

GSR (galvanic skin resistance) supposedly changes a lot (it&#39;s like when waking). Someone also recently suggested novel methods like putting capacitors and magnets over the eye and then measuring small differences with some component. I think I might try that too, if it&#39;s not too difficult to make.

----------


## lord soth

I have a parallax basic stamp 2. I was trying to make a "dream-ankleband" thingy with it. I managed to have it choose a random 20-30 minute time period and then power a pizo buzzer. I want to replace that with a small pager vibrator moter and attach that to my ankle, but the whole unit (including the main board, with breadboard, and 9 volt) was too big to do anything with. I was going to use this to help with reality checks during the day and then help me recognize i&#39;m dreaming during the night. But like i said, its too big to wear. If anyone knows how to make a device like this using discreet components. i&#39;d be interested to purchase the supplies and build the thing.

----------


## icuurd12b42

> GSR (galvanic skin resistance) supposedly changes a lot (it&#39;s like when waking). Someone also recently suggested novel methods like putting capacitors and magnets  over the eye and then measuring small differences with some component. I think I might try that too, if it&#39;s not too difficult to make.
> [/b]



Not magnet. Inductors. One would have to select a circuit that is easily influenced by the change in inductence from an inductor who inductance is easilly changed by the close proximity of flesh.

----------


## Durett

Hey, I was just wandering if anyone is continuing this or has finished it? I came across this thread and it looked interesting...

----------


## Durett

I assume no one has finished this project and made data. I was browsing the internet and cam across this site 
http://instruct1.cit.cornell.edu/Cou....html#SHDesign
Basically, it's the same thing except they use a microcontroller. A possibility. A self
adjusting range for a wide variety of resistance would have to be added, though...

----------


## Placebo

Very nice find  :wink2:

----------


## Seeker

I had to scroll to the bottom to see the authors.  Thought for a moment it might have been from Kimpossible.

She never did develop or sell the last device that she and Placebo were working on.

On a high note, that looks like a really nice design.

----------


## Robot_Butler

Have you guys looked into this at all?  I'm no engineer, but I have thought about it in regards to lucid dreaming many times.  They already have it set up to determine when someone is in various stages of sleep.

http://www.hoana.com/technology.html

It's my Father's company, so if you have any questions let me know.

----------


## Seeker

> Have you guys looked into this at all? I'm no engineer, but I have thought about it in regards to lucid dreaming many times. They already have it set up to determine when someone is in various stages of sleep.
> 
> http://www.hoana.com/technology.html
> 
> It's my Father's company, so if you have any questions let me know.



I AM an engineer, if I get a chance soon, I'll give it a look and comment.

----------


## Durett

I've been searching again and I found this neat pdf file on how to build a bluetooth gsr detector. Not the easiest thing to build, but still cool, and would be quite educational too.
http://affect.media.mit.edu/pdfs/05.strauss.pdf

Oh, and just in case that link doesn't work, I got it from this gsr website
http://bentham.k2.t.u-tokyo.ac.jp/notebook/?p=158l

----------


## Placebo

Just to fill everyone in who doesn't know the background... we (Me, Kimpossible, Seeker and Magna..something) were developing a glove-based electrodermal detector, that would log the data and on REM would trigger a 'you're dreaming' signal (lights or vibration)

It has applications outside of lucid dreaming as well, of course, but the intention was to detect dreams and lucid dreams.

So what happened? Kimpossible cheesed off some people and is no longer with us. Before pissing people off, she removed all the data that had been collected :/
And I suck at electronics, so I'm not in a position to carry on without some serious electronics studies.





> On a high note, that looks like a really nice design.



Yeah, but I notice that they weren't actually able to detect emotional state with it - it wasn't exactly successful. But they did feel that it had more to do with the cheaper electrodes. Kim also mentioned the electrodes being important.

Yet another project I need to get around to. I have an electronics savy friend that I might be able to bully into helping me, but it's not easy to motivate him.

----------


## Placebo

Oh, and that Hoana device looks great. But it's probably very expensive, because it's intended for medical purposes.

----------


## Durett

I was looking more at the schematic at the bottom. It could help, and certainly the blue tooth could be eliminated and surface mount componenets changed to dip components to cut costs. Or, it could just help us with another design...

----------


## Durett

Alright, here’s my semi-analysis of the circuit contained at the bottom of the pdf at the website http://affect.media.mit.edu/pdfs/05.strauss.pdf for the gsr circuit. I would change the circuit so that in the first amplification stage, you have 2 1M resistors, a 500k resistor, and a 250k resistor in parallel. I probably made many mistakes, major  or minor, so just correct me. An analysis is important before you build a circuit because, well, if you want to change a few factors, you have to know what you’re doing. Look at the schematic, 
or else you’ll have no clue what I’m talking about. So here it is…

     First, an overview of the circuit. There are two amplification stages. The first one has 4 gain stages. The first has a range of 0-5 uS, the second 4-10 uS, the third 8-20 uS, the fourth 16-40 uS. S stands for a Siemen, while the u stands for micro (10^-6). A siemen is equal to 1/resistance. Therefore, 5 uS = 1/(5*10^-6) ohms = 200,000 ohms. The corresponding ohmic ranges, from first to fourth gain stage, are 200,000 + ohms; 250,000 to 100,000; 125,000 to 50,000; and 62,500 to 25,000 ohms. The second amplification stage shifts the range of voltage into the 0-2.5 V range required by the PIC microcontroller for its Analog to Digital conversion.
     Let’s take a look at the first amplification stage. The input voltage to the + side of the op amp is .5 V. The capacitor on the – side is simply meant for noise filtering. The voltage gain of this noninverting amplifier configuration can be shown to be 1+R/Skin where R is the equivalent resistance of resistors R3, R4, R5, and R6 (depending on which ones are connected).
     The mode depends on whether the appropriate electronic switches are open or closed. The microcontroller controls the state of the switches . The switches are actually contained in the ADG712BRU integrated chip.
      In the second gain mode, the 2 1M resistors are connected in parallel. Therefore, R = (1*10^6)^2/(2*1*10^6) = 500,000 ohms.  
      Therefore, the gain in mode 1 is 1+500,000/(100,000) to 1+(500,000/250,000) = 6 to 3. The output voltage range is therefore .5 * 6 = 3V to .5 * 3 = 1.5 V. The same calculations can be made for modes 1, 3, and 4.

Mode 1: R = 1,000,000 ohms. Gain is 1+(1,000,000)/(200,000) =  6 all the way down to 1 (as skin resistance approaches infinity, R/Skin approaches 0). Therefore, voltage range is from 3V to .5 V.

Mode 3:   R =250,000 ohms. Gain is 1+(250,000)/(50,000) = 6 to 1+(250,000)/(125,000) = 3. Voltage range is from .5*6 = 3V to .5*3 = 1.5V

Mode 4: R = 125,000 ohms. Gain can be calculated to be from 6 to 3, which in turn produces an output voltage of 3 to 1.5V.

     All right, to sum it up we have 4 modes that produce an output voltage from 1.5 to 3 V for stages 2,3, and 4 while producing output voltage of .5 to 3V.

    On to the second amplification mode! The voltage input into the second op amp can be seen to be 11/21V (V is output of first amplification stage) with only the 100k resistor in series with the 110k resistor going to ground. 

    The voltage output of the second amp can be derived as V-20*10^3*((V1-V)/(26.4*10^3)+(V2-V)/(132*10^3)) where V = the input voltage into the + side of the op amp, V1 and V2 can be 3.3V or 0V, as controlled by the high and low state of the microcontroller (it is powered by a 3.3V regulator). Of course, the low voltage won’t really be 0 V and the high voltage won’t really be 3.3V. This probably means that, to get the best accuracy, you would have to record the voltage level of your individual microcontroller at home and change the computer software as appropriate. 
      Anyways, since I’m getting tired already, and you’re getting tired of reading this stuff, suffice it to say that in order to subtract .5V from the first amplification stage you need a 100k resistor alone, while in order to subtract 1.5 and multiply by 5/3, you need the 100k resistor in parallel with the other two resistors that are also in parallel (24k and 91k. Atleast that’s what I think 24k||91k means in the schematic in the pdf file). The second part just mentioned is actually just an approximation, but the error is so small, that a 10 bit ADC won’t detect the difference.

    Now it’s time to calculate the accuracy of each mode!

    The minimum change in voltage the ADC can detect is 2.5/(2^10) = 2.5/1024  = .0024414 V. The output voltage for modes 2, 3, and 4 is (.5* (1+R/skin)-1.5)*5/3 = V, where V = output voltage. First, solve equation for skin resistance given output voltage. Skin = 5*R/(6*V+10) . 

    Starting with mode 2, V max is 2.5 V, while minimum is 0 V.  Letting R= 500,000 ohms, the error can be calculated at 2.5V (100,000 ohms skin resistance) to be 
5*(500,000)/(6*(2.5-2.5/1024)+10) -5*500,000/(6*2.5+10) = 58.6 ohms.
At 0V (250,000 ohms skin resistance) error is Abs(5*500,000/(6*(0+2.5/1024)+10)-5*500,000/(6*0+10)) = 365.7 ohms. These errors correspond to percent errors of (365.7/250,000)*100 = .14628&#37; to (58.6/100,000)*100 = .0586%.

    Next, mode 3. R = 250,000 ohms. V max is 2.5 V, while minimum is 0 V.  Error is from 29.3 ohms (at 2.5 V) to 182.8 ohms (at 0 V). This corresponds to a percent error of (182.8/125,000)*100= .14624% to (29.3/50,000)*100 = .0586%.

     Next, mode 4. R= 125,000 ohms. V max is 2.5 V, min is 0 V. Error is 14.6 ohms (at 2.5 V) and 91.4 ohms (at 0 V). This corresponds to a percent error of (91.4/62,500)*100 = .14624% to (14.6/25,000)*100 = .0584%.

     Finally, the awesome mode 1. We need to derive a different formula for this, since in the second mode of amplification only .5 V is subtracted rather than subtracting 1.5 V and multiplying by 5/3.
     The formula is .5(1+R/skin)-.5=V, where V= voltage output. Solving for skin, we get 
skin=R/(2V)

      At 2.5V (200,000 ohm skin resistance), error is 1,000,000/(2*(2.5-2.5/1024))-(1,000,000/(2*2.5)) = 195.5 ohms.  
This corresponds to an error of (195.5/200,000)*100 = .09775%. Notice that we subtracted (2.5-2.5/1024) because this will give us a larger error than adding (2.5+2.5/1024). As V gets smaller, the error increases rapidly (the skin resistance measured gets larger).

     Let’s calculate the skin resistance that will produce an error of 1.0%. Set up the equation …
((1,000,000/(2*(x-2.5/1024)))-(1,000,000/(2x))) /(1,000,000/(2x))* 100 = 1
Solving, x = .246582 volts. This corresponds to a skin resistance of 2.028*10^6 ohms. Unfortunately, 1% of this is a 20,280 ohm error! At x = .5 V, skin resistance would be 1*10^6 ohms. This level will correspond to an error of 4906.77 ohms. If we switch to a 12 bit ADC converter (you can get microcontrollers that have this level of ADC built in), the error that corresponds with a skin resistance of 2.028*10^6 would be 5031.57 ohms.

     Alright. Now it’s time for a preliminary part cost list of the integrated chips used (didn’t include resistors, capactitor, diodes, because I didn’t feel like it. So cost is higher. Also, it doesn’t include Bluetooth since we can just connect it serially to the computer)

ADG712BRU: $2.00
OPA2342EA: $2.36 *2 = $4.72
PIC16LF88 = $5.33
3.3 Voltage Regulator: $1.13
Total: $13.18 + $8.00 (shipping, maybe more) = $21.18

    We could probably find a cheaper microcontroller than the PIC (somewhere around $2.00, say an atmel tiny) but I’m just going with what they used. Alright… Next, I shall look at the other possibility mentioned, using a frequency to voltage converter. Even if this way is not cheap enough, still some ideals concerning using the skin resistance to change the op amp amplification is good to know.

    It’d be good to discuss and generate  more ideals, suggest improvements on this circuit to make it cheaper/more accurate, etc… Till then, au revoir!

----------


## Durett

Woops... Didn't format when I copied from microsoft word...

----------


## Durett

Just off the top of my head, it would be nice to study the techniques used in electrometers to get such accuracy.
Oh, and I was taking a look at a previous ideal to use a voltage to frequency converter to measure the voltage, and by this, the resistance. I was just wandering, does anyone have any ideal on how to accurately measure high frequencies using a pc without sucking down the resources?

----------


## Placebo

Nope sorry. Like I said before, I'd love to help, but my electronics knowledge is dangerous at best.
It was a long technical post, so let's see if someone else (maybe Seeker) gets time to figure it out  :smiley:

----------


## davidcaudron

Hello every body,

I am  new comer in this forum (and in lucid dream resarch), and i would like to know if it is the right place for debates about piezo sensors for eye movement detection. The start of the thread was a little general but it seems that you ve been focusing on GSR since a while, so if you want me to deplace my response, just tell me. ::bowdown:: 

I ve been actually awared by a specialist that IR could actually warm the liquid contained inside the eye ball without any alarm from our senses because illumination occurs behind the "right place" (i don't know the english word for it"). Then, for a home made device, i think this technologie is a little bit unsafe. 
So, i 've been looking for another way, and i found out that the NASA, has actually used piezo sensors, for eye movement detection, monitoring that way paradoxal sleep.
Here is the kind of sensor i am talking about**:

http://www.meas-spec.com/advizia/v41...=Piezo&Rnd=124

What do you think of it? any specialist around for a new dream mask generation (USB 2.0 required ::banana:: )

----------


## Durett

That sounds like a good ideal! Do you have any more information on it, like how the circuit was made? And, it appears that you have to call to order it... is this the only place you can get it or are there others?
Cheers!

----------


## Durett

I haven't posted lately, but right now I'm trying to get a very uncooperative microcontroller (atmega16) to program. One moment it programs (I'm using winavr software) and the next time it says the stupid microcontroller isn't responding... Anyways, I've decided before I order anything that I should try out a basic rc circuit to see if this will work for general gsr detection. The resistance doesn't need to be 100%accurate, just the change in resistance will matter. I'm doing it this way because i remember somewhere on the internet they sold a gsr detector that used an rc circuit, and i was like, hey, why not give it a go? The site
http://www.robotshop.ca/PDF/RCtime_App_Note.pdf
has some good data on measuring resistance using rc circuit. In actuallity, it looks pretty accurate, assuming the capacitor doesn't drift in capacitance (which it does, but as i said, this doesn't matter, because only the change in resistance matters).
I've noticed no-one has been responding, I guess they're waiting for a little success to start the flood of responses ::roll::  ::lol:: 
Till then!

----------


## Placebo

The piezo sensors rely on having a face mask again, which I'm not keen on.
But if it's got reliable results and isn't too hard to make ... hmm... might be a good idea.

----------


## ethan_hines

To whom it may concern, I've been looking at alternative ways to detect rem sleep other then using IR goggles and I think this maybe it. It's a "Neural Impulse Activator" believe it or not it's used as a gaming device to control movement with brain waves. It's an electro-myogram, electro-encephalogram, and electro-oculogram all-in-one. I'm not an expert in electronics But I think this is something to look into and it's relatively inexpensive I found Amazon selling it for about eighty five dollars. It would obviously need some tinkering but it basically should do the trick. Please let me know what you think. I should mention that this is not my idea but an Idea I found on the fourm at this website:http://www.ocztechnology.com/product...pulse_actuator

----------


## marcc

It's probably easier to graph one night's sleep and work using a timing device to set off in REM


But I'd love to see a cheap REM detector  ::D: 


Side-note: I have a small heart beat monitor that you just clamp onto your thumb. It has a 3.55mm audio-like output jack, and I was wondering if there were any way to hack this up? Thanks  ::D:

----------


## ethan_hines

> .... i remember somewhere on the internet they sold a gsr detector that used an rc circuit, and i was like, hey, why not give it a go? The site
> http://www.robotshop.ca/PDF/RCtime_App_Note.pdf



I just want to make sure...rc in this case doesn't mean Reality Check right?





> Here is the kind of sensor i am talking about**:
> http://www.meas-spec.com/advizia/v41...=Piezo&Rnd=124



Just for fun I thought I'd check into these sensors so I emailed the company and sure enough they sent 4 piezo sensors to me in the mail. ::lol::

----------


## coconuta2

So, I've had this Nova Dream maker for about 8 mos.  I used it every night for about 2 mos.  I received nothing.  It ends up on the side of my bed or falls to the floor.  It's supposed to detect REM and other light sources in my room.  It rarely does that.  I set it and I even spoke with that Bruce guy.  All I want it to do is blink maybe a few times every minute or every other minute.  But it's just set to this REM detection mode.  I notice that when I hear sounds or flashing lights, sometimes they spill into my dream.  That's when I realize that I'm dreaming.  Can someone help me set my Nova dreamer other I'm just gonna give up on it and slang it on Ebay.  Or, if someone knows of another technology that can aid in Lucid dreaming?  I would forever be in debt to you.   ::bowdown::   Thank you kindly,


Carlos

----------


## ethan_hines

> So, I've had this Nova Dream maker for about 8 mos.  I used it every night for about 2 mos.  I received nothing.  It ends up on the side of my bed or falls to the floor.  It's supposed to detect REM and other light sources in my room.  It rarely does that.  I set it and I even spoke with that Bruce guy.  All I want it to do is blink maybe a few times every minute or every other minute.  But it's just set to this REM detection mode.  I notice that when I hear sounds or flashing lights, sometimes they spill into my dream.  That's when I realize that I'm dreaming.  Can someone help me set my Nova dreamer other I'm just gonna give up on it and slang it on Ebay.  Or, if someone knows of another technology that can aid in Lucid dreaming?  I would forever be in debt to you.    Thank you kindly,
> 
> 
> Carlos



Carlos, It's doing what it's supostodo.That is detect when your eyes are rapidly moving (REM) when you are dreaming, blink or make a noise (or both) and alert you *in your dream* that you are dreaming without waking you up.

----------


## coconuta2

Thanks for the reply.  I know that that's what it's supposed to do but that method doesn't work for me.  I was just looking for some continuous blink or noise method that would work without it having to detect REM.   I have to literally look up and down for like 10 secs for it to turn on.  I know I don't sleep like that.   It sounds simple enough but I don't know how to program it that way.

----------


## ethan_hines

You might have to turn up the sensitivity. Depending on the model there are small adjustable potentiometers that just the sensitivity of the eye movement.

----------


## chimpboysteve

I've just been reading an interesting experiment a guy is doing at the moment using a Neural Impulse Actuator (NIA) to detect REM.  By the looks of it he left for Army Service.  He developed some software to pick up on the REM but unfortunately needs a lot of work and is awaiting the Software Developers Kit to be launched to proceed his development.

It looks very interesting hopefully he will complete this soon.

Looks like it could work.

The link to the discussion is below:-


http://www.ocztechnologyforum.com/fo...and-brainwaves

Found these other links on the Forums:-
Here's another project using NIA with LED'S

http://www.ocztechnologyforum.com/fo...-Dream-Project

REM Detector that sends Tweets on Twitter when you REM

http://www.ocztechnologyforum.com/fo...ms-a-pynia-App

----------


## Dylan Tinning

Wow this is a realy interesting thread and i hope people continue to try to make this device...

Well im only 16 and i am very interested in making a cheap novadreamer like device because the new Novadreamer 2 is said to cost between $800 to $1000... who would pay that?

Anyway im not very "smart" when it comes to most of these things but i will help anyway i can if its still going ahead... i do have some conections  :wink2:

----------


## ethan_hines

This thread is like 9 pages long and I don't have the time or energy to leaf through it so can someone give me an update on what is the general concensious on how to best detect REM? Is it 
IREMGSkin Galvanic ResponseEEGOther

----------


## Dylan Tinning

Im not sure but it doesn't look like any1 else is posting unfortunatly :/ This would be a very interesting thread to continue!

To answer your question out of my knowledge  :tongue2:  I think i read somewhere that the skin response was a real good way of detecting REM... Thats just my knowledge  ::D: 

Please someone else post to continue this thread!!!

----------


## ethan_hines

What about respiration frequency I heard that changes dramaticaly with REM

----------


## Dylan Tinning

Well i suppose it all comes down to how "exciting" your dreams are???
It could be a really "boring" dream therefore having a low respiration frequency...

Like new people with LDing normally with there first LD its a very short one and they get woken from excitement so theres would be high, but experienced people would have a low wouldn't they???

Dunno just throwing things out there  ::D:

----------


## knacko

I am amazed by you guys. Crazy persistence in your undertaking. I respect that very much! I have two suggestions that could be useful. 

First one is the  cheaper solution. The openEEG project @ http://openeeg.sourceforge.net/doc/. It is a guy in Bulgaria (Europe) that is giving instructions to how to make an assembly of a 4 channel EEG.  

Second suggestion is rather expensive but seems to be a stable device that came out recently. It is called Emotiv and can be found @ http://www.emotiv.com/

----------


## Hijo de la Luna

In my personal research I have heard that the galvonic skin response is a poor detector of REM as the skin loses conductivity in sleep.  

In my personal experience when I am doing WILD or OBE the first big sign I am asleep is when I my breathing changes.  It becomes shallow, my expiration gets slightly longer, my inhalation is shallow and quick. Other than that I might begin to snore.

Rapid Eye MOVEMENT. I mean no sarcasm here but this phenomenon is a movement that is perceivable by the human eye to the awake person. so I think usinig motion sensors would be best.

It is true that respiration and heart beat increase in relationship to the dream content but it is mitigated. EEG measures brainwaves not experience.  However if you were to corralate the relationship of the respiration cycle/heart rate with the sleep cycle maybe you could extrapolate that data to locate an REM cycle

You can be in theta without dreaming. To learn more about this Anna Wise has a great book calledThe High Performance Mind, which I highly recommend. It has to do with brain states and the recorded experiences in each state and, how we can create the brain state at will to suite our desired results or task.

BTW that website is overwhelming but interesting.  I couldn't figure out where to start

----------


## topcat

The rabbit hole goes deeper: 'Multi-Player Dream Games' in:  http://www.dreaminglucid.com/issues/LDE%2054.pdf

----------


## Teblin

Placebo I found a device not long ago on the internet called an OCZ NIA its a headbad that u could quite easily sleep wearing and it can detect alpha/beta waves muscle movement and lateral eye movement they cost around £85. The plug into computer via usb and come with calibration software and software that allows u to map ur brains events into emulated keyboard keypresses eg u could have 1 key press for looking right and another for looking left. The OCZ NIA is origanlaly aimed at gamers but you could quite easily detect these keypresses in another custom made program and then send out messages like "you are dreaming" or something to some small in-ear earphones that u also wear while you are asleep or something. I beleve alpha and beta waves also change during different stages of sleep which may make detecting dreams more acurate with some experimentation.

----------


## topcat

The ideal mask for multi-player games is one that has very little logic; just transmits eye movement data to the computer and receives commands back to flash a light or sound (or different colored lights or sounds); the computer and the website do all the logic to determine REM and deliberate eye movement signals and coordinate the lucid dreams.

----------


## Rozollo

I've tried to follow this thread, but I seem to be really missing the overall idea.  I want to make a Kvasar or some type of mask that can function similar to the NovaDreamer's REM detection.

Can someone point me to the posts in here that will get me to that point?  I have a fairly decent understanding of basic electronics, so I just need some help figuring where to go next.  Thanks.

----------


## topcat

> I've tried to follow this thread, but I seem to be really missing the overall idea.  I want to make a Kvasar or some type of mask that can function similar to the NovaDreamer's REM detection.
> 
> Can someone point me to the posts in here that will get me to that point?  I have a fairly decent understanding of basic electronics, so I just need some help figuring where to go next.  Thanks.



This link may get you started: Mathieu Mallet // Morpheus REM Monitor

----------


## Rozollo

Thanks!  I'll research that.

----------


## topcat

> Thanks!  I'll research that.



Here is another one: www.bbelmont.com/pdfs/DreamMachine.pdf

----------


## Rozollo

On that one, is that also a mask?  I went through the documents, and I just saw a lot of schematics for building the board, so I am guessing this just does the REM, but it's called the Dream Machine.

I did a quick scan before printing it, so I probably missed something.

----------


## topcat

> On that one, is that also a mask?  I went through the documents, and I just saw a lot of schematics for building the board, so I am guessing this just does the REM, but it's called the Dream Machine.
> 
> I did a quick scan before printing it, so I probably missed something.



Think it is some kind of mask or at least some type of signaling for LD cue: "After detecting that the user is in REM sleep, the machine will either wake up the user gradually (alarm mode) or give subtle hints to induce lucid dreams (blink LEDs only 5 times)."

----------


## Rozollo

Perfect!  My speed reading isn't up to snuff...

I'll give it a go though.  Thanks for the links.

----------


## philquiet

Hi!
I've been thinking about making a DIY REM sleep detector and I found this topic. The topic is huge and I only got to speed read a few post, so if i'm giving old information and need to be updated, please tell me.

Based on my research, you could detect REM sleep with heart beat alone, but I just had the stinkiest time trying to figure out how to find the algorithm on Google. For what I found, it use as an input the Heart rate variability (Heart rate variability - Wikipedia, the free encyclopedia). Peripheral arterial tone can be used too and its detected by a wristwatch-like medical device used by paramedics.

But my most promising solution comes by searching about a kind of gadget called a bio-alarm clock. This stuff wakes you up at a light stage of sleep so you feel fresh and restful, as opposed of being groggy from waking up from a deep sleep stage. They do detect REM sleep and other sleep stages as part of their algorithm and sometimes they generate a nice graph of your sleep stages afterward.

Some of this stuff is real expensive and they are not made to be used for LDing. But I discovered an bio-alarm clock in the form of a $0.99 IPhone app (Sleep Cycle alarm clock) that does all the stuff only with the IPhone accelerometer! You just have to put the IPhone on your mattress and, as it is claimed, detect the movement you make in bed. As the site says: "Since you move differently in bed during the different phases, Sleep Cycle uses the accelerometer in your iPhone to monitor your movement to determine which sleep phase you are in." The app even gives you the graph of your sleep stages. When I saw that my jaw dropped and I said: wow... darn impressive.

This make me think that:
1-One could make a cheap NovaDreamer-like IPhone app for LDing
2-For people like me who don't own a IPhone, the only sensor I would need for a DIY solution is an accelerometer. (Like a Wiimote connected on a PC via bluetooth placed on my mattress, for example)

Now I just need to find an algorithm, since the damn IPhone app isn't open-source.

----------


## maxy126

Ive learnt about eye tracking in college. There are devices + technology out there that can track your eye movements, ive seen a video where a disabled person is controlling a computer by moving there eyes, so in theory if you could make the devices more precise and look for smaller eye movements. And make a program where it tracks your eyemovements over a certain movement (over 10 moves in 30 seconds?) then activate something which informs you that you are dreaming i think its possible guys  :smiley:

----------


## RBee

> Hi!
> Now I just need to find an algorithm, since the damn IPhone app isn't open-source.



That might be something I'll have to look into. I'm sure there are a couple of articles in the good ol' peer reviewed journals lying around on the topic.

You could also use a small PIC (like the 16F88) to sample readings from an accelerometer, and send the serial data back to the PC using a recycled 433MHz transmitter from a discarded wireless thermometer (4800bps)...

----------


## RBee

I've been reviewing some of those IR sensing goggles for REM detection. It seems simple enough. I have several IR LEDs and phototransistors lying around. 

If it's as simple as shining IR on the eyelid and measuring the frequency of voltage change at the photo-transistor, then this is so simple it's not even funny! The Mathieu Mallet version shows a very simple configuration. The photo transistor could modulate the VCO section of a 4046 PLL or simple a-stable 555 circuit running at <=10kHz, and send the output to the MIC in of a laptop.  A simple frequency count can be done in software, and simple calculations can show presence of REM.

This simple setup would work for experimental purposes to get all the bugs worked out. It would also work great for those who don't mind sleeping with a laptop running next to their bed. Use a simple pair of wires to carry You could have a plethora of signals to alert REM from a PC, such as subtle audio files to play, rather than a harsh buzzer that's more likely to awaken than cue you into lucidity.

After figuring out the best algorithm for detecting, then it could be ported to a PIC or AVR for a portable version.

I'll whip up an IR detector in some goggles then see what kind of results I get. This should prove quite interesting!

----------

