Skip to main content
Skip to main content

LilyPad Personalised
Alert Buzzer

Years 7-8

In this lesson students will create a personalised musical buzzer by programming the LilyPad Arduino to play a sound using the Main board, Buzzer and Button, coding the note frequency in Arduino IDE. The lesson can be extended to include LED’s that light up or flash according to the note played to enable the buzzer to be used for the hearing impaired.

This lesson idea was created by Toni Falusi.



Overview

Description

In this lesson students will create a personalised musical buzzer by programming the LilyPad Arduino to play a sound using the Main board, Buzzer and Button, coding the note frequency in Arduino IDE. The lesson can be extended to include LED’s that light up or flash according to the note played to enable the buzzer to be used for the hearing impaired.

During the testing phase, the LilyPad components will be connected using alligator clips before progressing to hand stitching them together using conductive thread for a final product that can be held in a person's hand or attached to their clothing.

The buzzer is to be personalised with a tune or tone of the student's choosing and will be used as an alert system for a person who is incapacitated.

Resources

  • Lilypad ProtoSnap kit with rechargeable battery
  • LilyPad LED’s
  • Conductive thread
  • Alligator clips
  • Arduino IDE installed onto computers
  • Mini USB cable
  • Chalk or pen for marking fabric
  • Felt/Material
  • Scissors
  • Paper
  • Needle
  • Pencils for design sketches
  • Embroidery hoop (suggested)
  • Mac or PC with latest Arduino IDE installed:
    For Windows
    For Mac

Prior Student Learning

An understanding of basic circuitry is essential for this activity as it is important that the threads do not cross over or touch as you may short circuit the board.

Simple hand stitching skills would be beneficial but not essential as the components can be connected with alligator clips.

Learning hook

  1. Discussion prompts:
    • What would the advantages be of a wearable personal buzzer?
    • Why would it be useful for a personalised alert tone’? (Carers would know who was in need of attention quickly)
    • How could the buzzer be adapted for use in a noisy environment? (Include LEDs)
    • What other applications would a personalise buzzer be useful for? (eg. Quiz game buzzer)
  2. Pose a scenario to the students that they have been approached by a Retirement Village to produce personalised buzzers for a range of clients who have varying needs. These include but are not limited to the elderly who are hearing impaired, visually impaired,have mobility issues and/or vocal impairment.
  3. These clients require a means of getting the attention of their carers when they are in areas of the Retirement village other than their room. These devices must be wearable or able to attach to them in some way and be aesthetically pleasing.
  4. Introduce the concept of how these devices are programmable and thus code can be written to achieve the planned outcomes. Introduce the concept of functions and discuss how arduino has predefined functions for all the LilyPad components. Some of these functions include:
    • loop - for repetition
    • delay - delays action
    • pinMode - for configuring the specified pin to behave either as an input or an output
    • digitalWrite - for writing a low or high value to a pin
  5. A full documentation and description of these functions can be found here.

Learning map and outcomes

  • Identify LilyPad main board, Buzzer and Button
  • Review basic electronics & circuitry.
  • Explore Arduino IDE software that has been installed onto computers & configure port plus select LilyPad in Board Manager
  • Connect LilyPad components together using alligator clips for testing
  • Type Alert Buzzer Basics program into Arduino IDE & upload to LilyPad
  • Establish the needs of the client who the personalised buzzer will be designed for & research the constraints that will limit the design.
  • Discuss possible designs and present to peers for feedback
  • Create diagram flow chart to show connections needed for LilyPad components and the chosen design of the Alert Buzzer
  • Create algorithm to create personalised musical sequence which includes more than three notes.
  • Students identify the ways in which the program can be decomposed into functions
  • Students identify the key arduino functions and learn how to change parameters and use these these functions to achieve planned outcomes
  • OPTIONAL - include visual component using LED’s and alter algorithm in Arduino IDE. Include changes to the diagram chart to indicated additional changes.
  • Hand stitch LilyPad components onto fabric following the flow chart
  • Present final project to the class.

Learning input

The teacher should have an understanding o

  • circuitry,
  • basic hand sewing techniques
  • the elements of C language used in the Arduino IDE
  • see Sew Electronics tutorial for basic code elements
  • Get started with Lily Pad (Arduino) Programming with this documentby Andrew Bulleen.

