12-13. Mechanical Design¶
Group assignment:
- Design a machine that includes mechanism, actuation, automation, and application.
- Build the mechanical parts and operate it manually.
- Document the group project and your individual contribution.
Key highlights of the project¶
Project Introduction:¶
My mentor Saverio and I brainstormed a humorous idea inspired by “petting cats” and the concept of “moyu.” We plan to create a mechanical device for the Mona Lisa to continuously stroke the fish in her arms.
Moyu is a popular internet slang in China. While it literally translates to “touching fish,” it actually refers to taking a break or relaxing secretly during work. This device is designed to bring joy and humor, aiming to surprise and amuse people with its playful concept.
Detailed steps:¶
1. Hardware preparation and connection
2. Build the structure
3. Arduino Uno burning Grbl firmware
4. Key Parameter Settings (via Gsender)
5. Programming
1. Hardware preparation and connection¶
1.1 Required Hardware
- Arduino Uno x1
- CNC Shield x1
- A4988 Driver Modules x1
- 42 Stepper Motor x1
- 12-24V Power Supply (for motor power) x1
- Arduino USB Cable x1
- SG90 9G Classic Servo x1
- Jumper Cap x3
- Male to Female DuPont Line x3
1.2 Wiring Steps
-
Arduino and CNC Shield Connection: Insert the shield onto the Arduino pins (ensure correct orientation).
-
Stepper Motor Connection :Connect the 4 wires of the 42 stepper motor (red, blue, green, black) to the X-axis driver module on the shield.
-
Connect the servo motor
-
Power Supply Connection: Connect the external power supply’s positive (+) terminal to the shield’s +V and the negative (-) terminal to GND (do not use USB power to avoid insufficient current).
-
Driver Current Adjustment: Adjust the driver module current according to the motor’s rated current (e.g., for a 1A motor, set Vref ≈ 0.8V).
2. Main structure¶
For the main structure of the machine, we used a system that we developed before in our Fablab. We use 2020 aluminum profiles with L shaped 90° joints and T-Nuts to assemble everything. Then we lasercut simple plates to hold the stepper motor and the pulley and we connect the timing belt to a 3D printed connector that can be screwed directly on the linear guide slider. This system allowed us to rapidly assemble a prototype and then modify each part to the need of our specific machine.
The basic structural components of the machine, based on Fablab Shanghai’s original drawing machine.
All the documentation about the structure we started from can be found on this repository on Wikifactory
These laser cut plates are connected to the 2020 aluminum frame by two T-Nuts. During the assembly of the motor, pulley and timing belt, it is better to keep the screws loosely tightened, then tighten one plate, pull with the hand the motor plate to increase the tension of the belt and tighten the T-Nuts of the motor plate while holding it in place.
Lasercut plates to hold the stepper motor and pulley
Actuator: Hand bracket
We initially designed a simple lasercut plate with a slot for the servomotor and a vertical bracket with a hole. Also, we lasercut a longer bracket to hold the “hand”. With these two simple pieces, we made some tests and took some measurements and better understood the way the servo motor rotates and make the hand braket tilt (using a bent metal paper clip).
The laser cut test piece to hold the servo motor and the hand bracket (later substituted with a 3D printed piece)
The laser cut bracket to hold the hand
After testing this structure, we designed and 3D print the final actuator piece. It is based on the linear guide slider attachment piece that serves as a connection for the timing belt and it incorporates the Servo mount and the joint for the rotational axis of the hand bracket.
The 3D printed actuator piece: servo motor mount, hand bracket joint, timing belt connection and attachment to the linear guide slider
3. Arduino Uno burning Grbl firmware¶
3.1 Install GRBL via .ZIP Library
-
Download GRBL: Visit GRBL Releases. Download the latest
.ZIP
file (e.g.,grbl-1.1h.zip
). -
Import ZIP in Arduino IDE: Open Arduino IDE.Go to
Sketch > Include Library > Add .ZIP Library
.Select the downloaded GRBL.ZIP
file.
3.2 Upload GRBL to Arduino Uno
-
Plug Arduino Uno into your computer via USB. Go to
Tools > Board > Arduino AVR Boards > Arduino Uno
. Go toTools > Port
and select the correct COM port (e.g.,COM3
). -
Navigate to
File > Examples > grbl-servo-uno > grblUpload
. Click the Upload Button (➔ icon).
3.3 Verify GRBL Functionality
- Open Serial Monitor,Set Baud Rate to 115200
.
-
Test Commands:Send
$$
to view GRBL parameters. Example output:$0=10 $1=25 $2=0 $3=0 ...
-
The instruction to modify data is:
* Enter $X to unlock GRBL.
* Enter parameter number=new value to modify the parameter,
for example: $110=5000, set the maximum speed of the X-axis to 5000 mm/min.
* Enter $SAVE to save the configuration.
* Enter $$to verify if the parameter is valid.
- Key Parameters (Initial Setup),I referred to Professor SAVERIO’s project and modified the parameters.
4. Key Parameter Settings (via Gsender)¶
4.1 Close Arduino Uno to prevent serial port conflicts, Open Gsender (baud rate 115200 ), connect hardware.
5. Programming¶
To control the machine with buttons, we used a second Arduino. The first Arduino has a simple program that reads the press of 4 buttons (two for up and down, two for left and right) and send 4 different G-code as a message over Serial Communication, depending on which button was pressed.
The first Arduino TX pin is connected to the RX pin of the second Arduino (the one with GRBL). Same for the RX pin of the first with the TX pin of the second, and they also share the GND line.
The second Arduino receives G-code via Serial Communication and it works without any modification to the GRBL firmware. This way the machine can be used without being connected to a computer, but the choice of movements is limited to the 4 different G-code short commands send by the press of the 4 buttons.
const int button1 = 8; // button right
const int button2 = 9; // button up
const int button3 = 10; // button left
const int button4 = 7; // button down
void setup() {
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(button4, INPUT);
Serial.begin(115200);
delay(1000);
}
void loop() {
if (digitalRead(button1) == HIGH) {
sendPath1();
delay(500);
}
else if (digitalRead(button2) == HIGH) {
sendPath2();
delay(500);
}
else if (digitalRead(button3) == HIGH) {
sendPath3();
delay(500);
}
else if (digitalRead(button4) == HIGH) {
sendPath4();
delay(500);
}
}
void sendPath1() { // move right
Serial.println("G21"); // mm
Serial.println("G91"); // relative
Serial.println("G1 X50 F10000");
}
void sendPath3() { // move left
Serial.println("G21"); // mm
Serial.println("G91"); // relative
Serial.println("G1 X-50 F10000");
}
void sendPath2() { // move up
Serial.println("G21"); // mm
Serial.println("G90"); // absolute
Serial.println("G1 Z1 F5000");
}
void sendPath4() { // move down
Serial.println("G21"); // mm
Serial.println("G90"); // absolute
Serial.println("G1 Z-1 F5000");
}
Design files¶
Related resources
- NAME 17 stepper motor
- CNC control board