Senior Project Guidance- Delaying LED from turning on for 10 seconds

Hi everybody!

My senior design team are building a device that uses UV light for sterilization. We are new to arduino and programming. We are wondering how do we program the arduino to delay an LED light from turning on for 10 seconds.

Our project: We are buliding an automatic sterilization device that will go above door knobs. It will sense motion from the human interacting with the door knob, wait 10 seconds, and then light the LED light onto the door knob. We are using LEDs instead of real UVs for prototyping.

What code would be best to use to make this possible? We are using an Arduino Uno and a HC-SR501 PIR motion detector. Thanks!

You need to use the millis() function like the BlinkWithoutDelay example. When you PIR fires, record the current millis() time. When the time has advanced 10,000 milliseconds from that time, do your cleansing. You use the same technique (millis() elapsed time) to time your cleansing.

You should also become aware of Finite State Machine style programming as this will make your task easier. This article Finite State Machine Programming Basics – Part 1 – Arduino++ will give you start but there is lots on the web about this.

Do you know how to detect the hand. Please post the code that you have already

If what you describe really is all you need to do then keep it simple

Pseudo code

start of loop()
  if hand detected
    turn on UV
  end if
end of loop()

Your "specification" does not mention how long the UV should be on or what causes it to turn off

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.