Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Uno/Mega+Shields/Sensors and port redirection Help on: December 26, 2012, 06:26:04 am
Hi I'm running a personal project involving uno/mega+touch screen + gps + led strip + voltage reading
i started with

http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411001.html
http://imall.iteadstudio.com/development-platform/arduino/shields/im120417008.html
http://imall.iteadstudio.com/display/tft-lcm/im120419009.html

working fine till i realized the lack of ports to use for my sensors
so i moved to

http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411002.html
http://imall.iteadstudio.com/development-platform/arduino/shields/im120417024.html
http://imall.iteadstudio.com/display/tft-lcm/im120419009.html

The touch didnt work with my shield so i managed to make it run with this mod

http://zallison.com/2012/05/05/electronics-henning-karlsen/
http://www.mathias-wilhelm.de/arduino/shields/itead-2-4-tft-lcd-touch/
modifying the utft library
and using the uno itdb02 shield on my mega

also my gps seemed to work only on 50-51 port of mega comparing to any port of uno
led strip so far is playing nice in my code snippets

the code atm is being assembled but my main problem is that when running the
modded library "to my belief" all other ports misbehave. so I'm trying
for some pointers on how to make maga+shield work without mods
(if cant get something soon might go to a mega+uno talking setup)

my code is about 500 lines atm and growing as i have still to integrate
some snippets and optimize the loop to behave more nicely

so any help acceptable on those points

1.mega + shield + screen working without mod (screen and touch and Sd if possible)
2.any port redirection guidelines etc so i could make a port-to-port redirection
 
2  Using Arduino / Displays / Re: ITDB02 TFT LCD module is not sensing touch on: December 26, 2012, 05:59:17 am
currently im having a about same setup on a personal project

i started with
http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411001.html
http://imall.iteadstudio.com/development-platform/arduino/shields/im120417008.html
http://imall.iteadstudio.com/display/tft-lcm/im120419009.html

The touch/screen worked fine and had run an SD read/test seeing the sd card fine
i was using something like

UTFT myGLCD(ITDB28,19,18,17,16); //UTFT(Model, RS, WR, CS, RST);
ITDB02_Touch myTouch(15,10,14,9,8); // ITDB02_Touch(TCLK, TCS, TDIN, TDOUT, IRQ);

then  moved due to lack of pins to further evolve my project to
http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411002.html
http://imall.iteadstudio.com/development-platform/arduino/shields/im120417024.html
http://imall.iteadstudio.com/display/tft-lcm/im120419009.html

Touch didnt work either for me in this setup.
only after a PORT redirection hack i managed to get touch+screen working but
this might have had an impact to my other pins (still investigating that)
the port involved putting the ITBD02 uno sheild on the mega
as my mega shield is either broken or im missing something to get it work
as supposed to be.

http://zallison.com/2012/05/05/electronics-henning-karlsen/
http://www.mathias-wilhelm.de/arduino/shields/itead-2-4-tft-lcd-touch/

in this setup i initialized with
//UTFT myGLCD(ILI9325D_8,A5,A4,A3,A2);        //Screen initialization
//UTouch    myTouch(A1,8,A0,9,10);         //Touch initialization

due to the hack library.

Touch and screen work flawlessly  but having trouble putting
all my extra to continue (LDP8806 and skm53 gps)


3  Using Arduino / Displays / Re: 2.8 tft ILI9325 touch menu's? on: December 08, 2012, 03:50:11 am
Hi. I used the new UTouch library from http://www.henningkarlsen.com/electronics/library.php?id=55
Probably your module is supported and the i started modifying the UTouch_Button_test for testing

Currently im building a Touch menu interface so its not complete so far. Here is my code to get
an idea. 4 Button menu to get to sub menus and a Back button to return to main menu
so far only the 2 first buttons "do" something and only the "first" has some meaningful code behind
(later to read an input from live system)

Hope it will help u.

=========================================================================================================
#include <UTFT.h>
#include <UTouch.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
extern uint8_t SevenSeg_XXXL_Num[];
extern unsigned int v[0x400];            //Image loaded as a sourche file (later to move to SD)

int x, y,g,menu;

UTFT myGLCD(ILI9325D_8,A5,A4,A3,A2);        //Screen initialization
UTouch    myTouch(A1,8,A0,9,10);         //Touch initialization

