Sonntag, 17. Januar 2016

How to reset the toner chip of a CLP-510, or learning I2C with Arduino

Some weeks ago I have got a laser printer Samsung CLP-510 for free. It replaced my old laser printer with an damaged transfer belt(At this point I didn't know I just refilled the wrong toner what caused the bad printing quality, but that's another story). Of course it didn't take long till I got the message of empty cartridges.

Well, we all know it's not the problem to refill the catridges, but to make the printer believe you have done it. It's about resetting the counter chip on each catridge. Google brought some old articles with broken links to DOS programs and a Raspberry project. Because we are not makers when consuming other peoples work and because of christmas vacation and spare time, I desided to play with it. On top of that it gave me the opportunity to settle two tasks I had in mind for a long time, but never had an opportunity for it. Firstly I wanted to work with the I2C-Bus and secondly I wanted to have a serial monitor with a command history.

My plan was to write an arduino sketch to read and write the chips and a serial monitor which allows to dump the chip content to a file and to write it back.

For all visiters really wanting to refill the CLP-510 I cover the whole process.

1. Open cover


First of all we need to remove 4 screws to open the cover of the chip and the refill opening .
Remove 1 screw from the ride side of the catridge(On the foto the catridge is upside down.).

Remove 4 screws from the bottom side of the catridge.


 2. Refill powder


Next to the chip you can see the round opening. You have to remove the cap with pliers.

Pull the rubber cap to remove it. Hold it with pliers at the rim.
After removing the cap, refill the catridge and put the cap back on the catridge to close it. Be carefull and don't breath this ;-) Finally put the cover back on the catridge and fix it with the 4 screws.

That was the boring part, but now it's getting interessting.

3.Connecting the Chip to the arduino


On the circuit board you find three connection points marked as SDA-CRUM, DGND and SCL_CRUM. It didn't take long to find out this is about I2C and this is where arduino and the wire library comes into play.

Connecting the chip to the arduino is really simple, it just takes two pull-up resistors and some wires.

Pull up the pins SDA and SCL to 3.3 V power source. I am using an Arduino Mega where SCL is port 21 and SDA is port 20. Than connect SDL_CRUM from the toner chip to SDL from the Arduino and SDA_CRUM from the toner chip to SDA to the Arduine. And finally connect DGND from the toner chip to GND from the Arduino. That's it. You don't have to remove the chip from the tomer catridge, I just had one laying round and it's more comfortable to take pictures from it.

We have connected the chip to the Arduino and now we can start to communicate with it.

4. Finding devices on a I2C bus


I never used the wire library before and I was surprised by the small number of methods it has.
On Wikipedia I read each device on a I2C-Bus has it's own 7-bit address and to communicate with it you have to know this address. So firstly I wrote a function to scan for devices on the bus. My idea was to try to read from each possible address and to listen for answers. This worked excelently I found the chip at the first try.


 5. Dumping the chip


This is the point I was excited about and why I did all this. Reading the whole chip and check if received data makes sense in any way. I wrote a dump function which takes the device address and the number of bytes to read. The output is formated as usally. On the left block there is a hex dump and on the right side there is the ascii representation of the data.

Oh boy, I am so glad! I saw "SAMSUNG", "CLP510" and something, that could be a production date "2006.03". This was a real success.

6. Finding the Page counter


Somewhere in this dump there must be the number of pages that has been printed with this catridge. To find the position I printed a page and did a second dump. Comparing these two dumps showed all changing positions when the printer counts pages. There are three position of them. In the next step I printed a configuration report of the printer and luckily it says how many pages has been printed with each catridge. This is a helpful information because now I know what to look for.

Et voila! One of these three positions contained exactly a number from the report.
The printer configuration report shows the page count of each catridge

Dump of the magenta catrigde showing the page counter marked


7. Resetting the counter


Till now I worked with the serial monitor from the arduino IDE. But now I needed something to write the chip content to a file and to write it back to the chip. This is the main reason, why I wrote my own serial monitor. After writing the basic functionality like connectiing to the arduino, sending a string and receiving the response, I started to add the functionality for the dump file.

Writing the dump file back to the chip is done byte by byte and the commands to manipulate a small number of memory positions could have been done by hand without dumping the whole file. This made my serial monitor not nesasary anymore for this small project. But, hey, it was nearly finished at this point and dumping a file can be helpful for other projects too, so of course, I finished it anyway. :-)

Setting the red marked bytes to 00 resets the page counter.

For this project I wrote a Serial monitor which is some kind of a I2C-Console when used with a special Arduino sketch and I want to share it with you. So I uploaded all sources to my Git-Repository.

In one of the next post, I'll demonstrate the capabilities and functions of the tores console.



Serial monitor:
Arduino sketch:

Sonntag, 3. Januar 2016


Just found out, I am a member since 2007. So it's probably time for some posts.