Problem with circuit for LCD shield and MDD10A?

Hello, I'm completely new to this so please be patient.

I was following along on this video for using an LCD shield with a PWM motor controller:

I created the following circuit:

This is the code I am using:

  PWM Motor Test
  Uses LCD Keypad module
  Modified from Cytron example code
  DroneBot Workshop 2019
// Include libraries for LCD Display
#include <LiquidCrystal.h>
#include <LCD_Key.h>
// Define keycodes
#define None     0
#define Select   1
#define Left     2
#define Up       3
#define Down     4
#define Right    5
// Pin for analog keypad
#define diy_pwm A0
// PWM output pin
#define pwm 3
// Motor direction pin
#define dir 2
// Define LCD display connections
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// Setup LCD Keypad object
LCD_Key keypad;
// Variable to represent PWM value
int pwm_value = 0;
// Variable to represent Keypad value
int localKey;
void setup(){
  // Setup LCD  
  lcd.begin(16, 2);
  // Define Pins
void loop()
   // Scan keypad to determine which button was pressed
   localKey = keypad.getKey();
   // Toggle motor direction if LEFT button pressed
   // Increase motor speed if UP button pressed
   // Decrease motor speed if DOWN button pressed
   else if(localKey==Down){
   // Ensure PWM value ranges from 0 to 255
     pwm_value= 255;
   else if(pwm_value<0)
     pwm_value= 0;
   // Send PWM to output pin
   // Display results on LCD

Electronics are:

  • Arduino UNO
  • DFROBOT LCD Shield 1.1
  • Cytron MDD10A

It seems that I can't get to work no matter what I do. :frowning: Whenever I push the buttons on the LCD shield, nothing happens. What am I doing wrong? Does anyone have any ideas?

What did you do?

Did you try the example that comes with the library?

And why on earth are you doing this?

Do you understand what loop() does?

1 Like

I just used the code from the video I posted above.

I'm new to all this so I don't know what it does.

I rely on follow along tutorials

Time to google and learn.

It is rightly said that you cannot (afford to) believe what you read on the Internet. :roll_eyes:

I was just hoping that maybe someone saw an obvious error in code or the circuit, that maybe they could help me.

Obviously people shouldn't believe everything that's on the internet. I'm not too sure how your comment helps though. Are you just trying to be rude to me for no reason?

Do you see anything on the LCD? If so, do the PWM and DIR values change when you press the buttons?

What type motor are you using?

What are you using to power the MDD10A?

Are you just trying to be rude to me for no reason?

Just pulling your leg. :grin:

OK, it seems you did get that spurious code from the video, not the reference in #3. Suffice to say that is speaks poorly of the competence of the presenter in the video. :worried:

I have never done anything like this before, as I'm beyond new. So it's hard for me to vet content on the internet.

I might as well just say what I'm trying to do. I need to gradually increase the speed of the 775 DC motor I'm using, and I wanted to utilize the keypad to do that. :slight_smile:

The goal is to find the correct speeds I need for different applications, and then create a program that initiates those exact speeds.

The first step in my mind was doing the initial step of testing speeds using the keypad, but I don't really know how to do that other than what I saw on that video.

No, the LCD lights up and displays the words "PWM", "DIR", but when I push the buttons to increase the speed of the motor, nothing displays on the LCD and the DC motor doesn't initiate.

I'm using a 775 DC motor that I got off Amazon:

I'm powering the MDD10A using a DeWalt 20v battery.

Have you tried to example code that came with the libary as I pointed out in reply #3? It will report when a button is pressed. You could also put a Serial.print() statement in multiple places to report the button press as well.

If you are seeing the words "PWM" and "DIR" on the display you surely are seeing values right after them as well?

It could likely be that your power supply is not sufficient to power your motor

I'm going to use the sample code this afternoon when I have some time to troubleshoot.

That's what's odd, there are just the words "PWM" and "DIR", but no values after those words appear when a button is pressed.

There is a test button on the MDD10A, and when I push it the DC motor starts, so I know the battery can power the DC motor.

It's as though there is a disconnect between the LCD shield and the MDD10A, which is either due to code or the circuit itself. I'll try the test code after though! :slight_smile:

So you claim is that the above code produces only "PWM" and "DIR" on the lcd? No colons, no values? That is hard to believe

Well jeepers man I don't have a reason to lie.

If you'd like I can make a video of my setup and maybe that might help in figuring out what's going on?

I am not saying you are lying. I find it hard to figure out how


can only produce "PWM" Are you sure the code above is what is running on your board?

Clearly, a picture is worth 1000 words. Your video shows the contents of the screen as "PWM:0" and "DIR:0" which is NOT the same as your previous description.

Also, it appears that you do not have the battery negative connected to the arduino ground, All of your grounds need to be tied together so there is a common reference for "0V".

You can also put in some Serial.print() statements to announce your key presses on the Serial Monitor to help debugging