#13. Input Devices

Button load

For this week i thought i would start doing some parts for my final project, in this case i imagined making a load button. Since this is for a bingo, and it will need a button for select a new number on the game, so if i could make a button with a pressure input just like the hello load that would be perfect. So, started by researching a little bit more on this and came up with the following:

Then, i needed to had the pad i wanted the button to be, so i imported the png trace to Corel were i used trace and then saved it in dxf wish i opened in AutoCAD and make up with this design:

After all looks good, saved it, opened the dwg in Corel, saved it in svg wish i imported in Easel and then carved on the Carvey. Unfortunately i couldn't make a one side only pcb and had to make some holes to pass some wires below. Also, decided to make a flat AVRISP so that i wouldn't have any pins pointing up. Another thing i made was to prep the board to power up with a 9V battery.

Since after all i decided to simplify a bit more the eletronics for the bingo i went i redesign the button and so i removed the 3 LEDs and design it using a separated button from the rest of the board. For more info on this part please go here.

Inicially i wanted to do the load button, but found out that the capacitive sensoring would basicaly do the same so download the example and explore it a bit. In the code below the idea is that it senses the capacitance between the pad and the "earthiness" of the finger, that way it will generate a value that changes according to the distance or the amount of area pressed. Then just went for the code from myEcho Hello World week and adapted it.


#include 

CapacitiveSensor cs_7_8 = CapacitiveSensor(7,8);
unsigned long cs;

const int led0 =  1;
const int led1 =  2;
const int led2 =  3;


void setup() {
  
  pinMode(led0, OUTPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  

}

void loop() {
  cs = cs_7_8.capacitiveSensor(80); 

  if ( cs > 100 ) {
    
    while ( cs_7_8.capacitiveSensor(80) > 100){};
    cs_7_8.reset_CS_AutoCal();
      digitalWrite(led0, HIGH);
      delay(100);
      digitalWrite(led0, LOW);
      delay(200);
      digitalWrite(led1, HIGH);
      delay(100);
      digitalWrite(led1, LOW);
      delay(200);
      digitalWrite(led2, HIGH);
      delay(100);
      digitalWrite(led2, LOW);
      delay(200);
    
      } else {
        // turn LED off:
        digitalWrite(led0, LOW);
        digitalWrite(led1, LOW);
        digitalWrite(led2, LOW);
  }
}
                                

Files to download:

Design files