Week 12 - Mechanical Design, Machine Design (2025)

Published on: April 23, 2025
Machine Building Week: Individual Contribution
This page outlines my contribution to Machine Building Week, including a table that details my working days and the activities I carried out.
| Date | Activities |
|---|---|
| Feb 16, 2025 | Initial coordination meeting to discuss and plan the machine concept in advance of the workshop. |
| Apr 8, 2025 | Pre-Machine Week planning meeting at 12 PM. After work: gathering of components, initial assembly of parts, and task distribution within the team. |
| Apr 11, 2025 | After work: pick-up of the mainboard package (BIGTREETECH Octopus V1.1) at the FabLab. Joint work session: photographic documentation and parts listing. |
| Apr 12, 2025 | Programming the Marlin firmware for the mainboard; setting parameters for the planned XYZ-axis machine. Development of test code for motor and pump control. Implementation of a custom boot screen and menu. |
| Apr 13, 2025 | Crimping of JST-XH motor cable connectors. First operational test of motors and pump using a laboratory power supply. |
| Apr 14, 2025 | Experimental test to determine the optimal height for the pump. Assembly of components and cable preparation (crimping). Mounting the mainboard to DIN rail and connecting the power supply. First power-on test of the mounted mainboard with existing test code (axes not yet assembled). Testing motor directions. Team meeting: review of current status and redistribution of tasks. |
| Apr 16, 2025 | Home office: 3D design of the display mount and ribbon cable clips. |
| Apr 17, 2025 | 3D printing and revision of designed parts due to minor flaws. Mounting the display onto the aluminum profile. Research on Z-axis head attachment, 3D Design of a possible head attachment and servo motor control using the Octopus V1.1. |
| Apr 19, 2025 | (Planned) Firmware update with final parameters (max height, travel range of base plate, max speed, drive gear ratios). Access to the machine was denied, so work was hypothetically completed: 1) Adjustment of firmware values, 2) Parameter testing and G-code calibration. |
| Apr 18–20, 2025 | (Planned) Creation of G-code for traversing multiple plates and simulating watering states (short burst mode and plant watering mode). Testing was not possible due to lack of machine access. Beginning of the writing process for the documentation. |
| Apr 20–22, 2025 | Writing of the documentation of the individual contribution. |
As always you will find our group assignment on our group documentation page.
1. Photographing the parts and creating a parts list
| Part | Quantity | Price |
|---|---|---|
| Aluminum Profile 25 x 3 x 3 | 4 | |
| Aluminum Profile 35 x 3 x 3 | 4 | |
| Aluminum Profile 31 x 3 x 3 | 4 | |
| T-slot Nuts 30mm M4 | ||
| Hex Socket Head Screws | ||
| Automatic Connectors (Screw, Cutting Nut, Hammerhead Nut) | 16 | |
| Peristaltic Pump (13D020 or NKP-DC-510Y) | 1 | |
| Stepper Motor SY42STH47-1684A | 2 | |
| Stepper Motor | 1 | |
| DIN Rail | 1 | |
| Terminal Blocks for DIN Rail | 4 | |
| End Terminal Block (4 Contacts Each) | 1 | |
| Cover for DIN Rail | 1 | |
| Connectors for Terminal Blocks | 2 | |
| Micro Metal Gearmotor | 1 | |
| Timing Pulleys (20 Teeth) | 3 | |
| Belt Pulleys (20 Teeth) | 3 | |
| Wire Strands (1.4mm) | ||
| LED Reel W10mmx6 | ||
| Ferrules | ||
| Anti-shock Feet | 4 | |
| End Caps for Aluminum Profiles (30x30) | 4 | |
| Linear Guide | ||
| 24V Power Supply | ||
| Full Graphic Smart Controller | 1 | |
| Bottle + Cap | ||
| BIGTREETECH Octopus, V1.1 | 1 | |
| TMC 2209 Stepper Motor Driver | 3 |
I also picked up the package with the Octopus V1.1. mainboard from the office at the university.
2. Programming the Mainboard and setup of the components
The control system of the machine is based on the BIGTREETECH Octopus V1.1 mainboard, equipped with TMC2209 stepper motor drivers and operated via a RepRap Discount Full Graphic Smart Controller.
2.1 Das Bigtree Octopus V1.1. Mainboard
The BIGTREETECH Octopus V1.1 is a high-performance 3D printer controller board designed for advanced motion control applications. It is based on the STM32F446 32-bit ARM Cortex-M4 microcontroller, offering fast processing capabilities and extended I/O options. The board supports up to 8 stepper motor drivers and features multiple communication interfaces, including USB, UART, SPI, and CAN. It is compatible with open-source firmware like Marlin and Klipper, and is particularly well-suited for complex, multi-axis machines requiring high-speed, real-time control.
2.2. TCM2209
The TMC2209 is a silent stepper motor driver developed by Trinamic, widely used in precision mechatronic systems due to its high efficiency and quiet operation. It supports up to 2A RMS current and integrates advanced features such as StealthChop2 for silent motion and SpreadCycle for optimized torque. Additionally, the driver includes sensorless homing via StallGuard4 and can be controlled via UART for real-time configuration. It is ideal for use in machines where smooth, quiet, and efficient motor control is required like 3D Printers or CNC machines.
2.3 RepRap Discount
The RepRap Discount Full Graphic Smart Controller is a user interface module that includes a rotary encoder, push-button, buzzer, and an ST7920-based monochrome graphical LCD display. It connects to the mainboard via SPI and is commonly used with Marlin firmware to provide offline control of 3D printers and CNC machines. The display enables real-time monitoring, parameter adjustment, and G-code execution without requiring a host computer. It is a robust and reliable interface for machine operation in standalone environments.
2.4 Marlin Firmware
Marlin is an open-source firmware developed for 3D printers and CNC machines using AVR or ARM-based control boards. It is written in C++ and provides a comprehensive feature set for motion planning, temperature regulation, user interface support, and machine safety. Marlin supports various hardware configurations and is highly configurable via its Configuration.h and Configuration_adv.h files. In this project, Marlin was customized to drive the BIGTREETECH Octopus board, enabling control of a multi-axis system with integrated peripheral components like stepper drivers and user interfaces.
2.5 Configuring and setting the Marlin software
I watched some useful youtube videos as a first impression on how to program the octopus mainboard with marlin firmware.
2.5.1. Software Setup and Firmware Configuration
To program the BIGTREETECH Octopus V1.1 mainboard with Marlin firmware, a series of development tools and software packages had to be installed and configured. This process included downloading the latest firmware, setting up a build environment, and adjusting configuration files to match the specific hardware setup of the machine.
Installing Required Software
The firmware used for this project was Marlin 2.1.2.5, which was downloaded directly from the official Marlin GitHub repository:
https://github.com/MarlinFirmware/Marlin/tree/2.1.2.5
To compile and upload the firmware to the Octopus board, the Visual Studio Code (VS Code) IDE was used. The following extensions were installed via the VS Code extension manager:
PlatformIO IDE: Required for building embedded C++ projects and managing board environments.
Auto Build Marlin: A plugin designed to simplify Marlin-specific build and upload processes, including board detection and configuration selection.
After installing the extensions, the Marlin source folder was opened in VS Code, allowing access to the platformio.ini file and the relevant configuration directories.
Configuration of Marlin Firmware
The core of the firmware customization takes place in two files:
- Configuration.h
- Configuration_adv.h
These files define the machine's hardware layout, motion system parameters, endstop behavior, motor driver settings, and other extended features.
In the Configuration.h file, it is important to adjust the following key settings:
#define MOTHERBOARD BOARD_BTT_OCTOPUS_V1_1
This selects the correct board variant to match the BIGTREETECH Octopus V1.1. The motor drivers used are TMC2209 modules, which are configured as follows:
#define X_DRIVER_TYPE TMC2209
#define Y_DRIVER_TYPE TMC2209
#define Z_DRIVER_TYPE TMC2209
Since the TMC2209 stepper drivers operate via UART communication by default, no special wiring is required apart from correctly placing the UART jumpers on the Octopus board, depending on the module version (as we used V1.3 I had to place the jumpers on the mainboard).
Custom Bootscreen
To personalize the user interface on the RepRap Discount Full Graphic Smart Controller (128x64 px LCD), a custom boot screen was created. The process included:
- Designing a pixel art logo with dimensions of 128x64 pixels.
- Converting the image into a C-compatible header file (_Bootscreen.h) using online tools or graphic-to-code converters.
- Including the file in the Marlin source and enabling the custom boot screen option in the configuration.

