Today, we mainly work on the programming part of the microplate readers. Previously, we have finished the programing for "M" code which is the movement of the motor to a specific spot, and the "L" code for lighting up and turning off of the LEDs. Today we have finished the "A" and "S" code. For the "A" code, the function is to light up specific LED or many LEDs at a time for a specific period of time. The "S" code's function is to perform a shaking movement.
String ledString = ""; String auxString = ""; int auxDuration = 0; int brightInt = 0; long brightValue = 0; long expTime = 0; int pumpNumb = 0; int pumpDur = 0; String totalString = "";
void setup() { Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for native USB } pinMode(3, OUTPUT); pinMode(4, OUTPUT); }
void loop() { if (Serial.available() > 0) { protocolString = Serial.readString(); Serial.println(protocolString); for (int i = 0; i <= protocolString.length(); i++){ // Analyze command string one character at a time parsedString = protocolString.substring(i,i+1); if (parsedString == ";"){ if (protocolString.substring(startIndex, startIndex+1) == "L"){ totalString = protocolString.substring(startIndex,i); Serial.println(totalString.length()); if (totalString.length() <= 2){ ledString = protocolString.substring(startIndex+1,i); if (ledString == "1"){ digitalWrite(3, !digitalRead(3)); } else if (ledString == "2"){ digitalWrite(4, !digitalRead(4)); } else if (ledString == "3"){ digitalWrite(5, !digitalRead(5)); } } } if (protocolString.substring(startIndex, startIndex+1) == "A"){ totalString = protocolString.substring(startIndex,i); auxString = protocolString.substring(startIndex+1,startIndex+2); auxDuration = (protocolString.substring(startIndex+2,i)).toInt(); if (auxString == "1"){ digitalWrite(3, HIGH); delay(auxDuration); digitalWrite(3, LOW); } else if (auxString == "2"){ //digitalWrite(8, !digitalRead(8)); digitalWrite(5, HIGH); digitalWrite(4, HIGH); delay(auxDuration); //digitalWrite(8, !digitalRead(8)); digitalWrite(5, LOW); digitalWrite(4, LOW); // digitalWrite(11, HIGH); // delay(auxDuration); // digitalWrite(11, LOW); } ...
Momentous! We finally succeeded in installing the belts of our x and y-axis.
Week after week, our gear holder kept fracturing, and the frame always had a slight tilt, preventing it from moving back and forth on the y-axis smoothly.
Today, we removed the frame, modified screw holes on the frame, and installed them one more time.
After watching a video about DIY drawing machine, we also found a great tip of installing the belt!
Instead of using a small, white thing to connect the two ends of the belt, we could fix them in place by printing a round stuff as shown in the video. They are on the printing machine now. Hopefully, we can installed them next week and try to run the machine with the code we had been working on for the last several weeks.
Today, we work on improving and updating our programming on both the motor control and led control. We have changed the condition statement and code for the movement of the motors in the programming part. We have added an end-switch to the x and y axis so that when the plate holder and the x axis reached the end of the trail, it would know that it has returned to the original point.
void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(2, INPUT); pinMode(3, INPUT); }
void loop() { // put your main code here, to run repeatedly: int sensorValue = digitalRead(2); int sensorValue2 = digitalRead(3);
We have also fixed the holes on the x axis and recut it with the CNC. even though we have met some problems during the process, we still manage to get it done.
We 3D printed the parts of the two axis(gear holder, belt holder, etc) and fixed up the problem that we have faced before such as the height of the gear holders.
This Sunday, our team worked mainly on changing the details and improving the PCB board that we have drawn. We have added LEDs and motor to the PCB so that we would be able to control both the LED and the motor in one single program. This is our schematic diagram and PCB board that we have drawn.
We have almost finished with the motor control programming that we have found a few mistakes such as the conditions we gave to the motor need to be more complicated although the calculation would not bring the plateholder to the right spot.
This is our code that still needs improvement:
String protocolString = ""; boolean protocolWait = false; String parsedString = ""; int startIndex = 0; String totalString = ""; String ledString = ""; unsigned long Xstepcount = 0; unsigned long Ystepcount = 0; unsigned long Xstep = 0; unsigned long Ystep = 0; unsigned long Xmili = 0; unsigned long Ymili = 0; unsigned long Xstep1 = 0; unsigned long Ystep1 = 0; unsigned long Xstep_prev = 0; unsigned long Ystep_prev = 0; int period = 0; void initOutput() { //digitalWrite(ENNpin,HIGH); // Disable motors //We are going to overwrite the Timer1 to use the stepper motors // STEPPER MOTORS INITIALIZATION // TIMER1 CTC MODE TCCR1B &= ~(1<<WGM13); TCCR1B |= (1<<WGM12); TCCR1A &= ~(1<<WGM11); TCCR1A &= ~(1<<WGM10);
TIMSK1 |= (1<<OCIE1A); // Enable Timer1 interrupt //digitalWrite(ENNpin, LOW); // Enable stepper drivers }// System Inialization Setup const int dirpin = 5; const int steppin = 4; const int enpin = 7; const int dirpin2 = 2; const int steppin2 = 3; int stepstate = LOW; unsigned long pM = 0; unsigned long pM2 = 0; int vt = 1000;
void setup() { pinMode(dirpin, OUTPUT); pinMode(dirpin2, OUTPUT); pinMode(steppin, OUTPUT); pinMode(steppin2, OUTPUT); pinMode(enpin, OUTPUT); digitalWrite(dirpin, HIGH); digitalWrite(dirpin2, LOW); digitalWrite(steppin, LOW); digitalWrite(steppin2, LOW); digitalWrite(enpin, LOW); // put your setup code here, to run once: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for native USB } pinMode(2, OUTPUT); pinMode(3, OUTPUT); initOutput(); }
void loop() { // Serial.println("pass"); if (Serial.available() > 0) { protocolString = Serial.readString(); // Serial.println(protocolString); for (int i = 0; i <= protocolString.length(); i++){ // Analyze command string one character at a time parsedString = protocolString.substring(i,i+1); if (parsedString == "@"){ // '@' Symbolizes the end of a command if (protocolString.substring(startIndex, startIndex+1) == "L"){ totalString = protocolString.substring(startIndex,i); // Serial.println(totalString.length()); if (totalString.length() <= 2){ ledString = protocolString.substring(startIndex+1,i); if (ledString == "1"){ digitalWrite(2, !digitalRead(2)); } else if (ledString == "2"){ digitalWrite(3, !digitalRead(3)); ...
This is the last day of 2020. We are working on constructing the x-axis and y-axis, drillING screw spike on the y-axis using the aluminum cutting machine so that we can put x and y together( BELOW IS THE PICTURE FOR THE ALUMINUM AXES ) . The 8.0 version of gear holder is also put to print. 2 articles about the enzyme-carrying polymeric nanofibers and electrospinning are also reviewed.
We finally finished modifying the codes. We can now control 2 stepper motors! We expect to have our x-axis, belt, and gear holders installed on the frame and perhaps run it tomorrow!
We made further modification for the plate holder and the gear holder (The gear holder was designed in such a way that it is so fragile, breaking easily, and the plate holder was not suitable for the belt.)
We also played around with the programming for LED Light to get ourselves familiar with the codes.
W8’s Sunday: Continue with the designing of the Plate Holder and how to move it with a motor; Designed and built gear holder to help with the movement of the plate and the belt; measured and laser-cut the top panel of the micro plate reader; learned about the programming for controlling the movement of motor and the turning on and off of the LED
We continued constructing the outer box. The frame had already been set up last week, so we began drawing laser-cutting diagrams(used acrylic board) for the box and plate holder. To draw the diagram, 2 of us measured the framework, confirmed the coordinates of screw holes. The other 2 modeled the plate holder.