Pages: [1]   Go Down
Author Topic: lcd created random caracters  (Read 804 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,
we have a problem with the LCD screen. after the program runs, in a random time the comunication between the screen and the arduino is lost. the program in the arduino is running corectly but the screen is down.
as you can see in the photo, arduino takes power from usb form a mobilepfone charger. for the motors we have a 29A switching power supply and the max current of the robot is 2A.
can you help us?
this is the robot arm working.


* robot.jpg (60.05 KB, 440x448 - viewed 19 times.)

* random_text.jpg (90.85 KB, 800x450 - viewed 17 times.)

* normal_txt.jpg (134.57 KB, 800x450 - viewed 18 times.)
Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

Queens, New York
Online Online
Faraday Member
**
Karma: 83
Posts: 3395
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where is your code? Post it in FULL
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Edmonton, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your wire up is too messy, you need to move communication cables far from things that can cause any interference, such as motors.
« Last Edit: April 01, 2013, 12:13:04 pm by gnusci » Logged

--

gnusci

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

for the LCD driver i use the code from the example. we dont use any spesial funcions or any interupts.
Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4245
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
for the LCD driver i use the code from the example. we dont use any spesial funcions or any interupts.

"Where is your code? Post it in FULL"

Which part of this are you having trouble understanding?


Don
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

here is the code: in 2 messages.

Quote
#include <Servo.h>
 #include <LiquidCrystal.h>
 #include <Button.h>
 
Servo myservo0;  // create servo object to control a servo
 Servo myservo1;
 Servo myservo2;
  Servo myservo3;
  Servo myservo4;
   Servo myservo5;
  
  int eftase =0;
int x=0;
int oldx=0;

int servonum=0;


LiquidCrystal lcd(13, 12, 8, 7, 4, 2);

Button BPano = Button(A4,PULLUP);
Button BKato = Button(A5,PULLUP);
Button BSin = Button(A3,PULLUP);
Button BMion = Button(A1,PULLUP);
Button BEnter = Button(A2,PULLUP);
Button BPlay = Button(A0,PULLUP);
Button Fast = Button(1,PULLUP);

char* Menou[6]={"0 peristrofi basis ",
                "1 1 joint          ",
                "2 2 joint          ",
                "3 karpos           ",
                "4 peristrofi karpou ",
                "5 dagkana          "};
                
int Oria[2][6]={{85,21,21,21,0,40},
                {95,156,156,156,179,179}}; 
 
 int RenewScreen=1;
 int programma[21][6]={
{87,90,90,90,90,178},
{91,90,130,90,90,90},
{91,90,130,50,0,90},
{91,90,130,50,0,179},
{91,156,130,50,150,179},
{91,130,156,21,150,179},
{91,130,156,21,150,40},
{92,120,60,150,90,40},
{92,120,60,21,150,40},
{90,156,156,21,150,40},
{90,156,156,21,150,150},
{91,156,156,21,150,150},
{91,156,90,100,90,150},
{91,21,156,100,179,150},
{91,21,156,50,179,40},
{91,90,100,50,90,40},
{92,156,156,50,179,40},
{92,156,156,159,179,40},
{92,156,21,159,90,179},
{92,156,90,90,90,179},
{90,90,90,90,90,90},

 };
 
  int SeiraProgrammatos=0;
 int aferesi[6]={0,0,0,0,0,0};
 int parousathesi[6]={0,0,0,0,0,0};
float imitono=0;

              
int MenouNum=0;

void setup() {
  
lcd.begin(20, 4);
                
Serial.begin(9600);
    myservo0.attach(3,800,2200);// basi
    myservo1.attach(5,700,2300);//j1 basis
    myservo2.attach(6,700,2300);//j2 askonas oxi
    myservo3.attach(9,700,2300);//j3 karpos
    myservo4.attach(10,850,2150);//j4 peristrofi
    myservo5.attach(11,850,2150);//gripper
}



void loop() {

Buttons();
ScreenView();

myservo0.write(programma[SeiraProgrammatos][0]); 
myservo1.write(programma[SeiraProgrammatos][1]);
myservo2.write(programma[SeiraProgrammatos][2]);
myservo3.write(programma[SeiraProgrammatos][3]);
myservo4.write(programma[SeiraProgrammatos][4]);
myservo5.write(programma[SeiraProgrammatos][5]);
 
}







* screen.ino (1.27 KB - downloaded 7 times.)
* motor_euresi_thesis.ino (2.22 KB - downloaded 6 times.)
* Buttons_testing.ino (6.65 KB - downloaded 6 times.)
Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

void Buttons(){

  if(BPano.uniquePress()) {
MenouNum++;
  if (MenouNum>5) MenouNum=0;
  RenewScreen=1;
  }
  else
  {


  }
              if(BKato.uniquePress()) {
            MenouNum--;
             if (MenouNum<0) MenouNum=5;
             RenewScreen=1;
             
            
              }
              else
              {
            
            
              }
                      if(BSin.uniquePress()) {
                        if (Fast.isPressed()){
                          programma[SeiraProgrammatos][MenouNum]=programma[SeiraProgrammatos][MenouNum]+10;
                        }
                        else
                        {
            programma[SeiraProgrammatos][MenouNum]++;
                        }
             programma[SeiraProgrammatos][MenouNum]=min(programma[SeiraProgrammatos][MenouNum], Oria[1][MenouNum]);
             RenewScreen=1;
                      }
                      else
                      {
                    
                      }
                                if(BMion.uniquePress()) {
                        if (Fast.isPressed()){
                          programma[SeiraProgrammatos][MenouNum]=programma[SeiraProgrammatos][MenouNum]-10;
                        }
                        else
                        {
            programma[SeiraProgrammatos][MenouNum]--;
                        }
              programma[SeiraProgrammatos][MenouNum]=max(programma[SeiraProgrammatos][MenouNum], Oria[0][MenouNum]);
              RenewScreen=1;
                                }
                                else
                                {
                              
                                } 
                                              if(BEnter.uniquePress()) {
                                            
                                                RenewScreen=1;
                                                
                                                SeiraProgrammatos++;
                 // gia na min peidaei                               
                                               if(SeiraProgrammatos!=0&&eftase==0){
                                                 
                                               for (int y=0;y<6;y++){
                                                 
                                                 programma[SeiraProgrammatos][y]= programma[(SeiraProgrammatos-1)][y];
                                               }}
                                                if (SeiraProgrammatos>20){
                                                  SeiraProgrammatos=0;
                                                eftase =1;
                                              }}
                                           
                                                        if(BPlay.uniquePress()) {
                                                      
                                                          RenewScreen=1;
                                                          Serial.println("syntetagmenes:");
                                                          
                                                      for (int y=0;y<20;y++){
                                                          for (int x=0;x<5;x++){
                                                            Serial.print(programma[y]
  • );
Serial.print(" ");
                                                          
                                                          }
                                                          Serial.println(programma[y][5]);
                                                          
                                                      }
                                                      Serial.println("");
                                                       Serial.println("");
                                                       
    
for (int gramikodika=0;gramikodika<20;gramikodika++){  // gia na trezoyn oles oi grammes
  
                        for(int moter=0;moter<6;moter++){//gia na treksei 6 fores dld apo 0 eos 5
                          aferesi[moter] = programma[gramikodika+1][moter]-programma[gramikodika][moter];
                            parousathesi[moter]=programma[gramikodika][moter];
                            }
                    
     for (int xxx=0;xxx<180;xxx++){
      imitono=0.500*sin((xxx*71/4068.000)+4.6778)+0.500;     
                            for(int parousa=0;parousa<6;parousa++){//gia na treksei 6 fores dld apo 0 eos 5
                                            parousathesi[parousa]=imitono*aferesi[parousa]+programma[gramikodika][parousa];
                                              }
                                              
myservo0.write(parousathesi[0]); 
myservo1.write(parousathesi[1]);
myservo2.write(parousathesi[2]);
myservo3.write(parousathesi[3]);
myservo4.write(parousathesi[4]);
myservo5.write(parousathesi[5]);   
delay(1);
                                              
                                              
          
                    
     }              
  delay(200); 
}
   }
                                                    
}



Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

void ScreenView(){
 if (RenewScreen==1){
   
 RenewScreen=0;
 
 
    lcd.setCursor(0, 3);
//lcd.print(MenouNum);
lcd.print("   ");
   lcd.setCursor(0, 3);
//lcd.print(MenouNum);
lcd.print(Menou[MenouNum]);


    lcd.setCursor(0, 0);
//lcd.print(MenouNum);
lcd.print("   ");
lcd.setCursor(0, 0);
delay(1);
lcd.print(Oria[0][MenouNum]);



     lcd.setCursor(17, 0);
//lcd.print(MenouNum);
lcd.print("   ");
     lcd.setCursor(17, 0);
delay(1);
lcd.print(Oria[1][MenouNum]);



      lcd.setCursor(8, 0);
//lcd.print(MenouNum);
lcd.print("   ");
delay(1);
     lcd.setCursor(8, 0);
lcd.print(programma[SeiraProgrammatos][MenouNum]);
 
      lcd.setCursor(12, 2);
//lcd.print(MenouNum);
lcd.print("seira:");
delay(1);
     lcd.setCursor(18, 2);
lcd.print(SeiraProgrammatos);

      lcd.setCursor(0, 1);
//lcd.print(MenouNum);
lcd.print("                    ");
delay(1);
     lcd.setCursor(0, 1);
lcd.print(programma[SeiraProgrammatos][0]);
     lcd.setCursor(3, 1);
lcd.print(programma[SeiraProgrammatos][1]);
     lcd.setCursor(7, 1);
lcd.print(programma[SeiraProgrammatos][2]);
     lcd.setCursor(10, 1);
lcd.print(programma[SeiraProgrammatos][3]);
     lcd.setCursor(14, 1);
lcd.print(programma[SeiraProgrammatos][4]);
     lcd.setCursor(17, 1);
lcd.print(programma[SeiraProgrammatos][5]);
 }
}

this is my full code. if this can help you.
Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

Queens, New York
Online Online
Faraday Member
**
Karma: 83
Posts: 3395
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Aside from your code not in the proper format or tags, this is not how you attach your servos.
Quote
Serial.begin(9600);
    myservo0.attach(3,800,2200);// basi
    myservo1.attach(5,700,2300);//j1 basis
    myservo2.attach(6,700,2300);//j2 askonas oxi
    myservo3.attach(9,700,2300);//j3 karpos
    myservo4.attach(10,850,2150);//j4 peristrofi
    myservo5.attach(11,850,2150);//gripper
}
What are all these extra numbers? Look at this example, http://arduino.cc/en/Tutorial/Sweep
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

