Printing on the Brother HL-2270DW printer using a Raspberry Pi

Although the below directions work on Raspberry Pi, they should also work on any other system. The brother-provided driver does not run on arm processors[1] like the raspberry pi, so we will instead use the open-source brlaser[2].

Edit: This setup should also work on the following Brother monochrome printers, just substitute the name where needed:

  • brlaser 4, just install from package manager: DCP-1510, DCP-1600 series, DCP-7030, DCP-7040, DCP-7055, DCP-7055W, DCP-7060D, DCP-7065DN, DCP-7080, DCP-L2500D series, HL-1110 series, HL-1200 series, HL-L2300D series, HL-L2320D series, HL-L2340D series, HL-L2360D series, HL-L2375DW series, HL-L2390DW, MFC-1910W, MFC-7240, MFC-7360N, MFC-7365DN, MFC-7420, MFC-7460DN, MFC-7840W, MFC-L2710DW series
  • brlaser 6, follow full steps below: DCP-L2520D series, DCP-L2520DW series, DCP-L2540DW series (unclear, may only need 4), HL-2030 series, HL-2140 series, HL-2220 series, HL-2270DW series, HL-5030 series

Also, all these steps are command-line based, and you can do the whole setup headless (no monitor or keyboard) using SSH.

  1. Get the latest raspbian image up and running on your pi, with working networking. At the time of writing the latest version is 10 (buster)–once 11+ is released this will be much easier. I have written a convenience tool[3] for this step, but you can also find any number of standard guides. Log into your raspberry pi to run the following steps
  2. (Option 1, not recommended) Upgrade to Debian 11 bullseye (current testing release). This is because we need brlaser 6, not brlaser 4 from debian 10 buster (current stable release). Then, install the print system and driver[2]:
    sudo apt-get update && sudo apt-get install lpr cups ghostscript printer-driver-brlaser
  3. (Option 2, recommended) Install ‘brlaser’ from source.
    1. Install print system and build tools
      sudo apt-get update && sudo apt-get install lpr cups ghostscript git cmake libcups2-dev libcupsimage2-dev
    2. Download the source
      wget && tar xf v6.tar.gz
    3. Build the source and install
      cd brlaser-6 && cmake . && make && sudo make install
  4. Plug in the printer, verify that it shows up using sudo lsusb or sudo dmesg. (author’s shameful note: if you’re not looking, I find it surprisingly easy to plug USB B into the ethernet jack)
  5. Install the printer.
    1. Run sudo lpinfo -v | grep usb to get the device name of your printer. It will be something like usb://Brother/HL-2270DW%20series?serial=D4N207646
      If you’re following this in the hopes that it will work on another printer, run sudo lpinfo -m | grep HL-2270DW to get the PPD file for your printer.
    2. Install and enable the printer
      sudo lpadmin -p HL-2270DW -E -v usb://Brother/HL-2270DW%20series?serial=D4N207646 -m drv:///brlaser.drv/br2270dw.ppd
      Note, -p HL-2270DW is just the name I’m using for the printer, feel free to name the printer whatever you like.
    3. Enable the printer (did not work for me)
      sudo lpadmin -p HL-2270DW -E
    4. (Optional) Set the printer as the default destination
      sudo lpoptions -d HL-2270DW
    5. (Optional) Set any default options you want for the printer
      sudo lpoptions -p HL-2270DW -o media=letter
  6. Test the printer (I’m in the USA so we use ‘letter’ size paper, you can substitute whichever paper you have such as ‘a4’).
    1. echo "Hello World" | PRINTER=HL-2270DW lp -o media=letter (Make sure anything prints)
    2. cat <test document> | PRINTER=HL-2270DW lp -o media=letter (Print an actual test page to test alignment, etc)
    3. cat <test document> | PRINTER=HL-2270DW lp -o media=letter -o sides=two-sided-short-edge (Make sure duplex works if you plan to use that)
  7. (Optional) Set up an scp print server, so any file you copy to a /printme directory gets printed. For the 2270DW, I also have a /printme.duplex directory.

[1] brother driver does not work on arm (also verified myself)
[2] brlaser, the open-source Brother printer driver
[3] rpi-setup, my convenience command-line script for headless raspberry pi setup
[4] stack overflow answer on how to install one package from testing in debian

Tagged , , . Bookmark the permalink.

10 Responses to Printing on the Brother HL-2270DW printer using a Raspberry Pi

  1. Joel says:

    There appears to be a typo in step 5A. The page currently reads “lpinfo -m” but I believe should be “lpinfo -v”. Per the man page, the m flag lists drivers and the v flag lists devices.

    The USB device can be found in the -v output for step 5A but the driver can be found in the -m output for step 5B.

  2. Scott says:

    Thank you so very much for this. Worked like a charm.

    Any tips on how to print over the network?

  3. rathesun01 says:

    Awesome post. Joel is supposedly correct. It should have been “lpinfo -v” in the step 5A.

  4. admin says:

    Corrected ‘lpinfo -v’, thanks.
    No clue how to print over the network, sorry. That’s actually why I set up a raspberry pi to connect to the printer instead–it’s my wifi interface.

  5. steve says:

    I have the Brother HL-2270DW, and I had to install from source to get it to work. I’m not using USB, but port forwarding across via NAT to another internal network.

    I just used the cups admin pages to complete setting things up. Before using this package, I picked some other closely related printer. It was printing the page, sucking it back in, then finally printing. Not terrible, but I was annoyed. Now it’s perfect!

    For printing over the network, I used the socket::9100 setting. No idea the command line knobs or dials, just did it through the cups web page.

    Another reason for me to do this is now my little rasperry pi zero w shows my printer as an AirPrint printer, so now I can print from my iDevices. Brother has their own app for this printer, but I was annoyed having to install a special app for this. My HL2270DW was made without AirPrint. It’s a fine little machine and don’t want to throw it out.

    • Jaye Horn says:

      How did you install from source? and how did you do the port forwarding across via NAT to another internal network? I’m new to this so any help would be very much appreciated.

      Thank you.

  6. Job says:

    Would this work for brother hl-l2395dw scanner?

  7. Adam Trask says:

    Thanks so much for posting this. This helped get my HL-L2300D working properly.

  8. Danial Foster says:

    >>> (author’s shameful note: if you’re not looking, I find it
    >>>surprisingly easy to plug USB B into the ethernet jack)

    I smiled when I saw this because you are clearly a ding dong; that sounds like a rookie mistake.

    I couldn’t get your instructions to work, so I tried troubleshooting through Google. Couldn’t figure it out. sudo lpinfo -v | grep usb wasn’t showing jack.

    It was because I had my USB B plugged into the ethernet jack of my BR-2270DW.

    Everything works now. Thank you so much.

  9. J Bot says:

    Any steps to do this with a wifi connected HL-2270DW? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *