Showing posts with label MFC. Show all posts
Showing posts with label MFC. Show all posts

Thursday, September 6, 2012

Fixing Bronkhorst MFC

One of our Bronkhorst MFCs burned out from a user error: a short circuit on the input voltage.  We were building an interface for talking to this MFC and had an inadvertent short.  After this point the MFC became totally dead (no LED lights).  We contacted Bronkhorst tech support, but repairing a broken MFC bascially costs the same as getting a new one.  However, tech support did help us locate a likely culprit for the malfunction.  Given that the problem was a short circuit, we expected that some component regulating voltage on the main board of the MFC was burned out.  There are two voltage regulators on board the MFC we have and using an Ohmmeter, we determined the burnt one.  Here is the fix:

MFC Model: IQF-200C-AAD-00-V-A
Problem: Power surge due to short circuit
Damaged Component: Linear Technology LT1933, 600 mA, 500kHz Step-Down Switching Regulator
3.3V step down converter/regulator.  This IC chip takes in a wide input voltage 3.6-36V and converts it to a regulated 3.3V output for powering the onboard controller of the MFC.  This controller is the brains of the MFC.
Solution: Replace damaged component (Newark part number: 61M3374).

Here is where this chip lives on the MFC main board:

Saturday, May 12, 2012

Open-Source Arduino-Based Olfactometer Shields

We just put together a set of shields to allow Arduino-based olfactometer control.  I am including the linked schematics here.  To make these shields, we are using a program called ExpressPCB, which is linked to a printing service.  I will not go through the details of what component goes where on the PCB, but I assume anyone with some electronics know-how should be able to figure them out.

ArduinoShieldBasic.pcb - Template we use for designing shields for Arduino Mega

rs232shield2.pcb - A module we use to communicate with Alicat MFCs

This module converts from Arduino's TTL serial to RS232 serial.  It also has a pwm signal filter and unity gain to allow analog output from two channels on the Arduino for control using an analog voltage.

valvedriver3.pcb - The valve-driver module for controlling odor valves

The module has optocouplers to switch solenoids on or off and status LEDs to view valve state.

valvedriverSMT.pcb - Another valve driver module with ribbon cable breakout (below)
ValveBreakout.pcb - the breakout with indicator LEDs


Valve - breakout












Valve - driver

Friday, April 6, 2012

Human Olfactometer in Action

Today was a day of putting the new Alicat MFC powered human olfactometer through its paces.

We tested:

1. Onset Latency (NResearch final valve)
2. Concentration steps via flow dilution (Alicat MFC)
3. Concentration waveforms (Alicat MFC)
4. Odor sampling by human subject (YBS)

Here are pictures of our setup:

Olfactometer Test Setup 1: Kinetics.  The PID (photoionization detector) is sampling directly from  the nose port.  The scope is displaying PID output and flow from the flow sensor (below).  Scope is being triggered on final valve onset.
Closeup of nose port (Nasal Ranger) connected to our teflon odor injector (right top) and then Honeywell flow meter at exhaust (bottom).  Here the PID is sampling from the exhaust.

Monday, March 19, 2012

MFC Control Complete

Today I finished implementing control over my mass flow controllers from Alicat.  I now have the capacity to drive two MFCs via analog voltage or serial from our custom Arduino shield.  Everything works directly from MATLAB.

This is our Arduino-based olfactometer control module connected to two Alicat MFCs.
The output works at high frequencies with the MFCs being able to follow up to 3 Hz well.  I doubt that this performance will be maintained with long downstream tubing, but I hope to be able to do at least 1 Hz at output.

I had to work out a kink to get switching between serial and analog control to work.  The Alicat documentation says that A$$W20=16384 should enable analog set point. However, I found that this does not work.  Reading register 20 after setting analog set point from the front panel, however, showed that the correct value is actually 17408.

The Arduino will start by default in analog control mode. To switch modes:

[mode] = {0: SERIAL_OUT, 1: ANALOG_OUT}
olf.funcALIMode([mode]);

I tested the whole setup using my handy dandy flowmeter and things work very well so far.  Here is the code I used for my current test setup:


olf = OlfactometerDriver_SerialInterface('COM10'); pause(12);


% proportional control var
olf.funcALIMessage('A$$W21=500')
% differential control var
olf.funcALIMessage('A$$W22=10')


olf.funcALISin(1,1,0.5);
olf.funcALISin(0,1,0.5);


Next step: connect the MFCs to the olfactometer, determine the right parameters for sinusoids, and verify output via PID.


Friday, March 16, 2012

Alicat Control Registers: 21, 22, & 23

So I got a reply back from Alicat about what those control registers mean.  Turns out the documentation is spotty for a reason, the algorithm they use to control the valve is proprietary so they cannot reveal the details.  However, they could describe things roughly by an analogy:

"Address 21 (or the P value) can be considered as the gas pedal in a car, the harder you push it (raise its value) the faster the valve will operate. 

Address 22 (the D value) can be considered the brakes, the more the brakes are applied (raise its value) the faster the valve will stop at its set point. 

Finding a balance between these two values is crucial when trying to achieve an optimal response and accuracy from the valve. 

Address 23 ( the integral value) is a bit undefined…and rarely used.  It’s a value completely unique to the valve on the device, I guess to keep the analogy alive you can say that the I value is like the gear ratios within a gear box. The farther spread out the ratios are, (the larger the I value) the overall stability is increased, but the acceleration suffers. Conversely, the closer together the ratios become (the smaller the I value) acceleration is increased but overshoot and instability can become a major issue. 

