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.


7 comments:

  1. Thank you for posting your work connecting the arduino to the Alicat MFC. I am attempting the same right now. I see you shared some code on the arduino.cc forums, have you updated your comm snippets and library since your last post? I've not been able to successfully send to the Alicat. Thanks so much!

    ReplyDelete
  2. Hey, I'm happy to help you out. What specific problem are you having? My first question is if you are converting TTL to RS232 properly.

    ReplyDelete
  3. Thank you for offering to help! Yes, I have a shield to convert TTL to RS485 (our Alicats use the 485). It seems to be connected properly; my problem is with the software/programming. I don't understand how to send a basic command to the MFC. I am "Serial.write"-ing numbers, but the MFC does not see it. I cannot find documentation to form a proper command string.

    ReplyDelete
  4. Maybe this would be better over e-mail: ysirotin@gmail.com

    ReplyDelete
  5. Thank you again for your help Yevgeniy. My interface is now functioning. For the benefit of others, here is my Arduino code to command a full-range setpoint to the Alicat MFC over RS485:

    Serial.print("A");
    Serial.println("64000");

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. I am a new user of Alicat and have a problem on realising the communication between MFC and arduino. The physical connection is as following: Arduino->Arduino RS232 shield->RS232 DB9 connector->Alicat MFC.
    Beforehand the Arduino did communicate with Alicat ---unit ID can be changed with the following code:
    -------------------------------------------------------------------------------------------------------------

    void setup() {
    // put your setup code here, to run once:
    Serial.begin(19200);
    Serial3.begin(19200);
    Serial3.write("\r");
    Serial3.write("\r");
    Serial3.write("\r");
    Serial3.write("*@=Q");
    Serial3.write("\r");
    // Serial3.write("*w91=1000");
    // Serial3.write("\r");
    // Serial3.write("*@=@");
    // Serial3.write("\r");

    }


    void loop() {
    }
    --------------------------------------------------------------------------------------------------------


    Later, someone borrowed it from me and returned to me. Again, I tried the same thing with the whole setting but with the new RS232 DB9 connector replaced, the communication fails.

    I am wondering if this failure is to do with some settings of alicat itself related to RS232 communication.
    I really need your wise suggestion on this. Thank you in advance.

    ReplyDelete