Bubbly Blower Hat Inspired by Spongebob Squarepants
by HDuzenli in Circuits > Arduino
63 Views, 0 Favorites, 0 Comments
Bubbly Blower Hat Inspired by Spongebob Squarepants
This arduino projects was made at the University Of Stuttgart at the Institute for Computational Design (ICD). The task was to create a 'useless machine' using at least one sensor and one motor. This project is a hat that blows bubbles the more light the hat senses. It was inspired by the episode One Krabs Trash of the show Spongebob Squarepants.
Supplies
- arduino uno
- mosfet
- jumper wires
- light sensor from the arduino kit
- water bubble gun toys (https://www.amazon.de/dp/B087JT6WQ3?psc=1&ref=ppx_yo2ov_dt_b_product_details)
- breadbord
- cable ties
- diodes
- 9v power supply
- inside of construction helmet
- trucker hat with mesh surface in the back (https://www.ebay.de/itm/354925992092?mkcid=16&mkevt=1&mkrid=707-127634-2357-0&ssspo=-ftucajbq2o&sssrc=2047675&ssuid=XL83Y1xeQrC&var=624219770284&widget_ver=artemis&media=COPY)
Adjust Toy and Assembly Cap
- The bubble blowing mechanism of the toy is removed.
- the inside of the construction helmet is removed
- the #1 is drawn on the trucker hat
- the inside of the construction helmet is fittet into the trucker cap
- the bubble blowing mechanisms are mounted with help of the cable ties to both sides of the cap
- the arduino and the breadbord is mounted with help of the cable ties to the back of the cap
- the light sensor is mounted on top of the cap and connected to the arduino via breadbord
- two 9v batteries are mounted at the back, one powering the arduino and the other one powering the bubble throwers
Coding and Calibrating
After the assembly of the hat, the code was written. Which is explained as follows:
Initialization:
- Define the pins for the phototransistor and the output, along with a threshold value. In the setup() function, initialize the serial communication for debugging and configure the output pin as an output, ensuring it starts in the LOW state.
Reading the Sensor Value:
- In the loop() function, read the brightness value from the phototransistor connected to the analog pin.
Debugging Output:
- Print the sensor value to the Serial Monitor to monitor the brightness level detected by the phototransistor.
Threshold Check:
- Compare the sensor value to the predefined threshold. If the sensor value exceeds the threshold, proceed to regulate the power output. If the sensor value is below the threshold, set the output pin to LOW.
Power Regulation:
- If the sensor value exceeds the threshold, map the brightness value to a PWM range (0-255) using the regulatePower() function. This function sets the output pin to the regulated power value using PWM and prints the regulated power value to the Serial Monitor for debugging.
Delay:
- Add a small delay in the loop() function to avoid overwhelming the Serial Monitor with too many messages in quick succession.