Keep in mind that too high a value in any of these categories can and will cause overshoot/undershoot/oscillation, so when tuning start at a base number, write those base values down and increase and decrease in small increments."

I guess I will just play with the settings to get the performance that I need!  Thanks Alicat!

Thursday, March 15, 2012

Speedy MFC!

So it turns out there was a setting on the device that adjusts the speed with which the MFC operates.  Here I demo both the nice speed of the MFC and how it follows a 2 Hz sinusoid put out by my Arduino.

In order to do this, I had to change the "Proportional Control Variable" from the default value 100 to 500.  The documentation is not clear on what this variable is, but changing it sure does speed things up.  Here's how I did it all from MATLAB:

>> ret = olf.funcALIMessage('A $$W21=500'),

ret = 

    funcName: 'funcALIMessage'
         str: 'A   021 = 00500
                                                '


ret = olf.funcALISin(2,1,0.5),

ret = 

    funcName: 'funcALISin'
       state: 0



 And here's the flow output:


Alicat Response Times

I started measuring the performance of Alicat MFCs.  To do this, I set up an independent mass flow sensor at the output and connected it to an oscilloscope.  Alicat posted a rather impressive video on their website:

http://www.alicatscientific.com/documents/movies/alicat_response_time.avi

However, my performance so far is far less impressive:



And here's the video:


My Awesome Test Setup

Here's a picture of my setup.  On top of the Arduino is our custom valve driver shield.  Attached to the shield DB9 port is my hastily soldered inverter.  That connects to the Alicat MFC.  The Arduino is also connected to the PC by its USB port.

PC (MATLAB) --> Arduino --> MFC


Below is what interacting with the MFC looks like from MATLAB.


Outputting Functions to MFC

One of the thing I want to be able to do is to output arbitrary odor waveforms with my MFCs.  As a start, I implemented a Sin function to be output to the MFC (i.e. changing the flow rate at some set frequency).  I am hoping to put my MFCs into the setup to verify that they are working properly.

What I did was put a function that gets called on each loop of the Arduino which updates the flow rate at 100 msec intervals.

void loop()                     
{
  ...
  ALI.makeSin(); // ALI is my AlicatMFC object
}


void AlicatMFC::makeSin()

{
  float flow;
  unsigned int uiflow, flow_out;
  
  if (!_on) return;
  if ((millis()-_tL)<100) return;
  
  _tL = millis();
  
  flow = _mean + _ampl / 2.0 * sin( (float) (_tL - _t0) * 2.0 * 3.1415926536 * _freq / 1000.0 );


  if (flow > 1.0) flow = 1.0;
  if (flow < 0.0) flow = 0.0;
  
  uiflow = (unsigned int) ((float) ALI_MULTIPLIER * flow);
  
  setFlow('A',uiflow,&flow_out);  
}



Wednesday, March 14, 2012

Just resolved sending also and I got my first serial port comm between Arduino and the MFC.  In the end, I simply inverted both the transmit and receive signals.

In the light of the morning

In the light of the morning, answers come:
http://www.sparkfun.com/tutorials/215

It looks like the MFC is using an RS232 standard but the Arduino is using TTL serial standard.  These two protocols differ in two main ways:

1. TTL is high for 1 and low for 0, whereas RS232 is the opposite
2. The voltages on TTL and RS232 can be wildly different

However, I happen to know that the voltages one the two devices are ok, so for me its just a matter of inverting the signal.  I can in principle just get a signal inverter, however, I will also order a RS232 to Serial converter:

RS232 Shifter SMD
http://www.sparkfun.com/products/449

Update, I added a simple voltage inverter circuit in front of the receive on the Arduino and MAGIC, it now reads the signals from the MFC just fine!  Now all that is left is sending...

Tuesday, March 13, 2012

RS 232 Voltages

I managed to get some serial input from the MFC to the Arduino, however, the input was garbled!  One cause of this could be that the RS 232 voltage levels sent by the Alicat MFCs are inappropriate for the Arduino to handle directly.  I will call tech support tomorrow to determine their exact specs to see if all could be fixed with a simple resistor or if I will need some more serious circuitry.

However, I measured the output signal on my oscilloscope and I see that it indeed is 0-5V, which should be fine as far as the Arduino is concerned.  Strange behavior.

Setting Up Serial Comm with MFC via Arduino

I am now working on linking our Arduino to the Alicat MFCs.  I am connecting Serial port 3 on the arduino to the Alicat via a DB9 on our custom made Arduino shield.  As far as the software goes, I am first just forwarding strings sent to the Arduino from MATLAB on the PC to the Alicat and strings sent from the Alicat back to MATLAB.

One of the things I want to be able to do is to produce different odor concentration waveforms by manipulating the MFCs.  For example sine curves.

To do this more interesting and faster control, I will implement direct functions in the Arduino that will manipulate the MFC flow rate in real time.

Monday, March 12, 2012

MFC Online

First successful communication with the Alicat MFC. The device takes a line feed and new line as command terminators.

The device returns data as strings, however, so I will need to write a parser on the Arduino side.

Never Trust a Cable Just Because It Has The Right Connectors

I got some DB9 to mini DIN cables to connect to my Alicat MFC and... no luck.  After 1/2 hour of making sure I connected to the right PC serial port, I realized that the cables I got were designed for some other use.  They connected the wrong pins (only 3) from the DB9 to the DIN.  However, lucky for me, the DB9 connector on the cable was easily open-able and the cable had all the strands I needed!

The necessary connector layout is as follows:

DB9 --------------> 8 Pin Mini-DIN
5 ----- Ground ---- 8                                                             
3 ------ TX ------- 3
2 ------ RX ------- 5