Motion System and Axis Parameters
To ensure accurate motion control, the DEFAULT_AXIS_STEPS_PER_UNIT value was calculated based on the mechanical setup:
#define DEFAULT_AXIS_STEPS_PER_UNIT { 80, 80, 80 }
X, Y, Z axes: GT2 belts with 20-tooth pulleys, NEMA17 stepper motors (200 steps/rev), and 1/16 microstepping → Steps/mm = (200 × 16) / (20 × 2) = 80
The machine's build volume was later defined based on the usable area of the platform: 344 mm × 244 mm
Pump Control via G-code (FAN0)
The peristaltic pump is connected to the FAN0 output on the Octopus board and is controlled using standard G-code commands:
M106 P1 S255 ; Turn pump ON at full speed (PWM)
G4 S3 ; Wait for 3 seconds
M106 P1 S0 ; Turn pump OFF
This allows simple timed actuation of the pump directly from G-code scripts. Later, after the peristaltic pump tests have been carried out, the correct duration for pump operation can be set in the final code for controlling the machine.
Creating a Custom Menu (LCD Interface)
To extend the functionality of the RepRap Discount Full Graphic Smart Controller, a custom menu was implemented within the Marlin firmware.

2.5.2 Detailed walk through Configuration.h
After the basic tools for editing the Marlin firmware were installed, I went through the individual subchapters of the configuration files step by step to customize the changes for our machine, which is not a 3D printer.
Section: Getting Started
You can't really call setting the various parameters programming. It is more a matter of commenting out and in or adjusting the relevant or irrelevant parts in order to set the firmware according to your own requirements.
The settings for the boot screen and the mainboard used are located right at the beginning.

