Category Archives: Electronics

Notes on Marlin – Auto Bed Levelling

Upon enabling the auto bed levelling feature of the Marlin firmware I learned a thing or two through trial and error and wished it had been better documented so I’ll try and let you know what I’ve learned.

Here are links to some useful information that all helped me get setup:

Firmware setup
Hardware setup
PrintrBoard setup

In the Marlin firmware, where you set the left, right, back and front positions for probing, do not set the left and front positions below 10.  I tried 5 (assuming the bigger the test area the better results you would get) and wondered why moving the nozzle back to X0 Y0 after homing resulted in the nozzle crashing both X & Y in to the min endstops.  I quickly noticed that at the start of the probing both the nozzle did not move in either X or Y so they were both then 5mm out when homing after the probing.  I now use 20 for left and front.

I also found that if you just move X & Y to home before probing and your nozzle is quite high in relation to the bed then the bed probe would stop way before it even touched the bed.  I thought I’d fix this by homing the Z before probing but you need to make sure that the probe is within your bed probing co-ordinates (i.e. the middle of the bed, or at least more than you’ve set for left and front).

So here is my start G-Code* that I’ve put in to Slic3r:

G28 X0 Y0 ;home X & Y
G1 X100 Y100 F5000 ;move nozzle to centre of bed
G28 Z0 ;home Z
G29 ;probe bed
G90; set absolute coordinates
G92 E0; reset extruder distance
G1 Z5 F300 ;move nozzle up 5mm for safe homing
G1 X0 Y0 Z0 F5000; move nozzle to home

*If you’re going to use this code then please set your own bed centre and move velocities appropriate to your printer.

If I discover anything more on this topic then I’ll update this post.

Tagged , ,

Marlin – Auto Bed Levelling

A great feature was added to the Marlin firmware last year and I’ve finally gotten round to implementing it on my printer.

There were quite a few hurdles to over-come including designing some new parts to make it work.

I wanted to re-design the whole X – axis for my Mendel-Max as the clamps for holding the X – axis rods were poor and the belt being outside of the 2 rods meant there was a considerable amount of turning force on the parts, especially if you wanted tight belts.

So with the belt now between the 2 rods I had to completely re-design the carriage not only because the belt clamps had to be moved but I wanted to move to a direct-drive extruder on top of designing the probe arm to probe the bed!

With all of the new designs complete there were plenty of adjustments to be made to the firmware.  Moving to a direct-drive extruder meant new E – step / acceleration / speed settings. Enabling the bed levelling, setting up the servo including finding out which pin to assign to the servo for my PrintrBoard.  The biggest hurdle was discovering that by enabling the bed levelling filled the RAM on the PrintrBoard! To make the firmware fit I had to remove parts of the LCD menu.

After you have everything is working you need to set the distance from the hot-end to the micro-switch on your probe arm. Spend some time getting this as accurate as possible makes for the best result and only needs to be done once.

Has it been worth it? YES!

It’s great not having to adjust the bed manually, you can fine tune the distance between the nozzle and the bed in the LCD menu which is far more stable that any screw adjustments.

Tagged , , ,

LCD and Encoder controls (Panelolu) – – – – – – – Part 1, Software

I’d like to first thank the people over at for all the hard work they’ve done in providing most of the work in connecting an LCD and encoder to the PrintrBoard. I’m re-posting this information using the code that works for my PrintrBoard I use on my MendelMax. If this helps you with your machine then please leave a comment.

This code should work with any PrintrBoard connected to either a MendelMax, Printrbot or any 3D printer where you’re using Marlin firmware.

This post has 2 parts, this, the Software part and part 2, the Hardware part which will show the wiring diagrams for the LCD and controls.

The examples given will be using the latest version (at the time of writing) of the Marlin firmware.  Download it HERE

You must first prepare the files Configuration.h and pins.h within the firmware to access the LCD and encoder.


line 48-50

  #define MOTHERBOARD 81

line 78-81

#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 -1
#define TEMP_SENSOR_2 -1

line 216-218

const bool X_ENDSTOPS_INVERTING = false; //set to true to invert the logic of the endstops
const bool Y_ENDSTOPS_INVERTING = false; //set to true to invert the logic of the endstops
const bool Z_ENDSTOPS_INVERTING = false; //set to true to invert the logic of the endstops

line 275 – Obviously change these values to your own printers configuration.

#define DEFAULT_AXIS_STEPS_PER_UNIT   {78.7402,78.7402,200*8/3,760*1.1}

line 279-283 – Not necessary but I like to slow down the acceleration for less ringing when changing direction.

#define DEFAULT_ACCELERATION 1500 //X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 //X, Y, Z and E max acceleration in mm/s^2 for r retracts
#define DEFAULT_XYJERK 12.0

line 302-307

//LCD and SD support
//#define ULTRA_LCD //general lcd support, also 16x2
#define SDSUPPORT // Enable SD Card Support in Hardware Console
#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
//#define ULTIPANEL //the ultipanel as on thingiverse

line 961

#define FAN_PIN            22  // Fan

line 973 – To enable SD card support you must move the Y-endstop to the E-endstop pins (see previous post)

