SPEER – Samsung Printer EEprom Resetter for Raspberry Pi

Project Speer

Project Speer

Samsung Printer out of Toner?

The toner cartridges for the Samsung CLP-510 series printers contain an internal page counter. It will stop printing once a certain preprogrammed page count has been reached. Usually this does not mean that the toner toner cartridge is actually empty. Depending on the average degree of toner coverage, the cartridges could still be used for many hundreds more pages. It also prevents the printer from using the cartridges even if they have been refilled with new toner.

The toner cartridges contain a little board with a ST24C04 chip, which is a 4 Kbit Serial I²C Bus EEPROM. This is where Speer comes into play. It is a python script which can backup, restore and reset the content of that EEPROM. There are three contacts exposed on the side of the toner cartridge. Those three contacts need to be connected to the I²C-Bus of the Raspberry Pi. Speer is then able to read from and write back to the EEPROM.

The script will in theory run on any other Platform which provides the smbus python package. It was however only tested with a Raspberry Pi.

If you are interested in how this all works internally, you can also read my blog post Reset the Toner Cartridge of a Samsung CLP-510 with a Raspberry Pi.

But if you are only interested in getting your printer working as fast as possible again, take the following steps:

Downloading Speer

Speer is just a single Python script called speer.py. It’s open source and hosted on Github. It can be either downloaded straight from the Github website:

Project Speer on Github

Or you can use git to clone the source to your system:

git clone https://github.com/nharrer/speer.git

Wiring the Cartridge to the Raspberry Pi

The three contacts on the toner cartridge need to be wired to three pins of the GPIO header of the Raspberry Pi:

  • Raspberry Pi Pin 3 SDA –> left connector on toner (red wire)
  • Raspberry Pi Pin 5 SCL –> right connector on toner (green wire)
  • Raspberry Pi Pin 6 GND –> middle connector on toner (black wire)

An easy way is to solder some crocodile clips to a 0.1″ female header connector. Here are some example photos:

Note that the pictures above show a Raspberry Pi Model B+ which has a 40 pin GPIO header. The older models A and B have only 26 pins. The pin layout is however the same. It’s also the pins 3, 5 and 6 that need to be connected with model A or B.

Enabling I²C on the Raspberry Pi

I²C is not enabled by default in Raspbian. First, you need to add the i2c modules i2c-bcm2708 and i2c-dev. Edit /etc/modules:

sudo nano /etc/modules

Add those two lines.

i2c-bcm2708
i2c-dev

Now comment out the module in /etc/modprobe.d/raspi-blacklist.conf (only necessary if the files exists):

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Put a # in front of the following line:

blacklist spi-bcm2708
#blacklist i2c-bcm2708

On newer Raspbian kernels it might also be necessary to enable I²C in raspi-config:

sudo raspi-config

In Advanced Options select and enable I2C.

After a reboot, the modules should be loaded by default. You can check with lsmod:

lsmod
Module                  Size  Used by
...
i2c_dev                 5769  0
...
i2c_bcm2708             4943  0

Using Speer

Speer depends on the Python package python-smbus. On Raspbian this can be installed with:

sudo apt-get install python-smbus

Also make sure to run Speer with root privileges. Either log in as root or use sudo:

sudo ./speer.py
usage: speer.py [-b <filename>] [-x] [-r <filename>] [-z] [-w] [-h]
                [--bus <bus>] [--addr <addr>]

commands:
  -b <filename>  backup EEPROM to file
  -x             output hex dump of EEPROM
  -r <filename>  restore EEPROM from file
  -z             auto-zero page counter in EEPROM
  -w             print wiring information

optional arguments:
  -h, --help     show this help message and exit
  --bus <bus>    i2c-bus (default: 1)
  --addr <addr>  i2c-address (default: 0x56)

The different color cartridges have different I²C addresses:

  • 0x50: Yellow cartridge
  • 0x52: Magenta cartridge
  • 0x54: Cyan cartridge
  • 0x56: Black cartridge

Speer tries to auto-dectect the address if the –addr argument is not given. A wrong address might however be detected if there are other devices on the I²C bus.

Displaying the Content of the EEPROM

You can use argument -x to just display the content of the EEPROM as a hex dump. It should look similar to the example below. The first few letters should be SAMSUNG.

