Oxygen partial pressure using LuminOx sensor

Post details of your projects here.
Post Reply
jwillis172
Posts: 2
Joined: Wed Nov 12, 2014 8:20 pm

Oxygen partial pressure using LuminOx sensor

Post by jwillis172 »

Purpose: Develop the ability to monitor oxygen partial pressure in a sealed container in order to monitor an anaerobic process.
Components: SuperPro and LuminOx 2 oxygen sensor http://sstsensing.com/application-note- ... nox-sensor

The LuminOx 2 oxygen sensor has an on-board ARM processor and communicates via a 3.3 volt UART and serial port. It is plug-in compatible with the SuperPro.
sensor schematic.jpg
sensor schematic.jpg (36.63 KiB) Viewed 8053 times
The LuminOx sensor was mounted on a RadioShack perf board which was mounted on stand-offs to the lid of a Mason jar. An M12 connector was used as a vacuum tight feedthru.
IMG_1160 (800x616).jpg
IMG_1160 (800x616).jpg (285.29 KiB) Viewed 8065 times
Qualification of the apparatus proceeded by heating the Mason jar in an oven to about 220 F and then quickly sealing the jar. The partial pressure inside the jar then decreases as the air inside cools down.
pump down.jpg
pump down.jpg (67.87 KiB) Viewed 8065 times
The LuminOx sensor responds to a handful of text commands to either stream the data from periodic measurements or respond with a single measurement. The LuminOx sensor first responds to a command with an acknowledgment. The following program initializes the sensor and periodically requests a reading.

Code: Select all

char* banner1 = "//////////////////////////////////////////////////////////\n";
char* banner2 = "//                                                      //\n";
char* banner3 = "// code to read LuminOx sensor and transmit to console  //\n";
char* banner4 = "// Jim Willis September 12, 2014                        //\n";
char* banner5 = "//                                                      //\n";
char* banner6 = "//////////////////////////////////////////////////////////\n";


#include "coridium_pcb.h"	// this one is required and configures for the proper CPU

#include "string.h"
#include "printf.h"
#include "uart.h"
#include "breakpoint.h"
#include "systick.h"

#define TIME_BETWEEN_READINGS	60*1000/65	// 60 seconds in multiples of 65 milliseconds

// commands

char* offMode = "M 2\r\n";
char* pollMode = "M 1\r\n";
char* requestAll = "A\r\n";

// booleans
int haveResponse = FALSE;
int echoToConsole = TRUE;

void
waitForResponse()
{
	// add time out
	while (!haveResponse) 
	{
			checkForInputFromSensor();							// wait - needs timeout
	}
}

void
sendCommand(char *inputPtr, int wait)
{
	char* ptr = inputPtr;

	while(*ptr!=NULL)
	{
		// putc(*ptr, 0); // echo to console
		putc(*ptr, 1); // send to sensor
		++ptr;
	}
	if (wait)
	{
		haveResponse = FALSE;	// to handshake the response
		waitForResponse();
	}	
}

void
checkForInputFromSensor()
{
	int charIn;
	// getc() will return a single character (0-255) if one is available in the input buffer.
	// If no character is available then -1 is returned.
	charIn = getc(1);				// check the sensor receive buffer
	if(charIn != (-1) )				// if the sensor receive buffer is not empty
	{
		if (echoToConsole == TRUE) 	// if echoToConsole is TRUE then
			putc(charIn, 0);		// send it to the console port
		
		if (charIn == '\n')			// check for response terminator
		{
			haveResponse = TRUE;
		}
	}
}

void
checkForInputFromConsole()
{
	int charIn;
	
	charIn=getc(0);					// check the console receive buffer
	if(charIn != (-1))				// if there is a character waiting
	{
		putc(charIn, 1);			// send it to UART1 -- the sensor port
	}		
}

void
sysInit()
{
	SystemInit();					// initializes clocks
	UART_init(0,19200); 			// turns on UART0 which is the USB serial connection
	UART_init(1,9600);				// turns on UART1 which is the sensor serial connection
	systick_init();     			// sets up SysTick as the TIMER 1usec tick
}
void
displayBanner()
{
	puts(banner1);
	puts(banner2);
	puts(banner3);
	puts(banner4);
	puts(banner5);
	puts(banner6);
}

