Category Archives: Week 6 Assignment

week 6 sound sensor and LEDs

For this week’s assignment, I use the sound sensor to control the LEDs depends on the different levels of the sound inputted.

List of Materials

1 x Elegoo Uno R3

1 x Full sized breadboard

1 x sound sensor

3 x LEDs

How it works:

three LEDs will blink when the sound’s value changed, but I noticed that the sound sensor is not that sensitive to detect the accurate sound.

code:

 

video:

Week 6: Making my own piano

This week’s assignment was to creatively rethink how sound and/or light could be incorporated into projects by modifying the input sensors. I decided to work with capacitive sensing because I love the possibilities it provides. It allows us to make our own sensors and enhances the quality of the interactive experience.

List of Materials

1 x Elegoo Uno R3

1 x Full sized breadboard

1 x Piezo buzzer

3 x Graphite strips

3 x LEDs

Resistors: 3x 220 Ohms (for the LED), 3 x 1 Megaohms (for capacitive sensing)

Jumper wires

Fritzing diagram

Description of assembly 

  1. Connect the ground side of the breadboard to the GND pin, and the power side to the 5V pin, on the Arduino.
  2. Add three LEDs to the circuit, with the shorter legs connected to the ground via 220 Ohm resistors, and the longer legs to digital pins 11, 12 and 13 respectively. Connect the Piezo buzzer with the ground connected to the ground of the breadboard, and the power to digital pin 8. Both the LEDs and the buzzer act as the output, reacting to changes in the capacitive sensors.
  3. To make one capacitive sensor, connect two jumper wires on either end of a 1 Megaohm resistor to digital pins 2 and 3. The resistor leg, connected to pin 2, should also be connected through the jumper wire to the graphite strip.
  4. Repeat step 3 two more times, using digital pins 4, 5 and 6,7.
  5. Upload the code to the Arduino IDE.
  6. Debug, check connections and keep working!

How it works

Capacitive sensing works on the principle of using a conductive material to complete the circuit. This circuit works as follows. A high resistance of the order of a megaohm is placed on the breadboard, both ends of which are connected to say, digital pins 2 and 3. Digital pin 3 acts as the input and allows a steady stream of electrons to flow through the circuit. The resistor inhibits the flow and only lets a small number of electrons pass through the other end. The other end in addition to being connected to a digital pin is also attached to a jumper wire. When we touch the metallic end, we pass on a large number of electrons from our body to the circuit. The Arduino can sense this change and can be coded to control an output by defining a threshold value.

Iterations 

Graphite conducts electricity and this property can be utilized in interesting ways. I shaded some bits of paper with an HB pencil and connected them to the breadboard so that they could act as switches. For the first iteration I decided to make an instrument where, on pressing each key, one would hear a different, pre-programmed song through the Piezo buzzer. I first tried with the example code melody to see whether all three switches were working individually. On graduating to coding different songs, I had limited success.

This further led me to think about how a user could make their own music. On pressing a key, they would hear a tone, akin to a piano. The various sequences and combinations could culminate in unique tunes. I had trouble associating one LED to one graphite switch. After multiple iterations, it turned out to be a glitch in the code which I then rectified.

Code 

Continue reading

W06_Assignment

PART 1

IMG_1516

Goal:

I’m making a sound visualization project using Arduino as an input and Processing as an output.

Arduino: I’m using a photocell sensor to detect the light from the environment and map the data to use in Processing to control the alpha value of the floating points.

Processing: I’m using minim library to visualize the audio file and created 300 points floating with it.

Core components

1* photocell sensor
1 * 10k resistor
Wires & jumpwires
Arduino board

Circuit/Schematics

Code:

Arduino: StandardFirmata

Processing:

import cc.arduino.*;
import org.firmata.*;
import processing.serial.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import cc.arduino.*;

Minim minim;
AudioPlayer song;
FFT fft;
Arduino arduino;

int num = 300;
PVector[] posArray = new PVector[num];
float pTime = 0;
float vel;
PVector[] noiseArray = new PVector[num];

int sensorPin = 0;
int sensorVal = 0;
float newSensorVal;

