Skip to content

10. Input Devices

• Group assignment: Measure the analog levels and digital signals in an input device.

• Individual assignment: Measure something: add a sensor to a microcontroller board that you have designed and read it.

Group assignment


Josep Marti, Felipe Santos, Alberto Lopez, Diar Amin, Gustavo Abreu, Juan Carlos, Eva Blsakova.


To measure the analog and digital signals of a device with a multimeter you have turn the knob to the V~/- position and use the correct positive connection of the multimeter, plug the probes in parallel with the analog or digital pins of your device and turn it on.

I used an Arduino with the Analog Example Sketch to measure the analog output.

The results vary from 0v to 5v when turning the potentiometer up.

In the same way I used the Button Example Sketch to measure the digital output.

The results go from 0 to 1 when pressing the button.

Individual assignment

Past tries

I tried to make my own boards from scratch but I don’t know where I did something wrong because neither of the first boards worked. First I tried a capacitive sensor board:

Then I tried the Fab Kit and the Satsha Kit (first with the components that were in the BOM and after I changed some of them trying to debug):

In the last week I started playing with my own version of a FabLeo, a Atmega32u4 powered Arduino Leonardo copy that I redesigned from Grinham’s original project. You can see that in this version I soldered the header too close to the board so the melted plastic took some traces off after I tried some “shields” on it.

FabLeo Araucária V0.2

After I decided to remake my FabLeo I took some time to check the design and change some things in order to make it stronger and smaller.

BOM: + Led x3 + R22 x2 + R499 x4 + R10k x2 + C0.1uf x8 + C18pf x2 + Xtal 16MHz + Atmega 32u8 + Micro USB + Switch

Leaving some space between the board and the headers make the connections stronger so it can take more stress from the shields.

I burnt the bootloader from the AVRISP to transform it into an Arduino Leonardo.

To do this you just have to plug the ISP cable into the FabLeo’s headers, go to the Arduino IDE, select Tools > Boards > Arduino Leonardo, and Tools > Programmer > The one you are using. After this go to Tools > Burn bootloader.

Disconnect the ISP header and unplug the FabLeo from USB, plug it again and check in the Arduino IDE, Tools > Port if you can see an Arduino Leonardo.

Measure something

To complete this week’s assignment I designed a capacitive touch shield for my FabLeo:

With a touch pad made in the vinyl cutter:

With the help from Josep in the Arduino code I could get some measures from it:

The code is really simple, it only takes the digital readings from the pins and shows in the serial monitor some values based on the capacitance of the matrix.

I destroyed my first FabLeo after using the shields so when I remade it I also made a new capacitive piano shield:

As I had some time I tried making some paper cases for my boards in the vinyl cutter, just as a test for some solder mask, maybe?

I found a piano Arduino sketch on Instructables that I could adapt for my shield. It works by reading the capacitive inputs from the shield and transforming it into a sinewave output by a buzzer.

You have to begin by including a kind of library called “pitches.h” from Mike Putnam, it is used to convert the notes into a value that the buzzer can understand as the same pitch. It also makes easier to define the note lenghts (notelenght), the buzzer pin (output pin) and how sensitive is the piano (capacitance).

#include "pitches.h"

int notelength  = 10;
int outputpin   = A5;
int capacitance = 1;

void setup(void)
  tone(outputpin, NOTE_A4, 500); //beep and flash to show that the piano is working

the main void works like this:

void aeolianbt(void)
  if(readCapacitivePin(6) > capacitance)    {tone(outputpin, NOTE_A1, notelength);}
  if(readCapacitivePin(5) > capacitance)    {tone(outputpin, NOTE_C2, notelength);}
  if(readCapacitivePin(4) > capacitance)    {tone(outputpin, NOTE_E2, notelength);}
  if(readCapacitivePin(3) > capacitance)    {tone(outputpin, NOTE_G2, notelength);}
  if(readCapacitivePin(2) > capacitance)    {tone(outputpin, NOTE_A2, notelength);}
  if(readCapacitivePin(7) > capacitance)    {tone(outputpin, NOTE_A4, notelength);}
  if(readCapacitivePin(8) > capacitance)    {tone(outputpin, NOTE_C5, notelength);}
  if(readCapacitivePin(10) > capacitance)   {tone(outputpin, NOTE_E5, notelength);}
  if(readCapacitivePin(11) > capacitance)   {tone(outputpin, NOTE_G5, notelength);}
  if(readCapacitivePin(12) > capacitance)   {tone(outputpin, NOTE_A5, notelength);}

So if the capacitance is bigger than the threshold it generates a tone.