Making a "angry" Fire Fly With Arduino
by Floor_Pannen in Circuits > Arduino
269 Views, 0 Favorites, 0 Comments
Making a "angry" Fire Fly With Arduino






This sweet firefly is just living his life. You can tell from his emotions how he feels. He is very fond of his personal space. If you get too close, he will turn red and be angry!
It measures the distance by means of an Ultrasonic sensor (hc-sr04). If you come within 20 cm of the sensor, the light will change color through the Arduino.
---------------------------------------------------------------------------------------------------------------------------------------------------------------
//backgroundstory
I wanted to do something with sensors that can measure movement and distance. My first idea was to make a kind of peep behind the curtain. But because I didn't know anything about sensors, I found it difficult to start with this and I looked for a project that I could find more about online.
I wanted to experiment with the ultrasonic sensor (hc-sr04) in combination with a servo motor. For this I had found a nice project where I wanted to make a kind of doll. (https://www.youtube.com/watch?v=APU4y4s7U1w)
I didn't get the code translated properly and I kept getting error messages that I couldn't solve. I therefore chose to choose a slightly easier project (https://www.youtube.com/watch?v=Jk4t16fZZaQ) With this assignment I did get an error-free code and I could see in my code program that my sensor distance in cm, but my engine did not turn.
After I had thoroughly checked all the wiring several times, I started testing the servo motor separately and found out that my motor was not working. This is the moment when I had come up with a new idea.
I wanted to do something with this sensor, I did more research into the possibilities:
ultrasonic library: https://www.arduinolibraries.info/libraries/ultrasonic
complete guide: https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/?utm_content=cmp-true
complete guide 2: https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/
I ended up using the code from the last link. When I knew that the sensor worked, I thought of replacing the motor with 2 lights. I added the code for this myself.
Please note when assembling and disassembling your work, then put the wires back in the right places. I myself have had that I had a wire that had to be in the positive row in the negative and the wires of the echo and the trigger had been reversed from the sensor.
//what did I learn
What I have learned is that a lot is possible with Arduino. I would start too big again when sometimes I need to act simpler. Also, I should have started earlier and missed some things for a long time.
Something I've done this project that I don't normally do is really take pictures every step of the way. Normally I always forget this but this project had achieved it. Well recorded of your working method is therefore also what I learned this project.
In addition, I have of course found new knowledge about coding. I've used some of other people's code. I've gone all the way through this code to understand what the deed is and then modified it to what I'd like to change and added the lights. I was quite proud of this.
Supplies
Requirements Arduino:
Arduino uno
Prep board
Ultrasonic Sensor (HC-SR04)
6 male to male connecting wires
4 female to male connecting wires
2 resistors of 330 Ohm
2 LED lights (color of your choice)
Firefly Requirements:
White translucent piece of fabric
1 a4 sheet of black felt
6 drawing pins
4 toothpicks
duck tape
Styrofoam (a4)
Thick iron wire (5mm)
Thin iron wire (2mm)
Tools:
Stanley knife
Pair of scissors
Pliers (cutting and bending)
superglue
Building the Arduino


Recreate the schematic drawing above. Paste your prep board on top of your Arduino.
I tied the wires together with a piece of wire and taped it with duck tape. In this way it was more compact and easier to process in the conversion.
Trigger: 2
echo: 3
blue light: 8
red light: 9
The Code

download the code and connect your arduino. Run the project to test it. If the lights change when you come close it works.
code inspiration: https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/
Start of the Conversion


Cut an oval out of the Styrofoam. Make sure it is about 20 by 10 cm.
Hollow out the Styrofoam with the Stanley knife at the location of the Arduino and the ultrasonic sensor and the USB cable. Only cut out the styrofoam for half. Attach a piece of Styrofoam under the base so that it is slightly higher from the table.
Secure the Arduino


Break the toothpicks in half. Secure the arduino and the sensor with toothpicks. Put a piece of duck tape over this.
The Arc

Make 2 arcs with the thick iron wire over the preb board and the arduino
Making the Head




Use half a4 paper to fold a proof. Fold the paper in half 3 times across the width. Cut the paper in half on the first and last 3 lines. You don't do anything with the line in the middle. This piece goes on top and you slide the other pieces under it until you get a bulge in the head. Also cut out the eyes on the place of the sensor.
Lay the paper "template" over the felt to make the head. Also cut out the eyes and glue them together with superglue.
The Fabric


Place the piece of fabric over the 2 bows and make sure you have enough at the front to attach it under the head. For the rest of the body, make sure that the fabric reaches the bottom of the Styrofoam. Take into account the USB cable on the back of the firefly.
If you have a square cloth like I had, you have to cut a notch in the back corners and fold the cloth over each other so that it fits nicely on the model. You then sew this and then cut away the remaining fabric.
Glue the front of the cloth under the head and let it dry. I have additionally secured it with a needle and thread, but in principle superglue should be strong enough.
The Details




Meanwhile, from the remaining felt, cut a long strip of 2.5 cm wide for around the firefly (this should go from one side of the head to the other), 6 triangles for the legs and 2 for the feelers. The feelers should be longer than the legs. Glue the thin wire in the middle of the triangles intended for the legs.
At the end of the long strip, glue 2 thumbtacks on the inside. On the other side, attach the first leg to the pin in the front, the next 3 cm behind it and the 3rd 3 cm behind it. You also repeat this process on the other side. Then fold all the legs down slightly so that it looks like the firefly is standing on its legs.
Glue the 2 feelers under the flap on top of the head.
Secure All Elements



Push the sensor through the holes in the head and pull the fabric good on his place. At the back of the firefly, secure the fabric with a thumbtack. Then put the band with the legs at the front behind the head with the thumbtacks.
Finisching Touch


Finally, fold the wings together using black iron wire. I did this by using a pair of wire cutters and bending pliers. First I made 2 large ovals. After this I pulled the wire from the middle of the 2 wings over the end of the wing. Here I turned it around once so that it fits nicely. On the way back to the center I went from left to right at 3 points with the wire. Here too, you turn it once around the shape of the wing at the end so that it stays in place.
You also attach the wings under the firefly's head and fix them completely with a drop of superglue. For the really nice finish, paint the bottom of the animal and the edge just below the head black so that it is less noticeable.