Category Archives: Quantified Bird

Bird – RGB lights mapped to Sonar

I put the RGB LED into the bird and controlled its colour output using the incoming Sonar values. The Sonar values were also translated mapped onto tone values played through a speaker.

Each of three RGB pins for the common anode LED were given mapped values between 0-255. The ratio of RGB values was correlated with distance values (0-20 cm) obtained by the Sonar distance sensor. (See code below for how the ratio of values were mapped and calculated).

 

 

Here’s a couple images of my wiring

IMG_0146

 

IMG_0141

Below is the CODE I used if you wanna see how I controlled the RGB LED and mapped the sounds, distance, colours onto each other.
// For RGB LED
int redPin = 11;
int greenPin = 10;
int bluePin = 9;
int micPin = 0;
int micVal = 0;
int sampleRate = 500;
long lastChange = 0;

// For Ping Sensor
#include <NewPing.h>
#define TRIGGER_PIN 6 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 5 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 40 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

// For Speaker Output
#include <NewTone.h>
#define TONE_PIN 8
int speakerRate = 1000;
int minFreq = 250; // minimum and maximum frequencies
int maxFreq = 2000;

/*uncomment this line if using a Common Anode LED */
#define COMMON_ANODE

void setup() {
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);

Serial.begin(115200);
}

void loop() {
// PING
delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
Serial.print(“Ping: “);
int distance = uS / US_ROUNDTRIP_CM;
Serial.print(distance); // Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.println(“cm”);

int distanceScaled = map(distance, 0, MAX_DISTANCE, 0, 100); // Normalize ping distance values

// RGB Values calculated from distanceScaled
int red = getRed(distanceScaled);
int green = getGreen(distanceScaled);
int blue = getBlue(distanceScaled);

// Output Tone
if(distanceScaled > 0) {
int freq = map(distanceScaled, 0, 100, 1500, 250);
NewTone(TONE_PIN, freq);
delay(1);
noNewTone(TONE_PIN);
}

if((millis()-lastChange>=speakerRate) && (distanceScaled > 0)) {
int freq = map(distanceScaled, 0, 100, maxFreq, minFreq);
NewTone(TONE_PIN, freq);
delay(5);
noNewTone(TONE_PIN);
lastChange=millis();
}

setColor(blue,red,green); // red delay(1000);
}

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);
}

int getRed(int distance) {
if((distance > 0) && (distance < 26)) {
int red = map(distance, 1,25, 0,255);
return red;
}
else if((distance > 25) && (distance < 51)) {
int red = map(distance, 26, 50, 255, 0); return red;
}
else{int red = 0; return red;}
}

int getGreen(int distance) {
if((distance > 25) && (distance < 51)) {
int green = map(distance, 25,50, 0,255);
return green;
}
else if((distance > 50) && (distance < 76)) {
int green = map(distance, 26, 50, 255, 0); return green;
}
else{int green = 0; return green;}
}

int getBlue(int distance) {
if((distance > 49) && (distance < 76)) {
int blue = map(distance, 50,75, 0,255);
return blue;
}
else if((distance > 75) && (distance < 101)) {
int blue = map(distance, 76, 100, 255, 0); return blue;
}
else{int blue = 0; return blue;}
}

 

Digibird Killing Machine

A

Born without a body, the bird was looked upon with disdain. The bird and its family were killed by the rest of the digibird colony to prevent inferior body-less genes from passing on to the next generation.

…but the bird managed to escape. Through the power of science the bird created a machine to replace its missing body and exact revenge on the evil eugenic digibird tribe.

Coming to a store near you!

B

The skeleton is made out of Lego pieces. The shell armor is of course the original digibird’s exterior plastic. There are two LEDs: one in the machine gun to simulate weapon fire and one in the pilot seat to make the pilot look ominous via underbelly lighting. The machine gun LED blinks when activated and is triggered by a switch.

C

The machine gun can move up and down in an about 90 degrees arc via a gear system placed under the pilot seat. Point and shoot! The degree limitation is due to other components getting in the way. The Lego pieces making up the elbow can actually allow some left/right articulation as well.

Video: https://drive.google.com/file/d/0B2RTbvkxolNsbV9NbUVHWGxNalU/view?usp=sharing

Digibird: Tuesday Xu

bird1

