Design Considerations

I decided to look beyond the usual ways of interfacing DACs and ADCs (I2C, SPI, Parallel) because of the relative slowness of the badge CPU and the 4-bit width of the Input and Output ports. My solution was use 2-bits of the output port as reset and clock to drive an 8-bit counter which is the the input to the 8-bit DAC. This arrangement means the DAC can serve as a sawtooth signal generator with an accurate 1V reference - for calibrating oscilloscopes for example.
All the functions required are integrated into a custom chip, the 20AFBadgeIO.

ADC Conversion

6 comparators are also provided which, when combined with the DAC,  provide 6 channels of A/D conversion. The idea is to run the counter through all its values and store the count value when each comparator changes sign.  A third bit of the output port is used to switch multiplexers so the 6 comparators can be read using 3 bits of the Input port. The 4th bit (MSB) is not used to avoid contention when it is used for transmissions on the serial port.

Special Inputs

4 of the comparators are free to use as you see fit. A 5th one is tied to the positive rail to serve as a battery monitor. The 6th one is connected to a special connector and a built-in 100uA current source. It can be used to read resistance values. 

The remaining output port is wired to an open drain transistor. This can be used to discharge a capacitor connected to the current source as part of a time to digital conversion cycle for capacitance measurement.

Connectivity

The PCB for the chip provides the pins to plug into the badge, breakout pins for the ICE connector, 2 grove connectors for the ADC inputs, a stereo jack for I/O, a third grove connector breaking out the serial port pins. The board can also be populated with up to 4 pots and 5 switches.

Software

I tested the chip and board before arriving at SuperCon using a fake badge: a Teensy LC.

At SuperCon I wrote an assembler and confirmed all the core functions work on the badge itself.

I will refactor this into some utility subroutines soon

Drivers and Examples

Work in Progress...