This is the read_me document for the 2nd option for the miniature trapping rigs (turn on word wrap to read normally) This document will go through and give a short explanation for each file as well as a list of the small changes that will need to be made for your use. Lastly this document will explain how to modify the code in order to run two of the rigs on the same pi at once(option 2.1). ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1: The Files of Option 2.0 a. main.py-------------------------------------------------------------------------------------------------------------------------- This is the main file to run, inside of main.py are calls to bothe test_insert.py and electromagnet.py.It is very important that all database info, formatting, and naming is uniform across main.py, test_insert.py and the SQlite database or else it will not work. This file calls the electromagnet file and runs it for the number of tests specified. Then the returned data is sent through to the test_insert file. At the beginning of the file it asks for a Rig Id number, this is to keep track of tests accross multiple systems if multiple systems are in use. The default number is A1 but feel free to change it. Parameter type is the overarching parameter that you are testing/researching such as laser power, or different materials/particles, or lens focal lengths. test_nameA is the exact parameter that this run will be testing. b. electromagnet.py----------------------------------------------------------------------------------------------------------------- This file controls the electromagnent by changing the duty cycle sent to the electromagnent. this file also interfaces with the camera by instructing the camera when to search for a trapped particle and recieving the trap detection results from the camera. This file using multi-threading which to allow for OPTION 2.1 but can still be used to control a single system. At line 121 you will find the Pin configuation for the pins being used, these can be adjusted as you see fit Line 108 contains a short pause that can be lengthened or shortened as desired, we have found 1.5 to be optimal. c. test_insert.py------------------------------------------------------------------------------------------------------------------- This file recieves the data from main.py, and after opening the database inputs each entry into the specified table. "TABLE_NAME" on line 32 should be replaced with the name of your table in the database On line 40 replace the sample file path with your database's actual path d. camera_controller.py------------------------------------------------------------------------------------------------------------ This file must be saved onto the camera as main.py (not to be confused with the main.py above) This file controls the camera and interfaces with electromagnet.py to detect whether or not a particle is trapped. The detection program works by searching within a set box for Blobs of light within a certain threshhold, if nothing is found the box expands until a certain point where it is deemed unlikely that a trap is present, and if a trap is found the box narrows in on the trap. The acceptable brightness range as well as acceptable blob count might need to be changed depending on the test you are doing. This camera system is not perfect but functions best when placed in an area with little to no ambient light or glare. Lines 209-212 describe the orginal size and placement of the searching box. These variable can be changed if needed Lines 215 and 216 declare the minimum and maximum brightness values, these values will mostly likely need to change depending on the tests performed and the enviroment of each test. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2. OPTION 2.1 option 2.1 is the ability to run two seperate rigs and tests at the same time off of the same Raspberry pi. For Option 2.1 everything is doubled setup wise except the files on the pi. Throughout main.py and electromagnet.py there are line/sections of commentented-out code that begin with "#(OPTION 2.1)" these comments must be uncommented and the "(OPTION 2.1) must be removed. In addition several of these line follow after lines with "(OPTION 2.0)" at the end. Take for example main.py lines 6 and 7, line 7 must be uncommented and line 6 must be commentented out. Here is complete list of lines that must be changed of Option 2.1 main.py: lines 6-7, 10, 12-13, 26-35, 38, 40, 42-43 electromagnet.py: lines 124, 178-179, 183-183