void setup() {
size(1000, 800, P3D);
minim = new Minim(this);
println(Serial.list());
arduino = new Arduino(this, Arduino.list()[1], 57600);

song = minim.loadFile(“1.mp3”, 512);
song.loop();

fft = new FFT(song.bufferSize(), song.sampleRate());

for (int i = 0; i < num; i++) {
float r = random(300,400);
float theta = random(TWO_PI);
float y = r*sin(theta);
float x = r*cos(theta);

noiseArray[i] = new PVector(x, y);
posArray[i] = new PVector(0, 0);
}

arduino.pinMode(sensorPin, Arduino.INPUT);
}

void draw() {

background(0);
pushMatrix();
translate(width/2, height/2);
scale(1.5);
fft.forward(song.mix);
noStroke();
println(arduino.analogRead(sensorPin));
sensorVal = arduino.analogRead(sensorPin);
newSensorVal = map(sensorVal,800,960,50,250);
//float a= random(100,200);
fill(random(0,255),random(0,255),random(0,255),newSensorVal);
for (int i = 0; i < num; i++) {
ellipse(posArray[i].x, posArray[i].y, 2, 2);
}

popMatrix();

update();
}

void update() {

float time = millis()*0.001;
float dt = time – pTime;
println(dt);
pTime = time;

float level = song.mix.level();
float fftVal = fft.getBand(300);
vel = map(fftVal, 0, 0.1, 0.05, 0.5);

for (int i = 0; i < num; i++) {
noiseArray[i].x += vel * dt;
noiseArray[i].y += vel *dt;
float xScale = map(noise(noiseArray[i].x), 0, 1, -1, 1);
float yScale = map(noise(noiseArray[i].y), 0, 1, -1, 1);

posArray[i].x = xScale * 300;
posArray[i].y = yScale * 300;
}
}

PART 2

Communication protocols:

Capacitive Children’s Book_Light&Sound (Week 6)

  1. Goal: The goal of this project was to create an interactive book that would play into both the physical and digital spaces. I chose to use light and sound from the digital element, Processing. Conceptually, this book serves is for a prototype children’s book to help very young ESL students learn the English onomatopoetic sounds of various animals. When children press the pages of the book, they will hear the sound of the animal displayed. Continue reading

Week 6: Foray into e-textiles

