Category Archives: Assignments

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:

Motors (Week 8)

The Difference Between Servo Motors, DC Motors, and Stepper Motors

Servo: A servo motor is capable of precise control of linear or angular motion. This is particularly useful when you want to control the degree of the rotation. Projects that need precision control, such as robotic items, typically use servo motors. Servos determine angles by sending a pulse of electricity for an amount of time. The length of the pulse will determine the angle.  A drawback, however, is the range. The rotation is limited to 180 degrees back and forth.

Stepper: A stepper motor uses toothed electromagnets arranged around a central gear. When an electromagnet is powered it attracts the gear’s teeth and aligns them. This process continues for each of the electromagnets creating a rotation. Each of these movements is called ‘steps’ and can make a full 360-degree rotation. A pro feature of this motor is that it doesn’t require power to hold its position. Functionality is quite precise because the steps are built in, however, it sacrifices speed.

DC Motor: DC motors or direct current motors are continuous rotation motors. Unlike a servo motor, where the PWM controls the range of movement, here it controls the speed. The percentage of time spent cycling between on and off determines the speed of the motor. DC motors are fast and have a high RPM, making them good motors for things such as wheels and fans.

Bluetooth Mailbox Notification (Week 7)

  1. Goal: To create a wireless notification device. The mailbox in my apartment building is on the first floor. However, I live on the fourth floor. It takes extra effort to go downstairs to check the mailbox only to discover that nothing has arrived. So, this project is an Arduino Bluetooth-enabled device that sends a notification to my desktop and my cell phone that the mailbox has been opened, thus alerting me to the presence of mail.  Continue reading

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 8 Assignment

  1. Write a simple paragraph or any graph to show the difference between DC, Stepper, and Servo Motors.
  2. Make a circuit using any of the new things you learned today- H bridges/ controlling high current loads OR work with a motor you haven’t worked with before OR Try making a circuit using multiple motors. Document it on the blog per the usual format.

IR remote controlling TV channels & volume (Week 7)

  • Goal of this project : I would like to make a sample version of TV’s display of indicating channels and volume and remote control. Using IR receiver module and remote control, it will enable users to control channels (number) and volume (up and down).
  • Assembly description : I made a circuit that IR receiver module and 7-segment display to be connected to the arduino uno. IR receiver module has three legs – one (G) is for ground, the other one (R) is for Vcc, and the last one (S) is for signal. I connected the signal pin to pin 11, and set an additional led in pin 13 so that user could know the signal is receiving or not (We could also know through the tiny light on IR receiver module). For 7-segment display, the each pin represents each different stroke that constitute a number (including period “.” to confirm the exact direction of numbers). It has total 10 pins, 8 of them representing strokes are connected to each different output pins, and two of them are connected to the ground.

Continue reading

Wireless Week 7

Video:

Goal: The goal of this week’s wireless assignment is to be able to control a RGB mood light via smartphone blue tooth.

Core Components:

Assembly:

RGB LED to Arduino:

  1. Red to Pin 3 of Arduino
  2. Blue to Pin 5 of Arduino
  3. Green to Pin 6 of Arduino
  4. Anode to 5V If Strip Gnd of driver to gnd of Arduino

Blue Tooth Connection to Arduino:

  1. Rx to pin 12 of Arduino
  2. Tx to pin 11 of Arduino
  3. vcc to 5v
  4. gnd to gnd

 

How it works: As the concept goes, via bluetooth and the correct smartphone app I will be able to control the color of the LED wirelessly. The designer of this project went into depth about the logistics of how the RGB LED actually changes colors by describing how the Arduino uses a digital representing Analog signal that varies pulse to mimic a PWM (Pulse Width Modulation). By using a digital representing Analog signal the colors are able to seem like they are gradually changing even when they are not.

Problems: I faced a plethora of problems with this assignment. From jumping to project to project trying to find a source that didn’t rely on Android applications or Google Play to simply the code refusing to upload onto the Arduino “programmer not responding.” To say the least I had many difficulties. Though I believe the most prevalent can be found in the fact the alternative applications I downloaded onto my phone (Iphone) to control the LED via blue tooth could not connect. I’m not sure if it was because of the code/ Arduino blue tooth or the app not being compatible with the program, regardless it didn’t work. I ended up accidentally burning out my RGB LED, so I will try again tomorrow with another application!

 

  Color LED Controller- screenshot

Images of Physical Circuit:

 

 

Sources: SmartPhone Controlled RGB MOOD Light

Continue reading