BPM Monitor with LCD Display

Materials:

  • LCD Display Screen
  • Jumper Wires
  • Potentiometer
  • Heartbeat Pulse Sensor
  • Cardboard
  • Duct Tape
  • Wrapping Paper
  • Scissors

Instructions

  1. Aquire cardboard
  2. Use cardboard to form a box with the dimensions of 7 inches by 2 1/2 inches by 5 inches. (Figure 1)
  3. Cut a rectangle in between the box to create the lens space seen in (Figure 1) for the LCD screen. This will allow you to look inside into the LCD in order to see your BPM
  4. Within the upper section (top of the box) make sure to cut as to have a lid where you will later be able to insert your wiring connections (Figure 2)
  5. Begin Setting up your wires after your box if fully made
  6. LCD VSS to GND, LCD VDD to 5V, LCD VO to Potentiometer front leg, LCD RS to Pin 12, LCD RW to GND, LCD E to Pin 11, LCD D4 to DPin 5, LCD D5 to DPin 4, LCD D6 to DPin 3, LCD D7 to DPin 2, LCD A to 220Ohm to 5V, LCD K to GND, Left Leg Potentiometer to GND, Right Leg Potentiometer to 5V. (This concludes potentiometer and LCD screen to Arduino).
  7. Now to begin your Pulse Sensor setup. PulseSensor = PS. PS Signal to A0, PS VCC to 5V, and PS GND to GND.
  8. (Use figure 3 for reference of this).
  9. Now you’ll need to cut a small opening on the side of the box through where you intend to have your Arduino and Pulse Sensor to slip out from. (Figure 4)
  10. Wrap your box with black gifting stuffing all around. (Figure 5)
  11. You’re Work is all done now.

Screen Shot 2018-12-11 at 10.52.17 PM.png

Figure 1

Screen Shot 2018-12-11 at 10.56.31 PM.pngFigure 2

IMG_0223.jpegFigure 3

IMG_0224.jpegFigure 4

Screen Shot 2018-12-11 at 11.21.34 PM.pngFigure 5

Code:

#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int pulsePin = A0;
int blinkPin = 13;
volatile int BPM;
volatile int Signal;
volatile int IBI = 600;
volatile boolean Pulse = false;
volatile boolean QS = false;
static boolean serialVisual = true;
volatile int rate[10];
volatile unsigned long sampleCounter = 0;
volatile unsigned long lastBeatTime = 0;
volatile int P = 512;
volatile int T = 512;
volatile int thresh = 525;
volatile int amp = 100;
volatile boolean firstBeat = true;
volatile boolean secondBeat = false;
void setup()
{
pinMode(blinkPin, OUTPUT);
Serial.begin(115200);
interruptSetup();

lcd.begin(16, 2);
lcd.clear();
}

void loop()
{
serialOutput();

if (QS == true)
{

serialOutputWhenBeatHappens();
QS = false;
}

delay(20);
}
void interruptSetup()
{

TCCR2A = 0x02;
TCCR2B = 0x06;
OCR2A = 0X7C;
TIMSK2 = 0x02;
sei();
}

void serialOutput()
{
if (serialVisual == true)
{
arduinoSerialMonitorVisual(‘-‘, Signal);
}
else
{
sendDataToSerial(‘S’, Signal);
}
}

void serialOutputWhenBeatHappens()
{
if (serialVisual == true)
{
Serial.print(” Heart-Beat Found “);
Serial.print(“BPM: “);
Serial.println(BPM);
lcd.print(“Heart-Beat Found “);
lcd.setCursor(1, 1);
lcd.print(“BPM: “);
lcd.setCursor(5, 1);
lcd.print(BPM);
delay(300);
lcd.clear();
}
else
{
sendDataToSerial(‘B’, BPM);
sendDataToSerial(‘Q’, IBI);
}
}
// this is making me cry why is this so hardbkjZSDCDBJKSZDjkndcjknszdjnkzdbcarv;rejkn
void arduinoSerialMonitorVisual(char symbol, int data )
{
const int sensorMin = 0;
const int sensorMax = 1024;
int sensorReading = data;
int range = map(sensorReading, sensorMin, sensorMax, 0, 11);

}
void sendDataToSerial(char symbol, int data )
{
Serial.print(symbol);
Serial.println(data);
}

ISR(TIMER2_COMPA_vect)
{
cli();
Signal = analogRead(pulsePin);
sampleCounter += 2;
int N = sampleCounter – lastBeatTime;

if (Signal < thresh && N > (IBI / 5) * 3)
{
if (Signal < T)
{
T = Signal;
}
}

if (Signal > thresh && Signal > P)
{
P = Signal;
}

if (N > 250)
{
if ( (Signal > thresh) && (Pulse == false) && (N > (IBI / 5) * 3) )
{
Pulse = true;
digitalWrite(blinkPin, HIGH);
IBI = sampleCounter – lastBeatTime;
lastBeatTime = sampleCounter;

if (secondBeat)
{
secondBeat = false;
for (int i = 0; i <= 9; i++)
{
rate[i] = IBI;
}
}

if (firstBeat)
{
firstBeat = false;
secondBeat = true;
sei();
return;
}

word runningTotal = 0;

for (int i = 0; i <= 8; i++)
{
rate[i] = rate[i + 1];
runningTotal += rate[i];
}

rate[9] = IBI;
runningTotal += rate[9];
runningTotal /= 10;
BPM = 60000 / runningTotal;
QS = true;

}
}

if (Signal < thresh && Pulse == true)
{
digitalWrite(blinkPin, LOW);
Pulse = false;
amp = P – T;
thresh = amp / 2 + T;
P = thresh;
T = thresh;
}

if (N > 2500)
{
thresh = 512;
P = 512;
T = 512;
lastBeatTime = sampleCounter;
firstBeat = true;
secondBeat = false;
}

sei();
}