void setup()
{
  myGLCD.InitLCD(LANDSCAPE);                   // Initialize the display
  myGLCD.clrScr();                             // Clear the screen (black)
  myTouch.InitTouch(LANDSCAPE);
  myTouch.setPrecision(PREC_MEDIUM);
  myGLCD.setFont(BigFont);
  myGLCD.fillScr(255,255,255);               // Clear the screen (White)
  myGLCD.drawBitmap(40, 0, 80, 80, v,3);       // Draw a pixel bitmap
  delay(3000);                                 //Delay to draw the image
  myGLCD.clrScr();                            // Clear the screen (black)
  Menu1();
  menu=1;
}

//Buttons coordinates
//Menu 1
//Button Gpro
int x11=20; int y11=20; int x12=150; int y12=100;
//Button Leds
int x21=180; int y21=20; int x22=300; int y22=100;
//Button Volto
int x31=20; int y31=120; int x32=150; int y32=200;
//Button Spare
int x41=180; int y41=120; int x42=300; int y42=200;
//Button G
int x51=10; int y51=10; int x52=160; int y52=220;
//Button Back
int x61=200; int y61=130; int x62=300; int y62=220;
//Front led
int x71=20; int y71=40; int x72=170; int y72=100;
//Back led
int x81=20; int y81=130; int x82=170; int y82=190;

void Menu1()    // MAIN MENU
{
  myGLCD.clrScr(); // Clear the screen (black)
  myGLCD.setFont(BigFont);
  myGLCD.setColor(0, 0, 255);
  myGLCD.setBackColor(0, 0, 255);
  //BUTTON Gpro
  button (x11,y11,x12,y12);  myGLCD.print("Gpro",35,50);
  //BUTTON Leds
  button (x21,y21,x22,y22);  myGLCD.print("Leds",210,50);   
  //BUTTON Volto
  button (x31,y31,x32,y32);  myGLCD.print("Volto",35,150);     
  //BUTTON Spare
  button (x41,y41,x42,y42);  myGLCD.print("Spare",210,150);
  menu =1; 
}

void Menu2()    //GPRO MENU
{
   myGLCD.clrScr(); // Clear the screen (black)
  //BUTTON Gpro
  button (x51,y51,x52,y52);
  //BUTTON Back
  myGLCD.setBackColor(0, 0, 255);
  button (x61,y61,x62,y62);   myGLCD.setFont(BigFont);  myGLCD.print("Back",230,200);   
  menu =2;
}

void Menu3()    //GPRO MENU
{
  myGLCD.clrScr(); // Clear the screen (black)
  //Front led
  button (x71,y71,x72,y72);
  myGLCD.setFont(BigFont);    myGLCD.print("Front Led",30,70);
  //Back Led
  button (x81,y81,x82,y82);
  myGLCD.setBackColor(0, 0, 255);
  myGLCD.setFont(BigFont);    myGLCD.print("Back Led",30,160);   
  button (x61,y61,x62,y62);   myGLCD.setFont(BigFont);  myGLCD.print("Back",230,200);   
  menu =3;
}


void loop()
{
  while (true)
  {
    if (myTouch.dataAvailable())
    {
      myTouch.read();
      x=myTouch.getX();
      y=myTouch.getY();

      if (menu ==1) 
      {
        if ((y>=y11) && (y<=y12))  // Upper row
        {     
          if ((x>=x11) && (x<=x12))  // Button: Gpro
          {       
            waitForIt(x11,y11,x12,y12);
            menu =2;
            Menu2();
          }
          if ((x>=x21) && (x<=x22))  // Button: Leds
           {
             waitForIt(x21,y21,x22,y22);
            menu =3;
            Menu3();
           }
        }
        if ((y>=y31) && (y<=y32))  // Lower row
        {     
          if ((x>=x31) && (x<=x32))  // Button: Volto
            waitForIt(x31,y31,x32,y32);
          if ((x>=x41) && (x<=x42))  // Button: Spare
            waitForIt(x41,y41,x42,y42);
        }
      }

      if (menu==2)
      {
        int g=random(6);
        myGLCD.setFont(SevenSeg_XXXL_Num);
        myGLCD.printNumI(g,35,50);
        delay(1000);
        if ((y>=y61) && (y<=y62))  // Button: Back
        {     
          if ((x>=x61) && (x<=x62))  // Button: Back
          {     
            waitForIt(x61,y61,x62,y62);
            menu =1;
            Menu1();
          }

        }
      }
      if (menu==3)
      {
        if ((y>=y61) && (y<=y62))  // Button: Back
        {     
          if ((x>=x61) && (x<=x62))  // Button: Back
          {     
            waitForIt(x61,y61,x62,y62);
            menu =1;
            Menu1();
          }

        }
      }
   
    }
}
}


