Skip to content

3D-Printing-for-Microfluidics/valve-control

 
 

Repository files navigation

valve-control

Use Arduino Uno to control solenoid valves.
Follow the steps below to set up your own valve control station.

Purchase

Solenoid Valves

Details can be found on page 215-221 in Clippard Full-line Catalog

Send PCB design Out For Manufacturing

  • Highly recommend JLCPCB. Fabrication and shipping took ~1 week for me in the U.S.
  • If you choose JLCPCB, go here, upload plots.zip, and leave everything else as default.
  • If you have access to a PCB baking oven, buying a SMT-Stencil will save you a lot of time for soldering. If not, all the components can still be soldered by hand.
Top Layer Bottom Layer

Electrical Components To Buy

Part Label on PCB Qty. (per PCB) Purchase
Shift register, SN74HC595N plug on the DIP socket (U1) 1 link
Optoisolator, HCPL 2731 plug on the DIP sockets (U2-U5) 4 link
Resistor, 2.32 kΩ, package 0805 R1-R16 16 link
Common anode diode D1-D4 4 link
PMOS Q1-Q8 8 link
1 uF capacitor, package 0805, voltage rating 10V C1 1 link
DIP socket, 2x8 U1 1 link
DIP socket, 2x4 U2-U5 4 link
Stacking headers J2-J4, H1, H2 1 link
Connector, Molex 50212-8000 N/A 18 link
Connector housing, Molex 0873690200 N/A 9 link
JST header, Molex 0894010210 J5-J13 9 link
2.5 mm barrel jack, 5A max, CUI PJ-057BH J1 1 for each setup link

Download

Download zip and extract all files.

Prepare Software

Flash Arduino Uno

  • Connect an Arduino Uno to computer via USB
  • Download and Install Arduino IDE
  • Open arduino_valve_control.ino in arduino_valve_control folder with Arduino IDE
  • Select USB port: Tools > Port
  • Click Upload (the right arrow at the top left corner)
  • Wait for uploading to complete

Python

  • Download and Install Python 3.6
    • The Python distribution, Anaconda is recommended, because it comes with pre-installed packages.
    • Note: On Windows, the directory of installed Python must be added to environment variable.
  • Install Python dependencies
    • Windows: double click platforms/windows/setup.bat
    • MacOSX: $ bash <path to>/platforms/macosx/setup.sh

Soldering

(ADD photos of top and bottom layer after soldering)

Solder all the components according to the table above. The surface mount components are soldered to the bottom layer, while the rest are mounted on the top layer.

Stacking Headers

In the table above, the stacking headers contains the following headers.

Stacking Header Label on PCB Qty.
1 x 10 cut out a 1x2 for J4 1
1 x 8 H1, H2 2
1 x 6 2
2 x 3 J2+J3 1

H3 - 5V and GND

Because the JST headers at J11 and J12 block H3 on the top layer, I would do the following:

  1. Cut a 1x2 stacking header out of an unused one
  2. Solder it on H3 from the bottom layer
  3. Cut off the female portion on the top layer
  4. Put more solder from the top layer

Barrel Jack

Each setup only needs one barrel jack to connect to a 12 V power supply. The barrel jack can be soldered on any one of the boards.

Assembly

Shift Register and Optoisolators

(The images shown below are all taken for the previous PCB design, which is marginally different from the current design.)

After soldering, plug the shift register and optoisolators into their corresponding DIP sockets. Refer to the following image for their orientation.

image

Stacking PCBs

For the impatient

  1. Bend or remove the data pins on all boards except Board 1. See the left image below.
  2. Make a connector for serial input and serial output. See the right image below.
  3. Stack the PCBs and plug in the connector just made.
Data Pin Serial Input/Output

Details

In the images above, there are 4 boards stacked on an Arduino Uno.
Each board provides 8 solenoid valve connectors, and the current design supports up to 6 boards.
Before putting the boards together, the data pins on all boards except Board 1 must be bent or removed. This is because the data pin connects to the serial input of shift register. On Board 1, the shift register receives data from the Arduino directly. For the Board 2-n, their shift registers must have its serial input connected to the serial output of board right beneath it.

Using the Device

Installing the Application

  • Electron Version

  • Python Version

    1. Open the "platforms" folder.
    2. Open the folder corresponding to your platform.
    3. Run the setup script.

Starting the Application

  1. Run the application
    • Electron version
      • Run the "Valve Control" app.
    • Python version
      • Run the "run" script in the platforms folder.
      • OR
      • Run run.py in the root folder
  2. Select the correct serial device.
    • A grid of gray numbered buttons should appear. This indicates the device is ready for use.

Manual Mode

  1. Click the numbered buttons to toggle valves on and off.

Pre-programmed Mode

  1. Select "Built-in Program" at the bottom of the screen.
  2. Click the "Load" button.
  3. Fill in the desired values in popup window.
  4. Enter the number of cycles you wish to run in the "Cycles" field.
  5. Enter the number of ms you want between phases in the "Phase interval" field. (See the Writing a Program section for more information)
  6. Click "Run"
  7. If needed the program can be stopped with the "Stop" button

Self-programmed Mode

  1. Select "..." to the right of the "Program" field.
  2. Navigate to the desired program in the "Open File" dialog.
  3. Enter the number of cycles you wish to run in the "Cycles" field.
  4. Enter the number of ms you want between phases in the "Phase interval" field. (See the Writing a Program section for more information)
  5. Click "Run"
  6. If needed the program can be stopped with the "Stop" button

Writing a Program

  1. Create a .txt file.
  2. Create 3 section headers in the file: BEFORE, CYCLE, and AFTER.
    • The BEFORE section describes the inital state of the valves (this section is optional).
    • The CYCLE section is the section that is repeated during operation.
    • The AFTER section is the final states of the valves (this section is optional).
  3. In each section, specify the desired states of the valves.
    • There are 2 states: ON and OFF.
    • One or more valves can be set in a single line (eg. ON 1) (eg. OFF 1 2 3)
  4. On each line in the section describe a single phase.
    • Each line should begin with a tab.
    • Each line/phase is seperated by a timed delay called the "Phase interval".
  5. Between each section leave an empty line.
  6. You should now have a program that looks similar to the program below
    BEFORE
        ON 3
        ON 2
        ON 1
    
    CYCLE
        OFF 1 2
        ON 1
        OFF 3
        ON 2
        ON 3
    
    AFTER
        ON 3
  1. If it follows this format, it should be a funtioning program.
  2. Save the file and run it using the "Self-Programmed Mode" instructions.

About

Use Arduino Uno to control solenoid valves

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 74.8%
  • C++ 21.0%
  • C 3.1%
  • Other 1.1%