mitutoyo: A library for the Mitutoyo Digimatic (SPC) protocol.

This library is an implementation of the Mitutoyo Digimatic protocol used to read data from gauges and scales.

It was written as a first project with CircuitPython. Data used to implement this were Mitutoyo datasheets.

  • Author(s): Adrian “vifino” Pistol

Implementation Notes

Hardware:

  • You need the ‘data’ and ‘clock’ pins configured as inputs with pullup. They are pin 2 and 3 on a Digimatic 10-pin cable.
  • Connect the ‘req’ pin to a NPN with a 10kΩ resistor and the open collector output to ‘!req’. On a Digimatic 10-pin cable, ‘!req’ is pin 5.
  • Optionally, you can connect ‘ready’ as an input with a pullup to know when to read. On a Digimatic 10-pin cable, ‘ready’ is pin 4.

Software:

  • CircuitPython 5.0 tested, older versions should work. MicroPython should also work, thanks to Adafruit Blinka.
class mitutoyo.Digimatic(**args)

Mitutoyo Digimatic SPC implementation for CircuitPython. Provide either ‘req’ or ‘nreq’. ‘req’ takes precedence.

Parameters:
  • data (Pin) – data pin
  • clock (Pin) – clock pin
  • req (Pin) – non-inverted data request pin, alternative to ‘nreq’
  • nreq (Pin) – inverted data request pin, alternative to ‘req’
class Reading(value, unit)

A Reading from a Mitutoyo Digimatic instrument.

unit = None

The unit the reading’s value is in. (str)

value = None

The value returned by the instrument. (float)

read()

Attempt to read a value from the connected instrument.

Returns:A reading or none if data is unparsable
Return type:mitutoyo.Digimatic.Reading
read_cm()

Attempt to read from a connected instrument, but always return the value in centimeters.

Returns:centimeters
Return type:float