Anna Aflalo

Fab Academy 2015 | Wgtn

WEEK 10 | Input Devices

Bread board - Capacitive Sensor Test
Which input is the best option for my final project ? The aim is to detect the steel ball at different places of the game.

Alternatives:
Capacitive sensor | Inductive sensor | "Home made" switch | Reflective sensor
I decided to do some tests to decide which one to use.

This example is the capacitive sensor. It works very well with fingers. With the marble, the variation was different every time I tried. So it was complicated to find the right value to make something happen when the marble touches the capacitive sensor. So I decided to focus on the "home made" switch.
Bread board - Switch Test
Purpose of this test:
- To know how to dispose the "copper tape switch"
- To test the sensor's sensitivity.
As you can see on the picture, this input worked well for what I wanna do. So I decided to focus on this one for this week's assignment.

How the AttachInterrupt() function works on Arduino:
AttachInterrupt is set up on the "switch" pin. When the voltage is FALLING on this pin, AttachInterrupts activated another function. I used a function that changed the LED color. So AttachInterrupt() knew that the marble was closing the circuit because the voltage was dropping from 5V to 0V in the "switch" pin.
It's time to make the board
I've also lost a lot of time trying to make a board small enough to fit in the marble game. Then I realized that I should make my electronic work before focusing on the design. I also had to redo my board twice because I forgot the 6 pins header to program it and the screw terminal to provide the power...

Here, download:
- the .png files: traces and board.
- the eagle files: schematic and board.
Programming



First of all I had issues with the NeoPixel library which was working with Arduino Uno. I needed a 20MHz resonator in order to use it. So I downloaded the new FastLED library and changed the code. But the board wasn't doing what I expected it to do, the LED color wasn't changing. I decided to do some tests to understand what was happening (see below).





In the middle of this big reflexion I smoked my board... I have no idea how I managed to do that. However, I had to replace my ATtiny45 and the regulator.
I checked if the switch was working properly with a multimeter. Then I used the SoftwareSerial library to print the switch pin values. (I couldn't program the WS2812 LED at the same time because I was running out of memory.)

Conclusion:
The program was working with Arduino Uno, I burnt the bootloader, the LED and the switch were working independently. The problem was the AttachInterrupt() function, it doesn't work with an ATtiny45 or maybe I did something wrong!





At the end, I used the digitalRead() function instead of this fancy AttachInterrupt() function and it worked!

Here download:
- the Arduino Uno program
- the ATtiny45 program.