For a very long time, I have been fascinated by e-textiles because they lie at the intersection of craft and electronics. I did not know where to begin my exploration from and decided to follow along a simple Sparkfun tutorial to make a light-up plush (https://learn.sparkfun.com/tutorials/light-up-plush)

  

Materials required

Lilypad ProtoSnap

3V Coin Cell Battery

Conductive thread

Needle

Plush pattern

Felt piece: 10 by 10 inches

Scissors

Fabric glue (optional)

Beads, pompoms, ribbons, buttons, glitter to decorate

Diagram (taken from the Sparkfun website)

Description of assembly

  1. Cut the plush pattern from the piece of felt
  2. Arrange the Lilypad ProtoSnap components on the pattern.
  3. Using conductive thread, make secure connections (loop around each tab at least 3-4 times) between the positive tab of the battery holder and one of the tabs of the switch.
  4. Connect the other side of the switch to the positive terminals of the top two LEDs that make up the eyes, and finally to one of the tabs of the button.
  5. Continue stitching, from the other side of the button to the positive tab of the last LED.
  6. Connect the negative sew tab of the first LED, with the second, through the third to the negative sew tab of the battery holder.
  7. Insert the battery, debug, and keep experimenting!

How it works

I was surprised to find that working with e-textiles isn’t very different from working with the Arduino hardware. It is based on the same principles of electronics that we are familiar with. A 3V coin cell powers the circuit, and the electrons, regulated through the side switch and the button, light up the LEDs.

Challenges

I had difficulty debugging my circuit. Unlike a “traditional” circuit, it was time-consuming to check the connections- as I had to re-embroider entire sections. Later I realized, that my circuit was getting shorted because of the long, untrimmed pieces of wire. After securing a few connections, and trimming the ends, it started working!

Future Iterations 

I am excited about incorporating physical elements or characters in the process of digital storytelling. I feel they make the story more compelling. I was imagining a choose-your-own-adventure story, that plays out on the screen, depending on one’s choices in the real world. So these characters could act as controllers that are affecting the narrative.  Continue reading

Sound + Light – Dario N (Week 6)

PART 1

Goal of the Project:

The intention with this project was to explore the infinite creative possibilities of playing with the relations between light and sound using a microcontroller. In this particular case, I wanted to explore new sensors such as BIG sound as input that triggers other process such as turning on and LED.

List of Components:

  • x1 Arduino Uno
  • x1 Breadboard
  • x1 Big sound module
  • x1 RED LED
  • x1 220 kohm Resistors
  • Jumper Wires

Assembly Process:

To create this project, first, the big sound module has to be connected to Arduino (We can use a Digital pin or Analog Pin. In this case, we used the digital pin 3, but we need to tell Arduino we are using it as DIGITAL input). Then we connect the LED to a digital pin 4 as an OUTPUT.

How it works:

To test the Big sound module, the 2 LEDs of the module will light up. In order to control the sensibility of the module, we need to move the built-in potentiometer in the module using a screwdriver. The idea is to turn it to the left to reduce resistance and add sensibility. As soon as the led turn off, that means the module is ready. Then we connect an LED to a pin and set it as OUTPUT. The result? The LED will respond to the high and low frequencies received from the sounds from the surroundings.

Problems:

Controlling the sensibility of the bid sound module represented a challenge. I wasn’t able to get an important sensibility value in order to control the LED. To test it, I had to create sounds with deep basses and had to be fairly loud. I also test the “small sound” module and the issue was even worst.

Arduino Code (File):

https://www.dropbox.com/s/rgi5s89rif0mg1b/DarioNarvaez_HW6.ino?dl=0

Circuit Diagrams:

References: 

https://create.arduino.cc/projecthub/iotboys/control-led-by-clap-using-arduino-and-sound-sensor-e31809

PART 2

I2C Protocol:

Or Inter-Integrated Circuit is a protocol that allows to connect multiple “slave” devices to a one “master” device. It’s the most used between electronic devices (microcontrollers, sensors…cellphones, cars…). The connection between a microcontroller (Arduino) with sensors and modules are good exaples of Master-Slave relation, where both can communicate to each other, but the communication is initiated only by the master.

Pros:

Only requires 2 wires that can support multiple devices for the communication (bus connection) up to 127 devices.

Simple to use, reliable and inexpensive.

Cons:

Short distance communication with a single device

Hardware is more complex than other protocols

Resource:

http://www.robot-electronics.co.uk/i2c-tutorial

https://www.youtube.com/watch?v=qeJN_80CiMU

Sound and Light Week 6: Part 1

 

  • Brief: After this week’s lesson about light and sound I wanted to find a project that would further enlighten me to the logistics of how sound can be sensed and a subsequent automatic action can be taken. The first idea for a project that came to mind was to use a vibration/sound sensor to sense a sequence of wave lengths and subsequently signal this information to us by lighting up a line of LED lights with escalating levels of brightness. Though that was a bit much for a novice like myself. Ergo,  I thought pursuing something of a practical and simpler fashion could be very informative, like turning on a light fixture by clapping.
  • Goal: Conclusively, the goal of this weeks assignment is to assemble an arduino system that can sense a clap and automatically turn on an LED/light. Hopefully I will be able to personalize the clap rhythm or code that will turn on the light.

  • Assembly:
    • Materials:
      • Arduino Board, Relay Module, Sound Sensor, 9V Battery, F to M Jumper 6x, M to M Jumper 1x, Breadboard, Battery Cable, mini screw driver, wire strippers and two prong light fixture.
  • Clap Sensing Arduino Light Switch Tutorial (<– Really amazing)
    • 1) Using your light fixture, expose the live wires
      • you can leave the neutral wire alone, but it might make the length crooked.
      • The live wire is the side that runs along the the more narrow prong of the outlet head.
    • 2) After exposing the wire connect them to the relay open pins of the relay module.
    • 3) Using 3x of the F to M jumpers, connect the Relay GND pin will be connected to the GND pin of the Arduino.
      • The Relay VCC pin will be connected to the +5V pin of the Arduino.
      • The Relay INPUT pin will be connected to the Digital 5 pin of the Arduino.
    •  4) Connection of the Sound Sensor uses 3x of the F to M jumpers
      • The Sound Sensor VCC pin will be connected to the +5V pin of the Arduino.
      • The Sound Sensor OUT pin will be connected to the Digital 4 pin of the Arduino.
      • The Sound Sensor GND pin will be connected to the GND pin of the Arduino.
    • 5) Connection of the breadboard, using 1x M to M jumper
      1. Abreast from one another connect the M to M jumper to the 5v pin in the Arduino.
      2. Connect the relay module’s VCC: positive power supply M jumper end to the bread board (abreast the 5v connection).
      3. Connect the VCC: positive power supply of the sound module to the breadboard abreast the module jumper.
    • 6) Up load code:
    • 7) Connect 9V battery with cable to Arduino.
    • 8) Plug in light and turn on.
    • 9) Start clapping because now you got light!
  • How it works: Video
  • Problems:
    • The biggest problem I had with this project was due to my own lack of knowledge. In the very informative and simple video tutorial of how to make a clap sensing light switch the architect does not articulate which of the two wired cables are neutral and live (probably because most people know, but I didn’t). Accordingly, my first time around I didn’t connect the live to the relay module, instead I connected the neutral so initially my light didn’t turn on at all. I was stumped and very discouraged by the 2nd time I had taken it apart and put it back together again. The next day I did some research on how to fix cords chewed up from pets and during this tutorial I learned that in addition to my neutral and live connection problem I probably damaged the wires post stripping. By the third trial I had made a solid connection and miraculously the light turned on and could sense my clapping… snapping, and any high pitched double ” bang.”
  • Images:

    • 7) Insert the Read More quicktag, otherwise your post will go one forever.

