2016-06-25

Light & Ladder — Simple Testbed for Microcontrollers

Recently I was bringing up an Arduino-like core for the ATtiny841, and wanted to test all the functionality. Testing digitalOut and analogOut was simple, though doing so for lots of pins required a bit of setup. digitalIn was also simple, but analogIn required slightly more work. As a small exercise, I decided to combine all of the required parts onto a single board. Using integrated resistor networks helped save a lot of parts.

The top part is very conventional, but the bottom might be a bit more interesting. Effectively, it serves as a primitive analog computer to generate a wide selection of fractions of the voltage applied to "+" and "-". As noted on the board, connecting one or more pins from the "+" side to one or more pins from the "-" side generates a voltage V*P/(P+M) where "P" is the sum of the labels of pins connected on the "+" side and "M" the sum on the "-" side. If "+" is 5V, you can obtain e.g.:
  • 1V as 1/5 of 5V, by connecting "1" on the "+" side and "4" on the "-" side.
  • 1.25V as 1/4, by connecting "1" on the "+" side, and 3 (as "1" and "2") on the "-" side.
  • 1.5V as 3/10, by connecting "1" and "2" on the "+" side, and "1", "2", and "4" on the "-" side.
Source code available on Github, boards on OSH Park.