The Octopus V1.1 is based on a STM32 chip with several UARTs, therefore the SERIAL_PORT is set to -1 in Marlin.

Section: Stepper Drivers
We use the same TMC2209 stepper drivers for all axes, which I have covered with heat sinks and mounted on the board in advance.

For further peripherals, #define E0_DRIVER_TYPE A4988 could be set to TMC2209 or another value in future, depending on use. E0 stands for the extruder. However, as we are controlling our water via the pump (FAN0), we do not need this.
Section: Extruders
The funny thing is that we don't have an extruder on our machine. We use the 12V outputs for FAN to control the pump because, just like fans, it can be controlled simply via PWM and a voltage. Very practical! Means: No extruder motor, no heater, no hotend - We can completely remove or comment out the settings, as they only apply to multi-extruder systems or dual-nozzle 3D printing. So we can also deactivate the PID control, temperature sensors and thermal protection functions.

Since our machine does not have temperature sensors or a heating bed, we can set the values to 0 at this point and simply comment out the following sections on temperature settings.

Section: Endstop Settings
- Configuration for sensorless homing (in Configuration.h)
- Do NOT use endstops
- Instead of physical endstops, we say Marlin: "I have no buttons - homing runs via the drivers."
Therefore we can use sensorless homing active, no physical endstops.


Since we are using sensorless homing, we need to define the homing direction. -1 means direction to minimum (left/front/bottom). (important for sensorless, so that it moves against a defined stop)
Sensorless homing must also be activated in Configuration_adv.h. More on this later.
Section: Movement Settings