My initial plan was to put a vibrator into the bird so the “tail” can be moved by vibrator while the bird is singing. However according to my calculation,  the speaker (32Ω,0.25W) needs around 5-6V electronic voltage to function,and the vibrator needs almost exactly the same voltage (around 5V) to produce any real vibration. They can’t work at the same time since the batteries can only provide that much power.

Not wanting to sacrifice the speaker, I decided to use the exist electromagnet in the bird to create the tail swaying effect.

 

magnet

What in the red circle is the electromagnet. I made a hook attached to it.

 

bird3 bird2

Since the speaker must be removed from where it was to make room for the tail, I reattached the speaker from outside the bird and made a school bag for it so the bird can carry it around (ง •̀_•́)ง

I also put two birds and three flowers on the “tail”.

video:

WorkShop 1: Digi Bird Alarm

The singing bird doesn’t sing anymore!

Started off with breaking the bird into pieces and after multiple iterations, was able to let it beep as an alarm. I used the sketch of ‘Blink without Delay’ and connected it to the bird. So the output was two types of robotic tones and now the bird beeps along with the blinking LED.

20151004_19082420151004_190908

You may also see it working here

Workshop 1: DigiBird, Davidson Zheng

My alteration is to simply connect the speaker from the original DigiBird core to the arduino with blinking LED on each beat. Since the soldering iron broke the circuit on the board where the speaker was connected, I have no idea how to put it back.

As a result, I decided to
1) write a program to play some self-defined melodies,
2) use the speaker to play those melodies.

thumb_DSC05338_1024More specifically, the program loops between two pre-defined melodies.
It uses PWM pin 9 for outputing the sound signal and pin 13 for blinking LED on each beat.

thumb_DSC05335_1024

thumb_DSC05337_1024The most challenging and time-consuming part is to manually define all the notes and the duration between each notes. There is an example in Arduino called 02. Digital -> toneMelody that helped me get started.

Another two references are,
Play Melody
Super Mario theme song w/ piezo buzzer and Arduino …

Spidey Bird’s Web

So Spidey Bird had a little trouble with its circuitry getting glitched by a soldering iron, but she still looks pretty!

IMG_0422

My approach was to interface Spidey Bird with a web control switch (no pun intended).  The purpose was to show the ability to have Arduino circuits controlled via the web with a little help from Processing.  Here’s how:

1.  First start a web server with PHP.

Screen Shot 2015-10-05 at 9.03.38 AM Screen Shot 2015-10-05 at 9.03.16 AM

2. Then upload a power switch program to Arduino.

Screen Shot 2015-10-05 at 9.04.52 AM

3. Create a Processing script to listen for web commands from a web site.

Screen Shot 2015-10-05 at 9.06.59 AM

4. Go to http://localhost:8000 for the web interface switch

IMG_0423

The following are screenshots of how simple the code is that runs on the web server:

Screen Shot 2015-10-05 at 9.53.24 AM Screen Shot 2015-10-05 at 9.53.09 AM

 

In the end, the goal was to have the switch simply turn on a fan, by turning on the switch, then blowing or whistling into Spidey’s microphone to spin the fan intermittently.

MVI_0419(mini)

Social Artifacts

IMG_1338

Social Artifacts is a look at experiences that are shared through digital mediums can have their meaning or context of the “now” manipulated, misinterpreted, or even lost.

We all share our experiences on Social Media but we often overlook how the experiences we share become altered with the loss of context and all of the sensory information you were exposed to. Your followers understanding is often a simpler understanding of what you experienced because they did not have access to the same sensory information you did.

Documentation

Social Artifacts reads the analog audio output from the Digibird and interprets the original audio than manipulates it to varying degrees which is controlled using a Potentiometer. The manipulated audio is than broadcasted to a secondary speaker. The secondary speaker in this scenario is hidden in the tree as if it was a speakerphone of the digital world. This reinterpreted audio uses the same frequency as the original Digibird output but is simplified to only digital frequencies which overpowers the original higher quality audio.

During this project, having been playing around with the birds speaker cables the speaker connection fell off of the chip all together. I was trying to solder the speaker back to the birds chip without luck. This is illustrated in the image below. So solve this problem I biked over to Toys “R” Us to pick up a new DigiBird :S

IMG_1320

 

To get an idea of the “prototype” outside of the box this is what the whole project looked like in it’s raw state.

IMG_1313

Schematic

The Arduino prototype board is a replacement for the Digibird.

 

BirdSchamatic_bb

The source for the project is also posted on Github.