Week 9 Creative Switch – Khalifa Alshamsi

Concept:

In an endeavor to merge the timeless charm of LEGO with the dynamic glow of LED lighting, I took on a project that tested my creativity and also my persistence. The challenge was clear: integrate an LED system within a LEGO car in a functional and aesthetically pleasing manner. After numerous attempts and exploring various configurations, I found the perfect harmony by positioning the LED as the car’s internal dome light. This strategic placement allowed me to achieve an interactive feature where the light automatically turns on as the door closes and dims when the door is left open.

Code:

int ledPin = 9;           // LED connected to digital pin 9
int doorSensorPin = 2;    // Sensor (wires touching) connected to pin 2
int doorState = 0;        // Variable for reading the sensor status

void setup() {
  pinMode(ledPin, OUTPUT);      // Sets the digital pin as output
  pinMode(doorSensorPin, INPUT); // Sets the digital pin as input
  digitalWrite(doorSensorPin, LOW); // Enables pull-down resistor
}

void loop(){
  doorState = digitalRead(doorSensorPin); // Reads the state of the sensor value
  if (doorState == HIGH) {
     digitalWrite(ledPin, LOW);   // Turns LED off when the door is closed (wires touching)
  } else {
     digitalWrite(ledPin, HIGH);  // Turns LED on when the door is open (wires not touching)
  }
}

Video of Project:

Reflection and ideas for future work or improvements:

As I look back on this complicated project for me, I recognize the journey was as enlightening as it was challenging. One significant area for improvement that stands out is the need for a more refined wiring management system. Despite the project’s success, the sight of exposed wires and adhesive tape detracts from the overall aesthetic appeal. In future iterations, prioritizing a sleeker integration of the electronics will hopefully enhance the design.

Furthermore, this project served as a profound learning curve. Despite consuming countless videos and undergoing a trial-and-error process that saw me revising the wiring and code more times than I can count, I confess there remains a haze around my understanding of the underlying electronics principles. This realization, far from discouraging me, has sparked a curiosity to delve deeper into the fundamentals of electronics and programming.

Looking Ahead:

This project has laid the groundwork for further exploration into the fusion of technology with traditional toys. Ideas for future projects include incorporating more interactive elements, such as sound effects synchronized with the door’s motion or ambient light sensors to activate the headlights in dim conditions, transforming the LEGO car into an even more immersive and interactive experience, maybe even fully coding a 3D printed one to drive using the Arduino but again I still don’t know the full stretch of an Arduino board.

In essence, this journey has not only expanded my technical skills but also opened up a scenery of possibilities for exploring.

Leave a Reply