HIT RELOAD FOR LATEST VERSION
IT IS BEING REVISED CONSTANTLY
UNTIL IT IS COMPLETED


LOOKS LIKE A MESS

WORKS GREAT




Ok, I love a challange, and I love to build stuff. I rose to the bait of building a LED Heads Up Display LEDHUD because I had one in my long range plans anyway. If you have a brain in your head you will just buy one. This kind of project can result in your death. This unfortunatly is a blood sport in that people die. Electronics and water mix far too well and electronics is the loser. I am advising you to buy one, you will save a lot of time and be far safer. Having warned you not to follow, I have met my obligations to your family and friends who might miss you a lot.

Here are the design considerations that I worked within. I wanted to build a LEDHUD to act as an early warning signal of possible problems with my rebreather mix. I decided on using just two LEDs to perform this function and place them where they would always be in sight. The circuit flow is as follows:

Millivolt Output (nominal 10 mv in ambient air) from Sensor across a 10,000 resistor goes to
An Operational Amplifier OPAMP which amplifies it by about 21 times that goes to
A 12 bit 0 to 5 volt Analog to Digital ADC interface producing a number between 0 and 4000
That is requested by a basic stamp microcontroler that thinks about it and flashes LEDs to advise the diver

It was breadboard time. I selected a 324 quad op amp package because it could be expanded to handle up to 4 sensors....probably 3 sensors and a pressure sensor. It is powered as a single sided op amp meaning only one battery is necessary. (Many op amps require two batteries.)I chose to use a common 9 volt battery but any 6 to 15 volt package could be used.



This is how one of the sections is used to produce an amplified voltage. The sensor output is connected to the non inverting input. Make sure you use the right dropping resistor for your sensor. Mine was 10,000 ohms. The negative lead of the sensor goes to the common ground. You can use any of the sections of the opamp. R1 is 1000 ohms and R2 is 20 thousand ohms. 1 + (20/1) = a gain of 21. I used section 3 of the quad op amp because of spacing.

OP AMP PIN DESIGNATIONS

Pin 1SECTION 1 OUTPUTPin 8SECTION 3 OUTPUT
Pin 2SECTION 1 INVERTING INPin 9SECTION 3 INVERTING IN
Pin 3SECTION 1 NON INVERTING INPin 10SECTION 3 NON INVERTING IN
Pin 4+ POWER INPin 11GROUND
Pin 5SECTION 2 NON INVERTING INPin 12SECTION 4 NON INVERTING IN
Pin 6SECTION 2 INVERTING INPin 13SECTION 4 INVERTING IN
Pin 7SECTION 2 OUTPUTPin 14SECTION 4 OUTPUT


The thousand ohm resistor is from pin 9 to pin 11.
The 20 thousand ohm resistor is from pin 8 to 9.
The positive input from the sensor is on pin 10 and the negative is on pin 11 (ground).
Pin 8 is the amplified signal going out to the 1298 ADC.

My first test after assembly of the op amp was for linearity of output. The input was generated by the oxygen sensor simulator :



Looks great, you can see there is no problem of linearity with the op amp.



I selected a basic stamp 1C for the microprocessor. While there are lots of microprocessors out there as well as PICs, this is one of the easiest to use for a one off project. If I were going to build a bunch of these (and bore myself silly), I would just use a one time programmable PIC and burn it myself after I worked out the code and bugs using a stamp. That drops the size of the system considerably and the cost by about 20 bucks....but for one, its just not worth the additional time that I could be either diving, editing dive videos, writing web pages about diving, dreaming about diving, talking about diving, planning a dive trip, or building other diving stuff....ya get my drift.

Development time is much quicker that way. (In fact, from starting to plug parts into the breadboard and writing the code on the fly till I had the system working was less than four hours. )