pi@raspberrypi ~/samsung/speer $ sudo ./speer.py -x
Read passage 1 of 10.
Read passage 2 of 10.
Read passage 3 of 10.
Data was read consistently for 3 times.
00000000  53 41 4d 53 55 4e 47 e3  ff ff ff ff ff ff ff ff  |SAMSUNG.........|
00000010  ff ff ff ff ff ff ff ff  43 4c 50 35 31 30 ff ff  |........CLP510..|
00000020  32 30 30 39 2e 31 30 ff  6b 2d 30 39 31 30 32 30  |2009.10.k-091020|
00000030  37 36 33 35 38 ff ff ff  ff ff ff ff ff ff ff ff  |76358...........|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff 00 ff ff ff  |................|
00000050  00 ff ff ff 01 ff ff ff  01 e7 a0 d0 ff ff ff ff  |................|
00000060  ff ff ff ff ff ff ff ff  02 2e 10 38 ff ff ff ff  |...........8....|
00000070  ff ff ff ff ff ff ff ff  02 8a 2b c0 ff ff ff ff  |..........+.....|
00000080  ff ff ff ff ff ff ff ff  00 00 00 01 ff ff ff ff  |................|
00000090  00 00 1c 0f ff ff ff ff  aa bb ff ff ff ff ff ff  |................|
000000a0  30 39 39 39 39 ff ff ff  ff ff ff ff ff ff ff ff  |09999...........|
000000b0  ff ff ff ff ff ff ff ff  45 55 ff ff ff ff ff ff  |........EU......|
000000c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
000000f0  53 41 4d 53 55 4e 47 e3  43 4c 50 35 31 30 ff ff  |SAMSUNG.CLP510..|

Backing up the Content of the EEPROM

The argument -b followed by a file name can be used to back up the content of the EEPROM to that file. It is important that you always BACKUP the content before doing any write operations.

pi@raspberrypi ~/samsung/speer $ sudo ./speer.py -b black.bak
Read passage 1 of 10.
Read passage 2 of 10.
Read passage 3 of 10.
Data was read consistently for 3 times.
Backing up EEPROM to file black.bak.

Resetting the Page Count

The argument -z is used to set the page count back to zero.

pi@raspberrypi ~/samsung/speer $ sudo ./speer.py -z
Read passage 1 of 10.
Read passage 2 of 10.
Read passage 3 of 10.
Data was read consistently for 3 times.
Resetting pager counter.
Writing content back to EEPROM.
Writing 256 bytes:
................................................................................................................................................................................................................................................................
Verifying data:
Read passage 1 of 10.
Read passage 2 of 10.
Read passage 3 of 10.
Data was read consistently for 3 times.
Written data verified successfully.

Restoring a Previously Made Backup

If something went wrong you can restore the content of the EEPROM from a previously made backup. You can also make a backup of the EEPROM when the toner cartridge is new. And restore the backup once the cartridge has been refilled with new toner. This might be an option if you have a different printer model where the -z option does not work.

pi@raspberrypi ~/samsung/speer $ sudo ./speer.py -r black.bak
Restoring EEPROM from file black.bak.
Writing 256 bytes:
................................................................................................................................................................................................................................................................
Verifying data:
Read passage 1 of 10.
Read passage 2 of 10.
Read passage 3 of 10.
Data was read consistently for 3 times.
Written data verified successfully.

12 Comments

  1. Daniel Brice says:

    Hi, I have a quick observation to share in relation to resetting the Samsung CLP-510 cartridges using SPEER.

    The default address of 0x56 works for the black cartridge only, at least in the ones I used. The other addresses used for the cartridges were 0x50 for yellow, 0x52 for magenta, and 0x54 for cyan.

    I hope this helps anyone that may run into any issues resetting all of their cartridges.

    Thanks for the wonderful tool and all the effort put in to figuring all this stuff out.

    Daniel

    • norbert says:

      Sorry for the late reply (only three month later).

      And thanks for that observation. I completely forgot to mention that. In the mean time I added an auto-detect feature for the I2c-address. So it should work now for all color cartridges without having to specify the address explicitly.

      Thanks,
      Norbert.

  2. PierreCZ says:

    Hi,
    I'd like to ask - will it works for printer Samsung CLP-415N ?

    Thank you in advance for your reply.

  3. Okumu says:

    Thanks for this info.
    However, I have a Samsung ML2164 Monochrom.
    How can I reset the page counter?
    Pls Help if you can

  4. Rob Collisson says:

    Is there a program/device for Samsung CLX-4195FW printer cartridges?
    Black
    Yellow
    Magenta
    Cyan

  5. Paolo says:

    I need the dump file written on the eeprom 24c512 for a Samsung CLX 4195FW printer.
    Can you help me?


Trackbacks/Pingbacks

  1. Reset the Toner Cartridge of a Samsung CLP-510 with a Raspberry Pi — netzgewitter

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*