Introduction: Caliper Data Interface
The PCB I designed is a caliper data interface. This board works with several models of inexpensive Chinese calipers and tire depth gauges.
The board allows for either a TTL serial and/or an I2C interface. Through either interface you can perform several functions, such as zeroing the caliper, turning it on/off, getting the current reading, or receive notification only when a change occurs.
The connection to the caliper is made via the caliper’s data port. I’ve designed a 3D printed connector for this purpose with detailed instructions below on how to make one.
How it works:
The board’s vcc can be anywhere from 3 to 5 volts (although I’ve only tested it at 5V.)
The caliper data port has data and clock signals. These signals are at 1.5V and need to be level shifted to the mcu’s vcc. To do that I use a TLC3702 comparator chip. The comparator threshold for both signals is set to half the caliper voltage or 0.75 volts by way of a resistor voltage divider of the 1.5 volts output by the board’s AMS1117-1.5 LDO voltage regulator chip. The comparator’s vcc is set to the mcu’s vcc, so when the caliper signal value is at or above 0.75 the comparator shifts this to vcc, and when the caliper signal is below 0.75 the comparator shifts this to 0 volts.
Note that there are lots of ways to level shift signals. I chose the TLC3702 because it requires very few additional parts (just 2 resistors.)
As long as the caliper has power applied to it, it will periodically send a packet of data representing the current value being displayed on the caliper. The mcu reads one packet bit whenever the clock pin goes from high to low (vcc to 0V.) Each packet is composed of 24 bits. See CaliperUtils.cpp within the attached software.zip for the routine that unpacks the packet.
The board is software configurable to output only when the value changes in the case of TTL serial, and for I2C an interrupt line goes high whenever the value changes and stays high till the host reads the current value. For either type of connection to the host, the host can read the current value whenever it needs to.
To zero the caliper the board simply turns it off and on via a BSS138 N-channel MOSFET.
The only thing the board can’t do is set the mm/inches units being displayed on the caliper. For that you’d have to hack the caliper to simulate a button press on the units button. The default on power up is mm, so it shouldn’t be much of an issue.
There aren’t a lot of parts. This could easily be built on a breadboard. All of the chips except for the voltage regulator and MOSFET, are available in DIP packages. You could substitute a 2N7000 MOSFET in a TO-92 package for the BSS138. The 1.5V regulator could be replaced by a AA battery. In fact all of the parts could be replaced with something else.
The schematic, software, and parts list are enclosed in the next step.
If you’re interested in building one, the board Gerber files are shared on PCBWay.com. https://www.pcbway.com/project/shareproject/Calip...
See below for a video of the prototype board in action.
Step 1: Schematic and Software
The enclosed software is for the board using an ATtiny84A. If you’re building this on a breadboard this can be modified to work with other micro controllers such as the UNO’s ATmega328p. If you need help modifying the code, let me know.
I’m not including the steps needed to set the ATtiny84A fuses and upload CaliperI2CTiny84A sketch to the board. For this you can look at my other instructable: https://www.instructables.com/id/Varmint-Detector...
The Varmint-Detector instructable also contains detailed instructions for building an SMD board.
Step 2: Calipers I’ve Tested
The pictures in this step show the caliper and tire gauge I’ve tested. If the button layout is the same as shown in the pictures, this board and connector will probably work.
Step 3: Building the Caliper Interface Cable
Download the connector STL files from https://www.thingiverse.com/thing:2477494
Print both STLs at 0.1mm layer height, 20% infill, no support, with just a skirt, no brim (if you print with a brim it’s a pain to cleanup)
For wire I used 26AWG 1.27mm pitch flat cable. This is the ubiquitous “jumper cable” product you get with Dupont connectors already attached.
For this connector you need 4 conductors, any color. Strip 20 mm of insulation off one end as shown in the pictures. Apply solder to the first 15 mm of wire from the tip to stiffen the wire. After cleaning up the print of Connector.stl, use a 1.5 mm drill bit to enlarge the exit holes and to remove any material in between. The goal is to be able to insert all 4 insulated conductors bonded together as shown in the picture. Using the ConnectorNoHandle print, place the 4 soldered conductors in the 1.5 mm on center cuts and use this as a guide to insert the wires into the connector with a handle. After verifying that you’re able to insert the insulated cable into the exit holes approximately 5mm, withdraw the wire till the bare wires are exposed. Apply some plastic epoxy to the insulation and reinsert the wires. Put the assembly aside and wait for the epoxy to cure. Once cured fold the 4 wires around the end of the connector, cleaning up the soldered ends as needed.
The other end of the cable is a 4 pin JST XH2.54 connector. Connect the pins as shown in the picture.
I haven’t done any testing to determine what the maximum cable length is. The cable in the photo is about 22cm.
Step 4: Build the Host Cable
This cable supplies power to the board, I2C, and an interrupt line. Even if you aren’t going to use I2C you still need to build at minimum a 2 wire cable to supply power (red and black in the photos.)
The photos show a 5 pin JST XH2.54 connector on each end. Only the board requires this connector.
Step 5: Testing
To test I2C use the included the sketch CaliperI2CTest. The board doesn’t contain I2C pullup resistors so add two 4.7K ohm resistors to 5V (see photo.)
For TTL serial you can hook the board directly to a TTL to USB serial module and pass commands as documented in the CaliperI2CTiny84A sketch via any USB serial monitor (such as the one that comes with the Arduino IDE.)
Participated in the