void button(int x1, int y1, int x2, int y2)
{
  myGLCD.setColor(0, 0, 255);
  myGLCD.fillRoundRect (x1,y1,x2,y2);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (x1,y1,x2,y2);
}

// Draw a red frame while a button is touched
void waitForIt(int x1, int y1, int x2, int y2)
{
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
  //while (myTouch.dataAvailable())
  //myTouch.read();
  delay(300);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
}

=========================================================================================================
4  Using Arduino / Displays / Re: Help needed for touch setup for 2.8 ILI9325C TFT display (MEGA 1280 U16) on: December 01, 2012, 04:39:12 pm
Finally i'm getting somewhere and it seems that its the end of my BIG problems

After a bit i came to realize that this 2.8 screen is a pain to work with
cause not much people got to work with it but managed to get started and probably finish my project.
First this screen is a 8bit bus and is missing the RTS pin so many can go wrong.
I could work with it with ITDB02 Mega shield (revision 2.1 on board) but touch
was out of the question while it was fully operational to Arduino with ITDB02 shield

1.I used this post http://zallison.com/2012/05/05/electronics-henning-karlsen/
   which converts the code to get an arduino ITDB02 shield to work on a MEGA.
   (there is a tiny error in the library that need correction at the end of HW_AVR.h
    _set_direction_registers(byte mode)  ==>   UTFT::_set_direction_registers(byte mode) )
   and initialized with UTFT myGLCD(ILI9325D_8,A5,A4,A3,A2);   
   THIS GOT ME TO A FULLY WORKABLE SCREEN
2.Since ITDB02_Touch lib from  http://www.henningkarlsen.com/electronics
   worked for me went to get a fresh copy and for my surprise the new UTouch
   library is out so i took advantage of it to test. All went well  and got it to work
   with UTouch    myTouch(A1,8,A0,9,10);


First test is with UTouch_Button_test


// UTouch_ButtonTest (C)2010-2012 Henning Karlsen
// web: http://www.henningkarlsen.com/electronics
//
// This program is a quick demo of how create and use buttons.
//
// This program requires the UTFT library.
//
// It is assumed that the display module is connected to an
// appropriate shield or that you know how to change the pin
// numbers in the setup.
//

#include <UTFT.h>
#include <UTouch.h>

// Declare which fonts we will be using
extern uint8_t BigFont[];

// Uncomment the next two lines for the Arduino 2009/UNO
//UTFT        myGLCD(ITDB24D,19,18,17,16);   // Remember to change the model parameter to suit your display module!
//UTouch      myTouch(15,10,14,9,8);

// Uncomment the next two lines for the Arduino Mega
UTFT myGLCD(ILI9325D_8,A5,A4,A3,A2);   // Remember to change the model parameter to suit your display module!
UTouch    myTouch(A1,8,A0,9,10);

int x, y;
char stCurrent[20]="";
int stCurrentLen=0;
char stLast[20]="";

/*************************
**   Custom functions   **
*************************/

void drawButtons()
{
// Draw the upper row of buttons
  for (x=0; x<5; x++)
  {
    myGLCD.setColor(0, 0, 255);
    myGLCD.fillRoundRect (10+(x*60), 10, 60+(x*60), 60);
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (10+(x*60), 10, 60+(x*60), 60);
    myGLCD.printNumI(x+1, 27+(x*60), 27);
  }
// Draw the center row of buttons
  for (x=0; x<5; x++)
  {
    myGLCD.setColor(0, 0, 255);
    myGLCD.fillRoundRect (10+(x*60), 70, 60+(x*60), 120);
    myGLCD.setColor(255, 255, 255);
    myGLCD.drawRoundRect (10+(x*60), 70, 60+(x*60), 120);
    if (x<4)
      myGLCD.printNumI(x+6, 27+(x*60), 87);
  }
  myGLCD.print("0", 267, 87);
// Draw the lower row of buttons
  myGLCD.setColor(0, 0, 255);
  myGLCD.fillRoundRect (10, 130, 150, 180);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (10, 130, 150, 180);
  myGLCD.print("Clear", 40, 147);
  myGLCD.setColor(0, 0, 255);
  myGLCD.fillRoundRect (160, 130, 300, 180);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (160, 130, 300, 180);
  myGLCD.print("Enter", 190, 147);
  myGLCD.setBackColor (0, 0, 0);
}

