All posts by qianjingliu

Final Project _ Qianjing Liu

2O8A09412O8A09412O8A0941

My new concept is making a device to express how noise affect our inner world.  The container is divided into two parts. One stand for our inner wold while the other one means the outside world. Since people can hardly concentrate on both the inner world and the outside world,  they have to struggle for more space.  Once the outside part got more room, it means the inner part has lost some.

When people stay in a noisy environment, they can hardly focus on their thought. Instead of thinking in their mind, they will pay more attention what is happening around. So I try to make the two parts of room available, and could change with the volume of sound.

To get the volume I used a sound sensor. And I used two servos to get a border, which divided the container into two parts,  moving with the change of environment. To make the loudness of  sound more visible, I use two fans, which could also map their speed with noisy environment. There are small feathers inside the container, so that they will fly in the container while it is noisy outside.

 

#include <Servo.h>
int sensor1=11;
int sensor2 =10;
int sensor3 =12;
int pos1=0;
int pos2;
int sensor = A5;
int loudness;

Servo myservo1;
Servo myservo2;

void setup(){
pinMode(sensor1,OUTPUT);
pinMode(sensor2,OUTPUT);
pinMode(sensor3,OUTPUT);
Serial.begin(9600);
pinMode(sensor,INPUT);
myservo1.attach(6);
myservo2.attach(9);
}

void loop(){
loudness = analogRead(sensor);
loudness = loudness -500;
if(loudness < 0){
loudness = 0-loudness;
}
if (loudness >=430){
analogWrite(sensor1,255);
analogWrite(sensor2,255);
digitalWrite(sensor3,HIGH);
if(pos1 < 75){
pos1++;
delay(15);
}
}
if (loudness <430){
analogWrite(sensor1,0);
analogWrite(sensor2,0);
digitalWrite(sensor3,LOW);
if(pos1 > 0){
pos1–;
delay(15);
}
}

pos2=180-pos1;
myservo1.write(pos1); // tell servo to go to position in variable ‘pos’
myservo2.write(pos2);
Serial.println(loudness);
}

New proposal for Final

How will people feel in a noisy environment?

In my opinion, it is hard to focus on what you are doing when it is noisy. So I think there is a conflict between your inner world and the outside world.

The inner world may on behalf of your thought and the outside world is how you feel physically. When it is quiet, people is easy to sink their own world and get a deep think. But the noisy environment push people to feel the outside world instead of concentrate on their thought.

I am going to divide a certain space into two parts. One present our inner world while the other one means the outside world. Since the space is certain, the two parts are going to strive for a larger room. If the environment is noisy, the part for outside will become bigger, while the inner part will become smaller and vice versa.

 

The final proposal

For the final, I want to make a small model of cupboard.

When I try to change something in my life with Arduino, I find that I have some problem with finding different things in my cupboard. Because sometimes I put something in front of others, so when I try to find something I have to move others first, and sometimes I may miss them. To fix this problem, I come to the idea about making a real cupboard that can help me when I am finding my stuffs. But I realize that the servo cannot take the heavy work, so I will make a small model for it this time.The cupboard can rotate itself when users com to it. With this function, it will be more convenient for users to find out what they are looking for. Also users can stop the cupboard by press a button on the cupboard, so they can pick up what they want. As this project, I may put some candies in this model, so it will be a candy box actually. I will put different kind of candies in different place, as a symbol of different things. Users can choose what they like from the small box.

Here is the structure of my project.

proposal

And I checked other candy boxes. Most of them just mix the candies together, or put them in lines. The former one make users hard to pick out what they want, the latter one take a lot of spaces. But I also find that users like the transparent material and the wood material for the candies, I will use this as the element of my project.

Candy_Box_2

I am going to use a distance sensor to deter if a person come to it and a 360 reg servo to make the candy box run itself.  A pressure sensor will be used to stop it and a 180 reg servo will be used to open and close the box.

WORKSHOP-AUDIO POP

 

First we drew the circuit on the paper, and Ayo helped us to check if it is right or not.

IMG_1001

And then, we try to drew the circuit on the board.

IMG_0999

After that, we put the board into acid solution and waited for about 20 minutes!

IMG_1002

I picked my board out, and put it into water. After that, I clean it by the cotton-padded with alcohol.

IMG_1003

That’s what it looks like in the end of the class.

IMG_1004

WeChat_1416002114

LOLshield–wave

I made a pattern about wave with the LOL shield. It’s lucky that all the leds worked perfectly.

Here is the code:

