Weird Display Chars

Hi Guys

so this is my 3rd post, im still learning so sorry for asking some dumb questions,

ok so i have some basic code to turn a relay on and off, which will then send a message to a lcd (16x2)
which all works fine,

how ever when i stick a dc motor to the relay the lcd displays some odd stuff ive attached a copy of the image

/*
 * Mathew Buer - 18/05/2015 @ 12:00

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 */
int btnStart = 30;
int btnStop = 31;
int debounceDelay = 50;    // the debounce time; increase if the output flickers
int motorStart = 13;
int buttonState = 0;
// this constant won't change:

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 

void setup() {
  // set btnStart as input
  pinMode(btnStart, INPUT_PULLUP);
  // set btnStop as input
  pinMode(btnStop, INPUT_PULLUP);
  pinMode(motorStart, OUTPUT);
  // set up the LCD's number of columns and rows:
  // tell the lcd where were startubg
  lcd.begin(16, 2); 
  // set the line of the lcd we wish to print to
  lcd.setCursor(0,0); 
  // message were going to print.
  lcd.print("  Welcome To"); 
  // set the lcd to line 2
  lcd.setCursor(0,1); 
  // set the message
  lcd.print("Mathews Program"); 
  // delay for showing the message
  //delay(2000);
 // lcd.clear();
  // initialize the button pin as a input:
  // initialize serial communication:
  Serial.begin(9600);


}


void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(btnStop);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == LOW) {     
    // turn LED on:    
lcd.clear(); // clear lcd 
 lcd.print("STOP BUTTON"); // print stop button
  delay(100); // add a small delay to prevent lcd flickr
  digitalWrite(motorStart, HIGH); // turn power on to motor

  }

  // read the state of the pushbutton value:
  buttonState = digitalRead(btnStart);


  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == LOW) {     
    // turn LED on:    
lcd.clear(); // clear lcd
 lcd.print("START BUTTON"); // print start to lcd
 delay(100); // add a small delay to prevent lcd flickr
 digitalWrite(motorStart, LOW); // turn motor power off

  }
}

as you can see from the code its very basic stuff.

You may be getting interference from the motor. Move the wiring as far as possible from the Arduino and decouple the wires.

Weedpharma

Can you present a drawing of how everything is connected? Also, does the motor have an own power supply or a shared one from the arduino and LCD?

well ive tried a few things tbh

currently

i have the dc motor connected to a relay which is connected to the mega 2560

i have a 6v 1.2ah battery which im using to power the relay/motor

im assuming its to do with the motor as when i disconned the motor it all works fine with no interferance. but the second its connected it gives me issues.

We need a circuit diagram as has been requested previously.

Weedpharma

i would know where to start when drawing a diagram

so ive taken some pics of what ive done and ill try to explane them

ok so ive got my LCD wired up as follows

 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

ive got 2 buttons, (START & STOP) which goto pins 30 / 31
ive got a 2 relay module but only 1 relay is in use and wired but this is wired to pin 13

from the relay ive got a + going to the relay
a + wire from the relay to the DC Motor
a wire from the DC Motor to the - on the battery.

i then use a switch to pull high pin 13 which would then make a full loop.