A. Night Angel – Nadine(Ziyan) Chen – Eric Parren
B. CONCEPTION AND DESIGN:
Our project is called Night Angel, whose main part is a lotus with a neoPixel controlled by a Servo and a light sensor. When the environment is dark, the lotus will open, and the neoPixel will light on. In processing, there will play a music with the black background with shining colorful stars. When we turn on the light, the servo will spin and close the lotus will, the noePixel will be turned off, the music will stop playing, and the colorful stars will disappear, and the screen will become black again. Our project is designed for children who are afraid of dark and feel hard to fall asleep. By interacting with our project in the dark, children can see the colorful flower while seeing the shinning stars and hearing the peaceful music so they are less afraid of the dark night and fall asleep more easily. In terms of the inspiration for our project, we were inspired by a flower music candle: when ignite the candle, the closed plastic flower will open, and a music will start playing simultaneously in this video: https://www.youtube.com/watch?v=nVxn5mFe7NA
We took a closer look at this special candle, and figured out that the pedals of the plastic flower are held by strings, when the igniting fire touch the string, the string will break, and the flower will open. Instead of using fire, we thought that we can just use servo to control the status of the flower and make it recyclable rather than a single-use one. To make a connection between the Arduino and Processing, instead of using a MP3 player (also because it will make our project ugly), we use my computer as the music player. The interaction of our project is quite straight forward. People can choose to turn on or turn off the light to control the status of the lotus. Turning on or off the light can make the light sensor sense the light change of the environment. By connecting it to other components of our project, the open and close status of the flower can be changed by light. In the user test, we had not attached our project to the laser-cut box due to time limitation. Instead, my partner Angela held the servo by hands, as the function of a “box”. Because the room is bright, we asked users to cover the light sensor constantly by hands to make a “dark atmosphere”. When people doing so, the lotus opened, and a video with a “star” music played; when they remove their hands, the flower close, and the video stop playing. To make the project more interesting, professor suggested us to “draw stars” in processing instead of “playing a terrible video”. We took Professor Parren’s suggestions and draw many random colorful stars on a black screen when closing the light of the room, which is much better than before: more interaction, more creativity, and more interests. Background music(convert from this video): https://www.youtube.com/watch?v=bDVJJfeR-VY
This is our project:
In IMA SHOW:
C. FABRICATION AND PRODUCTION:
For the choice of the project, instead of the boring computer games that we previously thought, Professor suggested us to think more and make more interesting project ideas. This project ended up with the combination of ascetic and practical art piece, which is much better than the computer games! I think the most significant steps of our project is the comprehension of the mechanism. At first, we put the string that controls the flower on the bottom. However, it was hard to adjust the pedal’s position. After finding the strong gloss string, and several tests, Angela figured out that it would be effective to put the string with the servo connected to the top. And for the coding part, with the help of LAs and Professors, we combined all the code that controlled different part together and make our project work. We use a light sensor, a servo, a neoPixel, and a handful wires. The reason why we choose these components is that our project should be worked in the dark, the light sensor is sensitive to lights; the neoPixel has a variety of light change: the light color, the light position, etc., which can be pretty in the dark environment; the servo is strong so that it can hold the string and control the flower.
Here is the code:
Arduino:
#include
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
#include
#define DATA_PIN 3
// How many LEDs are attached to the Arduino?
#define NUM_LEDS 60
// LED brightness, 0 (min) to 255 (max)
#define BRIGHTNESS 50
// Adafruit_NeoPixel strip(NUM_LEDS, DATA_PIN, NEO_GRB); // <- Adafruit NeoPixel version
FastLED_NeoPixel<NUM_LEDS, DATA_PIN, NEO_GRB> strip; // <- FastLED NeoPixel version
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
myservo.attach(9);
strip.begin(); // initialize strip (required!)
strip.setBrightness(BRIGHTNESS);
}
void loop() {
// reads the input on analog pin A0 (value between 0 and 1023)
int analogValue = analogRead(A0);
Serial.println(analogValue); // the raw analog reading
// We'll have a few threshholds, qualitatively determined
int angle = map(analogValue, 550, 950, 1, 330);
myservo.write(angle);
delay(500);
if(analogValue < 300){
rainbow(10, 3);
blank(100);
}else{
strip.clear();
}
}
/* Fastled
* Fills a strip with a specific color, starting at 0 and continuing
* until the entire strip is filled. Takes two arguments:
*
* 1. the color to use in the fill
* 2. the amount of time to wait after writing each LED
*/
void colorWipe(uint32_t color, unsigned long wait) {
for (unsigned int i = 0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, color);
strip.show();
delay(wait);
}
}
/*
* Runs a marquee style "chase" sequence. Takes three arguments:
*
* 1. the color to use in the chase
* 2. the amount of time to wait between frames
* 3. the number of LEDs in each 'chase' group
* 3. the number of chases sequences to perform
*/
void theaterChase(uint32_t color, unsigned long wait, unsigned int groupSize, unsigned int numChases) {
for (unsigned int chase = 0; chase < numChases; chase++) {
for (unsigned int pos = 0; pos < groupSize; pos++) {
strip.clear(); // turn off all LEDs
for (unsigned int i = pos; i < strip.numPixels(); i += groupSize) {
strip.setPixelColor(i, color); // turn on the current group
}
strip.show();
delay(wait);
}
}
}
/*
* Simple rainbow animation, iterating through all 8-bit hues. LED color changes
* based on position in the strip. Takes two arguments:
*
* 1. the amount of time to wait between frames
* 2. the number of rainbows to loop through
*/
void rainbow(unsigned long wait, unsigned int numLoops) {
for (unsigned int count = 0; count < numLoops; count++) {
// iterate through all 8-bit hues, using 16-bit values for granularity
for (unsigned long firstPixelHue = 0; firstPixelHue < 65536; firstPixelHue += 256) {
for (unsigned int i = 0; i < strip.numPixels(); i++) {
unsigned long pixelHue = firstPixelHue + (i * 65536UL / strip.numPixels()); // vary LED hue based on position
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue))); // assign color, using gamma curve for a more natural look
}
strip.show();
// delay(wait);
}
}
}
/*
* Blanks the LEDs and waits for a short time.
*/
void blank(unsigned long wait) {
strip.clear();
strip.show();
delay(wait);
}
Processing:
import processing.sound.*;
import processing.serial.*;
boolean firsttrig = true;
Serial serialPort;
SoundFile sound;
int NUM_OF_VALUES_FROM_ARDUINO = 1; /* CHANGE THIS ACCORDING TO YOUR PROJECT */
/* This array stores values from Arduino */
int arduino_values[] = new int[NUM_OF_VALUES_FROM_ARDUINO];
Sound myMusic;
boolean Servo = false;
int numStars = 100; // number of stars
float[] xPos = new float[numStars]; // x positions of stars
float[] yPos = new float[numStars]; // y positions of stars
float[] sizes = new float[numStars]; // sizes of stars
color[] colors = new color[numStars]; // colors of stars
void setup() {
background(0);
size(1500, 1000);
//myMusic = new Music(this, "star.mp3");
//myMusic.loop();
printArray(Serial.list());
// put the name of the serial port your Arduino is connected
// to in the line below - this should be the same as you're
// using in the "Port" menu in the Arduino IDE
serialPort = new Serial(this, "/dev/cu.usbmodem1101", 9600);
println("Loading mp3...");
sound = new SoundFile(this, "star.mp3");
sound.loop();
for (int i = 0; i < numStars; i++) {
xPos[i] = random(width); // random x position
yPos[i] = random(height); // random y position
sizes[i] = random(5, 40); // random size
colors[i] = color(random(255), random(255), random(255)); // random color
}
}
void draw() {
// receive the values from Arduino
background(0); // black background
getSerialData();
float x = arduino_values[0];
//if (myMusic.available()) {
// myMusic.read();
//}
if (x < 300) {
Servo = true;
if (!sound.isPlaying()) {
sound.play();
}
// Draw the stars
for (int i = 0; i < numStars; i++) {
fill(colors[i]); // set the fill color
ellipse(xPos[i], yPos[i], sizes[i], sizes[i]); // draw the star
// Blinking effect
if (frameCount % 50 == 0) { // change every 50 frames
colors[i] = color(random(255), random(255), random(255)); // set a new random color
}
}
} else {
sound.stop();
}
//sound(myMusic, 0, 0);
// if (i < 35) { // When 'i' is less than 35...
// myMovie.read();
// }
// else if line(30, i, 80, i);
//}
//mousePressed() {
// myMovie.stop();
//}
}
void getSerialData() {
while (serialPort.available() > 0) {
String in = serialPort.readStringUntil( 10 ); // 10 = '\n' Linefeed in ASCII
if (in != null) {
print("From Arduino: " + in);
String[] serialInArray = split(trim(in), ",");
if (serialInArray.length == NUM_OF_VALUES_FROM_ARDUINO) {
for (int i=0; i<serialInArray.length; i++) {
arduino_values[i] = int(serialInArray[i]);
}
}
}
}
}
Circuit:
D. CONCLUSIONS:
The goal of our project is to turn off the light, turn on the neoPixel, open the flower, while playing a music and drawing colorful stars, making the dark environment colorful, peaceful, and beautiful; turn on the light to turn off the neoPixel, close the lotus, while stopping the music and quitting drawing stars. Our project mostly achieved the stated goals, there is a small problem with the servo because sometimes, the servo was crazy: instead of spinning once, it rotated continuously, making the flower open and close constantly. After the IMA SHOW, LA Zhiyang told me that it was because we had not connected the servo to another power supply. The audience first interacted with our project by covering the light sensor by hands on the final presentation; in IMA SHOW, audiences can turn on or turn off the flashlight to make the lotus open and close. In alignment with the definition of interaction, our project provides audience with the hearing, visionary, and behavioral interaction, making them able interact with the project. If we have more time, we can combine the box of circuit and the light sensor with the big box that contains flower and connect the servo to another separate 5V power supply. If possible, we can add another servo to make the lotus spine when turning off the light in the room.
During the making process, we also came across some adversities and failures, but we learned a lot from them. At the beginning, we could not figure out the mechanism of our project, we first tried wood pedals, but they were not good and stuck; we then 3D printed dimensional pedals, which were pretty, but lack one component on the bottom circle so that it was impossible to connected them to the middle ring. Instead of reprinting them again, we use hot glue gun to add glue to make up the missing half ring; also, as mentioned above, we changed the hanging position: hold the flower from the top rather than from the bottom. I learned the ability of being flexible, to be creative, and to be patient. We made several mistakes, but we never gave up, kept going and try our best to find the solutions. Finally, we made it! Also, in the final week, everyone is extremely busy. Try to manage the time appropriately, setting the priorities, and writing all things on the Google calendar. By doing so, we would not miss any due.
Works Cited
Isisip. “Twinkle Twinkle Little Star.”YouTube, YouTube Video, 10 Apr. 2020, www.youtube.com/watch?v=bDVJJfeR-VY. Accessed 14 May 2023.
MBS Nutrition. “Rotating Musical Flower Candle.” YouTube, YouTube Video, 11 June 2014, www.youtube.com/watch?v=nVxn5mFe7NA. Accessed 14 May 2023.
Leave a Reply