2022-10-30

Adding WiFi to HP Laserjet Pro M15a with Raspberry Pi B+

 I have an old Raspberry Pi B+ since 2014. Did some experiments back then, even made it to broadcast a FM radio within 50m radius, but now I`m giving to it a new, particular tasks to do - make my simple and cheap HP LaserJet to be found in the local home network. 

So, I will need a few things. Firstly, a fresh SD Card with Legacy Raspbian OS, CLI. (While installing with Raspberry Pi imager, it is convenient to set all the necessary settings like enabling ssh and home wifi , so no monitor and external keyboards will be neccessary.) Then, install PuTTY. 

Finding the ip address of the pi can be done through home router (if DNA automatically assigns it), or ... attach it to separate monitor or keyboard.

Then, when you log in via ssh - first things - 

sudo apt update 

and 

sudo apt upgrade

When repos are set, next thing is installing CUPS (Common UNIX printing system). 

sudo apt-get install cups 

It is not enough tho. HP Laserjet Pro M15a will need hp drivers. This is where hplip can be helpful.

sudo apt-get install hplip

 

After HP drivers are installed, the CUPS needs to be configured so its admin page is available from any computer within my network.

So a CUPS configuration file needs a few modifications.

Editing /etc/cups/cupsd.conf:

 

# Listen on external interfaces for connections

Listen TheIPofMyRaspberryPI:631

Listen /var/run/cups/cups.sock

 

# Show shared printers on the local network.

Browsing On

BrowseOrder allow,deny

BrowseAllow all

BrowseAddress All

 

# Default authentication type, when authentication is required...

DefaultAuthType Basic

 

# Restrict access to the server...

<Location />

  Order allow,deny

  Allow localhost

  Allow All

</Location>

 

# Restrict access to the admin pages...

<Location /admin>

  Order allow,deny

  Allow All

</Location>

 

# Restrict access to configuration files...

<Location /admin/conf>

  AuthType Default

  Require user @SYSTEM

  Order allow,deny

  Allow All

</Location>

 

And now I can restart the service.

sudo service cups restart 

or 

sudo /etc/init.d/cups restart

 

Now lets add Raspberry Pi user to the lpadmin group

sudo usermod -a -G lpadmin your-username

 

Now the printer should be visible in the CUPS configuration page.

Opening the CUPS conf page on the browser - CUPS port is 631 

http://raspberrypiIPaddress:631

Navigate to add a printer. 

Now you should be able to see a printer in the list. 

 

In the end let`s make a Raspberry Pi having a static ip address. I have Mikrotik router. 

Under the section IP find DHCP server and select the Leases tab there. Find your RPi there, click on it, and click on the button "Make Static"

 

Then add printer on your local devices. It should show up.



 

Happy printing!

 

 


Nav komentāru:

Ierakstīt komentāru