Auto Paper Airplane Dispenser
This project aims to develop a functional prototype using Arduino, focusing on integrating electronics, coding, and custom housing. The process begins with setting up the hardware by wiring the necessary components from the SparkFun Inventor's Kit for Arduino Uno, ensuring that each sensor and actuator is correctly connected to the microcontroller. Once the wiring is complete, the next step involves coding the Arduino to control these components, writing programs that allow the sensors to gather data and actuators to respond accordingly. Following the coding, thorough testing of both the code and wiring is essential to identify and fix any issues in the initial setup.
After verifying functionality, the project moves to building custom housing using a 3D printer. This housing will protect the components and provide a stable structure for the final product. Once the housing is ready, all parts are combined, securing the electronics within the enclosure. Finally, comprehensive testing of the complete setup ensures that each part works as expected in the final design, resulting in a robust and well-integrated prototype.
Here’s a structured overview:
- Wiring
- Gather components from the SparkFun Inventor's Kit for Arduino Uno.
- Connect sensors, actuators, and other necessary parts to the Arduino Uno.
- Ensure each connection is secure and correctly aligned with the circuit design.
- Coding
- Write code to control the sensors and actuators based on project requirements.
- Program the Arduino Uno to gather data from sensors and respond accordingly.
- Test the code for initial functionality and debug any errors.
- Testing Code and Wiring
- Run initial tests to ensure the code and wiring work together as expected.
- Adjust connections or modify code based on test results.
- Repeat tests until the circuit functions correctly.
- Building Housing
- Design a custom housing structure that will protect and hold the components securely.
- Use a 3D printer to create the housing based on the design specifications.
- Make adjustments as needed to fit all components comfortably.
- Combining It All
- Assemble the components within the 3D-printed housing.
- Securely mount the Arduino, sensors, and other parts inside the enclosure.
- Organize wires and ensure everything fits properly for a clean final build.
- Final Testing
- Perform comprehensive tests on the fully assembled prototype.
- Check for any issues with the wiring, code, or structural components.
- Make final adjustments to optimize performance and functionality.
This step-by-step approach ensures a well-organized development process, leading to a functional and reliable final prototype.
Supplies
For this project, the primary materials required include the SparkFun Inventor's Kit for Arduino Uno - v4.1, which provides a comprehensive set of components for Arduino-based prototyping. This kit includes essential parts such as the Arduino Uno microcontroller, a breadboard, various sensors, motors, LEDs, and other necessary hardware to create interactive electronic circuits. In addition to the kit, access to a 3D printer is essential for fabricating custom parts that may be needed to mount components or enclose circuits, enhancing the structural stability and aesthetics of the final design. The combination of the Arduino kit and 3D-printed parts will enable a versatile and creative approach to building and prototyping. Here are some of the supplies you will need for this project:
Arduino Board:
- A microcontroller board used to control and execute the program logic. It interfaces with all other components and acts as the main brain of the circuit.
Ultrasonic Sensor (HC-SR04):
- Used to measure distance by emitting ultrasonic waves and detecting their reflection. Commonly used in obstacle detection systems.
Breadboard:
- A prototyping tool that allows easy and temporary wiring of components without soldering.
9V Battery:
- Provides power to the circuit.
DC Motors (yellow components):
- These are used for rotational movement, such as driving wheels in a robotic car. They convert electrical energy into mechanical energy.
Motor Driver IC (L293D):
- Used to control the direction and speed of the DC motors. It acts as an interface between the Arduino and the motors.
Potentiometer:
- Used to adjust voltage levels manually. It can control brightness, volume, or motor speed depending on the setup.
Jumper Wires:
- Used to connect components together on the breadboard and link them to the Arduino.
Voltage Regulator Module (near the 9V battery):
- Ensures the proper voltage levels are supplied to the components, preventing overvoltage damage.
https://www.sparkfun.com/products/15631
Set Up Wiring
The wiring phase is a critical foundation for the project, as it involves connecting all components accurately to ensure proper communication and functionality. Here's a more detailed breakdown of the wiring process:
- Gathering Components
- Begin by collecting all necessary components from the SparkFun Inventor's Kit for Arduino Uno. This typically includes the Arduino Uno microcontroller, a breadboard, the motion sensor, the actuators (motors), resistors, jumper wires, and any additional specific parts required for your project.
- Planning the Circuit Layout
- Before connecting anything, sketch or refer to a wiring diagram to organize where each component will connect on the breadboard and to the Arduino’s pins. This step helps prevent errors and reduces confusion during the wiring process.
- Take note of which pins on the Arduino will correspond to each component, especially when multiple sensors or actuators are involved. For example, digital and analog pins may be designated for specific components based on the project's needs.
- Setting Up the Breadboard
- Place the breadboard near the Arduino, and if needed, establish a power and ground rail. The breadboard allows for modular connections, making it easier to manage and adjust wiring as needed.
- Use jumper wires to connect the breadboard’s power and ground rails to the Arduino’s 5V and GND pins. This setup creates a common power and ground connection for all components, which is essential for consistent operation.
- Connecting Sensors and Actuators
- Start wiring each component to its designated location on the breadboard and Arduino.
- For sensors, connect the power and ground leads to the appropriate rails, and connect the signal or data lead to the Arduino pin specified in your wiring diagram.
- For actuators, such as LEDs or motors, ensure they are connected with the correct polarity and use resistors if necessary to prevent excessive current that could damage the component or Arduino.
- Managing Connections
- Use color-coded jumper wires (e.g., red for power, black for ground, and other colors for signal) to help visually organize connections. This makes troubleshooting much easier and prevents mistakes.
- If the project requires a large number of connections, consider using additional mini breadboards or a larger breadboard to avoid overcrowding, which could lead to accidental short circuits.
- Checking and Securing Connections
- Once all components are connected, go through each connection carefully to ensure accuracy. Miswiring could lead to malfunctions or even damage the Arduino.
- Make sure each jumper wire is firmly inserted into the breadboard or Arduino headers, as loose connections can cause intermittent issues during testing.
- Powering Up and Initial Testing
- After double-checking all connections, power up the Arduino via USB or external power supply to test basic functionality. Look for any immediate issues, like components not powering on, which could indicate loose or incorrect wiring.
- At this stage, simple tests, like seeing if LEDs light up or sensors respond, can confirm the initial setup before moving on to coding.
By following a systematic and organized approach in the wiring phase, you can minimize errors, ensure a solid foundation for the project, and make troubleshooting easier in later stages. A video and wiring diagram has also been attached for your convenience.
Set Up Code
Steps to Upload the Code to Arduino
- Open the Arduino IDE: Make sure you have the latest version of the Arduino IDE installed and open it on your computer.
- Copy and Paste the Code: Copy the example code bellow and paste it into the Arduino IDE.
- Select the Correct Board and Port:
- Go to Tools > Board > Arduino Uno (or select the board you are using).
- Then go to Tools > Port and select the port that corresponds to your Arduino (usually named "COMx" on Windows or "/dev/ttyUSBx" on macOS/Linux).
- Upload the Code:
- Click on the "Upload" button (the right-facing arrow at the top of the IDE) to compile and upload the code to your Arduino.
- Wait for the IDE to display “Done uploading.” This means your code has been successfully uploaded.
- Open the Serial Monitor (Optional):
- Go to Tools > Serial Monitor to open the Serial Monitor window.
- Set the baud rate in the Serial Monitor to 9600 (to match Serial.begin(9600); in the code).
- The Serial Monitor will display the sensor readings, allowing you to observe how the Arduino reacts to different sensor values.
After uploading, your Arduino will run the code automatically, turning the LED on or off based on the sensor reading compared to the threshold. The code has been attached below.
Downloads
Test Code and Wiring
The testing phase is essential to ensure that both the code and wiring work together as expected before finalizing the project. Here’s a step-by-step guide for testing your Arduino setup.
1. Initial Power Test
- After uploading the code, power up your Arduino by connecting it to your computer via USB or using an external power source if applicable.
- Observe if the components, such as LEDs, display any immediate signs of power (e.g., LED blinking or lighting up briefly).
- This step helps verify that the Arduino board and basic connections are receiving power.
2. Checking Sensor Readings
- Open the Serial Monitor in the Arduino IDE by navigating to Tools > Serial Monitor. Ensure the baud rate is set to 9600 to match Serial.begin(9600); in the code.
- Observe the sensor readings displayed in the Serial Monitor. Move or adjust the environment around the sensor (e.g., place a hand closer or further away if using a proximity sensor) and check if the readings change accordingly.
- Confirm that the sensor is working as expected by comparing the readings to expected values. For example, if using a light sensor, you should see higher readings when exposed to light and lower readings in the dark.
3. Testing the Threshold Logic
- Gradually change the conditions around the sensor to test whether the threshold logic in your code functions correctly.
- For instance, if the threshold is set at 500, manipulate the environment so the sensor reading goes above and below this value.
- Observe whether the LED (or other output component) turns on when the sensor value is above the threshold and turns off when below.
4. Troubleshooting Common Issues
- No Response from Sensor: If the Serial Monitor shows no change in sensor values, check the wiring for loose or incorrect connections. Ensure the sensor is securely connected to the power, ground, and analog/digital pins.
- Unexpected Serial Output: If the Serial Monitor shows unexpected or fluctuating values, consider adding additional delays in the code or stabilizing the circuit by adding resistors or capacitors if needed.
5. Refining Threshold and Delay
- Based on the observed sensor readings, you may need to adjust the threshold value in your code to match real-world conditions. For instance, if the sensor values are typically in the 400–600 range, you might adjust the threshold closer to 550 for more accurate control.
- Modify any delays as needed. For instance, a delay of 100 milliseconds may be too slow or too fast depending on the responsiveness you need from the sensor.
6. Running Multiple Tests
- Repeat the test multiple times to ensure consistent performance. Consistency is key; any intermittent behavior could suggest a loose connection or unstable code logic.
- Test different scenarios or conditions the project might encounter. For example, if it’s a motion-activated project, try moving at various distances or speeds to ensure it responds accurately.
7. Documenting Results and Adjustments
- As you test, take notes of any adjustments made to the code (like changes in threshold or pin assignments) or hardware (like re-securing wires).
- Documenting helps in troubleshooting and serves as a reference for future improvements.
8. Final Check Before Moving On
- Once all tests consistently show correct behavior, the wiring and code are ready for the next steps, such as adding a housing or combining components.
- Run one final test to confirm everything is stable and functioning as expected before making any permanent adjustments to the hardware.
By following this structured approach, you’ll ensure that each component works correctly and that the project as a whole functions reliably before moving on to the next stage.
Develop Housing
The housing stage involves creating a protective enclosure for your Arduino project. This housing not only secures the components but also provides a clean, finished look. Here’s how to approach the housing build:
- Design the Housing
- Begin by sketching or planning the layout of your housing. Take into account the placement of each component, ensuring that all sensors, LEDs, buttons, and other elements have appropriate openings or mounts in the housing.
- Consider how the housing will be assembled and whether screws, hinges, or snap-fit connections will be needed for easy access to the components inside.
- Decide on the dimensions, ensuring enough room for the Arduino board, wiring, and any additional parts, like sensors and actuators.
- Using a 3D Modeling Software
- If you have access to 3D modeling software (such as Tinkercad, Fusion 360, or SolidWorks), create a digital model of the housing. This will allow you to customize the size and design precisely to fit your components.
- Make sure to add cutouts for any parts that need to be exposed (like sensor openings, power connectors, or USB access for the Arduino).
- Include mounting points or brackets to hold the Arduino and other components in place within the housing.
- Preparing the 3D Printer
- Load the STL file of your housing design into the slicing software for your 3D printer, adjusting the settings for the material you’re using (typically PLA or ABS).
- Choose print settings such as layer height, infill density, and support structures. Ensure the print orientation is optimized for strength and to minimize support material.
- 3D Printing the Housing
- Start the print and monitor it occasionally to ensure there are no issues, such as filament jams or warping.
- Once the print is complete, allow it to cool before removing it from the printer bed to prevent warping or damage.
- Post-Processing the Housing
- Remove any support material or imperfections with tools like pliers, sandpaper, or a file. This will create a smooth and professional look.
- If desired, paint or decorate the housing to enhance the appearance and make it visually appealing.
- Testing the Fit
- Place the Arduino and other components inside the housing to check for fit and clearance.
- Ensure that all cutouts align with the corresponding components (e.g., the USB port, power jack, sensors, and LEDs).
- Make adjustments as needed, such as sanding down areas or drilling additional holes, to achieve a snug and accurate fit.
- Securing the Components Inside the Housing
- Use screws, brackets, adhesive, or zip ties to secure each component inside the housing. Make sure everything is stable and that the wiring is organized to avoid tangles or accidental disconnections.
- If needed, use small cable clips or zip ties to manage wires and keep them in place.
- Final Assembly
- Once all components are securely positioned, close the housing according to your design. This could involve snapping, screwing, or gluing parts together.
- Test that any moving parts, like buttons or sensors, are accessible and functional through the housing openings.
- Double-Check Accessibility
- Confirm that all external ports and necessary controls, such as the USB port for programming or power inputs, are accessible without needing to open the housing again.
- This will make any future adjustments or reprogramming much easier.
By building a custom housing, you create a durable and professional-looking enclosure that enhances the usability and longevity of your project. A well-designed housing protects sensitive electronics while allowing full functionality and easy access to necessary parts.
In addition here is a full printing guide attached as a pdf:
here are the links to the editable CAD as well as the STL files:
https://docs.google.com/presentation/d/1gYtpn-zM7B30j22G0K5ZevVA8QNnEZM0sZ7oQ1E1KLo/edit
https://cad.onshape.com/documents/e45ffc817a555b0475bd0a88/w/ea724e1d142b551ba7441f92/e/86cd1079b6254293024b55bd
Combining It All
With the wiring, coding, testing, and housing prepared, the next step is to assemble everything into the final product. This phase involves carefully combining all components into the housing, ensuring everything is secure and works together seamlessly. Here’s a detailed guide to this stage:
- Preparing Components for Assembly
- Before placing everything into the housing, review all components to ensure they are clean and free from debris. Check for any loose connections or wires that may have come undone during previous testing.
- Gather any necessary tools, such as screwdrivers, pliers, adhesive, and zip ties, to secure the components inside the housing.
- Installing the Arduino and Core Components
- Start by placing the Arduino board inside the housing. Use screws or mounting brackets if your housing design includes them, ensuring the board is secure and won’t move.
- Arrange the main components, such as sensors, LEDs, or other outputs, in their designated spots within the housing. Make sure they align with any openings in the housing designed for them.
- Organizing the Wiring
- Carefully route the wires to avoid tangling and interference. Use zip ties or adhesive cable clips to keep wires organized and secured in place.
- Ensure that wires are not too tight, as this could strain connections, nor too loose, as this could cause tangling or accidental disconnections.
- Connecting All Components
- Plug all components into their designated pins on the Arduino board according to the wiring diagram. Double-check each connection to ensure it aligns with your code and circuit layout.
- Make sure any connections to external components, such as sensors outside the housing, are correctly routed through the housing cutouts and securely connected.
- Testing Connections One Last Time
- Power up the Arduino and perform a quick test of each component to ensure all connections are intact and working as expected.
- Verify that sensors, actuators, and LEDs respond correctly and that there are no loose wires or intermittent issues.
- Securing the Housing
- Once everything is in place and fully connected, close the housing. If it has screws, tighten them carefully to avoid damaging the structure. For snap-fit housings, ensure that all sides are securely snapped into place.
- If any components require adjustments or recalibrations, perform those now before completely sealing the housing.
- Final Adjustment and Cable Management
- Check that all wires are neatly arranged inside and that there’s no risk of short circuits or wire damage.
- Ensure any external components, such as sensors, buttons, or switches that extend outside the housing, are accessible and functional.
- Double-Check Accessibility and Functionality
- Confirm that all essential ports, such as the USB port for programming or the power jack, are accessible and not blocked by any part of the housing.
- Make sure that you can easily access any buttons or switches needed for operation without needing to open the housing.
- Documenting the Assembly
- Take photos of the final assembly, both inside and outside, to serve as a reference for future troubleshooting or modifications.
- Document any final changes made to wiring or connections, which will be helpful if you need to revisit or modify the project later.
- Final Testing
- Now that everything is fully assembled, the project is ready for final testing. Double-check that each component is secure and that there’s no risk of parts moving around when the device is in use.
By carefully combining all the elements, you’re setting up your project for success in the final testing phase. This organized approach helps prevent issues related to loose components or messy wiring, ensuring a polished, fully-functional prototype.