#define Y_STOP_PIN         37

line 989-994

  // these pins are defined in the SD library if building with SD support
    #define SCK_PIN          21  // 9
    #define MISO_PIN         22  //11
    #define MOSI_PIN         23  //10

line 995 add the following

#ifdef ULTRA_LCD
 #ifdef NEWPANEL
  //we have no buzzer installed
  #define BEEPER -1
  //LCD Pins
  #define LCD_PINS_RS        41
  #define LCD_PINS_ENABLE    1
  #define LCD_PINS_D4        11
  #define LCD_PINS_D5        9
  #define LCD_PINS_D6        6
  #define LCD_PINS_D7        4

  //The encoder and click button
  #define BTN_EN1 2  //must be a hardware interrupt pin
  #define BTN_EN2 3  //must be hardware interrupt pin
  #define BTN_ENC 0  //the click

  //not connected to a pin currently
  #define SDCARDDETECT -1

  //from the same bit in the RAMPS Newpanel define
  //encoder rotation values
  #define encrot0 0
  #define encrot1 2
  #define encrot2 3
  #define encrot3 1

  #define BLEN_C 2
  #define BLEN_B 1
  #define BLEN_A 0
 #endif //Newpanel
#endif //ULTRA_LCD

Upload this firmware to your PrintrBoard (how-to).

Once updated restart your PrintrBoard. If you have the LCD connected then it should display data about your printer. If you haven’t connected the LCD to your PrintrBoard yet then it’s worth attempting to connect your computer to the PrintrBoard to make sure everything is still working correctly.

Tagged , , , ,

Latest Marlin firmware for PrintrBoard

Recently I had noticed that the version of Marlin I was using on my 3D printer (using a PrintrBoard as the control board) was Marlin v1.0.0 RC2 and looking on GitHub there had been quite a few changes since this version was released.

Although a lot of work making it compatible with a PrintrBoard had already been included I needed to make a few alterations to get it working fully.

Code alterations I’ve made include:

  • change motherboard, temp sensors, endstops not inverting, included SD and LCD support to Configuration.h
  • swapped Y endstop pin to E endstop pin, added LCD, encoder and SD card pins to pins.h

Obvious updates include:

  • X & Y location on LCD home screen
  • Long filenames on SD card support
  • Move Axis by 10mm, 1mm or 0.1mm increments

You can download the version of Marlin I’m using here.  Don’t forget to adjust the calibration figures to your printers requirements.

Tagged , , ,

CDC Bootloader – PrintrBoard

I’d just like to add before I start that messing with the fuses and bootloaders may result in bricking your board, just don’t blame me if it goes wrong!

Credit for this post goes to Lincomatic.  I’m posting my methods and what I did to get my board working.  I also think having this information available it good for everyone. So…

I’m working on OSX 10.7.4 with a PrintrBoard Rev. D and here are the files I’m using :

CDC Bootloader, courtesy of Lincomatic – Link

AVRdude, “how-to install” link

Here are the steps I went through:

      1. Install AVRdude
      2. I bought and built the USBtinyISP kit from
      3. Connect the 6 pin socket on the USBtinyISP to the 6 pin header on the PrintrBoard so the RED wire on the ribbon cable is closest to the SD card socket.
      4. Add a jumper to the boot pins of the PrintrBoard, power it up, then press the reset button.  (For Rev. A, B & C PrintrBoards you remove the boot jumper)
      5. To set up the required space to upload the bootloader and free up some extra pins on the PrintrBoard set the “fuses“.  To do this paste and run the following code into Terminal:

avrdude -c usbtiny -p at90usb1286 -U lfuse:w:0xde:m -U hfuse:w:0xdb:m -U efuse:w:0xf0:m

      1. Then upload the CDC Bootloader, (make sure the path for the hex file is correct*).

avrdude -c usbtiny -p at90usb1286 -U flash:w:BootloaderCDC.hex:i

(note AVRdude will give a verification error, ignore it as the programmer can program but can’t read back large files)

      1. At this point you should power down the PrintrBoard and remove the 6 pin cable.  You’re now ready to upload your firmware.

See the next post for how to configure your computer to upload the Marlin firmware to your PrintrBoard.

*the easiest way to get the right location of the bootloader.hex file is to type the first part “avrdude -c usbtiny -p at90usb1286 -U flash:w:” then drag the file into the terminal window over the text.  This fills in the location for the file, then don’t forget to type “:i” at the end of the line.

Tagged , , , , , ,

It’s a Post-PC world

It talks

Whilst I was waiting for printer parts to arrive I’ve been playing around trying to get a display and encoder to work with my chosen printer control board, the Printrboard.  The Printrboard was designed to be used with the Printrbot but isn’t limited to it.

Fortunately very shortly after I purchase the Panelolu kit Tony who builds the kits had written a post about interfacing with the Printrboard.  Unfortunately in his haste to tell the world there were a few pin & code errors found and after a few emails back and to the LCD displayed data from the Printrboard. SUCCESS!

There is a MicroSD slot built on to the Printrboard where you can load G-Code using the rotary encoder and the display and print without an attached computer.

Tagged , ,