int main(void)
{
	unsigned int startTime, numberOfReadings = 0;
	sysInit();
	
	startTime = ms65_count;

	displayBanner();
	
	puts("turn on poll mode - wait for response\n");	
	sendCommand(pollMode, TRUE); 							// send command, wait for response

	puts("requestAll - wait for response\n");	
	printf("%u ", numberOfReadings++);	
	sendCommand(requestAll, TRUE); 							// send command, wait for response

	// puts("turn sensor off - don't wait for response\n");
	// sendCommand(offMode, FALSE);							// send command, don't wait for response

	while (1) 
	{
		checkForInputFromConsole();
				
		checkForInputFromSensor();
			
		if (ms65_count-startTime >= TIME_BETWEEN_READINGS)
		{	
				startTime = ms65_count;
				sendCommand(pollMode, TRUE);	
				
				echoToConsole = TRUE;						// show on console
				printf("%u ", numberOfReadings++);
				sendCommand(requestAll, TRUE); 				// send command, wait for response
				echoToConsole = FALSE;						// stop showing on console
				
				// sendCommand(offMode, FALSE);				// send command, don't wait for response
		}
	}
	return 0;
}
I use termite http://sur.ly/o/compuphase.com/software ... m/AA001290 to log the data. Here is a sample from the termite log file...

**********************************************************
Termite log, started at Mon Nov 10 17:42:22 2014

**********************************************************

17:42:21
requestAll - wait for response

O 0186.1 T +19.3 P 0912 % 020.40 e 0000
O 0186.1 T +19.3 P 0912 % 020.41 e 0000
O 0186.1 T +19.3 P 0912 % 020.41 e 0000
O 0186.1 T +19.3 P 0913 % 020.39 e 0000
...

Interpreted, partial pressure O2 is 186.1 mBar, temperature is 19.3 C, pressure is 913 mBar, O2 is 20.4 %.





More to follow...
Last edited by jwillis172 on Thu Nov 13, 2014 5:18 pm, edited 3 times in total.



AMDlloydsp
Posts: 99
Joined: Mon Apr 15, 2013 3:51 pm
Location: NE Central FL

Re: Oxygen partial pressure using LuminOx sensor

Post by AMDlloydsp »

I always thought the term "partial pressure" meant the portion of pressure that one gas contributes to the total pressure of a mixture.

'Looks to me like the partial pressure of O2 would remain pretty much constant, which makes sense, since you're rarifying all the gasses, not only the O2.

Unless I'm mistaken, "partial pressure" refers to the relative pressure of one gas compared to the ambient pressure in that atmosphere. Unless O2 has some odd characteristics vs. other 'ideal' gasses, I wouldn't suppose its partial pressure would decrease any faster than its percentage of the mixture.

In other words, if O2 is (say) 20% of a mixture of gasses, and its partial pressure is "X/(the whole mass of gas's pressure)", then shouldn't it remain constant regardless of absolute pressure, so long as it's percentage of the mixture does not change?

Not telling, learning... Tell me, please.

LLoyd

jwillis172
Posts: 2
Joined: Wed Nov 12, 2014 8:20 pm

Re: Oxygen partial pressure using LuminOx sensor

Post by jwillis172 »

Hi LLoyd,

NP. Let's say the barometric pressure is 1000 mBar and O2 is 20%.Then the partial pressure of O2 would be 200 mBar (1000 mBar times 20%.)

Now decrease the barometric pressure to 750 mBar (about the cabin pressure in an unpressurized airplane at 7500 feet MSL) then the paritial pressure of O2 would be 150 mBar (750 mBar times 20%).

Does this make sense?

Best regards,

Jim

AMDlloydsp
Posts: 99
Joined: Mon Apr 15, 2013 3:51 pm
Location: NE Central FL

Re: Oxygen partial pressure using LuminOx sensor

Post by AMDlloydsp »

ahhh... "partial pressure" doesn't mean "the part of the pressure"... that 'part' is still controlled by the percent of the gas in the mixture.

Partial pressure is an absolute number, not a percentage of the whole. Got it! Thanks!

Lloyd

Post Reply