The movement settings are used to calculate the belts and steps from the specifications below:
- Pulley: 20 teeth
- Belt: GT2 (Pitch = 2 mm/tooth)
- Motor: NEMA17 with 200 steps/revolution
- Microstepping: 16 (standard for TMC2209)
// → Steps/mm = (200 × 16) / (20 × 2) = 80
Formula:
steps_per_mm = (motor_steps_per_rev × microstepping) / (pulley_teeth × belt_pitch)
Maximum speed is specified in...

I have drastically reduced the speed compared to the default settings to avoid mechanical problems.
The maximum acceleration has also been significantly reduced.
#define DEFAULT_MAX_ACCELERATION {1000,1000,50}

To avoid vibrations in the machine and to make the movements smoother, S_Curve_Acceleration has also been activated.

Section: Z Probe Options
Must be commented out because of sensorless homing.

The direction of the stepper motor can be changed here if the motors are turning in the wrong direction.

The real values still have to be used here after the final completion of the mechanics with the linear guides and superstructures, as we cannot control the entire plate area due to the size of the heads and construction.

Section: Bed leveling
Can also be completely commented out.
Section: LCD and SD Support



Section: Extra Features
As we are using a connection for fans for the pump, we can set the number of fans to 1 here.
Configuration_adv.h
I am now finished with the settings in Configuration.h and the settings for sensorless homing in Configuration_adv.h can be addressed.

Custom Main Menu

TMC2209 Stepper Driver


UART is automatically activated by using STEALTHCHOP_XY and Z.
As already done, I have set the jumpers to J16 and J17 for X_DIAG (X end stop) and Y_DIAG (Y end stop). The DIAG signal is necessary for sensorless homing and replaces the classic end stop function.
2.6 Generate Firmware and copy to SD Card
With the Marlin Firmware Auto Build tool, which can be easily installed via the extension menu in Visual Studio Code, a 'firmware.bin' can be easily created from the configured firmware, which can then be copied to a freshly formatted SD card (preferably smaller than 32GB and FAT32). This then only needs to be inserted into the mainboard for operation.

I wasted a bit of time trying to flash the Marlin firmware to the board via USB. This is not intended and leads to errors. However, the variant of simply copying the file to the SD card worked directly and without any problems.
2.7 GCode
Initial test of the stepper motors, peristaltic pump and display

G-code is a machine control language commonly used for CNC machines and 3D printers. It consists of text-based instructions that tell a machine how to move, how fast to move, and when to turn functions like motors or pumps on or off.
Most commands begin with a letter, such as G for motion commands or M for machine-specific actions, followed by numbers and optional parameters:
G1: Performs a linear movement to a given position at a set speed (F= feedrate).G90: Sets the system to absolute positioning mode.G4: Pauses execution for a specified time (Sfor seconds).M106: Controls a fan or pump using pulse-width modulation (PWM).M18: Disables the stepper motors.
In this example, the machine lowers the Z-axis, moves along the X and Y axes, raises the Z-axis again, and then runs the pump for a short duration. These steps simulate a basic movement cycle with timed fluid dispensing, useful for simple automation tasks.
G90
; Lower the Z-axis (e.g., to 100 mm height)
G1 Z100 F600 ; Move Z-axis down at 600 mm/min
G4 S1 ; Wait for 1 second
; Move along the X-axis
G1 X200 F1200 ; Move to X = 200 mm
G4 S1 ; Wait for 1 second
G1 X0 F1200 ; Return to start position
G4 S1
; Move along the Y-axis
G1 Y200 F1200 ; Move to Y = 200 mm
G4 S1 ; Wait for 1 second
G1 Y0 F1200 ; Return to start position
G4 S1
; Raise the Z-axis again (e.g., to 0 mm)
G1 Z0 F600 ; Move Z-axis up
G4 S1 ; Wait for 1 second
; Activate pump (connected to FAN0)
M106 S255 ; Turn pump ON at full power (PWM)
G4 S3 ; Wait for 3 seconds
M106 S0 ; Turn pump OFF
; Disable all stepper motors
M18
3. Crimping the cables, first test run of the test GCode of the motors and the pump with laboratory power supply unit
To establish reliable connections between the stepper motors, pump, and the BIGTREETECH Octopus V1.1 mainboard, custom cables were prepared using proper crimping tools and connector housings. The process was carried out in several steps, ensuring electrical integrity and mechanical stability of the connections.
Crimping Process

