Example Projects
Workshops
Announcements
Actuators
Connections
Power
Sensors
Traces

Circuits and Code Wireless

Meet the Materials
Conductive Materials
Non-Conductive Materials
Tools
Techniques
Thinking Out Loud
Circuits and Code
  • Arduino Overview
  • Arduino as Bluetooth HID
  • ATtiny: 7-Segment Display
  • ATtiny: Capacitive Sensing
  • ATtiny: Programming
  • ATtiny Serial & Wireless Boards!
  • ATtiny: Soft Serial
  • ATtiny: Sound
  • ATtiny: Soft Fade
  • Bits and Bytes Binary numbers
  • Multiplexed Matrix
  • Controlling EL Panel and EL Wire
  • EL panel/wire inverter hack
  • EMF amplifier
  • Heat Controlling Circuit
  • LED with Light Sensor
  • Lilypad XBee Shield
  • My First Arduino Connection Check
  • pressure matrix code + circuit
  • Pull-up Resistors
  • Rabbit Control Client on Bela
  • RabbitControl on Bela
  • RGB Colour Fade
  • simple heat circuit
  • Solar Powered Motor Circuit
  • Sound Amplifying Circuits
  • Graphing and Drawing Sensor Values
  • Teensy as HID Device
  • Transistor Switch
  • Volume Detection
  • Visualization: 2x2 Matrix
  • Visualization: Drawing
  • Visualization: Graph
  • Visualization: Pressure Sensor Matrix
  • Visualization: Touchpad
  • Voltage Divider
  • Voltage Divider with Arduino
  • What is Variables?
  • Support the creation of content on this website through PATREON!
  • About
  • E-Textile Events
  • E-Textile Spaces
  • Newsletter
  • Print & Publications
  • E-Textile Shopping

  • SEARCH
    Content by Mika Satomi and Hannah Perner-Wilson
    E-Textile Tailor Shop by KOBAKANT
    The following institutions have funded our research and supported our work:

    Since 2020, Hannah is guest professor of the Spiel&&Objekt Master's program at the University of Performing Arts Ernst Busch in Berlin

    From 2013-2015 Mika was a guest professor at the eLab at Kunsthochschule Berlin-Weissensee

    From July - December 2013 Hannah was a researcher at the UdK's Design Research Lab

    From 2010-2012 Mika was a guest researcher in the Smart Textiles Design Lab at The Swedish School of Textiles

    From 2009 - 2011 Hannah was a graduate student in the MIT Media Lab's High-Low Tech research group led by Leah Buechley


    In 2009 Hannah and Mika were both research fellows at the Distance Lab


    Between 2003 - 2009 Hannah and Mika were both students at Interface Cultures
    We support the Open Source Hardware movement. All our own designs published on this website are released under the Free Cultural Works definition
    Circuits and Code

    ATtiny: Sound

    Following some examples of running sound on the ATtiny.

    Checking inputs while playing sound

    When reading inputs while playing sound one had to work around the “delay” used in most sound functions.
    Option 1) Use a counter instead of the delay function
    >> http://www.uchobby.com/index.php/2012/01/21/replacing-delay-in-arduino-sketches-istime-to-the-rescue/

    Option 2) Use a hardware interrupt to interrupt sound loop
    Video >> http://www.youtube.com/watch?v=0aAwKT0YWJU
    >> http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=105493

    Leah’s beep function

    Taken from >> http://web.media.mit.edu/~leah/LilyPad/07_sound.html

    // code for sound and led output on an ATtiny85
    // using leah buechley’s sound code, taken from: http://web.media.mit.edu/~leah/LilyPad/07_sound_code.html

    int speakerPin = 8;

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

    void loop() {
    beep(speakerPin, 2800, 1000); //plays frequency of 2800 for 1 second
    scale(C); //plays note C for half a second
    }

    void scale (char note)
    {
    if(note == ‘C’)
    beep(speakerPin,2093,500); //C: play the note C (C7 from the chart linked to above) for 500ms
    if(note == ‘D’)
    beep(speakerPin,2349,500); //D
    if(note == ‘E’)
    beep(speakerPin,2637,500); //E
    if(note == ‘F’)
    beep(speakerPin,2793,500); //F
    if(note == ‘G’)
    beep(speakerPin,3136,500); //G
    if(note == ‘A’)
    beep(speakerPin,3520,500); //A
    if(note == ‘B’)
    beep(speakerPin,3951,500); //B
    if(note == ‘H’)
    beep(speakerPin,4186,500); //C
    }

    void beep (unsigned char speakerPin, int frequencyInHertz, long timeInMilliseconds) // the sound producing function
    {
    int x;
    long delayAmount = (long)(1000000/frequencyInHertz);
    long loopTime = (long)((timeInMilliseconds*1000)/(delayAmount*2));
    for (x=0;x



    Leave a comment