How to make a circuit for a motor, screen, and push button?

Hello! I'm working on a project where I want an LCD screen to display a series of messages at the same time as a vibration motor turns on and off all controlled by a single push button. I'm not really sure where to start with this as my knowledge on Arduino is very limited - was just looking for some advice on what steps the code should have or if anyone has done anything similar?

Here's a more in depth description of what I'm trying to do:

What I’ve got:

  • Arduino Uno board
  • LCD display screen (No backlight)
  • 1 Push button
  • Motor

What I want to happen:

  • Push and hold the button down for 2 seconds and the screen power turns on
  • Screen displays welcome message ‘hello’
  • Wait 2 seconds and screen displays start calibration message ‘press on again to calibrate’
  • Push button again and motor starts with increasing intensity*
    • At the same time screen displays message ‘press button again to select intensity’
  • Press button again once and motor stops
  • Press and hold button for 2 seconds and screen power turns off

Thanks very much appreciate any help :slight_smile:

  • LCD display screen (No backlight)

Which LCD screen? There are many types and sizes with different controllers and interface methods.

Motor

What motor? Voltage rating? Stall current? Do you have a suitable driver and motor power supply? The Arduino pins cannot provide enough current to directly drive a motor nor can the Arduino supply power motors except the very small ones.

Add a motor driver board or a MOSFET logic transistor to the list.

  • Push button again and motor starts with increasing intensity*
    • At the same time screen displays message ‘press button again to select intensity’
  • Press button again once and motor stops

You need to be able to wind the motor up and watch the button at the same time to do this.

It can be done using millis() which returns an unsigned long. Always use unsigned integers with time calculations.

elapsed time = end time - start time. // is true as long as elapsed time is < max value of the unsigned variable used
// rollover is not an issue when it's done this way

if ( millis() - start >= interval ) // wait timer, do the thing after time is up

...

if ( millis() - start < interval ) // do timer, do the thing until time is up

...

if ( interval > 0 ) // 1-shot runs when some other code sets interval > 0 and start = millis()
{
if ( millis() - start >= interval )
{
// wait until do the thing
interval = 0;
}
}

Make sure to debounce the button, there's many many ways.