The cable preparation began with stripping the insulation from the wire ends using a Knipex automatic wire stripper. This ensured precise and consistent stripping lengths, which is critical for proper crimp connection.

Crimping JST-XH terminals
Subsequently, the stripped wire ends were inserted into JST-XH crimp terminals and securely crimped using a precision crimping tool (PR-3254), rated for AWG 26–18 wires.

Once crimped, the terminals were carefully inserted into 3-pin JST-XH connector housings. Proper orientation and full insertion were verified visually and by tactile feedback. The crimped connections showed no exposed strands and a clean mechanical seat in the housing.

The resulting cables were robust and ready for integration with the electronics. This step was crucial for the connection of motors and pump, ensuring stable signal and power transmission under load.

Initial Test Setup
After preparing the cables, a first functional test was conducted using a laboratory power supply unit to safely power the control electronics and connected peripherals. The test setup included:
- The BIGTREETECH Octopus V1.1 board
- A RepRap Discount Full Graphic Smart Controller (LCD)
- Two NEMA17 stepper motors
- One micro metal gear motor with attached peristaltic pump
- Custom-crimped JST-XH connections
The test G-code was executed via the LCD interface, which triggered simple movement commands and activated the pump via M106 P1 S255. The motor directions, step behavior, and pump activation were all verified in this low-risk environment before connecting the full machine assembly.
This test confirmed that the firmware was correctly flashed, the stepper drivers (TMC2209 via UART) were operational, and the custom cabling met electrical and mechanical expectations.

4. Test Series: Determining the Optimal Z-Axis Height for the Peristaltic Pump
To ensure precise and clean water dispensing into the plant vessels or shot glasses, a series of experiments was conducted to determine the optimal vertical position of the tube outlet on the Z-axis. The goal was to identify the exact height at which the liquid could be dispensed reliably without causing splashes or uncontrolled dripping onto the machine's base plate.
The setup involved a transparent test platform with predefined holes to place shot glasses filled with water. The peristaltic pump was connected via silicone tubing, and various Z-heights were manually tested using a folding ruler. This allowed the measurement of the ideal clearance between the tube outlet and the water surface in each container.
The peristaltic pump drew water from an external reservoir placed next to the machine. Each test run involved activating the pump observing the behavior of the water stream at different nozzle heights. In addition to the optimal Z-position, the pump runtime required to fill a single shot glass was also determined. This value ranged between 8.5 and 10 seconds per container.
It was found that placing the tube outlet at a maximum height of 8cm ensured optimal performance—minimizing splashing while maintaining consistent water delivery. These findings were then used to adjust the firmware-defined Z-axis movement limits and setpoints for the final version of the machine.



5. Interim status: mounting the electronic components on the machine housing
During this phase of the build, the main electronic components were mechanically integrated into the machine housing and electrically pre-connected to allow further functional testing and firmware validation.





The process began with preparing the AC power input cable. A standard 3-core power cord was stripped, fitted with ferrules using a crimping tool, and later connected to the input terminals of the 24 V DC power supply. This ensured a secure and reliable connection for safe power distribution.
A wiring diagram was used as a reference to systematically connect the BIGTREETECH Octopus V1.1 control board to peripheral components such as stepper motors, endstops, the display module, the emergency stop button, and the peristaltic pump.
After mounting the control electronics, stepper motor cables and peripheral wiring were routed and connected according to the wiring diagram.
6. 3D design and printing
6.1 3D print display case
For the housing of the RepRap Discount Full Graphic Smart Controller, an existing case design was used from Thingiverse:
https://www.thingiverse.com/thing:4776911/files
The STL file was downloaded, sliced, and printed without major modifications. The case provides a snug fit for the LCD and knob and includes openings for cable routing.
6.2. 3D Design display holder for aluminum profile
- Display Holder 1: Designed for mounting with a screw through the side. However, due to the installation angle, the screw could not be passed through the slot to reach the T-nut.
- Display Holder 2: This version was designed to twist into the profile directly, without pivot points. It could not be installed as intended, since the geometry didn't allow for insertion into the slot.
- Display Holder 3: Final version with rounded corners and pivot points. It can be turned into the aluminum profile and locks in securely. A key learning here was how to modify sketches using the timeline feature in Fusion 360 and "roll forward" design changes.

Display holder 1: Experiment 1 for screwing

Display holder 2: Experiment 1 for turning in without pivot points

Display holder 3
For turning into the aluminum profile with rounded corners and pivot points (Learning: Editing a sketch in Fusion with Timeline and then "fast-forwarding" to the previous point)
6.3 Ribbon Cable Clip
A custom clip was designed to manage and guide the flat ribbon cable used for the display. The clip ensures strain relief and improves cable routing within the frame. It was modeled to fit the thickness of the frame and snap into place to hold the ribbon cables.


6.4 Iterations
Here you can see some of the trial and error 3D printed parts.

6.5 First Design: Z-Axis Head with Belt Attachment for Water Tube
The head for the Z-axis was developed to serve as a mounting point for the water delivery system, specifically the silicone tube coming from the peristaltic pump. The design was inspired by common GT2 belt clamps and was adapted to integrate with a linear guide-based movement system.

The clamping mechanism grips the GT2 timing belt from both sides, using two opposing 3D-printed jaws that are fastened with a central screw. This ensures a firm connection between the belt and the Z-carriage, allowing precise vertical movement of the mounted head.
To transfer this motion to the linear guide system, a custom adapter plate was designed. The plate includes mounting holes that match the linear rail slider and connects to the belt clamp part.
The head was designed to be mounted directly onto the linear guide carriage of the Z-axis, enabling controlled vertical movement. This allowed for accurate positioning of the water tube above the plants or glasses, making it possible to perform targeted watering and filling operations.





7. Control of servo motors for the bulk material chute with the Octopus Board
After researching on the Internet how I can control servo motors with a 5V voltage with the Octopus board, I came across a solution that uses the following PINs for control.

BL Touch uses a small servo internally, which is why it can be used here and set in configuration.h to operate the bulk material chute.
8. GCode
Here is an example GCode, which controls the centers of the circles of the planting plate and lets the pump run for 3 seconds to irrigate them.
; === Watering Mode for Plant Plate - Slow Movement ===
G90 ; Absolute positioning
G21 ; Set units to millimeters
; Travel height
G1 Z80 F600
; Position 1
G1 X41.15 Y17.15 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 2
G1 X122.21 Y17.15 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 3
G1 X203.26 Y17.15 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 4
G1 X41.15 Y120.52 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 5
G1 X122.21 Y120.52 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 6
G1 X203.26 Y120.52 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 7
G1 X41.15 Y223.89 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 8
G1 X122.21 Y223.89 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 9
G1 X203.26 Y223.89 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 10
G1 X41.15 Y327.26 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 11
G1 X122.21 Y327.26 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Position 12
G1 X203.26 Y327.26 F600
G1 Z70 F600
M106 P1 S255
G4 S3
M106 P1 S0
G1 Z80 F600
; Disable motors
M18
Conclusion
This week, I deepened my understanding of Octopus board programming with Marlin, learned how to design pivot points for turnable components, and improved my systematic approach to writing G-code – combining both programming and 3D design skills.