This activity can be completed in small groups or individually depending on the experience of the students with the technology & Arduino IDE

Learning construction

  • Students review knowledge of basic electronics and the issue of short circuits.
  • Introduce conductive thread discussing issues with insulation & resistance. The kit contains 2 ply thread that will compromise the brightness of the LED if sewn over a long distance. (This should not be a problem with this task)
  • Open Arduino IDE and connect board to computer using mini USB cable
  • Select the board type and port - Tools_Board Manager_ LilyPad Arduino. Then Tools_port (select the serial port that is corresponds to the USB port eg:COM3
  • Set up LilyPad - Using alligator clips, connect the positive (+) on the Buzzer to Port 5 on the Main Board. Attach the negative (-) on the Buzzer to the negative port on the Main Board. Attach the (+) on the Button to Port A3 on the main board and (-) on the Button to (-) on the Main Board to complete the circuit.
  • Type the following code into the Arduino IDE and save as Alert Buzzer Basic
  • // Pin the buzzer is attached to
    int buzzerPin = 5;

    // Pin the button is attached to
    int buttonPin = A3;

    // Variable to store the button's state
    int buttonState = 0;

    // Set a time in milliseconds for all delays
    int delayTime = 100;

    // Notes
    const int C = 1046;
    const int D = 1175;
    const int E = 1319;
    const int F = 1397;
    const int G = 1568;
    const int A = 1760;
    const int B = 1976;
    const int C1 = 2093;
    const int D1 = 2349;

    void setup()
    {
    // Set the buzzer pin as an OUTPUT
    pinMode(buzzerPin, OUTPUT);
    //Set the button as INPUT
    pinMode(buttonPin, INPUT_PULLUP);
    }

    void loop()
    {
    buttonState = digitalRead(buttonPin);
    if (buttonState == LOW)
    {
    // Call a function named playSong()
    playSong();
    } else
    {
    noTone(buzzerPin);
    }
    delay(delayTime);
    }
    void playSong()
    {
    tone(buzzerPin, C);
    delay(delayTime);
    // Use noTone() to shut off the buzzer and delay to create a 'rest'
    noTone(buzzerPin);
    delay(delayTime);
    }
  • Upload Sketch to LilyPad and test by pressing the Button. There should be a single pulse tone played when the button is pressed.
  • Once the test program is successful, students move on to designing the user interface for the Alert Buzzer based on the needs of their client.
  • Identify the key blocks of the code, in particular the setup() and loop() functions, and discuss their purpose. What about the delay() function? What other functions of interest can students find?
  • Share designs with class members for feedback and make any changes are required.
  • Create a labelled diagram flow chart to show connections needed for LilyPad components and the chosen design of the Alert Buzzer
  • Currently the Alert Buzzer only plays a single tone using the frequency of C=1046. Make alterations to the program to incorporate a minimum of three varying tones.
  • Students decompose this problem into key elements:
    • setting the first tone - using the tone function
    • delay - using the delay function
    • setting the second tone using the tone function
    • delay - using the delay function
  • This can be done by adding additional lines of code under the new function called void playSong ()
    Eg:

    tone(buzzerPin, D);
    delay(delayTime);
    tone(buzzerPin, A);
    delay(delayTime);
  • Students can explore the varying tones of each note added. The program will play sequentially through each command repeatedly when the button is pressed. Remind the students to upload the sketch each time they make a change.
  • For a more advanced activity, LED’s can be incorporated into the design at this stage but is not an essential component for this task.
  • Hand stitch all components to fabric following the diagram flow chart.
  • Present final product to class and evaluate designs based on the original design brief.

Learning demo

  • Students present their final product to the class, together with their diagram flow chart and evaluate the Alert Buzzer against the original design brief.

Learning reflection

  • How has the final product met the requirements of the Retirement Village brief?
  • How user friendly is the design for the client? Can it be attached or worn with ease whilst still being accessible for the patient to push the Button?
  • Is the alert tone personalised?
  • How could they market this device? Could it be reproduced easily?
  • What is the role of technology in this task? Could the Alert buzzer be produced without it?
  • What are the advantages/disadvantages of using functions in code? Did they discover an interesting/useful function they want to share?

Resources