Fab Academy 2017
Learn how to make ALMOST anything!

Input Devices

This week's task was to measure something: add a sensor to a microcontroller board that you have designed and read it

To begin with this task, I took a deeper look to my final project. Generally, in the project, there will be an input sensing to check if the piece of the puzzle is put correctly in place or not.

So, my main idea was to develop something that can cover the piece place and give a signal to the control board. Something similar to the idea below.


The 2 ideas I had to implement this are:

1. Two copper sheets that close a circuit in form of switch.

2. Capacitive touch sensor; where the touchpad will be in form of copper sheet sticked on the back of the circuit.


Before making the final decision, I made some studying as I was really interested in the capactive touch sensing. Here are some really good resources I found and you can start with:

1. All About Circuits: Introduction to Capacitive Touch Sensing.

2. All About Circuits: Circuits and Techniques for Implementing Capacitive Touch Sensing.

3. Khan Academy: Capacitors and capacitance.

4. Mohamed Kamel; 2016 Fab Lab Egypt Student touch pad project.

5. Moatt Blackshaw.


I decided to go first for the first idea and make the touch pad as the 2nd phase.

The Circuit:

Using Eagle, I modified the previous Echo-Hello Board we redraw in week 4 to implement the circuit. I added a simple 2x2 pin header to communicate the pad to the board via jumper wires.

Circuit Schematic

PCB Board view

After the milling and soldering the components, this is how it looked like.

Before Soldering Final Board

For the touch sensor, I used a copper sheet on a carboard with which attached jumpers that go into the pin header attached to Ground and ATTiny44 pin. The touch pads act like a switch.

Touch pads.

Touch pads.

Programming the Board:

To Program the board, I used Arduino IDE. And as a start to make sure the board is working properly, I uploaded the "Blink" program to test the board and also its programming.

I faced lots of difficulties in this and got lots of errors when I first started. I, first, programmed with Arduino as ISP.


With Arduino.

I compiled the code and when I clicked uploading, I got that error.

avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: Expected signature for ATtiny44 is 1E 92 07 Double check chip, or use -F to override this check. Wrong microcontroller found. Did you select the right board from the Tools > Board menu?


I tried several times, but It didn't work.

Next, I tried to program via USBasp programmer. First, you'll need to download its driver. I use Windows 10.

With USBasp.

And It also failed!

Finally, I went to program with FabISP and it WORKED!

with FabISP.

Blinking LED.

So, Now it was the time to work on the switch program.

The Program was simple, it's to read the pad and use the LED as an indicator. I used Arduino IDE to write the code.

                        int sensorValue = 6; 
                        int LED = 7;   
                        float voltage;

                        void setup(){
                          pinMode(LED, OUTPUT);      // sets the digital pin 13 as output
                          pinMode(sensorValue, INPUT);      // sets the digital pin 7 as input

                        void loop(){
                        digitalWrite (LED, HIGH);

                         sensorValue = analogRead(6);
                          // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
                          voltage = sensorValue * (5.0 / 1023.0);

                          if (voltage > 3.5 && voltage <= 5) {
                          digitalWrite(LED, LOW);   // turn the LED on (HIGH is the voltage level)


It worked Great as the video is showing.


Final Project Ciruit:

Following the same concept, I worked on developping the Final project circuit idea. The circuit is simply a Voltage divider. it enlightens different LEDs when different voltage is read.


Then, I developped the Schematic and board on Eagle.


After Machining and stuffing the board with components, Here it is!


Programming Final Project Ciruit:

The concept of the program was very easy, yet it wasn;t that easy in the implementation. The concept of the program was to measure different voltage if the the sensor was touched. Generally these are the voltage values at each sensor.

One of the most useful apps for simulating the circuit and the values of the voltage is Every Circuit, Moreover, I tried the concept on bread board vircuit before the final programming and implementation of the circuit.

Main Resistor Value: Voltage read value:
10k ohms 2.5 - 2.52 V
100k ohms 4.55 V
1k ohms 0.455 V

The challenge of the program mainly was in the serial communication, and that expalined more in details in the Networking assignment.


Final Project Ciruit sensor:

For the sensor, it was pretty simple, A switch using copper sheet.

The Piece back. The switch.

And Testing it. It worked perfectly.


1. Circuit Schematics and file.

2. Arduino Code.