Light Tunnel Controller

by joshuadm23 in Circuits > Arduino

119 Views, 0 Favorites, 0 Comments

Light Tunnel Controller

PXL_20230804_120151742.jpg

Welcome to this instructable, where we delve into the world of gaming and Arduino to create a unique and interactive experience! In this project, we will explore the fascinating concept of using light to control a game world through an Arduino-based game controller.


Traditional game controllers have come a long way, from buttons and joysticks to motion sensors and touchpads. But what if we take it a step further and harness the power of light to immerse ourselves in the virtual realm? With thislight-controlled Arduino game controller, we can do just that!


Imagine casting spells with a wave of your hand or building structures by blocking light – your physical actions translate directly into in-game actions. The possibilities are endless, and the excitement of this interactive gaming experience is unparalleled.


In this instructable, we will guide you through the process of creating your light-controlled Arduino game controller. We'll cover everything from assembling the hardware to writing the necessary code, and by the end, you'll have a powerful tool to revolutionize your gaming adventures.


Whether you're a seasoned Arduino enthusiast or a curious beginner, this project will take your gaming experience to a whole new level. So, gather your enthusiasm and let's dive into the exciting world of Arduino game control with light!

Supplies

Elektronic components

  • Arduino Uno
  1. Light sensors (photocells or photodiodes) - These sensors will detect changes in light intensity and allow you to interact with the game.
  2. Resistors - You will need resistors to ensure proper voltage levels and current flow in the circuit. The specific values will depend on the light sensors you are using.
  3. Jumper wires - These wires will be used to make connections between the components on the breadboard or prototyping board.
  4. perfboard

Materialen voor de behuizing

  • 1220x1440x3mm mdf
  • Red paint
  • Bue paint
  • Yellow paint
  • Green paint
  • Orange paint
  • Paper tape
  • Woodglue
  • glue
  • Thin foam sheet
  • paper

Tools

  • Soldering iron with solder
  • Laser cutter
  • Scizors

Cut Parts

Welcome to the captivating realm of precision cutting with the laser! In this step, we'll witness the laser cutter's magic as it carves intricate designs onto 3mm MDF. Watch in awe as your digital creations become tangible masterpieces, each stroke of the laser bringing unrivaled accuracy to your vision. Let's embark on this cutting adventure and bring our designs to life, embracing the artistry of technology and craftsmanship

Downloads

Code

Welcome to the enchanting world of Arduino code! In this section, we'll explore how lines of programming language transform light into a captivating game controller. Witness the digital wizardry of Arduino as we decode the language of light to control the virtual realm. From beginners to enthusiasts, follow our step-by-step explanations to wield this coding magic and bring your controller to life.

void setup() {
 // Initialize the serial communication with a baud rate of 9600
 Serial.begin(9600);
}

void loop() {
 // Read analog values from four different analog pins (A2, A3, A4, A5)
 int analogValue1 = analogRead(A2);
 int analogValue2 = analogRead(A3);
 int analogValue3 = analogRead(A4);
 int analogValue4 = analogRead(A5);

 // Check the value read from analogValue1 and determine the light condition
 if (analogValue1 < 200) {
  Serial.println("Dark1"); // If the analog value is less than 200, print "Dark1" to the serial monitor
 } else if (analogValue1 < 800) {
  Serial.println("light1"); // If the analog value is between 200 and 799, print "light1" to the serial monitor
 }

 // Check the value read from analogValue2 and determine the light condition
 if (analogValue2 < 200) {
  Serial.println("Dark2"); // If the analog value is less than 200, print "Dark2" to the serial monitor
 } else if (analogValue2 < 800) {
  Serial.println("light2"); // If the analog value is between 200 and 799, print "light2" to the serial monitor
 }

 // Check the value read from analogValue3 and determine the light condition
 if (analogValue3 < 200) {
  Serial.println("Dark3"); // If the analog value is less than 200, print "Dark3" to the serial monitor
 } else if (analogValue3 < 800) {
  Serial.println("light3"); // If the analog value is between 200 and 799, print "light3" to the serial monitor
 }

 // Check the value read from analogValue4 and determine the light condition
 if (analogValue4 < 200) {
  Serial.println("Dark4"); // If the analog value is less than 200, print "Dark4" to the serial monitor
 } else if (analogValue4 < 800) {
  Serial.println("light4"); // If the analog value is between 200 and 799, print "light4" to the serial monitor
 }
}

Downloads

Circuit

sensor.png
PXL_20230504_112434946.jpg
PXL_20230504_112441870.jpg
  1. Straighten and insert the 4 LDR sensors into a breadboard or prototyping board.
  2. Connect a 10kΩ resistor to the positive rail and attach the other end to the longer lead of each LDR sensor.
  3. Solder the connections securely and trim excess leads.
  4. Connect the shorter lead of each LDR sensor to individual analog input pins (A0 to A3) on the Arduino.
  5. Connect Arduino's ground (GND) pin to the negative rail and 5V pin to the positive rail on the breadboard.
  6. Optionally, insulate the connections with heat shrink tubing or electrical tape.
  7. Test the LDR sensors using a simple Arduino sketch and observe readings on the Serial Monitor.

Congratulations! You've successfully connected and soldered 4 LDR sensors to your Arduino, paving the way for captivating light-controlled projects. Enjoy your Arduino adventure!

Contruction

PXL_20230508_094716958.jpg
PXL_20230508_222215065.jpg
PXL_20230508_124734978.jpg
PXL_20230508_222150072.jpg
PXL_20230508_125032609.jpg
PXL_20230508_125210675.jpg
PXL_20230508_134101533.jpg
PXL_20230508_135904394.jpg
PXL_20230508_124711163.jpg

Prepare the Base and Top Hexagons:

  • Tape five hexagons together to form the bottom half of the Decahedron.
  • Tape one hexagon to the top to complete the structure.

Create the Half Decahedron:

  • Fold the assembled pieces upward to form the half Decahedron shape.
  • Reinforce the sides with additional tape to ensure stability.

Attach the Top Half:

  • Place the top half of the Decahedron on the lower half.
  • Tape one side of the top half to the corresponding side of the lower half, allowing the Decahedron to open and close.

Assemble the Pipes, Pole, and Base:

  • Glue together the previously cut pieces for the pipes, pole, and base.
  • Paint each pipe a different color for visual distinction.

Position Sensors and Arduino:

  • Place the Arduino at the bottom of the Decahedron with the cable passing through the bottom hole.
  • Insert a sensor through each remaining large hole of the Decahedron.

Secure Sensors and Pipes:

  • Apply foam around each sensor to provide protection and cushioning.
  • Attach the sensors at the ends of the pipes to ensure accurate light detection.

Apply Printed Paper Skin:

  • Cut out printed paper in the desired patterns.
  • Use glue to apply the paper as the skin over various parts of the Decahedron.

Feed Cable through Pole and Base:

  • Thread the cable through the pole.
  • Insert the pole into the base of the Decahedron.

Feed Cable through Base Exit Hole:

  • Pass the cable through the exit hole of the base.

Congratulations! You've successfully assembled your light-controlled Decahedron game controller. Enjoy the immersive gaming experience and explore the magical interaction between light and virtual worlds. Happy gaming!

Unity Project

here i have a unity project i made and used to test the controller!!

https://drive.google.com/file/d/12mcRtHbqjS-6BiJLulBGnT8mIiAiMs-D/view?usp=sharing