Trick or Treat Slide

by annamb5 in Circuits > Arduino

250 Views, 0 Favorites, 0 Comments

Trick or Treat Slide

Screenshot 2022-11-03 at 14.00.02.png
Screenshot 2022-11-03 at 13.57.51.png
Screenshot 2022-11-03 at 14.02.53.png
Trick or Treat Slide

We present to you, the spookiest slide you have ever seen. What colour will it be? That depends on how well you have behaved this year.. two options: ready to die? ready to live?

The slide drops different coloured sweets into different pots depending on their colour, which will be detected as soon as it is dropped into the slide. We will go ahead and describe all the materials and steps so that you can try it for yourself.

Are you brave enough to play and see what colour you get? Halloween is the perfect day to try it out. Don't miss your shot!

Supplies

Materials

  • plywood 5mm thick
  • fake spider
  • cotton
  • Acrylic paints
  • Adhesive tape

Electronic components

  • Arduino UNO
  • Long and short wires for the Arduino pins
  • Breadboard
  • 2 Servo motor
  • TCS230 TCS3200 Color Sensor

Tools

  • Glue
  • Filing machine
  • Cutter
  • Soldering iron
  • White glue
  • Paint brush
  • Little bowl with water
  • Pencil and eraser
  • Ruler
  • Black marker pen

Code

  • Get the Arduino application on your laptop.
  • Download the code you see above.
  • Open this link and download the ultrasonic sensor library. Install it in the program.
  • Connect the Arduino UNO to your computer and load the code into it.

Code description: We need to include the “Servo.h” library, define the pins to which the color sensor will be connected, create the servo objects and declare some variables needed for the program. In the setup section we need to define the pins as Outputs and Inputs, set the frequency-scaling for the color sensor, define the servo pins and start the serial communication for printing the results of the color read on the serial monitor.

In the loop section, our program starts with moving the top servo motor to the position of the skittle charger.

Using the “for” loop we will rotate and bring the skittle to the position of the color sensor. We are using a “for” loop so that we can control the speed of the rotation by changing the delay time in loop. After a delay, using the custom made function, readColor() we will read the color of the skittle. Using the four control pins and the frequency output pin of the color sensor we read color of the skittle. The sensor reads 3 different values for each skittle, Red, Green and Blue and according to these values we tell what the actual color is.

Downloads

Flow Diagram

flowdiagram.png

This diagram visually represents the practical function that our circuit reads.

Wooden Box

IMG_8967.jpg
IMG_8966.jpg
IMG_8969.jpg

The first step is to design the box drawings in the Rhino programme.

Once you make sure that the measurements are correct and that everything fits, you buy a sheet of plywood not too thick and take it to a laser machine to cut it. It is important to choose the right cut to cut as often the final finish looks bad because the wood is burnt too much and then you have to spend more time filing the plywood or painting it to hide the defects.

Once you have all the pieces cut you start building the box and you can modify the pieces if they don't fit well. When they all fit together it's time to paint the pieces with the theme you want. At this point it is important that you do not glue anything because you still have to put all the electronics.

Downloads

Electrical Components

Slide machine circuit.png
Screenshot 2022-11-03 at 14.05.27.png
Screenshot 2022-11-03 at 14.13.40.png
Videoleap 1DB7F046 E0EE 4275 82F3 C355309063D4

Once the code is programmed, you connect it to the arduino and test it. You adjust the angles of movement of the servomotors and the waiting time in the sequences so that the mechanism works well. Calibrate the colour sensor so that it identifies the colours of the Skittles. It is important that it is calibrated in the conditions in which you are going to operate the machine because the sensor requires a lot of precision in the luminosity, identification distance... Keep in mind that you will put decoration later and this will also affect the brightness of the colour sensor.

Artistic Part

75B32659-E3B3-4363-8BE9-E99266A9128B.JPG
Screenshot 2022-11-03 at 14.24.37.png

Once you have checked that everything is working as it should, glue the pieces in place and start decorating the outside in the halloween theme.

Conclusion

Screenshot 2022-11-03 at 14.25.42.png
Screenshot 2022-11-03 at 14.24.56.png

This project has been very practical and we have learnt a lot since all the theory that we have been taught in the classes we have had to apply it in a real project. Now we understand better how programming works and its applications in daily life. Also, working in a team helps you to see things from different points of view and come up with more original ideas.