void updateStr(int val)
{
  if (stCurrentLen<20)
  {
    stCurrent[stCurrentLen]=val;
    stCurrent[stCurrentLen+1]='\0';
    stCurrentLen++;
    myGLCD.setColor(0, 255, 0);
    myGLCD.print(stCurrent, LEFT, 224);
  }
  else
  {
    myGLCD.setColor(255, 0, 0);
    myGLCD.print("BUFFER FULL!", CENTER, 192);
    delay(500);
    myGLCD.print("            ", CENTER, 192);
    delay(500);
    myGLCD.print("BUFFER FULL!", CENTER, 192);
    delay(500);
    myGLCD.print("            ", CENTER, 192);
    myGLCD.setColor(0, 255, 0);
  }
}

// Draw a red frame while a button is touched
void waitForIt(int x1, int y1, int x2, int y2)
{
  myGLCD.setColor(255, 0, 0);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
    //while (myTouch.dataAvailable())     //commended out cause it had me stuck
    //myTouch.read();                            //and put a delay to button press
    delay(300);
  myGLCD.setColor(255, 255, 255);
  myGLCD.drawRoundRect (x1, y1, x2, y2);
}

/*************************
**  Required functions  **
*************************/

void setup()
{
// Initial setup
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);

  myGLCD.setFont(BigFont);
  myGLCD.setBackColor(0, 0, 255);
  drawButtons(); 
}

void loop()
{
  while (true)
  {
    if (myTouch.dataAvailable())
    {
      myTouch.read();
      x=myTouch.getX();
      y=myTouch.getY();
     
      if ((y>=10) && (y<=60))  // Upper row
      {
        if ((x>=10) && (x<=60))  // Button: 1
        {
          waitForIt(10, 10, 60, 60);
          updateStr('1');
        }
        if ((x>=70) && (x<=120))  // Button: 2
        {
          waitForIt(70, 10, 120, 60);
          updateStr('2');
        }
        if ((x>=130) && (x<=180))  // Button: 3
        {
          waitForIt(130, 10, 180, 60);
          updateStr('3');
        }
        if ((x>=190) && (x<=240))  // Button: 4
        {
          waitForIt(190, 10, 240, 60);
          updateStr('4');
        }
        if ((x>=250) && (x<=300))  // Button: 5
        {
          waitForIt(250, 10, 300, 60);
          updateStr('5');
        }
      }

      if ((y>=70) && (y<=120))  // Center row
      {
        if ((x>=10) && (x<=60))  // Button: 6
        {
          waitForIt(10, 70, 60, 120);
          updateStr('6');
        }
        if ((x>=70) && (x<=120))  // Button: 7
        {
          waitForIt(70, 70, 120, 120);
          updateStr('7');
        }
        if ((x>=130) && (x<=180))  // Button: 8
        {
          waitForIt(130, 70, 180, 120);
          updateStr('8');
        }
        if ((x>=190) && (x<=240))  // Button: 9
        {
          waitForIt(190, 70, 240, 120);
          updateStr('9');
        }
        if ((x>=250) && (x<=300))  // Button: 0
        {
          waitForIt(250, 70, 300, 120);
          updateStr('0');
        }
      }

      if ((y>=130) && (y<=180))  // Upper row
      {
        if ((x>=10) && (x<=150))  // Button: Clear
        {
          waitForIt(10, 130, 150, 180);
          stCurrent[0]='\0';
          stCurrentLen=0;
          myGLCD.setColor(0, 0, 0);
          myGLCD.fillRect(0, 224, 319, 239);
        }
        if ((x>=160) && (x<=300))  // Button: Enter
        {
          waitForIt(160, 130, 300, 180);
          if (stCurrentLen>0)
          {
            for (x=0; x<stCurrentLen+1; x++)
            {
              stLast
  • =stCurrent
  • ;
            }
            stCurrent[0]='\0';
            stCurrentLen=0;
            myGLCD.setColor(0, 0, 0);
            myGLCD.fillRect(0, 208, 319, 239);
            myGLCD.setColor(0, 255, 0);
            myGLCD.print(stLast, LEFT, 208);
          }
          else
          {
            myGLCD.setColor(255, 0, 0);
            myGLCD.print("BUFFER EMPTY", CENTER, 192);
            delay(500);
            myGLCD.print("            ", CENTER, 192);
            delay(500);
            myGLCD.print("BUFFER EMPTY", CENTER, 192);
            delay(500);
            myGLCD.print("            ", CENTER, 192);
            myGLCD.setColor(0, 255, 0);
          }
        }
      }
    }
  }
}