Back to the project. I made my own programing cable for the basic stamp. It takes just three pins from the printer port. Pins 2, 11, & 25. I used a standard printer plug from my toy box (they are available from Radio Shack, soldered the wires into the plug and stuck the other ends in the breadboard. I made plug holders with some epoxy paste. If you have followed my other activities, you know I would not buy one, didn't you and you know I would find a use for some epoxy paste.

PIN LAYOUT FOR THE STAMP

Pin 1+ POWER INPin 8IO PORT 1
Pin 2GROUND (Programming cable pin 25)Pin 9IO PORT 2
Pin 3PCO (Programming cable pin 11)Pin 10IO PORT 3
Pin 4PCI (Programming cable pin 2)Pin 11IO PORT 4
Pin 5+ 5 VOLTS OUTPin 12IO PORT 5
Pin 6RESETPin 13IO PORT 6
Pin 7IO PORT 0Pin 14IO PORT 7

I plugged the stamp in the breadboard, plugged in the programming cable, put the power to the stamp and ran the debug program that came with the stamp software. It was alive on the first try.

The next active part is an Analog to Digital Converter. This is the guy that takes the voltage signal from the op amp, converts it into a digital number that the stamp needs, and gives it to the stamp upon request. I selected a LTC 1298 because the stamp folks used them in several example projects and the code was available.



PIN LAYOUT FOR THE LTC 1298

Pin 1CS Pin 5DIGITAL IN
Pin 2CHANNEL 0 Pin 6DIGITAL OUT
Pin 3CHANNEL 1 Pin 7CLOCK
Pin 4GROUND Pin 8+ 5V POWER IN & REFERENCE

I connected the stamp to the ADC, connected a 1000 ohm resistor across pins 5 & 6 of the ADC as instructed in the stamp manual, put in a 10 microfarad tantilum cap across the power to ground of the ADC, brought in the reference voltage from the stamp 5 volt output, and connected the ADC to the stamp. I ran the ltc1298 program and it worked. It read zero cause there was no input into the ADC. Now I connected the sensor simulator to the input pin of the ADC and numbers started flowing.

When I got the basic stamp up and running with the Analog Digital Converter, I again tested the linearity with the following results:



INTERSTAGE CONNECTIONS

OP AMPLTC 1298STAMPOFF BOARD
NONEPIN 1PIN 7NONE
PIN 8 OUTPUTPIN 2 CHANNEL 0 INPUTNONE NONE
PIN 11 GROUNDPIN 3 CHANNEL 1 GROUNDEDPIN 2 GROUND GROUND
PIN 11 GROUNDPIN 4 GROUNDPIN 2 GROUNDGROUND
NONEPIN 5 PIN 9*
NONEPIN 6 NONE*
NONEPIN 7PIN 8NONE
NONEPIN 8 5V REFERENCE INPIN 5 5V OUTLTC 1298 10MF CAP TO GROUND
PIN 9 INVERTING INPUTNONENONEOP AMP PIN 9 TIED TO PIN 8 BY 20 K RESISTOR TIED TO PIN 11 BY 1 K RESISTOR
PIN 4 + 9 VOLTS NONEPIN 1 + 9 VOLTSNONE
PIN 10 ANALOG INPUTNONENONEMV SENSOR OUTPUT

* CONNECT LTC PINS 5 & 6 WITH A 1,000 OHM RESISTOR

As my sensor produces about 10mv for ambient air the 80 mv in represents a PPO of 1.6. By now I was quite pleased with myself. I could generate a reliable number for any output of a sensor within the operational range. I put my attention to the code. I decided on 5 ranges.

PPO BELOW .18 .....SLOW RED FLASHES
PPO ABOVE .18 BUT BELOW .8 SLOW GREEN FLASHES
PPO ABOVE .8 BUT BELOW 1.2 LONG GREEN FLASH OFF SHORT TIME LONG GREEN FLASH
PPO ABOVE 1.2 BUT BELOW 1.6 QUICK GREEN FLASHES
PPO ABOVE 1.6 QUICK RED FLASHES

I use conditional branches in the code to goto a subroutine in the code defined by a label such as ANOXIA: .This is what the code looks like and the purpose of the subroutine. AD is the variable name for the number that the stamp got from the LTC 1298 ADC. The stamp goes line by line through the code. The stamp compares a preset number to AD and make a decision. For example in the first conditional branch, if the number is lower than 180 the program jumps to the label ANOXIA but if it is higher, it just goes to the next line and so on. This stuff is really fun.

CODESUBROUTINE FUNCTION
IF AD <180 THEN ANOXIAFlashes Red Led Slowly
IF AD <690 THEN SUCKINGFlashes Green Led Slowly
IF AD <1050 THEN CRUISINGFlashes Green Led Steady with short off
IF AD <1390 THEN RICHMIXFlashes Green Led Fast
GOTO QUIVERINGFlashes Red Led Fast
Here is how you connect a LED from a stamp.


And here is the code within a label that makes it work.
CODEFUNCTION
ANOXIA:Location called ANOXIA
high 6Turns on red LED
pause 1000Wait 1 second
low 6Turns off red LED
pause 1000Wait 1 second
GOTO ANOXIAStarts it again

That little snippet of code flashes the red LED in a slow flash signaling that the PPO is below .18.





Here are the parts and supplier lists.
Here is the basic stamp code.
Calibration, Multiple Sensors, Concepts, Theory, and Project Expansion

OBSERVATIONS



THE SYSTEM UPDATES ONCE EVERY TWO SECONDS

RAN FOR 72 HOURS ON ONE BATTERY!

Even though I used junkbox LEDs and under drove them, you can see them in bright daylight.

It is really neat to dial in a mv input and watch the pulse rate change.....
Cheers,
Tom

If you are having fun so far or read this drop me a line for suggestions or comments.

Click to e-mail me.




HOME, SCUBA DIVE TRIPS & STORIES, FREEDIVING AND SPEARFISHING, REBREATHERS, MAKING DIVE STUFF, ABOUT THE AUTHOR, REVIEWS & OPINIONS, LINKS, FREQUENTLY ASKED QUESTIONS