© Royalty Free/CORBIS
© Royalty Free/Corbis


Exercise 1
Exercise 2
Soft Circuits




Exercise 1—Using a Push Button

Switches complete your circuits:
lightswitch.gif

Using a NO (normally on) push button, add the following to your breadboard:
switch1.png

These little switches are a 1/4" on each side, and can plug directly into a breadboard. These mechanical devices have 4 legs, which may make you think that there are 4 wires that are switched on and off, but in fact, two on each side are actually connected together inside. So really, this switch is just a 2-wire switch.
buttonlegsdiag.jpg
Normally, the two wires are disconnected (normally open) but when you press the little button on top, they are mechanically connected.
pushbuttons.gif

To get the buttons to sit better in the protoshield, you may want to straighten out the legs (just squish them with a pair of pliers) so that they look like the button on the left.
buttonlegs.jpg



Adding the Microcontroller

Now connect the led and the switch to the chip:
NO Push button

The Arduino chip has uncommitted inputs. That is, when an I/O pin is not connected and acting as an input, it cannot be assured to be either HIGH or LOW. Pull-up and pull-down resistors are needed to commit the input to the non-active (open) state for switches.





/* using a push button*/
int LED1=8;
int BTN1=10;
void setup(){
    pinMode(LED1,OUTPUT);
    pinMode(BTN1,INPUT);
}
 void loop(){
 if (digitalRead(BTN1)==0){
        digitalWrite(LED1,LOW);
     } else if  (digitalRead(BTN1)==1){
        digitalWrite(LED1,HIGH);
     }
 }


This code can be rewritten:
/* using a push button*/
int LED1=8;
int BTN1=10;
void setup(){
    pinMode(LED1,OUTPUT);
    pinMode(BTN1,INPUT);
}
 void loop(){
 if (!digitalRead(BTN1)){
        digitalWrite(LED1,LOW);
     } else if  (digitalRead(BTN1)){
        digitalWrite(LED1,HIGH);
     }
 }
or:
/* using a push button*/
int LED1=8;
int BTN1=10;
void setup(){
    pinMode(LED1,OUTPUT);
    pinMode(BTN1,INPUT);
}
 void loop(){
     digitalWrite(LED1,digitalRead(BTN1);  
 }

Alternative Circuits

Instead of a push button create a custom button using one of the following: water, penny, stapler, sheets of metal, etc.

Soft Circuits

Pick one from the choices below

There are different ways of making your own soft push buttons. All of them are based on the same principle of creating a circuit from and back to Arduino with a breaking point somewhere in the circuit. A breaking point is where you can reconnect the circuit so you can determine if the soft pushbutton is active (pushed) or not.

  1. To make a soft push button start by cutting out two small pieces of conductive fabric and glue them on two separate pieces of nonconductive fabric. Then sew a wire at the end of both pieces and sew a connection to each of the conductive fabrics. Take a piece of foam and cut a hole through it. If you didnŐt have any foam you could use a couple of layers of normal fabric. Once the hole is done, glue one of the conductive fabric pieces on each side of the foam:
    materials
    • Conductive fabric
    • Non-conductive fabric
    • One piece of foam
    • Conductive thread
    • wire
    • Fabric glue
    • led
    • resistor

    Create a soft circuit with a soft button and an LED. Write a program so that if the button isnŐt pushed the LED will remain off.


  2. The following is a way of making a hidden push button, appropriate when you need a discrete input hidden in a garment. You can use the same code as above to try it out. This button is made with two sew-on metal snap buttons that can be found in any sewing shop. You sew the buttons in place using conductive thread and connect two wires at the end.

    materials
    • Non-conductive fabric
    • Conductive thread
    • Sew-on metal snap button
    • wire
    • Fabric glue
    • led
    • resistor



  3. The last hidden button is made like a normal button. The trick is to use conductive thread to sew the button in place and then sew around the button hole using the same thread.

    materials
    • Non-conductive fabric
    • Conductive thread
    • Sew-on metallic button, or Jeans button
    • wire
    • Fabric glue
    • led
    • resistor




Using conductive fabric:




Open Softwear