Infineon Team
Published © MIT

Overengineering your workshop lighting

I used a 60GHz radar for motion detection to illuminate my workshop while keeping the sensor hidden

BeginnerFull instructions provided2 hours411
Overengineering your workshop lighting

Things used in this project

Hardware components

BGT60LTR11AIP Autonomous shield
Infineon BGT60LTR11AIP Autonomous shield
×1
XMC2GO - industrial microcontroller kit
Infineon XMC2GO - industrial microcontroller kit
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

BGT60 lighting

Arduino
Switch a light on and off with a dimmer
const int motion_state = 9;     // the number of the motion pin
const int ledPin =  8;      // the number of the LED pin
bool motion = 0;         // variable for reading the pushbutton status
int brightness = 0;

void setup() {
  pinMode(ledPin, OUTPUT);      // initialize the LED pin as an output
  pinMode(motion_state, INPUT); // initialize the motion pin as an input
}

void loop() {
  motion = digitalRead(motion_state);             //read the state of motion 
  if (motion == HIGH) {                           //no motion detected
    brightness = constrain(brightness - 1,0,255);   //reduce brightness
  } else {                                        //motion detected
    brightness = constrain(brightness + 2,0,255);   //increase brightness
  }
  analogWrite(ledPin, brightness);
}

Credits

Infineon Team
106 projects • 171 followers
Contact

Comments

Please log in or sign up to comment.