Motor control Issue


I recently tried to design a circuit that would meet the following criteria:

I wish to select control a 240V motors run time and have a 20 second delay on motor start.

The motor is to be housed in a PELI case and fitted with a panel top that will house LCD display, keypad and push button.

I want an operator via the following steps to be able to set motor to run for chosen time in minutes.

Operator will turn power on.
Display will ask for run time (minutes)
Operator will set run time via keypad (with ability to cancel if wrong numbers entered etc)
Display will confirm run time and ask operator to press start
Operator will push start button
20 second delay with start
After 20 seconds motor will run for chosen time and then stop.

System will be ready to use again

I am using an UNOR3 board but not having any luck with the code I have written.

Products being used:

Including solderless prototype boards and dupont wires.

I have attached code, not sure if issue lies with code or wiring.


Some more details of "not having any luck" would be good. What exactly does it do? Which part doesn't work?

A schematic showing how everything is connected and powered would also help because I have no way to tell if there's anything wrong with the wiring either.

BTW your links would be a lot more helpful if you made them clickable and said what they were links to. Also the code should posted in line. Information on how to do these things is in "General guidance and how to use this forum" at the top of every forum.

The only thing that looks immediately odd in the code is your 'while (digitalRead(START) == LOW) do nothing'. When you're using INPUT_PULLUP the value LOW means the button is pressed.


  while (digitalRead(START) == LOW) {}

Your pin is set INPUT_PULLUP so it will read HIGH unless connected to Ground. Usually you would have a Normally Open button between the pin and Ground and the pin would read HIGH when the button is NOT pressed. If your sketch is not waiting for the START button, this could be why and you should change LOW to HIGH.

Operator will push start button
20 second delay with start
After 20 seconds motor will run for chosen time and then stop.

  lcd.print("Getting Ready...");

If you want to delay for 20 seconds you should probably do that instead of delaying for 15 seconds.

  digitalWrite(MOTOR, HIGH);
  unsigned long DelayTime = MINUTES * 60000;
  digitalWrite(MOTOR, LOW);

Is your output device a relay module? They are typically Active Low and will turn the relay ON when the output is LOW and OFF when the output is HIGH. WARNING: You don't use digitalWrite() to set the MOTOR pin state in setup(). You should do that BEFORE setting the pin as an OUTPUT.