This is only a preview of the May 1989 issue of Silicon Chip. You can view 38 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
BUILD A BIOFEEDBA
MONITOR
FOR YOUR PC
By JIM BARBARELLO
Feeling tense? Build this simple biofeedback
monitor and let your computer calm you down. It
can be used with any IBM PC-compatible computer.
And if you don't need biofeedback, it is an
interesting exercise in computer interfacing.
Although most people think of the
IBM PC primarily as a business
computer that grinds away from 9
to 5 through spreadsheets, databases and documents, it can also be
made to serve other, quite different
roles. One such application is as a
computer-assisted biofeedback
monitor.
Biofeedback is the process of
monitoring a biological function
that indicates your level of
tenseness, and then feeding back
that information to you in real time.
By allowing you to see what happens when you try to relax, biofeedback lets you discover the techniques that work best for you. You
can then practice those techniques
to gain more control over daily tension and stress.
One biological function that indicates tenseness is your galvanic
skin response, usually called simply
GSR, which in non-medical terms
means the resistance of your skin.
PROBE A
10k
3
PROBE B
PLUG 1
11
IC1
7555
16
l
3V
.!..
20
As you become more tense, your
rate of perpiration increases,
thereby lowering the resistance of
your skin. As you become less tense
- as you "calm down" - the
perspiration rate slows and your
skin's resistance increases.
A variation from your normal or
average GSR is therefore an accurate biofeedback indicator of
how tense or calm you are at a
given instant in time.
The easiest way to measure GSR
would be with an analog resistancemeasuring device such as an ohmmeter (or your multimeter switched
to an Ohms range). Unfortunately,
analog measurements are not wellsuited to digital computers.
There is, however, a surprisingly
simple alternative. By using a circuit that generates a digital pulse
with a duration proportional to a
resistance, we can use a computer
to measure the length of the pulse
and then interpolate the pulselength into a resistance value. That
approach forms the basis for this
BIOFEEDBACK MONITOR
Fig.1: the circuit uses a 7555 timer IC that's triggered by the
INIT line (pin 16) of the computer's printer port.
38
SILICON CHIP
Copyright 1988, Gernsback Publications. Reprinted with permission from
October 1 988 " Computer Digest".
---20
0000
0000
I
1
S..!_r+t' 0 I
3V BATTERY
Fig.2: the circuit can be quickly wired up on a small piece of
Veroboard. The two probes are actually aluminium foil strips
which are fixed to the lid of the case using double-sided tape.
biofeedback monitor for IBM PCcompatible computers. The monitor's schematic is shown in Fig.1.
IC1 is a CMOS 555 timer which is
wired as a simple pulse generator.
The width of its output pulse is the
product of capacitance Cl, resistance R1, and the skin resistance
present between probes A and B.
Since Cl and R1 are constant, any
change in the pulse width is the
direct result of a change in the
resistance between the probes.
Now all we need to do is to trigger IC1 to force its output at pin 3
high and measure the periorl of time
until the output on pin 3 goes low
(ie, returns to ground).
nector, the INIT line, connects to
IC1 's trigger input, pin 2. Sending
out a short INIT pulse from the computer triggers IC1 and causes IC1 's
output, pin 3, to go high. Pin 3 goes
low at the end of the pulse (ie, when
Cl has charged to 2/3Vcc).
Pin 11 of PL1 is the computer's
BUSY line. If we have the computer
check for a low on pin 11, it will
know when IC1's pulse has ended.
The common ground between the
computer and the biofeedback
monitor is through PL1 pin 20.
Switch S1 applies power to the circuit from series-connected batteries B1 and B2. The batteries provide only 3 volts, so the output of
IC1 will also be about 3 volts peak
instead of the more usual 5 volts.
Although 3 volts is much less than 5
volts, it is high enough to be sensed
by the computer's printer port.
The software
The simplicity of the hardware is
made possible by the fact that the
software does most of the work in
creating a screen display of your
GSR. Let's look at some of the more
important aspects of the program,
called PCBIO (for PC Biofeerlback),
as shown in Listing 1.
Line 30 looks to see if a printer
port is installed and determines its
address. Line 50 uses that information to set the address for the trigger input (T) and output (G) to the
circuit. Line 190 begins the process
of initialisation.
Since each person's GSR is different, the program takes five in-
The printer port
It may seem strange but the computer's LPT1 parallel printer port is
the ideal way of interconnecting the
biofeedback monitor to the computer. The PC's printer port has a
number of input and output lines
that are normally used to do things
like initialise the printer and check
for a busy status.
In our circuit, a 25-pin (DB25
male) connector PL1 attaches to the
PC's printer port. Pin 16 of the con-
Fig.3: when you load the PCBIO program into your computer the opening
screen shows a thermometer-type display that ranges from calm to tense.
MAY1989
39
Fig.4: if you're tense, the indicator will move up the
display and the tone from the speaker will increase in
pitch.
itial samples and averages them to
determine a mid-range value [Y in
line 220). Line 220 also calculates
an increment value [INC) which is
used to determine the range from
full calm to full tense. Those range
values are stored in array L in line
230.
The actual monitoring process
begins in line 250. A call to the
subroutine at line 320 gets a sample
from the hardware as a count
stored in variable X. Lines 280 and
290 determine where the tenseness
indicator should be and places it
there. The monitoring session ends
when either full calm is reached (L
) 22 in line 280) or when you press
the ESC key during monitoring (C =
27 in line 260).
The subroutine at line 320 interfaces with the hardware. Line 330
generates a short negative-going
pulse to trigger IC1. Line 340 begins
counting the time by incrementing
variable X and checks to see if ICl 's
output has returned to zero [INP(G)
= 127). When it does, line 350
checks to see if another sample
should be taken [Z ( XF).
Variable XF is a scaling factor
used to ensure that the count
returned in variable X will always
be above 100 [lower counts make
the gauge displayed on the screen
respond too quickly, and are
distracting during the monitoring
session). The commands LOCATE
1,60:PRINT X;: in line 350 display
the actual count number just past
the title -on the screen display.
40
SILICON CHIP
Fig.5: the calmer you get, the lower the indicator's
position and the lower the tone from the speaker.
Construction
The circuit can be assembled on
a small piece of Vero board which is
installed, along with a battery
holder, in a small plastic utility
case. Simply pass the component
leads through the appropriate holes
in the Veroboard [see Fig.2) and
solder them to the copper strips.
An oversize drill can be used to
make the necessary cuts in the copper pattern.
Glue the battery holder into the
case as close as possible to one end.
If you'd like to secure the circuit
board, it too can be glued to the
PARTS LIST
1 plastic utility box, 83 x 54 x
28mm
1 piece of Veroboard
1 SPOT miniature toggle switch
1 D825 male plug
1 double-AA battery holder
1 battery snap connector
2 AA-size 1 . 5V batteries
1 7555 or TLC55 CMOS timer
IC (IC1)
1 1µ,F metallised polyester
capacitor
1 10kQ 1/4 W resistor
2 solder lugs
2 3mm x 6mm-long screws
plus nuts and washers
2 metres of 4-way telephone
cable
1 small cable tie
2 pieces of cooking foil, 4.5 x
2cm
case with a drop of silicon rubber
adhesive or Blue-tak.
The finger contacts are simply
two aluminium foil strips fixed to
the cover with double-sided tape.
These are then connected to the circuit via machine screws which pass
through the lid and the foil.
Cut two strips of ordinary
household aluminium foil to a size
measuring 4.5 x 2cm. Apply doublesided tape to the dull side· of the foil
strips then carefully affix them to
the lid of the case.
Now drill two 3mm-diameter
holes in the locations shown in
the photos. Place two 3mm x 6mmlong screws through the holes and
secure each one using a solder lug,
washer and nut. The probe leads
from the PC board can then be
soldered to the solder lugs.
We used a length of 4-wire (2
pair) phone ea ble to connect the circuit to the DB25 male connector. A
plastic cable tie was used to anchor the cable inside the case.
Testing the circuit
Before you hook the circuit to
your computer, it is a good idea to
test the circuit on the bench. The
easiest way to do this is to connect a jumper wire between pins 2
and 6 and a lOOkQ resistor across
the screw terminals for the finger
contacts. This allows the circuit to
operate as an oscillator instead of a
pulse generator.
If you have an oscilloscope you
can then check that the circuit is
oscillating. Connect the oscilloscope probe between pin 1 [OV)
and pin 7 and you should see a
sawtooth waveform.
Alternatively, if you don't have
access to an oscilloscope you can
use your multimeter to check the
circuit. Connect_ pins 2 and 6 as
before but omit the lOOkO resistor.
Then connect the multimeter, switched to a low DC voltage range, between the two finger contacts. With
the circuit running, the meter
should read half the supply voltage;
ie, about 1.5V for a 3V supply.
Having checked the circuit,
remove the connection between
pins 2 and 6 and then plug the DB25
connector into your computer's
printer port.
Using the monitor
Connect PLl to your computer's
parallel printer port, apply power
to the biofeedback monitor by closing S1, then load BASIC and the
PCBIO program into your computer.
When you run the program, the
computer will create the screen
shown in Fig.3. In the centre is the
tenseness gauge resembling a
thermometer.
The top of the gauge is maximum
tenseness, the bottom of the gauge
Fig.6: you will probably already have
most of the parts for this project in
your junkbox. Take care - it's easy
to make a mistake with Veroboard.
Fig. 7: the circuit is connected to the
computer's parallel printer port via a
DB25 male plug.
Listing 1
1 REM**
PC Biofeedback Monitor Program
2 REM**
NAME: PCBIO
3 REM**
c 1987, JJ Barbarello, Manalapan, NJ 07726
4 REM**
V870911
10 CLEAR:DEFINT G,X:G=O:X=O:DEFSTR A,B:A=CHR$(232):B=SPACE$(2)
20 COLOR 0,6,6:CLS:KEY OFF:WIDTH 80:DIM L(22)
30 DEF SEG=64 :PA=PEEK(8)+256*(PEEK(9))
40 IF PA=O THEN COLOR 7,0,0:CLS:GOTO 430
50 A=CHR$(232):B=SPACE$(2):G=PA+1 :L=13:T=PA+2:LOCATE 1,23,0
60 PRINT STRING$(5, 16);" P.C. BIOFEEDBACK MONITOR " ;STRING$(5, 17)
70 LOCATE 2,37:PRINT CHR$(201 );STRING$(5,205);CHR$(187)
80 FOR 1=3 TO 22:LOCATE I,37:PRINT CHR$(204);B;A;B;CHR$(185):NEXT
90 LOCATE 23,37:PRINT CHR$(200);STRING$(5,205);CHR$(188)
100 LOCATE 3,31 :PRINT "TENSE " ;CHR$(206)
110 LOCATE 13,29:PRINT "AVERAGE " ;CHR$(206)
120 LOCATE 22,32 :PRINT "CALM ";CHR$(206):PLAY "L64"
130 FOR 1=3 TO 22:LOCATE I,40:PRINT" " :P$="N"+STR$(60-I*2):PLAY
P$:NEXT I
140 FOR 1=22 TO 13 STEP -1 :LOCATE I,40:PRINT
A:P$="N"+STR$(60-I*2)
150 PLAY P$:LOCATE I,40:PRINT" ": NEXT l:LOCATE 13,40:PRINT A
160 LOCATE 24 ,22 ,1:PRINT "Press (ENTER) to begin, or (ESC) to end ... ";
170 AA=INPUT$(1):C=ASC(AA):IF C=27 THEN 400 ELSE IF C013 THEN
170
180 LOCATE 24,22,0:PRINT SPACE$(42);
190 LOCATE 24,34:PRINT "INITIALIZING ... "; :Y=0:PLAY"L64" :XF=1
200 GOSUB 320:IF X( 100 THEN XF=XF+ 1:PLAY "L64;N32":GOTO 200
210 FOR 1=1 TO 5:GOSUB 320:PLAY "L64 ;N34": Y=Y+X:NEXT I
220 Y=Y/5 :INC=Y/100:LOCATE 24 ,28:PRINT"Press (ESC) to End Trial.";
230 PLAY"L32" :LOW=Y-10*INC:FOR 1=3 TO
22:L(l)=LOW+(l-2)*INC:NEXT
240 REM** MONITORING
250 P$="N"+STR$(60-(L *2)):PLAY P$ :IF X=O THEN 360
260 AA=INKEY$:IF AA()<'" THEN C=ASC(AA):IF C=27 THEN 370
270 GOSUB 320
280 IF X)L(L) THEN LOCATE L,40:PRINT" " :L=L+1:IF L)22 THEN 370 ELSE
LOCATE L,40:PRINT A
290 IF X(L(L) THEN L=L-1 :IF L(3 THEN L=3 ELSE LOCATE L+1,40:PRINT
" ":LOCATE L,40:PRINT A
300 GOTO 250
310 REM** SAMPLING SUBROUTINE
320 X=O:Z=O
330 OUT T,O:OUT T,4
340 X=X+1:IF (INP(G) AND 128)=0 THEN 340
350 Z=Z+1 :IF Z(XF THEN 330 ELSE LOCATE 1,60:PRINT X;:RETURN
360 REM** TRIAL END
370 LOCATE 13,8,1
380 PRINT "TRIAL COMPLETED. Press (ENTER) to try again, or ( ESC) to
end ... " ;
390 AA=INPUT$(1 ):C=ASC(AA):IF C=13 THEN CLS:GOTO 50 ELSE IF C027
THEN 390
400 COLOR 7,0,0 :CLS:LOCATE 10,28 ,1:PRINT"MONITORING SESSION OVER"
410 LOCATE 13,1:END
420 REM** CAN'T FIND STANDARD PRINTER PORT
430 LOCATE 10,27,1:PRINT''PRINTER PORT 1 NOT
AVAILABLE" :PRINT:PRINT:END
MAY 1989
41
sure that the unit is working properly, you can begin actual
monitoring.
You should try to concentrate on
different images or thoughts and
note the results on the gauge. At
first it may seem that trying to calm
down actually increases tension.
That is normal because the untrained mind tends to race through many
different thoughts.
Through practice you will learn
how to focus on the images and
thoughts that actually decrease tension, disregarding everything else,
and use them to assist you in the
calming process.
Tweaking
Fig.8: the completed prototype. Notice how the leads to the foil strips connect
to the screws that pass through the lid of the case.
is maximum calm, and the centre of
the gauge is average. The message
on the bottom of the screen asks you
to press ENTER to begin monitoring,
or ESC to end the session.
The room you're in should be
comfortable (about 20°C). Sit in a
chair that provides good support
and place the biofeedback monitor
next to you on a table or stand that
can support your forearm. Make
sure your fingers are free of oil or
excess perspiration. Rest your
forearm on the stand in front of the
unit, place your first (index) finger
on one probe and your second
finger on the other probe.
It is very important that you do
not move your fingers or change the
pressure on the probes during the
monitoring session, as that will
change the resistance between the
probes and give a false reading.
Press the Enter key with your
free hand. The message on the bottom of the screen will change to
"INITIALISING" and you will hear a
series of beeps as the system
measures your initial level of
tenseness. After a short time, the
message on the bottom of the screen
42
SILICON CHIP
will change to ''Press C to End
Trial"; you are now monitoring
your changing level of tenseness.
That's indicated by the moving cursor in the middle of the gauge and a
beep with a changing tone.
As you become more tense, the
beep frequency will increase and
the indicator will ascend, as shown
in Fig.4. When you calm down, the
beep frequency decreases and the
indicator descends as shown in
Fig.5.
The session ends when you either
press the ESC key or reach maximum calm (nirvana?). The mes~age
"TRIAL COMPLETED. Press Enter to
try again, or Escape to end" will appear in the middle of the screen.
When you end the session, the
screen will clear except for the
message "MONITORING SESSION
OVER".
To test the unit, begin monitoring.
Press down hard with your two
fingers to simulate increased
perspiration (tenseness). The indicator should begin to rise.
Release the pressure and note that
the indicator begins to fall. Press
ESC to end the trial. When you are
The software monitoring subroutine is sensitive to the speed of
your computer. The program listing
contains the fact "IF X( 100" in line
200 to adjust it for use on a standard 4.77MHz computer. Computers operating at 8MHz or AT
systems will respond more quickly
and produce a higher count for the
same amount of time and thus seem
to be racing along.
To compensate for racing, simply
change the "100" in line 200 to a
higher number (try 300 as a starting value and adjust it until you are
comfortable with the speed).
Closing thoughts
The biofeedback monitor is
basically just a self-learning type of
device that also happens to be a lot
of fun. It is not meant to take the
place of any necessary medical
treatment or equipment. However,
with practice, the device can help
you learn how to reduce everyday
stress and tension. Sooner or later
you'll find that you do have the
ability to mentally calm and relax
yourself.
Another interesting point is that
GSR is one measure that is used by
polygraphs (lie-detectors) to determine whether or not someone is telling the truth. For that reason, the
device can also be used as a
rudimentary "lie detector" for
entertainment at parties and
gatherings.
And even if you don't put much
store in this device as a biofeedback monitor, we are sure that it
will be the basis for many interesting computer applications. ~
|