Part 4, Install Scanner Server

– How to add WiFi to a multifunction printer using Raspberry Pi –

PART 4: INSTALL SCANNER SERVER

In the previous part we configured the IP address of the Raspberry Pi. In this article, instructions are given to install scanner server software SANE. Configuration makes it accessible from the local network.

23) Install internet daemon xinetd

sudo apt-get install xinetd

As a result, your has the better intenet daemon, which makes managing sevices provided via sockets easier.

24) Install Scanner server software SANEwith some utilities

sudo apt-get install sane-utils

The package contains sane utilities including saned SANE daemon.

25) Installing scanner server requires to add / edit new udev rule for scanner, to enable access:

sudo nano /etc/udev/rules.d/65-libsane.rulesprinter

contents of the new rule line:

ACTION==”add”, ENV{DEVTYPE}==”usb_device”, ENV{libsane_matched}==”yes”, RUN+=”/bin/setfacl -m g:scanner:rw $env{DEVNAME}”

26) find path of saned

which saned

Presuming, it is /usr/sbin/saned , as it shoud be with Raspbian Buster Lite

27) Check that saned is added to services

sudo cat /etc/services | grep sane

EXPECTED OUTPUT:

sane-port 6566/tcp sane saned  # SANE network scanner daemon

28) Add saned to xinetd config, so internet daemon will listen and provide sane-daemon service:

sudo nano /etc/xinetd.d/sane-daemon

Add/Edit contents to:

service sane-port
{
  socket-type = stream
  server = /usr/sbin/saned
  protocol = tcp
  user = saned
  group = saned
  wait = no
  disable = no
}

29) Edit sane daemon config, adding your current wlan subnet as permitted.

sudo nano /etc/sane.d/saned.conf 
# Leaving only uncommented line as
192.168.1.0/24

30) Add user lp to saned group 

sudo adduser saned lp

31) Enable saned socket to receive and send

sudo systemctl enable saned.socket
32) Check saned socket status

sudo systemctl status saned.socket

33) Get free client software: SwingSane

I recommend SwingSane. It is quite functional. Eve so, on Windows the custom scanning settings had to be used always to get good scanning results.

Color mode and resolution 200 (dpi), br-x 215, br-y 297
Working Swing Sane Custom Settings

Install SwingSane to a client computer. Then, configure it by adding new scanner by IP address. In this point, you can give it any name you want. The Remote Address is the address of the Raspberry Pi, and the SANE port number is 6566. 

34) Do a test scan

As a result, of the installs and configuration, you should have now a printer – scanner with a WiFi connection, that can be reached over the wireless local area network.

I didn’t make this all up by myself. Some partial instructions were helpful. Therefore, I give them credit and backlinks:

How to add WiFi to a multifunction printer with USB using Raspberry Pi – Part 3, Set Fixed IP Address

PART 3: SET FIXED IP ADDRESS

In the previous part, we configured the printer server, now we may want to set a fixed IP address, which makes configuring the scanner software easier, and also facilitates printer search too. The IP address range used by router’s DHCP should not be used for fixed addresses, but you may be able to set a fixed DHCP address for the raspberry in the router’s config, so that the DHCP always gives the same address to the device (which it reconginzes in WLAN by its MAC address).

21) Plan the place of the Raspberry Pi in your Local Area Network

Let’s think about configuring your RPi to have a fixed IP address in the WLAN. You can either program your WLAN router to always give the same IP address to the RPi:s WLAN adapter, or select an address within the subnet and out of the DHCP range in use. In this writing, we take the latter route, i.e. setting the IP address out of the DHCP range; assuming that DHCP is giving addresses starting from 192.168.1.10 and ending to 192.168.1.200, we pick an address in range 201-254, say, 192.168.1.245. This depends of course of your subnet configuration. If you have router management IP in 192.168.1.1 and the IP V4 net mask is 255.255.255.0, and you have nothing in your net with IP address 192.168.1.245, you’re good to go with my settings.

22) Configure the IP V4 address via DHCP

Configure the dhcp daemon to make the IP address a static one; consult iwconfig to get the name of your connected wlan interface. In the system configuration step, raspi-config , section Network – 2, you should have  set “Enable Predictable names” to get wlan0 instead of something like wlx01234678ABCD. Now, edit dhcp configuration file:

sudo nano /etc/dhcpcd.conf

#Add to beginning:

nohook lookup-hostname
interface wlan0 # wlan0 is the typical name for the wireless lan (wifi) interface, but it may be also longer
static ip_address=192.168.1.245/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 # of whichever DNS you want, for example, 192.168.1.1, 8.8.8.8 will also do.

Save and then restart DHCPD, or just reboot.

Now we have set fixed IP address for the Raspberry Pi. Please note that if you configured the printer in the PC using IP address, you may want to reconfigure the address now.

In the next part we will configure the scanner server.

How to add WiFi to a multifunction printer using Raspberry Pi – Part 1

Add wifi to printer!

Dear reader, I got a good but old photo-quality printer, but it was missing wireless connectivity. Even if its tradeable value is around 50 euros, it still works very well. I also avoid generation of unnecessary waste, so you might think this a “greenish” project, as a no new printer needs to be produced in China and hauled to Europe. Now, add wifi to printer!

Printer scanner
Epson RX 520 printer scanner device