all the servos dont have the same parameters.
please see: http://arduino.cc/en/Reference/ServoAttach
the meaning of this numders are the servo.attach(pin, min, max)
min (optional): the pulse width, in microseconds, corresponding to the minimum (0-degree) angle on the servo (defaults to 544)
max (optional): the pulse width, in microseconds, corresponding to the maximum (180-degree) angle on the servo (defaults to 2400)

i think that the format is making difficult to read it and doesnt have any effect to the performace. do you have some tips & tricks or general rules for the correct code format?
i am engineer mechanic so, the code is not my best.
Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

Queens, New York
Online Online
Faraday Member
**
Karma: 83
Posts: 3395
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, my mistake. Usually the min/max are not used, but ok. As for proper format, Ctrl + T in your arduino software will fix the format, or just go under Edit >> auto format.

Are you using an Arduino Mega or Uno? Judging by the size of your code, you may be running out of memory. If you are using a Uno, I suggest you upgrade to a Mega.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

we want maximum acurancy and efficience of the motors, so we are using all the opions we have. (acurancy in hobby servos... smiley-eek-blue)
Our code is:  10.318 bytes (at maximum  32.256 byte)
is any way to mesure the free memory? we use uno.
 
Logged

those who can,do.
those who can't, teach.
those who can't teach, admin.

Pages: [1]   Go Up
Jump to: