Skip to content

Mechanical Design, Machine Design

These last two weeks absolutely sucked. They gave me more gray hairs than I can count, a hint of burnout combined with depression and a general dislike for the way the Fab Academy puts constant pressure on students that don’t want to produce generic slop that has been done a billion times before week over week.

Anyways…

I teamed up with Kerstin and Lars, the other students from HRW FabLab, to build a machine that distributes small seeds and keeps them watered.

You can find our page right here.

In the process of building our machine I took care of a lot of 3D modeling and printing as well as programming, while Lars and Kerstin worked on the mechanical components, electrical wiring and 2D designs.

Digital Twin

My first task was to set up a work in progress digital twin for all of us to work on in Fusion.

I started by arranging 30mm x 30mm aluminum extrusions and MGN9 linear rails the way we had planned in our prep meeting.

The next thing I designed were these little plate holders that can be twisted into the extrusions.

They were then printed out of PLA.

Of course outside of the digital world the extrusions wouldn’t just magically stay together the way we want them to.

So after we tried connecting them with cutting sleeve automatic fasteners and realized that they bend the profiles out of shape, I started working on some corner brackets for the top.

These took a lot of iterations because, since the whole digital twin was a work in progress, there were always things being added to them.

My first goal with the brackets was to make them printable in a way that they wouldn’t have a weak direction.

To achieve this I simply cut off the corner at an angel and used the newly created plane as the first layer of the print.

Everything else is then printed at a still quite challenging but doable angle.

In future iterations I slightly changed the location of the mounting holes, added slots for the linear rails to fit in, rounded some corners and even added an elevated mounting hole where a heat set insert can be installed to later mount other components on.

The next step was to design and print a motor mount and tensioning mechanism for the timing belt that drives the Y-axis as well as carriage stops for the opposite side.

The motor mount is pretty selfexplanatory, it sits on the back left corner of the frame, uses three of the bracket’s screw holes as well as the one with the threaded insert and holds a NEMA17 stepper motor.

On the front left corner the tensioning mechanism can be found.

Just like the motor mount the tensioner case is mounted via three holes on the bracket’s sides and the threaded insert.

It houses an idler pulley assembly that slides along the printed guide rails on the inside and can be used to tighten the timing belt via a trapped nut and screw at the back.

All of the parts that build upon the corner brackets leave a small gap to the back and the side for panels to fit in, which Kerstin designed and manufactured on one of our lasercutters.

After those were done I began designing parts that mount the X-gantry to the carriages on the Y-axis linear rails.

In the first iteration they ended up looking like this:

As a first test, only holding the X-axis extrusion, it did the trick but not much later I realized that this axis would also need parts that make it move at some point so I went with this:

Besides the 4 holes that are used to mount the parts to the carriage with M3 screws I also added 3 larger ones that can be fitted with heat set inserts giving us new mounting points.

The gantry mount on the left features a small clamp that secures the ends of the Y-belt.

The next logical step for me was to design a new motor mount and tensioning mechanism that fit onto the gantry mounts.

In the meantime the team had figured out a solution for the head or Z-axis assembly.

Thus I was able to come up with another belt clamp that mounts behind the Z motor.

Speaking of the Z-axis, I also briefly worked on a version of the left head that distributes small seeds.

My design is powered by a servo motor that drives a rack and pinion.

The tip of the rack is bent in a way that it fits into a kind of nozzle that is printed out of flexible TPU filament and holds the seeds.

By moving the rack downwards the seeds essentially get pushed through the oval ending of the nozzle and squeeze out in small quantities.

We didn’t end up using my design because Lars came up with a far more reliable one.

Besides the “big” parts I also spent some time designing and printing some useful little tools such as:

  • Centering clips that help you properly align the linear rails on the aluminum extrusions

  • Printable T-nuts that use regular M3 nuts for mounting parts to the extrusions

  • Clamps that can be screwed onto the linear rails to prevent the carriage from flying off

The entire digital twin fusion file can be downloaded via our group website, so be sure to check that out right here.

Programming

Marlin Firmware

Since our machine is based on a lot of components found in a modern 3D printer, I chose to make use of the open source Marlin firmware.

Once I downloaded and unzipped the latest release, I opened it in Visual Studio Code.

To be able to build the firmware for our machine, I needed to install two crucial extensions.

Auto Build Marlin and PlatformIO IDE massively simplify the whole process.

Marlin is quite a behemoth when it comes to customizability, only the basic configuration file contains almost 3500 lines of code that can be changed to power a machine.

To add to that there is an advanced configuration file with ~4300 lines.

Going through every single one of the possible settings to change would certainly be too much, so I’ll just give you the cliff notes of what I did to get our machine up and running.

For everything else there is an entire configuration guide, so be sure to check that out.

The first things I needed to change were related to the hardware we are using.

In Configuration.h I set up the BigTreeTech Octopus V1.1 as the motherboard and changed the stepper motor drivers for X,Y,Z and E0 to TMC2209.

Next, since our machine is not really a 3D printer and thus doesn’t have any hot parts, I had to set up dummy thermal sensors because disabling them entirely would result in an error.

Further down in the configuration file I then enabled endstops for all of our axes.

The logic for our Z-axis endstop had to be inverted due to reasons, I’ll cover in a bit.

Up next: defining the length of our axes.

Keep scrolling and you’ll end up in the LCD and SD support section, this is what ours looked like:

The next section defines the type of screen you are using, ours required us to uncomment line 2768, #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER.

With that the basic setup was out of the way and I changed over to the Configuration_adv.h file.

As mentioned, this one is the larger of the two but just because there are so many options doesn’t mean you have to enable them all.

The first relevant changes I made were found in the tmc/config section following line 2722.

Here I changed the current and number of microsteps to 1000mA and 16 respectively.

In the tmc/stallguard section I enabled sensorless homing, which is a neat feature that lets you home your machine without a physical limit switch.

Remember how I had to invert the logic for the Z-axis endstop? For some reason sensorless homing just didn’t want to work reliably so I had to install an actual switch there while the other axes were just fine with a sensitivity of 80.

That pretty much covers all the relevant changes. I next headed over to the Auto Build Marlin extension and built a firmware binary file that I could save onto a micro SD card.

After inserting that SD card into the mainboard and turning on the machine, it automatically flashed the new firmware.

GCODE

After the firmware was done I began writing a gcode script that makes our machine distribute water and seeds at specific locations.

With the digital twin already pretty much done, determining the locations was pretty straight forward so I needed to figure out how long and how fast I’d need to run the two distribution motors.

By the way those motors are technically using fan ports on the mainboard so don’t be surprised when looking at our gcode…

Here is the beginning of the watering and seed distribution routine I ended up with:

G28                     ; home all axes

//1st position
G0 X250 Y130 Z90 F3000  ; move to next position at 50mm/s
M106 P0 S255            ; turn on pump at full speed
G4 S9                   ; wait for 9 seconds
M107 P0                 ; turn off pump
G0 X250 Y130 Z0         ; move down second head
M106 P1 S10             ; turn on seed motor at slow speed
G4 P500                 ; wait for half a second
M107 P1                 ; turn off seed motor
G4 S1                   ; wait for another second to prevent scattering seeds

This is simply repeated for every location.

Just like the 3D models, you can find the firmware and gcode linked on our group website.

Click here to see for yourself and remember to stay hydrated.