the Utouch_Calibration not responds atm but i will try later
Will post more code samples as i go
5  Using Arduino / Displays / Re: Help needed for touch setup for 2.8 ILI9325C TFT display (MEGA 1280 U16) on: November 19, 2012, 11:38:23 am
thanks for the feedback.
i used the code from this thread   http://arduino.cc/forum/index.php?topic=119000.0
the library is this http://www.henningkarlsen.com/electronics/library.php?id=35 (as no other available i think but i'm open to try any other available)

the code above is working (switching the port mappings) to my first setup
myTouch.read(); i believe might be of little significance since its a loop
not get correct values first time, will get second

**Forgot to mention that on Mega 1280 "seems" that the first touch does something and then freeze.
while trying to write a troubleshooting code i think i get no data

put a      Serial.println(myTouch.getX(),myTouch.getY());        in my loop and get no data (#include <Serial.h> Serial.begin(9600)smiley-wink
6  Using Arduino / Displays / Help needed for touch setup for 2.8 ILI9325C TFT display (MEGA 1280 U16)(SOLVED) on: November 19, 2012, 10:19:09 am
hello everyone. i started a personal project to make a informational (at start) gadget for my moto
my initial setup included
1.Iteaduino UNO (http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120905006.html)
2.ITDB02 Arduino Shield (http://imall.iteadstudio.com/development-platform/arduino/shields/im120417008.html)
3.ITDB02-2.8 (http://imall.iteadstudio.com/display/tft-lcm/im120419009.html)

so far all went good. I started coding/testing subsystems so i could
1.fully manipulate the tft screen ===> UTFT myGLCD(ITDB28,19,18,17,16);  
2.use touch controls ==>  ITDB02_Touch myTouch(15,10,14,9,8);
3.read the SD card (over spi bus)



but then i saw that all my pins where in use from the tft screen and no space
for further development and sensors

so i decided to move to a bigger arduino
1.Arduino MEGA (ATMega 1280-16AU) (http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/im120411002.html)
2.ITDB02 Arduino MEGA Shield   (http://imall.iteadstudio.com/development-platform/arduino/shields/im120417024.html)
3.ITDB02-2.8 (http://imall.iteadstudio.com/display/tft-lcm/im120419009.html)

and started testing code again to control each subsystem
1.fully manipulate the tft screen ===> UTFT myGLCD(ITDB28,38,39,40,41);
2............ITDB02_Touch  myTouch(6,5,4,3,2);



However i cannot get anywhere as far touch is concerned.
The ITDB02-2.8 seems fully operational (on iteaduino uno is ok) but i cannot get it
so far to work touch.

I believe i have followed the correct pin outs and the libraries support the ILI9325C chipset . so far i tested the touch with the following code


=======================================================
#include <UTFT.h>
#include <ITDB02_Touch.h>

// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

//UTFT myGLCD(ITDB28,19,18,17,16);               //UTFT(Model, RS, WR, CS, RST);                                  iteaduino
UTFT myGLCD(ITDB28,38,39,40,41);                  //UTFT(Model, RS, WR, CS, RST);                                   mega1280
//ITDB02_Touch myTouch(15,10,14,9,8);           // ITDB02_Touch(TCLK, TCS, TDIN, TDOUT, IRQ);            iteaduino
ITDB02_Touch  myTouch(6,5,4,3,2);                  // ITDB02_Touch(TCLK, TCS, TDIN, TDOUT, IRQ);             mega1280

void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch(PORTRAIT);
  myTouch.setPrecision(PREC_MEDIUM);
  
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 319, 13);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.drawLine(0, 14, 319, 14);
  myGLCD.print("S.TISSEYRE - 2012", CENTER, 1);
  myGLCD.setBackColor(0, 0, 0);

  myGLCD.setColor(0, 255, 0);
  myGLCD.setFont(SevenSegNumFont);
}

void loop()
{
  while (myTouch.dataAvailable() == true)
    {
      int x,y;
      x = myTouch.getX();
      y = myTouch.getY();
      myGLCD.printNumI(x, CENTER, 50, 3, ':');
      myGLCD.printNumI(y, CENTER, 120, 3);
            myTouch.read();

    }
}
====================================================================================
   





Pages: [1]