//Ready to use arduino program to reset the toner chip SP150 to its factory values as if it was brandnew. //No need to buy just reset it! //How it works: Every 5s, the chip is programmed, the led (L on Arduino UNO R3, LED_BUILTIN) blinks //if everything is ok (Memory copied AND checked). Serial connection is not compulsory it's only used for debug. //Successfully tested with Arduino Uno R3 // Sources: // http://www.mikrocontroller.net/topic/369267 // AND // FILE: Reset.ino // AUTHOR: Ludovic Guégan adjusted for SP150 Viktor D. // VERSION: 0.2 // PURPOSE: Reset chip for Ricoh SP150 toner // DATE: 2026-03-016 // // Released to the public domain //Wirings: #include // __ __ // | \/ | // |_ _ _ | // | A4 | (SDA) // |_ _ _ | // | A5 | (SCL) // |_ _ _ | // | 3,3V | (VCC) // |_ _ _ | // | GND | (GND) // |_ _ _ | // |__0___| //Chip's memory size unsigned int dump_bin_len = 256; //Factory default memory byte dump_bin[] = { 0x32, 0x00, 0x01, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x34, 0x30, 0x37, 0x39, 0x37, 0x31, 0x16, 0x07, 0x4D, 0x4D, 0x22, 0x00, 0x03, 0x21, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x05, 0x21, 0x59, 0x30, 0x36, 0x36, 0x4D, 0x41, 0x30, 0x31, 0x34, 0x33, 0x39, 0x20, 0x64, 0x30, 0x00, 0x00, 0x8C, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x0E, 0x05, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB6, 0x12, 0x00, 0x00, 0x00, 0x00, 0x64, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; // Set current address: // master send start condition // master send eeprom address + read bit // master send data address // master send start condition unsigned int setCurrentAddress(int eeprom, unsigned int address) { Wire.beginTransmission(eeprom); byte size = Wire.write(address); if (size == 0) { Serial.println("Failed to write address"); return 10; } byte error = Wire.endTransmission(false); if (error == 0) { // Serial.println("tranmission success"); } else if (error == 1) { Serial.println("Data too long to fit in buffer"); } else if (error == 2) { Serial.println("Receive NAK when transmiting address"); } else if (error == 3) { Serial.println("Receive NAK when transmiting data"); } else if (error == 4) { Serial.println("Other error"); } else { Serial.println("Unknown error"); } // return error value return error; } // Current read: // master send eeprom address + read bit // device respond with data // master send stop condition unsigned int printCurrentAddress(int eeprom) { byte size = Wire.requestFrom(eeprom, 1, true); if (size == 0) { } if (Wire.available()) { byte rdata = Wire.read(); Serial.print("0x"); Serial.print(rdata, HEX); Serial.println(""); return 0; } else { Serial.println("No data available from device"); return 1; } } // Current write: // master send eeprom address + write bit // master send data // master send stop condition unsigned int randomWrite(int eeprom, unsigned int address, byte data) { Wire.beginTransmission(eeprom); byte size = Wire.write(address); if (size == 0) { Serial.println("Failed to write address"); return 1; } size = Wire.write(data); if (size == 0) { Serial.println("Failed to write data"); return 2; } byte error = Wire.endTransmission(true); if (error == 0) { //Serial.println("tranmission success"); } else if (error == 1) { Serial.println("Data too long to fit in buffer"); } else if (error == 2) { Serial.println("Receive NAK when transmiting address"); } else if (error == 3) { Serial.println("Receive NAK when transmiting data"); } else if (error == 4) { Serial.println("Other error"); } else { Serial.println("Unknown error"); } delay(5); // wait 5 ms, a write cycle return error; } // Random read: // 1. set current address // 2. read current address unsigned int printRandomAddress(int eeprom, unsigned int address) { if (setCurrentAddress(eeprom, address) != 0) { Serial.println("Failed to set current address"); return 1; } delay(5); // wait 5 ms between write and read if (printCurrentAddress(eeprom) != 0) { Serial.println("Failed to read current address"); return 2; } return 0; } // display the content of the eeprom void eepromRead(unsigned int eeprom) { Serial.print("Reading device "); Serial.print(eeprom, HEX); Serial.println(""); unsigned int address; for (address = 0; address < 256; address++) { if (printRandomAddress(eeprom, address) != 0) { Serial.print("Read failed at "); Serial.print(address, HEX); Serial.println("!"); break; } } Serial.println("read end."); } // erase the content of the eeprom void eepromWrite(unsigned int eeprom, byte data[], unsigned int data_length) { Serial.print("Writing to device "); Serial.print(eeprom, HEX); Serial.println(""); unsigned int address; unsigned int nbrerror = 0; for (address = 0; address < data_length; address++) { if (randomWrite(eeprom, address, data[address]) != 0) { Serial.print("Write failed at "); Serial.print(address, HEX); Serial.println("!"); nbrerror++; break; } } if (nbrerror == 0) { Serial.println("Success !"); } else { Serial.println("Errors, try again"); } Serial.println(""); } // initialize serial connection and wait for user input. // initialize i2c bus after user input. void initialize(void) { Serial.begin(115200);//115200 //while (!Serial.available()) { ; // wait for serial port to connect //} Serial.println("\nStart"); // define the i2c bus speed // 400kHz, 800kHz or 1MHz unsigned int clock = 800000L ;//800000L; Wire.begin(); Wire.setClock(clock); Serial.println("I2C bus initalized!"); } void work(void) { // eeprom address on the i2c bus // 0x53 = 83 = 1010011 = 1010, A0=0 A1=1 A2=1 unsigned int eeprom = 0x53; //Reset de la puce eepromWrite(eeprom, dump_bin, dump_bin_len); // Vérification de la mémoire if (eepromCompare(eeprom, dump_bin) == true) { Serial.println("Comparison succeeded"); //Blink one time for 300ms digitalWrite(LED_BUILTIN, HIGH); delay(300); digitalWrite(LED_BUILTIN, LOW); } else Serial.println("Comparison failed"); } //Initialize void setup(void) { pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, LOW); initialize(); work(); } //Do the job void loop() { } // Current read: // master send eeprom address + read bit // device respond with data // master send stop condition byte GetCurrentData(int eeprom) { byte size = Wire.requestFrom(eeprom, 1, true); if (size == 0) { Serial.println("Error"); } if (Wire.available()) { unsigned char rdata = Wire.read(); return rdata; } } // Compare read memory from eeprom chip bool eepromCompare(unsigned int eeprom, byte data[]) { Serial.print("Comparing Dump file with eeprom : "); Serial.print(eeprom, HEX); Serial.println(""); unsigned int address; for (address = 0; address < 256; address++) { if (setCurrentAddress(eeprom, address) != 0) { Serial.print("Read failed at "); Serial.print(address, HEX); Serial.println("!"); break; } else { if (GetCurrentData(eeprom) != data[address]) { Serial.print("Error at Address: "); Serial.print(address); Serial.print(" ,Data : " ); Serial.print(GetCurrentData(eeprom)); Serial.print(" ,Dump file: " ); Serial.println(data[address]); break; } } } Serial.println("End of comparison"); if (address == 256) return true; else return false; }