5.4 Implementation

Fabrication and Assembly

The linkage mechanism is fabricated out of laser-cut 1/8" acrylic and press-fitting bearings into the linkages. We connected the linkages by cutting the 6 mm shafts to size and putting them through the bearings of each linkage. We used 1/8" acrylic as the linkages would have less friction as they crossed one another and the 1/8" acrylic was lighter than the 1/4" acrylic. The base plate was also laser cut out of 1/8" acrylic and had 2 parts as seen in the figures below. The top base plate was directly interfaced with the linkage system as the driver linkage was connected to the motor via a 5 mm motor encoder. Another linkage was attached to the base plate via 6 mm motor encoders attached to the base plate and linkage and a 6 mm shaft. The linkage system is essentially cantilevered from the base plate. The top base plate was utilized to interface with the linkage system and keep other components in place, such as the motor, breadboard, Arduino, and battery. The bottom base plate was necessary as the 6 mm motor encoder screwed into the bottom of the top base plate and the bottom plate allowed for the mechanism to sit flatly on the table. 


Figure 1: Full Assembly of Final Design


Figure 2: Bottom Base Plate


Figure 3: Top Base Plate



Electronics and Circuitry


Our system is driven by a 42mm NEMA 17 stepper motor powered by a 24V/2A supply. The motor is controlled by an A4988 stepper driver that is powered by the same 24V supply with a decoupling capacitor to reduce noise in the circuit. To actuate our motor we use a push button connected to GPIO2 of the Arduino Uno that is powered by a 9V battery. The button uses a pulldown resistor to prevent an accidental actuation as a safety precaution. Additionally, the RST (reset) and SLP (sleep) ports on the A4988 stepper driver are connected to create a closed loop because we are not using them.  The DIR (direction) pin is connected to port 8 of the Arduino and it controls whether the motor spins clockwise or counter-clockwise. The STEP pin is connected to port 9 of the Arduino and it controls the number of steps the motor takes.


Figure 4: Electronics Wiring Diagram

Software Development


We chose to use the AccelStepper.h library to control the NEMA 17 stepper motor. Our mechanism aims to achieve a swinging motion that spans around 90 degrees, stops abruptly, and then returns to its original folded position. After trial and error, we decided to write code to tell the motor to take 60 steps which equates to 108 degrees of rotation. Our max speed was chosen to be 1000 steps/sec, which proved to be sufficient given the load on our system. The code tells the motor to actuate after the push button has been pressed once. Unfortunately, there were torque issues with driving the motor backward. So, we only wrote code to drive the motor forward and manually moved the mechanism to its starting position. Below is the code we used to better illustrate the logic of our system.