What is a solution to representing bits physically? (on a cartridge, to be read by the cartridge holder… like a printer)

I am trying to recreate the sort of microchips that are on printer cartridges so that I can make cartridges that can have their data programmed and read? I only need to store 8 bits, so I was thinking a microchip might be overkill. How can I get 8 bits of data from a cartridge that is plugged in?

I was also thinking of simply connecting power through a switch (0/1), representing the bits. This would be connected through a pull up resistor and so where the switch was closed, you would get some voltage reading.

Another design I thought of can differentiate 16 distinct currents based on 4 switches and 4 strategically chosen resistor values. The switch being open represents a zero. The current was equal to the bit value (ie. switches being closed in 1010 gave 10ma of current). How reliable then is current ADC and would it be easy to repeat this for several cartridge holders?

Anyways, these are the potential solutions I have been thinking of today. Let me know if you all can think of another solution for differentiating between cartridges when they are plugged in.

Excuse the many tags but the solution could potentially be in any of these categories.

Thank you!

• what do you mean by microchip? – jsotola Jun 19 '18 at 23:56
• You could get an actual microchip. Look for "serial EEPROMs". – user253751 Jun 20 '18 at 4:00
• Single wire eeproms. – Jeroen3 Jun 20 '18 at 6:23

The simplest common solution similar in style to your ideas is to make a PCB with a number of contact pads and wiring them together in different patterns. You can then read out the wiring pattern by connecting each one to a GPIO pin on your host device (must have input with pullup or pulldown as an option) and driving one pin and reading the others.

(It would also work with a plug instead of a custom PCB; the choice depends on what the best mechanical interface for your cartridge is.)

If you use diodes instead of wires then you can have as many bits as pairwise combinations of contacts (so 8 bits requires only 5 contacts); if you want a simple parallel read scheme then you would use 9 contacts (1 "power supply" and 8 data lines).

In any of those cases you can build it with switches instead of hardwiring for testing purposes.

If you want to use fewer GPIO pins, store more data, or have it be writable electrically, then you would use some type of memory chip communicating over a serial interface, such as an I2C EEPROM. This is a common approach for "identify the attached peripheral" applications that want many bytes of data but do not need a microcontroller in the peripheral.

Another design I thought of can differentiate 16 distinct currents based on 4 switches and 4 strategically chosen resistor values.

Using resistances to communicate more bits over a single line can be done (there is a classic technique of multiplexing pushbuttons this way) but in your case it can be disrupted by unintended resistance in the cartridge connection. You could fix that in principle by using four-terminal sensing, also known as a Kelvin connection, but at that point it's probably easier to use multiple digital lines instead.

• +1 It may seem silly to use only 8 bits out of 4096 or whatever, but you can buy an AT24C04 4K bit I2C SEEPROM in SOT-23-5 for pennies. – Spehro Pefhany Jun 20 '18 at 3:36