Week 6 Assignment – Lisa H.


Part 1

  • The goal of the project and/or desired interaction
    The assignment was to adapt one of the light and/or sound circuits we built in class for another creative purpose. I choose to use the ultrasonic sensor to make an interaction with the buzzer and the LED lights.
  • A quick description of assembly and list of core components— 1x Arduino Uno
    – 1x Breadboard
    – 1x HC-SRO4 Ultrasonic Sensor
    – 1x Buzzer
    – 2x Green LEDs
    – 2x White LEDs
    – 2x Red LEDs
    – 7x 330-ohm Resistors
    – Jumper wires
  • How it works

    When you move away from the ultrasonic sensor, the buzzer and LED lights will not light or make a sound. If you go closer to the ultrasonic sensor, the LED lights will light up and the buzzer will get louder.
  • Any problems you encountered and/or solvedAt first, I wasn’t sure how to exactly get the sound to get louder as I move nearer to the ultrasonic sensor.  But I looked at some code and figured it out.
  • Images of your circuit
  • Arduino Code https://github.com/lynnn43/PhysicalComputing/tree/master/wk5_hwk_sensors

Part 2

  • Give a description of the protocol.

SPI-

It is a synchronous data transfer technique which means there is a dedicated clock signal generated by the bus controller. It supports multi-master bus support and bidirectional transfer. It is a serial data protocol used by microcontrollers for communicating one or more peripheral devices quickly.

There is usually always one main master device controlling many other peripheral devices.

  • MISO (Master In Slave Out) – The Slave line for sending data to the master
  • MOSI (Master Out Slave In) – The Master line for sending data to the peripherals
  • SCK (Serial Clock) – The clock pulses which synchronize data transmission generated by the master
  • and one line specific for every device:
  • SS (Slave Select) – the pin on each device that the master can use to enable and disable specific devices.
  • Draw a diagram or illustration that shows how it works.
  • Give at least 2 examples of when you use this protocol.
    For example, SD cards and wireless transmitter both use SPI to communicate with microcontrollers to communicate without interruptions.

Continue reading