3D printing guides – Firmware basics

A basic guide to getting started with your printer’s firmware, including a basic wash-down of the common configuration errors.

Marlin: download
Using the Printrboard with Arduino

Firmware Basics

I’m Tom and today i’m going to give you a very basic walkthrough of configuring, uploading and debugging your 3D printer’s firmware.

So, the firmware controls basically every aspect of your printer: From the stepper control over heater management to the communication with the printer host, everything is handled by some part of the firmware. Now, on 99.9% of all printers the firmware runs on an Atmel chip, which makes the control board Arduino compatible. So, naturally, we’re going to be using the Arduino environment to configure and upload the firmware. If you don’t have Arduino installed yet, head over to arduino.cc and download and install the latest stable Arduino software – check the video description for a link.

So, i kinda lied when i said the controllers are Arduino compatible – for many of them, especially the ones like the RAMPS where an actual Arduino board is the basis of the controller, you can use the Arduino environment just like it it comes out of the box. However, for some boards like the Sanguinololu, the Melzi or the Printrboard, you’ll need to download a hardware configuration set so that the Arduino software knows how to talk to the board. You’ll find these linked in the RepRap wiki or on the board’s manufacturer’s page. Once you get the file, close the Arduino software if you have it open and unzip the file you downloaded into Arduino’s sketchbook folder – on Windows and Mac, that’s usually Documents, Arduino; on Linux, it’s the sketchbook folder in your user’s home directory. Inside you’ll find a folder called “hardware”. When unzipping the files, make sure you end up with a folder named after your control board that in turn has folders called bootloaders, cores and so on. If you installed it correctly, you’ll now be able to select your board within Arduino and upload firmware to it.

So the firmware i’m going to be using is Marlin – again, check the video description for a download link to a fresh copy of Marlin. Unpack the zip file and you’ll find the marlin.ino file, which you can open with Arduino. Since the Marlin firmware is being very actively developed, some of the options might look a bit different if you downloaded a newer version. Still, the basics aren’t going to change, so that’s what i’ll be covering in this video.

Also, if you’re using a 3D printer kit or a ready-built printer, check with the manufacturer of your printer, they might just have a preconfigured version for download that you can either tweak to your heart’s content or use as a basis for a fresh configuration.

So as you open up Marlin, it will flood your Arduino software with heaps of tabs. The important one for now is “configuration.h”, which contains all the basic setting. What is really important with these settings is that you don’t change the punctuation or separators, like commas and brackets, unless you know exactly what you’re doing. If you’re unsure if you messed things up, hit the “compile” button up here and it will throw an error if things aren’t right.

So as we work our way through the configuration file, keep in mind that there are a lot of setting in here that aren’t crucial to running your printer, so i’ll be skipping those and be focusing on the ones that are crucial for getting your printer running for the first time. The first important setting is the baud rate, which is the speed at which your printer communicates with the host.  The deafult is 250000, if you’r ehaving trouble connection to your printer, try 115200 instead. But for now, we’r ejust going to leave it at 250000. As you scroll doen, the next important setting is picking the right board. Each one of the popular boards has as number assigned to it, and all you need to do enter that number down here and Marlin will use proper setting for that board. I’m using a Melzi board, so that’s number 63.

So that’s the very basic configuration. But wait, there’s more! There is one more setting that you really should enable, and that’s hidden in the “configuration_adv.h” file.

So the firmware is ready to be uploaded at this point. Connect your control board via USB, make sure you selected the right serial port and hit “upload”. The firmware will compile and the Arduino software will upload it to the board. Wait till the LEDs stop flashing and Arduino says “Upload completed”. Now your board is basically ready to use.

Here’s a couple of basic checks that you can do to make sure you don’t have any major errors in the configuration:

Before you power up your 12 or 24V power supply, connect to the board with your favorite RepRap host software and check that the temperatures it’s reporting are plausible – if not, you probably selected the wrong thermistor. As you turn on the power supply, make sure that the temperatures don’t start rising on their own and that no part of the control board starts cooking. When it passes that test, use the host to move each axis by a bit and check that it moves in the right direction – keep in mind that the movements are taken from the nozzle relative to the bed, so if you have a moving bed and move Y +, the bed should move towards you. Use the right hand rule to get a basic idea of which axis has its positive direction at which end – hold your right hand out like this and from your point of view, this is x, this is y, this is z positive when you’re looking at the printer from the front.

If an axis only moves in one direction, you probably set up the endstop inverted setting wrong. If it always moves in the wrong direction, flip the motor connector around after turning the power off or invert the axis in Marlin’s config. Next, check the endstops’ functionality by homing one axis at a time, but keep a finger on the power switch. If the axis starts moving away from the endstop, the HOME_DIR is set wrong.

When the axis moves towards the endstop, try stopping it by triggering the endstop by hand, so that the axis doesn’t crash into the endstop if something is setup wrong. If it doesn’t react to the endstop when homing, you probably have it hooked up to the wrong axis – sending M119 to your printer will tell you which endstop you’re actually triggering at the moment.

Now, before you start printing anything you should also calibrate your extruder if you used an estimated steps per millimeter value for it in the config. Also, set your Z endstop if you haven’t done so already, and you should be able to get your first print out.

So that’s the basic process of getting Marlin running on your board. I hope this video helped you getting started, so as always, please like and subscribe and let me know in the comments what you’d like to see next.

White marlin on the thumbnail/video cover by dominic sherony at: https://commons.wikimedia.org/wiki/Fi…
Video thumbnail consequentially licensed as CC-BY-SA, except for the visual “TOM’S” and “TOM’S GUIDE” trademark.

You can support me without spending a single penny!