Christmas Landscape Display

Materials:

  • Minatures (Santa with Sleigh and Vegeta) + pine trees
  • PlayDough (various colors)
  • Breadboard
  • LEDs
  • Buzzer
  • Ultrasonic Sensor
  • Cardboard
  • Ductape
  • Clear Tape
  • Christmas Gift Wrap
  • Jumper Wires
  • 330ohm Resistors
  • Arduino
  • Styrofoam mini balls

Instructions

  1. Acquire a couple of cardboard boxes.
  2. With acquired cardboard create a 3 dimensional box ( 11inches by 7 1/2 inches by 8 inches). (Figure 1).
  3. Begin wiring your connections. Buzzer to Pin 3, LED 1 to Pin 8, LED 2 to Pin 9, LED 3 to Pin 10, LED 4 to Pin 11, LED 5 to Pin 12, LED 6 to Pin 13.
  4. Note the jumper wires to LEDs go from the Anodes to the Pins. All LEDs will have their Cathode side with one of the resistors connecting to ground.
  5. Now we’ll do the UltraSonicSensor. VCC to GND, Trig to Pin 7, Echo to Pin 6, and GND to GND. Refer to (Figure 2) for reference.
  6. Now that you’re all wired up it’s time to work on the box again.
  7. Create a slab in which you will hold up the Christmas landscape so make sure to place a piece of cardboard right above your wiring so that it is covered completely and allows for your landscape to be on top.
  8. Cut a small part of the landscape cardboard and place and oval like shape of craft paper over it (This will be your lake)
  9. Begin molding your clay into a variety of things. (patches of snow. patches of greenery, mountains, snow ramps and some large snowballs. Refer to (Figure 3).
  10. Place your Santa with sled as well as Vegeta on the Christmas landscape as the sole inhabitants that will fight for control of Christmas.
  11. Now add your pine trees. (Figure 3)
  12. Toss some styrofoam balls as well.
  13. Now that your landscape is done its time to grab some gift wrap and wrap up your box to give it life. (Figure 4).
  14. Finish setting up and test your creation.
  15. Buzzer and Lights will simultaneously go off giving life to your landscape based on proximity to the ultra sonic sensor.
  16. Enjoy!

Code:

#define trigPin 7
#define echoPin 6
#define led 13
#define led2 12
#define led3 11
#define led4 10
#define led5 9
#define led6 8
#define buzzer 3

int sound = 250;

void setup() {
// put your setup code here, to run once:
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(buzzer, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;

if (distance <= 30) {
digitalWrite(led, HIGH);
sound = 250;
}
else {
digitalWrite(led,LOW);
}
if (distance < 25) {
digitalWrite(led2, HIGH);
sound = 260;
}
else {
digitalWrite(led2, LOW);
}
if (distance < 20) {
digitalWrite(led3, HIGH);
sound = 270;
}
else {
digitalWrite(led3, LOW);
}
if (distance < 15) {
digitalWrite(led4, HIGH);
sound = 280;
}
else {
digitalWrite(led4,LOW);
}
if (distance < 10) {
digitalWrite(led5, HIGH);
sound = 290;
}
else {
digitalWrite(led5,LOW);
}
if (distance < 5) {
digitalWrite(led6, HIGH);
sound = 300;
}
else {
digitalWrite(led6,LOW);
}

if (distance > 30 || distance <= 0){
Serial.println(“Out of range”);
noTone(buzzer);
}
else {
Serial.print(distance);
Serial.println(” cm”);
tone(buzzer, sound);

}
delay(500);
}

Images: IMG_0221.jpeg

Figure 1

Screen Shot 2018-12-12 at 12.03.22 AM.png

Figure 2

Screen Shot 2018-12-12 at 12.05.47 AM.png

Figure 3

Screen Shot 2018-12-12 at 12.08.15 AM.png

Figure 4

Screen Shot 2018-12-12 at 12.09.06 AM.png

Figure 5

Travelle Arduino code/pics final

int trigPin = 11; // Trigger
int echoPin = 12; // Echo
long duration, cm, inches;
int R = 9;

void setup() {
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(R, OUTPUT);
}

void loop() {
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

// Convert the time into a distan ce
cm = (duration / 2) / 29.1; // Divide by 29.1 or multiply by 0.0343
inches = (duration / 2) / 74; // Divide by 74 or multiply by 0.0135

if (cm > 0 && cm <= 20) { //distcance is greater than 0 and less than 20cm
Serial.print(“LED”);
digitalWrite(R, HIGH); //red led is on // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(R, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for a second
} else if (cm > 20 && cm <= 80) { //distcance is greater than 20 and less than 80cm
digitalWrite(R, LOW); //red led is off

}
Serial.print(inches);
Serial.print(“in, “);
Serial.print(cm);
Serial.print(“cm”);
Serial.println();

delay(250);


}

Capacitive Touch Keyboard

For this project I’ve made a keyboard that uses capacitive touch as an input method. It boasts an impressive 12 keys so you can play almost an entire chromatic scale (MPR121 doesn’t have a 13th pin). This project uses software called Sonic Pi that is essentially a program that allows you to play sounds with code. I referenced this project to figure out how to get this to work so I will link it here if you want to see https://rbnrpi.wordpress.com/project-list/a-musical-12-tone-alarm-for-the-raspberry-pi-part-1/12-input-touch-keyboard-for-sonic-pi/

Here is what I made it with:

  • Raspberry Pi
  • Mpr121 Sensor
  • Wire
  • 8mm sheet of wood
  • More wires

As you can see, instead of arduino, this project uses a Raspberry Pi. Pi has a lot more options when it comes to producing sound compared to using the digital pins on an arduino.

Step 1: Building the thing.

IMG_3558.jpgIMG_3556.jpg

I used this website http://www.makercase.com/ to laser cut myself a box that was 6.25″ x 4″. I then cut more holes into it so I could poke wires through the top. Then I laser cut out all 12 keys and just kinda taped them into place.

IMG_3559.jpg

Step 2: Wiring stuff

This was the most annoying part to do since I didn’t have enough solder to do it correctly.

IMG_3570.jpg

First I soldered braided wires directly onto each key. That was a nice mistake because now the other end of the wire wont fit into the breadboard with the mpr121. To fix this I just duck taped jumper wires onto each key’s wire so I could make a “solid” connection to the sensor. The order of wiring the keys to the sensor starts with the leftmost key at pin 0 and just goes up to pin 11.

j8header-3b.pngIMG_3588.jpg

Connecting the MPR121 to the Pi is also annoying because they don’t label any of the pins. Lucky for you I looked everything up and labeled it myself.

Step 3: the Pi

Okay now you have to figure out how to get this thing running. First you have to go to https://www.raspberrypi.org/downloads/raspbian/ and download Raspbian Stretch with recommend software. Once you download that you need to get it on a microSD card using disc image software. I just used something called rufus https://rufus.ie/en_IE.html

To get the sensor to actually work with Pi there are a few steps you need to do. https://learn.adafruit.com/mpr121-capacitive-touch-sensor-on-raspberry-pi-and-beaglebone-black/software You can check this link for detailed instructions.

First you need to edit the /boot/config.txt and add this line to the bottom so the mpr121 actually works.

dtoverlay=i2c-bcm2708

After that install python3 by typing this into the terminal.

sudo apt-get update
sudo apt-get install build-essential python3-dev python3-smbus python3-pip git
cd ~
git clone https://github.com/adfruit/Adafruit_Python_MPR121
sudo python3 setup.py install

Now you need to save this as a python file. This is used so the mpr121 can interface with the software we are using.

#!/usr/bin/env python3

#driver for 12 pad touch keys and ps3 wireless controller by Robin Newman
#April 2018
#uses library for Adafruit MPR121 board

# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# NB Install Adafruit Library and python-osc library before use
import sys
import time
import pygame

import Adafruit_MPR121.MPR121 as MPR121

from pythonosc import osc_message_builder #add library for OSC support
from pythonosc import udp_client
import argparse
pygame.display.init()
##### uncomment next three lines to add joystick support
#pygame.joystick.init() #add support for PS3 controller
#ps3=pygame.joystick.Joystick(0)
#ps3.init()

def control(spip): #This is called once __main__ has set up the Sonic Pi ip address
gate = 0.1 #dead area used for PS3 joysticks
sender=udp_client.SimpleUDPClient(spip,4559) #set up OSC link to Sonic Pi


print('Adafruit MPR121 Capacitive Touch keypads')

# Create MPR121 instance.
cap = MPR121.MPR121()

# Initialize communication with MPR121 using default I2C bus of device, and
# default I2C address (0x5A). On BeagleBone Black will default to I2C bus 0.
if not cap.begin():
print('Error initializing MPR121. Check your wiring!')
sys.exit(1)

# Alternatively, specify a custom I2C address such as 0x5B (ADDR tied to 3.3V),
# 0x5C (ADDR tied to SDA), or 0x5D (ADDR tied to SCL).
#cap.begin(address=0x5B)

# Also you can specify an optional I2C bus with the bus keyword parameter.
#cap.begin(busnum=1)

pygame.init()


# Main loop to print a message every time a pin is touched.
print('Press Ctrl-C to quit.')
last_touched = cap.touched()
while True:
try:
current_touched = cap.touched()
# Check each pin's last and current state to see if it was pressed or released.
for i in range(12):
# Each pin is represented by a bit in the touched value. A value of 1
# means the pin is being touched, and 0 means it is not being touched.
pin_bit = 1 << i
# First check if transitioned from not touched to touched.
if current_touched & pin_bit and not last_touched & pin_bit:
print('{0} touched!'.format(i))
print("/key"+str(i)+',1')
sender.send_message('/key'+str(i) ,1)
if not current_touched & pin_bit and last_touched & pin_bit:
print('{0} released!'.format(i))
print('/key'+str(i)+',0')
sender.send_message('/key'+str(i) ,0)


# Update last state and wait a short period before repeating.
last_touched = current_touched
time.sleep(0.1)

except KeyboardInterrupt:
print("\nExiting")
sys.exit()

if __name__=="__main__":
parser = argparse.ArgumentParser() #setup retrieving arg (if any) for --sp
parser.add_argument("--sp",
default="127.0.0.1", help="The ip on which Sonic Pi listens")
args = parser.parse_args()
spip=args.sp
print("Sonic Pi on ip",spip)
control(spip)


Basically it will send events to Sonic Pi whenever a key is pressed so the code can respond to it.

Open up Sonic Pi, which is already installed, and put this code in.

#written by Robin Newman, April 2018
#moddified by Max Kawula

#the following function detects value of wild card in osc address
define:parse_sync_address do |address|
v= get_event(address).to_s.split(",")[6]
if v != nil
return v[3..-2].split("/")
else
return ["error"]
end
end

use_synth :piano #set initial synth
set :base,60 #set initial octave base note

live_loop :getkey do
use_real_time
b = sync "/osc/key*" #detect osc messages from ANY key using wild card *
if b[0] == 1 #if the key has been pressed
res = parse_sync_address "/osc/key*" #decode wild card value
puts "Decoded address information is",res
key = res[1][3..-1].to_i #extract key from res list and convert to integer
puts "key pressed was",key
if key<11
scaleOffset=[1,2,3,4,5,6,7,8,9,10,11,12]
play note get(:base) + scaleOffset[key]

end
end
end

Hit run and the keyboard should work. Here is a video of me playing it.

You might notice that there is a noticeable amount of latency every time I hit a key. That is because the software I’m using is really slow on Pi. The only work around on this is to send the OSC events to a remote computer running sonic pi and it should eliminate that horrible delay.

2 page paper below:

Capacitive Touch Keyboard.

Wearable Interactive project

For my wearable/interactive project I made a midi controller. Thanks to a midi controller I can take controls in an audio workstation and change them with the knobs. In this project, I am using Ableton, which has full Arduino support.

The layout of the whole thing is pretty simple, it’s basically knobs controlling stuff inside a program, therefore the code is also simple. The code is taken from the Arduino examples, it’s called Standart Firmata in the Firmata section.

Part List

  • Arduino Uno
  • Jump Wires
  • 4 5k/10k Potentiometers
  • Ableton Live 9,10 ( you can use the trial)
  • 3D Printer or Project Box
  • Solder
  • Soldering Iron
  • Wire cutters

 

Instructions

  1. 3d print the box, make sure it fits the Arduino.
  2. Insert the potentiometers.
  3. Connect a wire to the ground pin, and one to the 5v pin. These wires are going to be used as rails to connect our potentiometers.
  4. Connect the left legs of the potentiometers together and solder them to the 5v wire.
  5. Connect the right legs of the potentiometers together and solder them to the ground wire.
  6. The middle leg of each potentiometer will go to the A pins on the Arduino. The order doesn’t matter.
  7. Now that everything is connected, plug in the Arduino to your computer.
  8. Download the Connection Kit 

    on Kit from Ableton.com

  9. Once you have installed the kit you can select the Arduino Preset.

 

Now you can map any control you want to any knob.

 

The idea was taken from Ask Audio.

 

 

 

Final Project – Music Suit – Matt Insalata

 

Video

https://drive.google.com/file/d/1KQ3fJ7iB8XMFwy2QcVxyUZ-5ce8y7PZu/view?usp=sharing

Final Paper

https://docs.google.com/document/d/1vU-2Nx-ig0ZyoE-vJsLP1J5_5KwEvZEXVwSuimsj-cM/edit?usp=sharing

Materials

  1. Arduino Uno
  2. SD card shield
  3. SD card
  4. Lots o’ Wire
  5. MPR121 Capacitive Touch Sensor (x2)
  6. Copper Fabric
  7. Conductive Thread
  8. Amplifier and Speaker
  9. Instrument Cable (1/4 inch jack)
  10. Old Shirts and Fabric
  11. Wiring harness connectors (optional)
  12. Power source of your choice (9V battery, or USB power bank)
  13. Cardboard mailing tube

How to Build It 

(All wiring will be detailed in the wiring section that comes after this)

  1. Find music samples and load them to the SD card. I used FreeSounds.org to get the samples. Now convert the sound files to RAW file type using a conversion software. I used the free Software Audacity. Once inside Audacity, you have to change audio tracks to Mono, and resample them at 62,500 Hz. There are write-ups online that go in-depth on the file conversion process.
  2. Now put the SD card in the SD card shield and attach the shield to the Arduino. It should stack right on top of the Arduino. All connections will now be made to the pins on the SD card shield.
  3. Wire up the amp and speaker. I used a Marshall belt-clip mini amp which has a speaker inside. Without an amp, the sounds will be super quiet.
  4. Now wire up the capacitive touch sensors.
  5. Next connect the touch sensors to the copper fabric pads. I sewed the copper fabric pads for the drums into an old piece of fabric that I wrap around my leg. I put velcro on the fabric so that it is detachable. I glued copper fabric pads for keyboard sounds to a section of a cardboard mailing tube. Then I put elastic bands on the tube to attach it to my arm. Voila. Arm keyboard.
  6. I also wired wiring harness connectors between the arm piece and leg piece and Arduino. This makes it so everything can be disconnected and not one big piece. This step is optional.
  7. Now load the code into the Arduino
  8. Connect Arduino to power source. For portability, use either a USB power bank or a 9V battery.
  9. In order to make this project portable, find a jacket / shirt with many pockets to keep all of the electronics in. I sewed pockets on the inside of a shirt to house the Arduino, and a small breadboard containing the touch sensors.
  10. Hit the copper pads to hear music sounds. Copper pads sewed onto legs = drums. Copper pads on arm piece = keyboard.
  11. Make music!

Wiring

  1. As mentioned earlier, all connections go the SD card shield that is stacked on the Arduino.
  2. For the speaker and amp:
    • Connect the 1/4 inch instrument cable to the amp input.
    • Cut off the other end of the instrument cable and expose bare wires.
    • There will be an insulated wire inside, as well as some bare exposed wires.
    • Wire the bare wires to the ground of the arduino
    • Wire the insulated wire (this is the hot), to the pin 9 of Arduino
  3. For the Capacitive Touch sensors:
    • Wire the SCL pin of one of the sensors to the A5 pin of Arduino
    • Wire the SDA pin of one of the sensors to A4 pin of Arduino
    • Wire ground pin to ground of Arduino
    • Wire VIN pin to 5V pin of Arduino
    • Wire ADDR pin of the touch sensor that will be used for keyboard sounds to the 3.3V pin of Arduino
    • Now run wires that tie the two touch sensor boards together. Make the following connections
      • tie SCL pins to each other
      • tie SDA pins to each other
      • tie Ground pins to each other
      • tie VIN pins to each other
    • Now the sensors are hooked up, time to connect the touch pads
      • Touch sensor for keyboard sounds
        • Run wires from pins 0-11 to individual copper fabric pads
        • To connect wire to copper fabric: sew exposed wire to copper fabric pads using conductive thread
        • Reinforce connections with hot glue for durability
      • Touch sensor for drums
        • Run wires from following pins to copper fabric pads. Use the same tactic of sewing wires to fabric as discussed above.
          • Pin 9 = Hi-Hat fabric pad
          • Pin 8 = Snare fabric pad
          • Pin 4 = crash fabric pad

Code 

//Used several different codes to help piece together, including bits from the MPR121 class example, and from an online drum machine tutorial by some guy with a frog avatar

//Below are for SD card, using the SimpleSDAudio library which needs to be downloaded from the internet

#include <sd_l0.h>
#include <sd_l1.h>
#include <sd_l2.h>
#include <SimpleSDAudio.h>
#include <SimpleSDAudioDefs.h>

//below are for the MPR121touch sensor
#include <Wire.h>
#include “Adafruit_MPR121.h”

#ifndef _BV
#define _BV(bit) (1 << (bit))
#endif

// You can have up to 4 on one i2c bus but one is enough for testing!
Adafruit_MPR121 cap = Adafruit_MPR121(); //sensor 1 – drums
Adafruit_MPR121 cap2 = Adafruit_MPR121(); //sensor 2 – keyboard
// Keeps track of the last pins touched
// so we know when buttons are ‘released’
//sensor 1 – drums
uint16_t lasttouched = 0;
uint16_t currtouched = 0;

// Keeps track of the last pins touched
// so we know when buttons are ‘released’
//sensor 2 – keys
uint16_t lasttouched2 = 0;
uint16_t currtouched2 = 0;

//Code of MPR121 taken from class example

void setup()
{
Serial.begin(9600);
tone(9, 200, 30);//play startup sound
Serial.println(F(“startup Sound”));
delay (1000);

// SD card initialization
SdPlay.setSDCSPin(10); // chip select
SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER);
Serial.println(F(“sd ready”));

// Capactive touch sensor initialization
Serial.println(F(“Adafruit MPR121 Capacitive Touch sensor test”));
// Default address is 0x5A, if tied to 3.3V its 0x5B
// If tied to SDA its 0x5C and if SCL then 0x5D
if (!cap.begin(0x5A)) {
Serial.println(F(“MPR121 not found, check wiring?”));
while (1);
}
Serial.println(“MPR121 found!”);
//to sense MPR sensor number 2, use different address. Tie ADR pin to 3.3V
if (!cap2.begin(0x5B)) {
Serial.println(F(“MPR121 number 2 not found, check wiring?”));
while (1);
}
Serial.println(F(“MPR121 Dos found!”));

}

void loop()
{
currtouched = cap.touched(); //sets variables that store what pins are currently touched for each touch sensor
currtouched2 = cap2.touched();

//hook up speaker to pin 9, just like before on flannel

/*MPR121 Code
Code works by sensing if currently touched pin = corresponding pin. As long as the pin was not pressed the last time
through the loop, the sound will play. This prevents the possility of holding the pin and having the sound continuously play.
Cannot do this because since the programs loops so fast (for the sake of fastest response to touch possible), the sounds end up
being too fast when playing continously and sound like a crazy machine rather than an instrument.
*/

if ((currtouched & _BV(8)) && !(lasttouched & _BV(8))) {
SdPlay.setFile(“snare001.raw”); //sets up snare tone to run when called
SdPlay.play(); //plays snare sound
Serial.print(F(“snare sound playing”)); //F stores the string in flash memory, had to do this to save space
Serial.println();
}

else if ((currtouched & _BV(9)) && !(lasttouched & _BV(9)) && !(currtouched & _BV(8)) && !(currtouched & _BV(3))) { //code only executes if snare isn’t hit. Snare has priority.

SdPlay.setFile(“hat001.raw”); //sets up hi-hat tone to run when called
SdPlay.play();
Serial.print(F(“hi-hat sound playing”));
Serial.println();
}
if ((currtouched & _BV(3)) && !(lasttouched & _BV(3))) {
// play the bass drum sound if the pedal is pressed, and the touch pad is held

SdPlay.setFile(“tom.raw”); //sets up bass drum tone to run when called
SdPlay.play();
Serial.print(F(“bass drum sound playing”));
Serial.println();
}

if ((currtouched & _BV(4)) && !(lasttouched & _BV(4))) {

// play the crash cymbal sound
SdPlay.setFile(“crash001.raw”); //sets up bass drum tone to run when called
SdPlay.play();
Serial.print(F(“crash sound playing”));
Serial.println();
}
//All sounds from sensor 2 – Keys

if ((currtouched2 & _BV(0)) && !(lasttouched2 & _BV(0))) {
SdPlay.setFile(“a4.raw”); //sets up A note to run when called
SdPlay.play();
Serial.print(F(“A note playing”));
Serial.println();
}

if ((currtouched2 & _BV(1)) && !(lasttouched2 & _BV(1))) {
SdPlay.setFile(“a#4.raw”); //sets up A# note to run when called
SdPlay.play();
Serial.print(F(“A sharp note playing”));
Serial.println();
}

if ((currtouched2 & _BV(2)) && !(lasttouched2 & _BV(2))) {
SdPlay.setFile(“b4.raw”); //sets up B note to run when called
SdPlay.play();
Serial.print(F(“B note playing”));
Serial.println();
}
if ((currtouched2 & _BV(3)) && !(lasttouched2 & _BV(3))) {
SdPlay.setFile(“c5.raw”); //sets up C note to run when called
SdPlay.play();
Serial.print(F(“C note playing”));
Serial.println();
}

if ((currtouched2 & _BV(4)) && !(lasttouched2 & _BV(4))) {
SdPlay.setFile(“c#5.raw”); //sets up C# note to run when called
SdPlay.play();
Serial.print(F(“C# note playing”));
Serial.println();
}

if ((currtouched2 & _BV(5)) && !(lasttouched2 & _BV(5))) {
SdPlay.setFile(“d5.raw”); //sets up D note to run when called
SdPlay.play();
Serial.print(F(“D note playing”));
Serial.println();
}

if ((currtouched2 & _BV(6)) && !(lasttouched2 & _BV(6))) {
SdPlay.setFile(“d#5.raw”); //sets up D# note to run when called
SdPlay.play();
Serial.print(F(“D# note playing”));
Serial.println();
}

if ((currtouched2 & _BV(7)) && !(lasttouched2 & _BV(7))) {
SdPlay.setFile(“e5.raw”); //sets up E note to run when called
SdPlay.play();
Serial.print(F(“E note playing”));
Serial.println();
}

if ((currtouched2 & _BV(8)) && !(lasttouched2 & _BV(8))) {
SdPlay.setFile(“f5.raw”); //sets up F note to run when called
SdPlay.play();
Serial.print(F(“F note playing”));
Serial.println();
}

if ((currtouched2 & _BV(9)) && !(lasttouched2 & _BV(9))) {
SdPlay.setFile(“f#5.raw”); //sets up F# note to run when called
SdPlay.play();
Serial.print(F(“F# note playing”));
Serial.println();
}

if ((currtouched2 & _BV(10)) && !(lasttouched2 & _BV(10))) {
SdPlay.setFile(“g5.raw”); //sets up G note to run when called
SdPlay.play();
Serial.print(F(“G note playing”));
Serial.println();
}

if ((currtouched2 & _BV(11)) && !(lasttouched2 & _BV(11))) {
SdPlay.setFile(“g#5.raw”); //sets up G# note to run when called
SdPlay.play();
Serial.print(F(“G# note playing”));
Serial.println();
}

// reset our state for both Capacitive Touch Sensors
lasttouched = currtouched;
lasttouched2 = currtouched2;

delay(20); //delays just enough so that the sounds don’t happen too fast. Without this, it is TOO responsive and sounds messy

// Also, I found that I cannot go beyond, 43% of dynamic memory, or all sounds from SD card stop working.
// Could be possible that this aftermarket Arduino board does not have as much memory as the genuine Arduino unit.
}

Final Project: Cuddle Bot

Description:

Cuddle Bot is a lonely little robot that needs human interaction. When you get closer to Cuddle Bot, his lights become warmer and brighter. When you go away from him, his lights go off. The idea is to display emotions onto an otherwise lifeless object. We tend to give character and special meaning to the things we own. I know I do this all the time; therefore, I want to bring that aspect to this animated sculpture. It’s as if the human interacting with the bot is giving life to it. We need others to feel complete and that’s what this little guy will show.

Tools:

  • Arduino
  • USB Port
  • Wires
  • Wire stripper
  • Alligator clips
  • Soder
  • Sodering Iron
  • 2 RGB LEDs
  • Ultrasonic Sensor HC-SR04
  • Laser cutter
  • Shrink cover
  • Blow dryer
  • 6 330 Ω Resistors
  • Hot glue gun
  • Hot glue
  • 1/18in thick Chipboard
  • Exacto knife
  • Ruler
  • Duct tape

Process:

Step 1: Connect wires to breadboard to test

Step 2: If the sensor and lights work together, soder all parts together

Step 3: Construct Bot by sending chipboard to a laser printer to cut

Step 4: Use Exacto knife to score material on parts that will fold

Step 5: Hot Glue the pieces together and finish bot construction

Step 6: Place and tape circuits into the bot as shown

Step 7: Use and enjoy your new buddy

Gallery:

CuddleBot_template.jpg

IMG_3097.jpegIMG_3107.jpegIMG_3108.jpegIMG_3130.jpegIMG_3132.jpeg

Code:

*/
//Sensor//
int trigPin = 7; // Trigger
int echoPin = 8; // Echo
long duration, cm, inches;
int colorValue = 0;

//RGB LEDs//
int redPin = 11;
int greenPin = 10;
int bluePin = 9;
int redPin2 = 3;
int greenPin2 = 6;
int bluePin2 = 5;
void setup() {
//Sensor//
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

//RGB LEDs//
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(redPin2, OUTPUT);
pinMode(greenPin2, OUTPUT);
pinMode(bluePin2, OUTPUT);
}

void loop() {
//RGB LEDs//
setColor(colorValue, colorValue / 2, 255); // aqua

//Sensor//
// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

// Convert the time into a distance aaa
cm = (duration/2) / 29.1; // Divide by 29.1 or multiply by 0.0343
inches = (duration/2) / 74; // Divide by 74 or multiply by 0.0135
colorValue = map(cm, 0, 90, 0, 255);
Serial.print(inches);
Serial.print(“in, “);
Serial.print(cm);
Serial.print(“cm”);
Serial.println();

delay(250);
}

void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
red = 255 – red;
green = 255 – green;
blue = 255 – blue;
#endif
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
analogWrite(redPin2, red);
analogWrite(greenPin2, green);
analogWrite(bluePin2, blue);
}

 

Video:

https://drive.google.com/file/d/1pTta6jtTjKQ3jqCe3PYQv_gYmM8y-iwe/view?usp=sharing 

 

Essay:

Final Project: Granular Synthesizer

 

This project is a synthesizer. It creates sounds by moving the oscillators which are linked to the knobs. It has also an aux port which is necessary to hear the sounds, speakers are preferred since with headphones it’s harsh to the ears. I wanted to create this project because synthesizers are of my interest, and I always wanted to buy one, but now I have the opportunity to make one, and actually use it outside of school.

Paper: essay

Parts

  • Arduino
  • Jumper wires
  • Solder
  • Soldering Iron
  • Wires of different colors
  • Project box of the color and dimensions of your choice( make sure dimensions fit the Arduino)
  • Drill
  • 5k potentiometers
  • Female Audio Jack
  • Speakers or Headphones
  • LED of your choice of colors
  • 220 Ohm resistor
  • Screwdriver

Instructions

Part 1

Take your box and find where you want to place your knobs LED, audio jack port and the hole for the AC adapter cable. The potentiometers and led are of preference, but I recommend placing them apart from each other because it will make it easier to solder. As it goes for the other two holes, you should put one on the front of the box and one on the other front, this will make it easier for the AC cord to go out without being tangled with the wires.

Part 2

Mark the sports with a white sharpie or anything that will give you a sense of directions. Choose the appropriate size for the drill and drill the holes. Do this carefully because once you drill there is no going back.

Part 3

Now it’s time to figure out the schematic. I have a picture of the schematic linked below. To make things easier take a wire and put one in the 5v socket of the Arduino, the other one in the ground pin. Make sure these wires are longer than the other wires because they are the main wires that everything is going to be hooked up to. The middle pin of the potentiometer goes to the A pins on the Arduino, the other two on opposite sides go 5V and ground. To create a good running circuit, make sure that you connect all 5V wires of the potentiometers together, and then connect only the last one to the main 5V wire, do the same for the ground wires, but do not do this for the A sockets, those go directly to the Arduino

Part 4

Time to connect the aux and LEDs. For the audio jack, one leg will go to pin 3 in the Arduino, and the other one will go to the ground wire, take a look at the pictures for the right way because of the sides of the legs matter.

The LEDs are connected in a simple circuit, connect the two LEDs together with the corresponding leg, and then connect one of them to the 220-ohm resistor. The longer leg goes to the resistor, and the other leg will go to the ground wire.

Part 5

Now you should have a full circuit running, before putting it inside the box, make sure it runs. After that put the potentiometers and the LEDs in the box, disconnected from the Arduino. Once everything is inside you can connect all the wires back.

*A tip to make the LEDs stay without falling is to fold the legs.

PArt 6

Now that everything is connected, run the ac wire in the hole and close the box. Plug in the AC adapter. If the LEDs are on that means the circuit works. ALso moving the knobs will trigger the LEDs, so if that happens you know that the circuit works.

Finished result

Now you can plug in the audio jack to a set of speakers and play around with the sounds.

Yay

 

This project is a synthesizer. It creates sounds by moving the oscillators which are linked to the knobs. It has also an aux port which is necessary to hear the sounds, speakers are preferred since with headphones it’s harsh to the ears. I wanted to create this project because synthesizers are of my interest, and I always wanted to buy one, but now I have the opportunity to make one, and actually use it outside of school.

Parts

  • Arduino
  • Jumper wires
  • Solder
  • Soldering Iron
  • Wires of different colors
  • Project box of the color and dimensions of your choice( make sure dimensions fit the Arduino)
  • Drill
  • 5k potentiometers
  • Female Audio Jack
  • Speakers or Headphones
  • LED of your choice of colors
  • 220 Ohm resistor
  • Screwdriver

Instructions

Part 1

Take your box and find where you want to place your knobs LED, audio jack port and the hole for the AC adapter cable. The potentiometers and led are of preference, but I recommend placing them apart from each other because it will make it easier to solder. As it goes for the other two holes, you should put one on the front of the box and one on the other front, this will make it easier for the AC cord to go out without being tangled with the wires.

Part 2

Mark the sports with a white sharpie or anything that will give you a sense of directions. Choose the appropriate size for the drill and drill the holes. Do this carefully because once you drill there is no going back.

Part 3

Now it’s time to figure out the schematic. I have a picture of the schematic linked below. To make things easier take a wire and put one in the 5v socket of the Arduino, the other one in the ground pin. Make sure these wires are longer than the other wires because they are the main wires that everything is going to be hooked up to. The middle pin of the potentiometer goes to the A pins on the Arduino, the other two on opposite sides go 5V and ground. To create a good running circuit, make sure that you connect all 5V wires of the potentiometers together, and then connect only the last one to the main 5V wire, do the same for the ground wires, but do not do this for the A sockets, those go directly to the Arduino

Part 4

Time to connect the aux and LEDs. For the audio jack, one leg will go to pin 3 in the Arduino, and the other one will go to the ground wire, take a look at the pictures for the right way because of the sides of the legs matter.

The LEDs are connected in a simple circuit, connect the two LEDs together with the corresponding leg, and then connect one of them to the 220-ohm resistor. The longer leg goes to the resistor, and the other leg will go to the ground wire.

Part 5

Now you should have a full circuit running, before putting it inside the box, make sure it runs. After that put the potentiometers and the LEDs in the box, disconnected from the Arduino. Once everything is inside you can connect all the wires back.

*A tip to make the LEDs stay without falling is to fold the legs.

PArt 6

Now that everything is connected, run the ac wire in the hole and close the box. Plug in the AC adapter. If the LEDs are on that means the circuit works. ALso moving the knobs will trigger the LEDs, so if that happens you know that the circuit works.

Finished result

Now you can plug in the audio jack to a set of speakers and play around with the sounds.

Yay

Code and instructions were taken from here.

 

Pictures

 

This slideshow requires JavaScript.

 

This slideshow requires JavaScript.

 

Final Project: Drawing Machine

Video: https://drive.google.com/file/d/12UfQ8NYWdu8lXzaBfoubkTqgD9dctlm7/view?usp=sharing

Materials: box, cork, wire, stepper motor, wire, pencil, usb cord, arduino, breadboard, 20 wires, battery, tape, one resistor 330 ohms, button.

Steps:

  1. Attach wires correctly to breadboard and arduino. Add button to breadboard, connect wires.
  2. Tape battery on top of button so that the total height reaches the top of the box.
  3. place breadboard and arduino inside of box.
  4. cut hole out on top to fit the motor, and cut hole to fit usb adapter.
  5. tape motor so just the rotator is showing outside of the box.
  6. close box neatly.
  7. wrap wire around the cork and cut a hole in the shape of the rotator into one end of the cork. attach other end of wire to pencil.
  8. upload code and hook arduino up to power source (computer in this case).
  9. watch it draw clockwise, then hold down button on box to make the rotation counterclockwise.

Final Project: Drawing Machine

This project was fun to work on because we were able to fully experiment with all the content we learned the whole semester. I decided to create a drawing machine because I was interested in the development of an unknown outcome with something I could physically build. I wrote the code for my arduino and set everything up on the breadboard. I used one of the rotating motors so that I could attach a drawing utensil to the rotating piece enabling my pencil or pen to move. I then decided it was a little too easy so I added in a button so when the button is held down, the rotation spins clockwise however when the button is not pressed, the rotation spins counter-clockwise. This adds an element of interaction with the piece; without the button, it would be an autonomous machine. One thing I do enjoy about my project is that it looks much cleaner than it did at the beginning with numerous wires out and about. I find it interesting when a piece of art itself creates something and it is even more exciting when the artist doesn’t even know how the outcome will look. It gives the project a performance art quality which sometimes can make the project more fun to watch or witness. I added a box to conceal all of the unfinished looking parts and cut out holes for where things needed to come out of the box. I suppose it would look better if it were painted or one solid color box.

If I had to do the project over and improve it somehow, I would want to figure out how to eliminate the disruption the blue usb cord creates. Because there is an interruption in the circular movement the pencil makes, the project seems less impressive somehow. Then again, the disruption adds to the unknown outcome of what will happen when the pencil is blocked. Another element I would like to add is a different angle rotation. Instead of having it stay stagnant I would enjoy figuring out how I could alter the movement even further and add a vertical spin along with the circular revolution. Going even further, I wonder if eventually I could figure out to create a drawing machine that could actually draw a specific image, word, pattern, etc. I think what I have is a good basis to start at but I could turn it into so much more. I think I would also like to change the button. If I didn’t have to hold down the button, then my finger would not get in the way of the rotating pencil. If I could change it now I would press it once and it would rotate in one direction until I press the button again and It switches directions and so on. I might also consider changing the box it is in and attempt to make it more compact than it looks now.

My original idea for the final project was to sculpt an anthropomorphic figure in two different positions and have two different colored LEDs lining the person in the two separate positions. My idea was that I would turn a knob one way and it would light the sculpture up in one position with one color of lights, and then I would turn the knob the other direction and the sculpture would light up in the other color of lights and it would be in the second position I had arranged them in. This seemed more difficult because I would have to get more LEDs as well as figuring out if I wanted the sculpture three dimensional or two dimensional on paper or something.

I imagine that I could make a combination of my two ideas somehow. I could sculpt a figure and then have them hold the drawing utensil and they would be revolving and creating the unknown outcome. That however eliminates the interactive quality which may be my favorite element. I think the greatest part about this project in general is having the limitless ability to create with the arduino. I’m so grateful to have been introduced to the arduino because the arts are only growing with technology, expanding beyond what we know now. There are so many things you can make with the arduino and there are already so many projects online to use it for. It was also fun to hook up the wires in the correct places to the breadboard and arduino for this project because I realized I now know what goes where and feel confident in how electrical circuits work.

 

 

Code for Processing:

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>
const int buttonPin = 2; // the number of the pushbutton pin
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
int buttonState = 0;

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

void setup() {

// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

// set the speed at 60 rpm:
myStepper.setSpeed(180);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {

// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {

// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper.step(stepsPerRevolution);
//delay(500);
} else {
// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
//delay(500);
}
}