Chuck.ino Elisava Halloween

by JoanTenorioELISAVA in Circuits > Arduino

248 Views, 2 Favorites, 0 Comments

Chuck.ino Elisava Halloween

F3NHGXLKVGOEPWF.jpeg
FAEKK3SKVGOENVC.jpeg
IMG_9608.jpg
IMG_9604.jpg

We have made an Arduino project for the university. We had to create a product for Halloween using different electronic components and Arduino code.

We decided to make a terrorific baby doll to fit in the topic of the project.

To do so, we have putted some red LEDs inside the eyes. They turn on when the light of the room turns off thank to a Photoresistor. The head also turns 360ยบ using a stepper motor activated by an ultrasonic sensor.


TEAM:

We are a group of three third year Industrial Design Engineering students from ELISAVA Barcelona, our names are: Lluc Girbau, Joan Tenorio and Pere Canales.

Supplies

Esquema Circuit Arduino BabyDoll.png
IMG-20211102-WA0002.jpg
IMG-20211102-WA0003.jpg
IMG-20211102-WA0005.jpg
IMG-20211102-WA0006.jpg
IMG-20211102-WA0007.jpg

List of the materials used for the project:

-Arduino Kit:

1 UNO R3 Controller Board

1 Breadboard

2 red LEDs

2 Resistors of 220 Ohms

1 Resistor of 1000 Ohms

1 Photoresistor

1 Ultrasonic Sensor

1 Stepper Motor

1 Stepper Motor Driver Module


- 3D printed neck articulation

- Baby doll

Guide to Build It

IMG-20211102-WA0013.jpg
2.PNG
IMG-20211102-WA0009.jpg
IMG-20211102-WA0008.jpg

Guide steps:

First of all, we bought a baby with enough space inside to fit the arduino R3 controller, the sensors and the motor. It was also key that the neck area was removable for our principal idea.

Once the circuit was built and programmed we started with the installation of components. 

To fit all the components and wires we made a big rectanguar hole in the back of the baby.

For the neck we had to design and print some 3D parts to be able to attach the head to the stepper so that it could make a complete turn. This piece, thanks to its design, allows the wires to go through the neck and feed the LEDs in the eyes.

To place the LEDs in the eyes we had to weld a couple of wires and drill the eyes to make some space for them.

In the belly we drilled 3 holes to install the sensors from the inside.

The last step was to make up the baby for halloween giving him a terrifying look.

Arduino Code

Captura de pantalla 2021-11-02 160255.png

#include <HCSR04.h> //We download the HC SR04.h ultrasonic sensor libraries

#include <Stepper.h> //We download stepper motor libraries

int led = 6;    //The PWM pin the LED is attached to

int brightness = 0; //We define a value "brightness" which will be the initial value of the fade

int fadeAmount = 15; //We define a value "fadeAmount" which will be the increment of the fade

const int stepsPerRevolution = 2000; //We define the number of steps we want to perform with the "stepsPerRevolution" function


Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11); //We initialize the stepper that uses pins 8, 9, 10, 11 where the motor stepper is controlled and we define

                           //that the "stepsPerRevolution" function corresponds to the number of steps the engine must perform.

UltraSonicDistanceSensor distanceSensor(2, 3); //Initialize sensor that uses digital pins 2 and 3.



void setup () { //setup starts

 myStepper.setSpeed(15); //We define the speed at which the engine steps must be performed.

 pinMode(led, OUTPUT); //We define that the LED pin is an OUTPUT.


 Serial.begin(9600); //We initialize serial connection so that we could print values from sensor.

}



void loop () { //loop starts

 int dist = distanceSensor.measureDistanceCm(); //We define the variable "dist" as the distance detected by the ultrasonic sensor

 //Serial.println(distanceSensor.measureDistanceCm()); //Verification measures

 if ( dist <= 50 && dist > 0) { //We start the Boolean function "if". In case the distance is between (50.0)cm we enter in the function.

                  //(greater than 0, because the sensor if it does not detect any measurement writes the value -1 by default.)

  analogWrite(led, HIGH);  //We set the LEDs to ON when the function is performed.

  // Serial.println("steps"); //Verification measures

  myStepper.step(stepsPerRevolution); //We order the stepper motor to perform the number of steps previously defined.

  delay(1000); //1s delay 


  myStepper.step(-stepsPerRevolution); //We order the stepper motor to perform the number of steps previously defined in the opposite direction to the previous order.

  // Serial.println("steps ended"); //Verification measures

  digitalWrite(8, LOW); //We deactivate the pins of the motor stepper so that they do not absorb all the current.

  digitalWrite(9, LOW);

  digitalWrite(10, LOW);

  digitalWrite(11, LOW);

  brightness = 0; //We redefine the values "brightness" and "fadeAmount" to the initials.

  fadeAmount = 15;

 }

 //Serial.println(val); //Verification measures

 

 if (analogRead(A0) < 90) //We start the Boolean function "if". We enter the function in case the photoreceptor detects a light intensity less than 90 lx.

 {

  //Serial.println(analogRead(A0) ); //Verification measures

  // Serial.println(" setting light"); //Verification measures


  analogWrite(led, brightness); //We start the led as an analog reading and consider that the current value is the "brightness".

  //Serial.println(brightness); //Verification measures

  brightness = brightness + fadeAmount; //We create a loop to generate the fade effect. We progressively increase the value "brightness" with the "fadeAmount".

  if (brightness <= 0 || brightness >= 255) { //If the intensity of the LED is outside the range (255, 0) the "fadeAmount" increment sign is reversed.

   fadeAmount = -fadeAmount;

   delay(1); //Wait for 1 milliseconds to see the dimming effect

  }

 }

 else //In case the light intensity is above 90 lx the LEDs are kept off.

 {

  analogWrite(led, 0);

  brightness = 0;

  fadeAmount = 15;

 }


}

Downloads

Conclusion

With this project we have learned how to use the arduino components and program them as we wish. We have realised that it is a very useful tool for creating circuits and testing their functions. With it you can be creative and formalise several ideas.