Introduction: Demonstration Autosampler
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
Sampling is an important aspect of almost any wetlab as they can be analyzed to provide important information for research, industry, etc. However the frequency of sampling can be tedious and require the frequent presence of someone to take said sample including weekends, holidays, etc. An autosampler can relieve such demand and eliminates the need for scheduling and maintaining a sampling schedule and the personnel to execute it. In this Instructable a demonstration autosampler was constructed as a simple system that can be easily constructed and operated. Please watch the linked video to glimpse an overview of the development of this project.
The following is a list of the materials used to construct this project, all of these components should be able to be found in stores or online with a quick search:
- 1 x 3-D printer
- 1 x Hot Glue Gun
- 3 x Screws
- 1 x Screwdriver
- 1 x Arduino Uno
- 1 x Breadboard
- 1 x USB to Arduino Cable
- 1 x 12V, 1A Barrel Plug External Power Supply
- 1 x 12V Peristaltic Pump w/Iduino Driver
- 1 x Nema 17 Stepper Motor w/EasyDriver
- 1 x Magnetic Reed Switch
- 2 x Buttons
- 1 x 25mL sample vial
- 1 x 1.5" x 1.5" styrofoam block, hollowed out
- Pin wires for connecting Arduino and breadboard
- CAD software (i.e. Fusion 360/AutoCAD)
Step 1: Fabricate Linear Rack and Pinion System
In order to raise and lower the vial to receive the sample, I utilized a linear rack and pinion system taken from Thingiverse (https://www.thingiverse.com/thing:3037464) with credit due to the author: MechEngineerMike. However any appropriately sized rack and pinion system should work. This particular rack and pinion system is mounted together with screws. While a servo is shown in the images, a stepper motor was used to provide the necessary torque.
Recommended Print Settings (for printing all pieces):
- Rafts: No
- Supports: No
- Resolution: .2mm
- Infill: 10%
- Depending on the quality of your 3-D printer sanding printed pieces of imperfections will make assembly smoother
Step 2: Fabricate Stand
To house the sensor block (discussed later on) and the tubing from the peristaltic pump to fill the vial with sample, a stand needs to be fabricated. As this is a demonstration model where changes would need to be made along the way, a modular approach was utilized. Each block was designed as male to female configuration with three pins/holes at their respective ends to allow for easy modification, assembly, and disassembly. The corner building block functioned as the base and top of the stand, while the other block served to lengthen the height of the stand. The scale of the system depends on size of the sample that is desired to be taken. 25mL vials were used for this particular system and the blocks were designed with the following dimensions:
- Block H x W X D: 1.5" x 1.5" x 0.5"
- Male/Female Pin Radius x Length: 0.125" x 0.25"
Step 3: Fabricate Sensor Blocks
To fill a vial with sample on command, a sensor-based approach was utilized. A magnetic reed switch is used to activate the peristaltic pump when the two magnetics are brought together. To do this when the vial is raised to receive the sample, blocks of the same dimensions and similar design of the ones used to fabricate the stand were designed but have four holes near each corner for pins (with the same radius as the male/female pins of the blocks and a length of 2" but with a slightly thicker head to prevent the block from sliding off) with another 0.3" diameter hole in the center for the tubing that will fill the vial. Two sensor blocks are stacked together with pins going through the corner holes of each block. The end of the pins are cemented in the corner holes of the top sensor block to stabilize the blocks, hot glue was used but most other adhesives should work as well. With each half of the switch adhered to the side of each block, when the vial is raised by the activated linear rack and pinion system to receive the sample, it will raise the bottom block to along the length of the pins to meet the top sensor block and connect the magnetic switches, activating the peristaltic pump. Note that it is important to design the pins and corner holes to have enough clearance to allow the bottom block to easily slide up and down the length of the pins (at least 1/8").
Step 4: Control: Create Arduino Code and Connections
Part A: Code Description
In order for the system to function as intended, a Arduino Uno board is used to carry out these desired functions. The four main components requiring control are: initiating the process which in this case were up and down buttons, the stepper motor to raise and lower the linear rack and pinion system holding the vial, the magnetic reed switch to activate when the sensor blocks are raised by the vial, and the peristaltic pump to turn on and fill the vial when the magnetic reed switch is activated. For the Arduino to carry out these desired actions for the system the proper code for each of those outlined functions needs to be uploaded into the Arduino. The code (commented to make it easy to follow) that was used in this system was composed of two primary parts: the main code, and the stepper motor class which is composed of a header (.h) and C++ (.cpp) and are attached as pdf files with their corresponding names. Theoretically this code can be copied and pasted but should be reviewed that there was no transfer error. The main code is what actually carries out most of the desired functions for this project and is outline in the below primary elements and should be able to be easily followed in the commented code:
- Include the class to operate the stepper motor
- Define all variables and their assigned pin locations on the Arduino
- Define all the interfacing components as inputs or outputs to the Arduino, enable the stepper motor
- An if statement that turns on the peristaltic pump if the reed switch is activated (this if statement is in all other if and while loops to ensure that we are constantly checking that if the pump should be turned on)
- Corresponding if statements that when the up or down is pressed to turn the stepper motor a certain number of times (using a while loop) in the corresponding direction
The stepper motor class is essentially a blueprint that conveniently allows programmers to control similar hardware with the same code; theoretically you can copy this and use it for different stepper motors instead of having to rewrite code every time! The header file or .h file contains all the definitions that are defined and used specifically for this class (like defining the variable in the main code). The C++ code or .cpp file is the actual working section of the class and specifically for the steppr motor.
Part B: Hardware Setup
As the Arduino only supplies 5V and the stepper motor and peristaltic pump require 12V an external power source is required and integrated with appropriate drivers for each. As setting up the connections between the breadboard, Arduino and functioning components can be intricate and tedious, a wiring diagram schematic has been attached to easily show the hardware setup of the system for easy replication.
Step 5: Assemble
With the parts printed, the hardware wired, and code set up it is time to bring everything together.
- Assemble the rack and pinion system with the arm of the stepper motor inserted into the slot of the gear meant for the servo motor (refer to the images in step 1).
- Attach the styrofoam block to the top of the rack (I used hot glue).
- Insert the vial into the hollowed out styrofoam block, (styrofoam provides insulation to combat degradation of your sample until you can retrieve it).
- Assemble the modular stand with the corner blocks for the base and top, add as many of the other blocks to get the appropriate height to correspond with the height that the rack and pinion system raises and lowers. Once a final configuration is set it is recommended to put adhesive in the female ends of the blocks and fir the male ends. This ensures a strong bong and will improve the integrity of the system.
- Attach the respective halves of the magnetic reed switches to each sensor block.
- Ensure that the sensor bottom sensor block freely moves along the length of the pins (i.e. that there is enough clearance in the holes).
- Assemble the Arduino and the appropriate wired connections, these are all housed in the black box in the image along with the stepper motor.
- Plug the USB cable into the Arduino and then into a 5V source.
- Plug the external power supply into a outlet (note to avoid possible shorting out your Arduino it is very important to do it in this order and ensure that the Arduino is not touching anything metal or having data uploaded to it when this is plugging in the external power supply).
- Double check EVERYTHING
Step 6: Sample!
Congratulations! You have created your very own demonstration autosampler! While this autosampler wouldn't be all that practical to use in a lab as is, a few modifications would make it so! Keep an eye out for an future instructable on upgrading your demonstration autosampler to be able to use in an actual lab! In the mean time feel free showcase your proud work and use it as you see fit (perhaps a fancy drink dispenser!)