Converting a USB printer into a WiFi AirPrint printer with 9$

In my home office, I happen to have a XEROX 6130N: it’s a bit old, but works perfectly. It is actually also an ethernet printer, but 1) I don’t want to move the printer close to the router; 2) I don’t want to get a wire from the router to the printer (2 floors are between them); 3) XEROX 6130N was born before AirPrint, so it does not support it, and given that often I read documents over my iPad, it would be nice that I don’t have to move to the PC to print them when needed. So basically how do I convert it to my USB Printer into a WIFI AirPrint printer?

The simpler solution would have been buying a WIFI print server. Something like TP-LINK-TL-WPS510U seemed to be just perfect. But it is ain’t cheap (45$) and it turned out it has not AirPrint server… should I buy an Apple Airport Express to do that?! 99$ no way 🙂

Then, in January 2016, I started figuring out how to build one myself, and started thinking about a Raspberry PI, but also in that case, including the WIFI shield, the price would not have been cheap. (At that point in time, Raspberry PI Zero was not yet out – around $18 for the board plus a 4GB microSD and a wifi dongle – and you still need the power and usb cable). Finally, digging into internet i found C.H.I.P. except that was not yet shipped (it was a kickstarter), it was perfect, for 9$ you get:

  • WIFI and Bluetooth
  • 1GHz processor
  • 4GB HD
  • 512 MB RAM

chip

It finally arrived on 7th July 2016 🙂

And here is how created my small print server:

  • 1 CHIP
  • 1 USB Power Adapter (with detachable cable, so I could use it also to connect it to my Mac) .
  • 1 USB A-B Cable (to connect to the printer to chip)

Total cost: 18$ (actually I recycled the power adapter and the printer cable, so only 9$).

 

Connecting your CHIP to the WIFI

I don’t have any USB keyboard, so to configure CHIP, I had to connect it to my Mac and use the USB port as a serial port.

Step 1: Connect to CHIP using the USB Serial

From your terminal, list all the serial devices:

$ ls /dev/tty*

Now connect your CHIP to the USB port, wait 30 seconds or so that the boot procedure complete and repeat the command, the list should include a new device. That one is your CHIP! (be careful to use a USB cable that is not only meant to transport power).

Now use screen to connect:

$ screen /dev/tty.usbserial 115200

You’ll then be prompted for login. Defaults are username root and password chip. More details are available here.

At this point in time you are ready to connect your CHIP to the WIFI.

Step 2: List available Wi-Fi networks and connect to the proper network

In the terminal, type

$ nmcli device wifi list

The output will list available access points. Assuming you have a password protected network, you can connect with with the following command:

$ nmcli device wifi connect '(your wifi network name/SSID)' password '(your wifi password)' ifname wlan0

Test the network:

$ ping 8.8.8.8

Everything should work 🙂

Installing CUPS and AirPrint on your CHIP

Now you can disconnect CHIP from your PC, connect it to the power adapter and to the printer!

Great! As first step I recommend to upgrade your CHIP OS.

$ apt-get update && apt-get upgrade

Before doing the all work, it is also good that you check if your printer is recognised:

$ lsusb

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0924:3d60 Xerox
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here it’s our lovely XEROX!

Step 1: Install CUPS

Now we can install CUPS

$ apt-get install cups

Let’s add “chip” user to the printer admin group (so that you can login in the web interface with that account)

$ usermod –aG lpadmin chip

Step 2: Configure CUPS

Let’s now edit the configuration of cups to enable remote access to its admin web interface.

$ nano /etc/cups/cupsd.conf

As first step, we will allow for remote connections. Find the line:

Listen localhost:631

This tells CUPS to only listen to connections from the local machine. As we need to use it as a network print server, we will replace that line with a command that allow connection from any IP on Port 631. Insert:

Port 631

We also need to tell CUPS to alias itself to any hostname as AirPrint communicates with CUPS with a different hostname than the machine-defined one. To do this we need to add the directive ServerAlias * before the first block.

WebInterface Yes
ServerAlias *

This should be enough 🙂

Restart CUPS:
/etc/init.d/cups restart

Open your browser and check if everything works 🙂

screen1

Step 3: Install your printer

In the CUPS interface click on “Adding Printers and Classes” (you will be asked for a user and password, use the same you use to access your CHIP).

screen2

Then click on “Add Printer”.

screen3

Here is our XEROX 🙂 Select it and click “Continue”.

screen4

Now you can set name and other things. To display the printer over the network you need to select “Share This Printer”.

screen5

Select the proper driver and click “Add Printer”. In my case, the CUPS driver was supporting only B&W, so I downloaded the PPD file from the XEROX web site and used that one.

In the following screens, you can configure the default options of your printer.
Once done, test your printer 🙂

Step 4: Install “AirPrint” and finally make your USB Printer into a WIFI AirPrint printer!

This step is super easy 🙂

$ apt-get install avahi-discover

Now from your iPhone / iPad you should be able to print!

You converted your usb printer into a wifi airprint printer!

screen6

Future plans

  1. Introduce printer energy management, remoting control the printer power using CHIP GPIOs interfaced to a Solid State Relay.
  2. Eventually, add a mechanism to start printing only when people a ready to pick up their prints (how many time do you forgot about your printing queue and you waste tons of paper?), this could be done nicely with a RFID reader probably. When you are ready to collect you go to the printer and swipe your RFID card to collect prints.
  3. Print (if I ever buy a 3D printer) a nice case for the CHIP.
  4. Find a very short USB A to USB B male adapter (to reduce pending cables).
Share it!Share on FacebookTweet about this on TwitterShare on LinkedInShare on Google+Email this to someone