/*
Basic LoL Shield Test

Writen for the LoL Shield, designed by Jimmie Rodgers:

http://jimmieprodgers.com/kits/lolshield/

This needs the Charliplexing library, which you can get at the
LoL Shield project page: http://code.google.com/p/lolshield/

Created by Jimmie Rodgers on 12/30/2009.
Adapted from: http://www.arduino.cc/playground/Code/BitMath

History:
December 30, 2009 – V1.0 first version written at 26C3/Berlin

This is free software; you can redistribute it and/or
modify it under the terms of the GNU Version 3 General Public
License as published by the Free Software Foundation;
or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include <avr/pgmspace.h> //AVR library for writing to ROM
#include <Charliplexing.h> //Imports the library, which needs to be
//Initialized in setup.

//Sets the time each frame is shown (milliseconds)
const unsigned int blinkdelay = 1000 / 50;

/*
The BitMap array is what contains the frame data. Each line is one full frame.
Since each number is 16 bits, we can easily fit all 14 LEDs per row into it.
The number is calculated by adding up all the bits, starting with lowest on
the left of each row. 18000 was chosen as the kill number, so make sure that
is at the end of the matrix, or the program will continue to read into memory.

Here PROGMEM is called, which stores the array into ROM, which leaves us
with our RAM. You cannot change the array during run-time, only when you
upload to the Arduino. You will need to pull it out of ROM, which is covered
below. If you want it to stay in RAM, just delete PROGMEM
*/
PROGMEM const uint16_t BitMap[][9] = {
//Diaganal swipe across the screen
{0,0,514,1285,10376,4176,32,0,0},
{0,0,257,8834,5188,2088,16,0,0},
{0,0,8320,4417,2594,1044,8,0,0},
{0,0,4160,10400,1297,522,4,0,0},
{0,0,2080,5200,8840,261,2,0,0},
{0,0,1040,2600,4420,8322,1,0,0},
{0,0,520,1300,2210,4161,8192,0,0},
{0,0,260,650,1105,10272,4096,0,0},
{0,0,130,325,8744,5136,2048,0,0},
{0,0,65,8354,4372,2568,1024,0,0},
{0,0,8224,4177,2186,1284,512,0,0},
{0,0,4112,10280,1093,642,256,0,0},
{0,0,2056,5140,8738,321,128,0,0},
{0,0,1028,2570,4369,8352,64,0,0},
{18000}
};

void setup() {
LedSign::Init(DOUBLE_BUFFER | GRAYSCALE); //Initializes the screen
}
void loop() {
for (uint8_t gray = 1; gray < SHADES; gray++)
DisplayBitMap(gray); //Displays the bitmap
}

void DisplayBitMap(uint8_t grayscale)
{
boolean run=true; //While this is true, the screen updates
byte frame = 0; //Frame counter
byte line = 0; //Row counter
unsigned long data; //Temporary storage of the row data
unsigned long start = 0;

while(run == true) {

for(line = 0; line < 9; line++) {

//Here we fetch data from program memory with a pointer.
data = pgm_read_word_near (&BitMap[frame][line]);

//Kills the loop if the kill number is found
if (data==18000){
run=false;
}

//This is where the bit-shifting happens to pull out
//each LED from a row. If the bit is 1, then the LED
//is turned on, otherwise it is turned off.
else for (byte led=0; led<14; ++led) {
if (data & (1<<led)) {
LedSign::Set(led, line, grayscale);
}
else {
LedSign::Set(led, line, 0);
}
}
}
LedSign::Flip(true);

unsigned long end = millis();
unsigned long diff = end – start;
if ( start && (diff < blinkdelay) )
delay(200);
start = end;

frame++;
}
}

Midterm–Qianjing_Liu

 

 

I made a doll with arduino for midterm. There is a light sensor and a distance sensor in this doll. The eyes of the doll is the distance sensor while the nose of it is the light sensor.  The brightness of the two leds on the doll’s face will change with the light sensor. If the room is dark, the doll will get a red face. I also put a buzzer in the doll’s body, so if the distance sensor get that you are in a short distance, the buzzer will make sound. There is a servo in its tail, so if you are put something near the doll, its tail will move.

8  9 7 6 2  4 1  Photo on 10-12-14 at 18.36

 

 

 

Here is the code:

/*
Multiple tone player

Plays multiple tones on multiple pins in sequence

circuit:
* 3 8-ohm speaker on digital pins 6, 7, and 11

created 8 March 2010
by Tom Igoe
based on a snippet from Greg Borenstein

This example code is in the public domain.

http://arduino.cc/en/Tutorial/Tone4

*/
#include <Servo.h>

Servo myservo;

int pos = 0;
int lightsensor = A0;
const int echopin=2;
const int trigpin=3;
int led = 5;

void setup() {
Serial.begin(9600);
myservo.attach(9);
pinMode(lightsensor,INPUT);
pinMode(echopin,INPUT);
pinMode(trigpin,OUTPUT);
pinMode(led,OUTPUT);
}

void loop() {
int light = analogRead(lightsensor);
digitalWrite(trigpin,LOW);
delayMicroseconds(2);
digitalWrite(trigpin,HIGH);
delayMicroseconds(10);
digitalWrite(trigpin,LOW);
float distance = pulseIn(echopin,HIGH);
distance = distance/58.0;
delay(100);

if(distance<=15){
int sound = map(distance,0,15,1000,100);
for(pos = 0; pos < 180; pos += 1)
{
myservo.write(pos);
tone(4, sound, 200);
delay(5);
}
for(pos = 180; pos>=1; pos-=1)
{
myservo.write(pos);
tone(4, sound, 200);
delay(5);
}
}
int brightness = map(light,0,170,255,0);
if(brightness<0){
brightness=0;
}
analogWrite(led,brightness);
Serial.println(light);
}

 

HW_WEEK6_Qianjing_Liu

Photo on 10-2-14 at 23.15

I’ve made an indicator which can move when people revolve the knob. And with the movement of the indicator, 2 leds will be turned on. If the indicator moved in 120 degree, the green one will be brighter and brighter, but it will turned off if the indicator moved more than 120 degrees. After the green one turned off, the right one will be on and show the dangerous. I am trying to get some connection between this one with the speed of the car.

 

// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
int led1 = 6;
int led2 = 5;
Servo myservo; // create servo object to control a servo
int sensor = A0;// a maximum of eight servo objects can be created
int brightness;
int pos = 0; // variable to store the servo position

void setup()
{
myservo.attach(9);
Serial.begin(9600);
pinMode(sensor, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT); // attaches the servo on pin 9 to the servo object
}

void loop()
{
pos = map (analogRead(sensor),0,1023,0,180);
myservo.write(pos);
if(pos>=60){
brightness= map(pos,60,180,255,0);
analogWrite(led1, brightness);
analogWrite(led2,LOW);
}else{
brightness= map(pos,0,60,255,0);
analogWrite(led2,brightness);
analogWrite(led1, LOW);
}
Serial.println(pos);
}

Homework Week5_Qianjing_Liu

IMG_0944 IMG_0949 IMG_0951 IMG_0956

 

This is a clock. When the sun light came into the small house from the break on the roof, the clock inside will make sound and weak up users. There is also a switch on the house, which can control the sound value and turn off the clock.

 

#include “pitches.h”

int speaker = 11;
int sensor1 = A0;
int sensor2 = A1;
int sensorValue = 0;
int getsensor2 = 0;
int getsensor1 = 0;

void setup() {
Serial.begin(9600);
pinMode(sensor1, INPUT);
pinMode(sensor2, INPUT);
pinMode(speaker, OUTPUT);
}

void loop() {
getsensor1 = analogRead(sensor1);
getsensor2 = analogRead(sensor2);
sensorValue = map(getsensor2, 0, 1023, 0, 4000);
if(getsensor1<=0 || getsensor2<=0){
digitalWrite(speaker, LOW);
}else{
tone(speaker, sensorValue);
delay(1000/16);
noTone(speaker);
}
Serial.println(getsensor2);
}

HW for week4

3C6B6FB0-E632-4619-BE3A-8EEA36E5DAB8 6CB93C17-1DCB-43FA-AB33-128855B3BB87

871C4E07-1D7D-4D0E-BAE5-9C2FDC7D35BB

This circuit is about using a button to control two leds to flicking in different frequency.  I  changed a little from the  the first assignment. The button here is separate from the leds, and connect the arduino boarder with the A5 pin.

 

int led1=7;
int led2=6;
void setup()
{
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
}
void loop()
{
int i;
i=analogRead(5);
if(i>1000){
digitalWrite(led1,HIGH);
delay(200);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
delay(800);
digitalWrite(led2,LOW);
}
else{
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
}
}

HW for week2

 

IMG_0837

 

With the Arduino, you can control the lights. When you press the switch, the circuit is completed, and the light will be turned on. The red light and the green light will blink in turn.

I’ve tried two codes to make them blink in different ways.  So, I took two videos of them.

I don’t know why I cannot use the code snippets, so I just put one of my code here. I will put it into the code snippets, if it could work.

int led1=7;
int led2=6;
void setup()
{
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
}
void loop()
{
digitalWrite(led1,HIGH);
delay(1000);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
delay(500);
digitalWrite(led2,LOW);
delay(300);
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);

}