Here's what's in the photo. Everything came from either my collection of prototyping stuff, or from the collection of a fellow Sector member who took interest in this project.
- Arduino Uno and Wave shield https://www.adafruit.com/product/94
- Standard cheap calipers
- Adjustable breadboard power supply https://www.adafruit.com/product/184
- Logic Level Converter https://www.sparkfun.com/products/12009
- Earbuds
- A push button switch
If you add up the total cost of the items listed above, it comes out to about $85...so already cheaper than the $250 price point. (I'm aiming to get the total cost down a lot further than that though).
Here's how it all works together. The calipers are bumped up from their usual 1.5 volt voltage from the coin cell, to a 1.9 volt supply from the breadboard power supply. This makes it so that the logic level converter works with the signal from the calipers (because the minimum signal it will support is 1.8 volts, so 1.5 is too low). The signal from the calipers is easy to access; there's a port on the calipers accessible by a removable plastic cover. On the other end of the logic level converter we have the Arduino at 5 volts.
The wave shield comes with it's own example code. The calipers communication protocol has already been reversed engineering by a number of folks online; I got my code snippet from http://nut-bolt.nl/2012/reading-digital-calipers-with-an-arduino/.
The main challenge here is that the Wave shield uses all the external interrupt pins on the Arduino. I needed to use a different kind of interrupt. After a brief read through the forums and the datasheet for the Atmega328P, I decided to use the analog comparator. Comparing against some code snippets made it a fairly easy job to set all the registers I wanted to the values I needed. I used the internal bandgap reference as the positive input to the comparator and my calipers CLOCK signal as the negative input. Then I set the interrupt to trigger on rising output edges. [Noting that the positive input to the comparator, Atmega pin AIN0, refers to Arduino pin D6, and the negative input to the comparator, Atmega pin AIN7, refers to Arduino pin D7.]
The code for this project is available here.
Here's the video:
Next up I'll tackle building a prototype of a cheap and portable version.
Here's the video:
Next up I'll tackle building a prototype of a cheap and portable version.
No comments:
Post a Comment