Setting custom x/y bed bounds for Anet A8/marlin

I have an Anet A8 that I just flashed with the latest Marlin firmware (1.1.9). I'm sending prints to my printer with Ultimaker Cura via OctoPrint.

I have affixed a PEI surface to my bed that's about 10 mm smaller in each direction than the full size of the bed (that is, I lose about 5 mm on each side of the bed). This hasn't been a huge problem as usually I account for this myself and just make sure there's lots of room on each side of a print, but having upgraded my firmware, I'd like to take advantage of Marlin's bi-linear bed-levelling. Unfortunately, several of the points it chooses are outside the bounds of my PEI surface and so it's impossible to get a decent setting for those points.

What's the "correct" way to configure Marlin to know that my bed size is actually smaller than it thinks it is? Do I need to additionally adjust settings in Ultimaker Cura and/or OctoPrint?

As you just flashed your own Marlin, you probably have the marlin.ino and its associated files in the Arduino IDE set for your Processor and board and know how to work with them to some degree. This is just the short version where to find what you need to change the bed size, if the marlin.ino is based on the marlinfw-release.

Changing "home"

In Configuration.h there should be a set of lines that reads akin to this:

// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 200


Usually it is faster to use Ctrl+F and then typing in X_MIN_POS and adding the hook in front of Search all Sketch Tabs and then moving through all the finds till the right one pops up. This not only brings you right to the lines you want to alter, but also covers up the bases in case the distribution you work with did put the movement limits into a different location like Configruration_adv.h.

Changing Bed Size

Alter these minimum positions and make sure that the Maximum positions (usually just after them) to fit the maximum of the bed.

If you reduced your bed size, you also might need to change X_BED_SIZE and Y_BED_SIZE, which (in the marlin.ino) is in the same Configuration.h - I found it to preceede the Travel limits:

// The size of the print bed
#define X_BED_SIZE 200
#define Y_BED_SIZE 200


Adjust these as needed to fit the new sizing.

Hint: Getting the Values for Adjusting

For finding the adjusted values, I have had good experiences using Repetier Host on Manual Control to move the nozzle (lifted 1mm to prevent any accidents) into the correct XY-position and taking this position as adjustments for the minimum positions. Finding your personal settings is a bit of a trial and error still, so take your time.

Finishing up

Now, recompile the marlin.ino (the checkmark in the top left) to check for errors and flash the new firmware it.

• Thanks! The starting (x,y,z) values in my config were (-33, -12, 0) and it took me a bit of experimentation to figure out that to adjust the bounds of the bed 12mm right and 5mm back I needed to go to (-45,-17,0), but having sorted that out (and adjusted the max positions accordingly) everything seems to be working the way I'd expect. Aug 15 '18 at 23:00
• @AwesomeTown remember to adjust the ?_BED_SIZE correctly - I forgot to include their lines in the old version, fixed that. Aug 16 '18 at 7:39