Using a piezo plate, we implement a very simple knock sensor. We need a larger resistor (1M Ohm) connected in parallel with the piezo plate.

Piezo element with the connection wires

Connect the piezo to the beardboard

Connect the resistor in parallel with the piezo element

Connect the LED indicator

 

 
Code sample

const int LED = 7;
const int KNOCK = 1;

void setup()
{
  pinMode(LED, OUTPUT);
}

void loop()
{
  int value = analogRead(KNOCK);
  if (value>100)
  {
    digitalWrite(LED, HIGH);
  }
  else 
  {
    digitalWrite(LED, LOW);
  }
  delay(50);
}

Assignment 1 presentation

Topics

Sensor technology
 
Workshop

  • Shift register with LEDs
  • Flex sensor
  • Soft potentiometer
  • Touch sensor

 
Reference

ITP sensor workshop

Sparkfun sensor catalog

Parallax sensor catalog

Arduino capacitive sensing

Download capacitive sensing library
 


 

 
Code sample

#include <CapSense.h>

CapSense cs = CapSense(7, 8);

void setup()
{
  cs.set_CS_AutocaL_Millis(0xFFFFFFFF);
  Serial.begin(9600);
}

void loop()
{
  long total = cs.capSense(30);
  Serial.println(total);
  delay(100);
}

 

Since a lot of you may drive larger load of LEDs, the IC ULN2803A can be useful. Please see the following description and example.

How to use the ULN2803A IC with Arduino and its breadboard? In this demonstration, I use only one pair of input and output of the IC. You can use up to 8 pairs to control your lighting devices or others facilities.

Prepare an external power plug to use your 12V power adaptor.

Insert the ULN2803A IC on the breadboard.

Connect the power and ground of the IC.

Connect the IC to the Arduino’s Digital Output pin.

Testing

You can use the blinking LED program to test the circuit.

We are going to have tutorial for each group. Bring along your light and other material to work on the assignment 1.

Additional topics

If any groups would like to use external lighting with higher voltage or current, you may need to use the following material with a relay to achieve the result.

Relay

Transistor (P2N2222A)

Transistor schematics

Diode (1N4001)

Workshop

Use of the 5V relay to drive larger loads.

Breadboard diagram

Group 1

  • Cheng Nga Man, Nicola
  • Wong Hok Kan

Group 2

  • Cheung Man Yee
  • Cheng Hoi Man

Group 3

  • Ho Ka Fai
  • Chan Wing Kei, Vivian

Group 4

  • Chan Pik Shan
  • Ng Yee Man, Cuttle

Group 5

  • Xu Jia
  • Chan Ming Kin

 

Topics

  • Variety of lighting system
  • More schematic reading

Workshop

  • External power supply
  • Extending the cables
  • Controlling more light

Codes

const int DATA = 2;
const int CLOCK = 3;
const int LATCH = 4;

void setup()
{
  pinMode(DATA, OUTPUT);
  pinMode(CLOCK, OUTPUT);
  pinMode(LATCH, OUTPUT);
}

void loop()
{
  int delayTime = 50;
  int val = 1;
  for (int i=0; i<8; i++)
  {
    updateLEDs(val);
    delay(delayTime);
    val = val << 1;
  }
  for (int i=0; i<8; i++)
  {
    val = val >> 1;
    updateLEDs(val);
    delay(delayTime);
  }
}

void updateLEDs(int value)
{
  digitalWrite(LATCH, LOW);
  shiftOut(DATA, CLOCK, MSBFIRST, value);
  digitalWrite(LATCH, HIGH);
}

Assignment 1 tutorial

Reference

Light Art Biennale

LED Artist

Daan Roosegaarde

Common Lights

Jim Campbell

 

Incandescent light blubs

Halogen light blubs

Fluorescent tube bulbs

High intensity discharge lamps

LED light