I would like to be able to use an Arduino as a timer control to switch on/off a 120VAC load. I think I can do that with the Arduino triggering a small relay controlling the 120V contacts. But I need a display to show the timer duration value and a potentiometer or encoder (knob) to control the duration. Time values will be short, .1 second to 20 seconds, but will need to be easily changed with the pot or encoder and shown on the display. Ideally, the display would show the duration and count down to zero when triggered by a separate electrically dry contact closing. A few LEDs to show power on, relay energized, and one to signify the duration is able to be changed with the knob (a "set mode" indicator).

I can see how to set a timer duration in the code, but I need to be able to press a button or something and manually turn a knob to set a different duration for the timer without having to write/change the code every time I want to change the duration.

Any help pointing a newbie in the right direction where to look?

Thanks, dhg2

closed as too broad by VE7JRO, sempaiscuba, per1234, MatsK, gre_gor Feb 7 at 0:03

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I would definitely recommend using a rotary encoder to change and start the timer. If you use a potentiometer, then it would be physically set at some point, while a rotary encoder can spin continuously, allowing for the reset of the timer after each trigger event making time selection easy. For timer display, you could use two 7-segment displays together, or even easier, a I2C lcd screen. Adafruit has a lot of cool LED matrixes. Why don't you find what you'd like to use, and add an edit to your question so that we can help you with specific coding later. – HavocRC Jan 29 at 18:31

If you are determined to use a pot you could create a voltage divider circuit with a linear pot and a couple of resistors, and feed the result to an analog input pin on the Arduino.

I agree with Havoc that a rotary encoder or buttons would be a good way to go, and I2C LCD displays are cheap and easy to interface.

I am working on a power controller myself, and am using up/down buttons and an LCD display, plus software, to let the user select times in increments that increase as the user holds the button. (e.g. holding down the "increase time" button might step up the "on time" by 1 minute at a time for 5 minutes, then increase to stepping by 5 minute increments, then 15, then 30, then an hour at a time.)


With a pot, you can have an analog reading of 0 to 1023. Divide that by 50 for 20 ranges. Then

 delayTime = (analogRead(Ax)/50);  

Not the answer you're looking for? Browse other questions tagged or ask your own question.