The raspberry Pi came to rescue, bought it from Amazon for about 22 euros and 4 euros for the case. Despite being an economical option, I’m glad that the original Raspberry Pi’s are made in Sheffield, England, which still qualifies to geographical Europe.

Raspberry Pi 3 A+
The fast but small Raspberry Pi 3 A+

This is a recipe how to make a wireless (WLAN/WiFi) printer and scanner from a plain USB printer/scanner. To accomplish this, a  Raspberry Pi with Raspbian Linux and free server software cups and sane are used. 

It’s is updated, completed and checked for Raspbian buster operating system, I have collected information from many sources as there were no single, updated source to accomplish my mission to equip a USB printer with WiFi. This is important, it saves a good printer to go prematurely to waste! You may save a tree, as you reduce the of use nonrenewable resources! Especially, if you don’t give up printing, use of computer, buying a Raspberry pi…. 😀 

The journey is lenghtly, so prepare to spend a few hours with this! I’ve split the story to four parts. Easy? Yes, if you can already do something with Raspberry shell. In other words, this is for those who are past the first beginner steps, and can work with a command line. For people who see this difficult or troublesome I’d be happy to make and sell these for… say for 90 €. Hence, when you get a new printer for 90€, the project is not commercially very attractive, better to think it in DIY basis.

PART 1: PREPARE A RASPBERRY PI

Obviously, a Raspberry Pi is needed. I tried it first with a Raspberry Pi [1] B+ v1.2, the old one from 2014, but it’s sluggish on large prints and scans, so I ordered a Raspberry Pi 3 A+, which has sufficient connectivity for this application and besides, is cheap (I paid 22 € on Amazon.es).

The USB charger can be almost any that can supply real 5 V / 2.4 A of current, but I got some low voltage warnings with an insufficient cable.

If you only have a RasPi without wifi, you can use many old adapters. While two decades ago, Linux WiFi compatibility was a nightmare, it no longer is. In my stocks of old junk, I found a Linksys WUSB54GV4 “Wireless-G” WiFi adapter which is no longer detected by Windows 10 but works perfectly with Linux!

1) Hardware list

This is what I had, you may consider it a recommendation but no obligation.

  • Raspberry Pi 3 A+ (other models would do as well), costs about 25 €.
  • A case for the Raspberry Pi, with slots for power and USB cable.  4 – 10 €. You may use even a cardboard box.
  • Phone usb Power supply 2.4 A with a good microUSB cable. Less than 10 €.
  • 4 GB microSD card (I had a 8 GB, no problem), Less than 10 €.
  • A USB printer-scanner, model supported by SANE: Epson Stylus Photo RX520
    (Printer has to be supported by the CUPS)
    (List of SANE supported scanners here: http://www.sane-project.org/sane-mfgs.html)

The acessories required to configure the conveniently the Raspberry Pi:

  • Display with a HDMI input, You should have one already…
  • HDMI cable or cable with HDMI adapter -> to the display type. Came with the monitor, didn’t it?
  • USB keyboard (I had a Logitech K400+). Any USB keyboard will do.
  • Optionally, a USB hub to if you want to connect the keyboard and the printer same time to a Raspberry Pi with one USB port same time. 10 €

At the moment, I don’t advertise or have affiliations for now (also thanks to the old-fashioned Spanish taxation system for extra income). To give a glue, where I have got the items: I often buy used stuff from CashConverteres, CeX or Ebay. You can get a new parts like Raspberry Pi and the SD card from kubii.fr, amazon.es or even Carrefour or Alcampo.

2) Download a free operating system for the Raspberry Pi

download raspbian buster lite from here: https://www.raspberrypi.org/downloads/raspbian/

3) Flash the operating system ISO image to a microSD card

For example, balenaEtcher from here: https://www.balena.io/etcher/ will do the job. Rufus is also good.

4) Connect your Raspberry Pi to peripherals

Plug in the microSD Card, connect a display via HDMI and a keyboard via USB.

Hint: there are HDMI to DVI-D and HDMI to VGA adapters to make use of old display units.

5) Add Wifi adapter if Raspberry Pi does not contain it

On a Rasberry Pi 1 type boards and some others, there is no WiFi adapter. In that case, plug in a supported WiFi adapter to a USB port.

6) Connect power

Power with 2 amp phone charger with microUSB connector.

7) Booting

Raspberry Pi should boot and you get the usual dump on your display.

8) Login from local console

Use the keyboard and display connected to the Raspberry Pi. 

Login: pi Password: raspberry

These are the login and passsword after fresh installation.

9) Make first fundamental configurations to RasPi.

Configure the RPi with 

sudo raspi-config
  • in 4) Localization options to get the right keyboard layout (Default is US keyboard)
  • At Network Options N1 you may want to give the print server a name
  • You must setup WiFi network connection in Network Options N2, This way you can connect to your WLAN 
  • in Network Options N3 you may want to set also predictable interface names. As a result, you’ll get network interface names like wlan0.
  • in Interfacing Options you may want to enable SSH access (if you don’t have an extra display or USB HUB, you’ll want to connect from your computer with e,g, PuTTY) . If you enable SSH, you should change the password for the default user pi with the command passwd

Finish raspi-config and reboot

10) Update the operating system and included software 

First get updates, remember you need the wlan connection. Reboot to take the updates to use

sudo apt-get update
sudo apt-get upgrade
sudo reboot 

The next article will show how to configure the CUPS printer server in Raspberry Pi.