Sherline, TouchDRO : electronics

Not a lot of complexity in designing the electronic interface. The Teensyduino (LC) is small and low-cost ($9) and with the open-source quadrature encoding libraries, reading values from the AMT-102s was trivial. Sending the data to the TouchDRO was accomplished with a serial bluetooth module (HC-05) and the format is a simple text format of current values. No calculations are needed as the app takes care of translating the encoder output into distances. The tachometer was equally as simple with an infrared sensor module and the frequency measuring library.

Snippet of code for the teensyduino microcontroller:

 // read the current position of the encoders
   long _positionX = encoderX.read();
   long _positionY = encoderY.read();
   long _positionZ = encoderZ.read();

  // if any of the positions have changed or periodic interupt triggered
  if( (_positionX != positionX) ||
  (_positionY != positionY) ||
  (_positionZ != positionZ) ||
    keepAlive.check() == 1) {

    // set new values to current values
    positionX = _positionX;
    positionY = _positionY;
    positionZ = _positionZ;

    // send current position to TouchDRO app via bluetooth serial interface
    Serial1.print(F("x")); Serial1.print((long)positionX); Serial1.print(F(";"));
    Serial1.print(F("y")); Serial1.print((long)positionY); Serial1.print(F(";"));
    Serial1.print(F("z")); Serial1.print((long)positionZ); Serial1.print(F(";"));

    // send current tach reading to TouchDRO app via bluetooth serial interface
    Serial1.print(F("t")); Serial1.print((long)frequency); Serial1.print(F(";"));

    // reset the periodic interupt
    keepAlive.reset();

  }

The schematic for the encoder interface:

touchdro board schematic v1

For proof-of-concept and testing, I pulled all the items together on a breadboard.

electronics-breadboard

The original idea was to solder the components on a protoboard but it turned out to be easier to create a custom PCB. The free version of eagle was more than powerful to do the routing and communal PCB manufacturing at OSHPark made the price reasonable ( ~2.5"x2.25" board @ $5 a square inch for three copies).

touch dro board v1

I've made the code and eagle files available on github.

After about 2 weeks, I received this slick looking board:

electronics-emptyboard

Populated with the same components from the breadboard:

electronics-populated-board

And a 3D-printed enclosure:

electronics-enclosure

Approach

Step 1 Buy components. Parts can be ordered from websites like adafruit or sparkfun (or their UK, Australian, etc equivalents). If you don't mind waiting a little longer for shipping, some of the components can be ordered directly from the asian manufacturers via ebay for about 50% less.

Step 2 Get the board. There are several manufacturers that will do small runs for reasonable prices such as OSHPark. Some accept the Eagle CAD board files directly or it's easy to generate the necessary gerber files using the freeware version of Eagle CAD.

Step 3 Order the enclosure. I used shapeways to print the bottom and top of the enclosure. If you have your own 3D printer, the Solidwork CAD and STL files are included. Making your own is also an option as a project box can work too.

Step 4 Solder components. To keep the assembly simple, the PCB is designed with through-hole components. Any standard soldering iron with a small tip can be used. The board has labels that match the schematic component values (see picture above or the Eagle CAD schematic). The arduino-compatible Teensyduino and the HC05 bluetooth module need header pins, everything else is direct connection to the board. Note: since the PCB has its own power supply, you'll need to modify the teensyduino to separate the usb power from external source using option #1 before you solder it to the board..

Step 5 Upload arduino sketch. Setup files for PlatformIO is included in the github repository; this will install the necessary libraries, compile and upload the interface sketch to the Teensyduino. Alternatively, you can use the standard Arduino IDE with the teensyduino software add-on.

Step 6 Mount the encoders. If you're using a Sherline lathe and/or mill, the instructions can be found here. Otherwise, the AMT-102 datasheet has the mounting information for these to be adapted to other machines.

Step 7 Connect encoders. The PCB's bill of materials includes the connectors for the AMT-102 encoders as well as the board-compatible connectors. Or you can skip the board-side connectors since the PCB through-holes are big enough to solder 28-AWG wire directly.

Step 8 Power up! Any 5-12V DC power supply can be used with the PCB's 5.5mm x 2.1mm barrel jack. Pair your tablet installed with TouchDRO to the HC-05 and configure it with a CPI of 163840 (set at the default 4096 resolution).


tags:  |   |   |