Problem with Uno + Ehternet Shield + LCD

Hello,

I've been trying to get this to work for the last 4 days, trying numerous pin combinations, also tried using the analogue outputs as digital outputs, but nothing seems to work.. My LCD display works perfectly alone on the Arduino Uno, the Ethernet Shield works perfect on the Arduino, but as soon as a hook up the LCD to the Ethernet shield, as soon as data is received by the ethernet shield, the lcd stops responding. I'm quite sure it is a pin conflict, but as far as the documentation is concerned, only pins 13,12,11 & 10 are used by the ethernet shield. Surely i've been avoiding those :slight_smile:

does anyone have a working solution in which an arduino uno with ethernet shield and LCD is working correct? (pin numbers please :slight_smile: )

Thanks in advance!

Matthijs

Surely i've been avoiding those

Yeah, that's obvious. Not.

as soon as data is received by the ethernet shield, the lcd stops responding. I'm quite sure it is a pin conflict

If it was a pin conflict, either the LCD would never work, or the ethernet shield would never work. There are no pins that get activated when data arrives on the ethernet shield. They are active all the time.

Perhaps you should post some code.

The funny thing is after i posted my post on the forum, i tried one last pin config (a quite obvious one) and now it seems te be working :slight_smile:

Just for the sake of science, here's some code:

#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,105,177 };
byte gateway[] = { 192,168,105,254 };
byte subnet[] = { 255, 255, 255, 0 };
byte server[] = { 212,79,251,20 }; 
int port = 80;
boolean busy = false;
String output;
Client client(server, port);
int RS = 7;
int E = 6;
int D4 = 5;
int D5 = 4;
int D6 = 3;
int D7 = 2;

LiquidCrystal lcd(RS, E, D4, D5, D6, D7 ); 

void setup() 
{
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("INIT");
  Ethernet.begin(mac, ip, gateway, subnet);
  delay(1000);
}

void loop()
{
  //Check the ethernet shield for data..
  checkEthernet();
  //Fetch time every 2 seconds..
  if (!busy && millis() % 2000 == 0)
  {
    fetchTime();
  }
}

void checkEthernet()
{
  if (client.available()) 
  {
    char c = client.read();
    output += c;
  }

  if (!client.connected() && busy) 
  {
    client.stop();
    lcd.setCursor(0, 1);
    lcd.print("disconnected     ");
    int start = output.indexOf("{") + 1;
    String t = output.substring(start, start + 8);
    lcd.setCursor(0, 0);
    lcd.print(t);
    output = "";
    busy = false;
  }
}

void fetchTime() 
{
  busy = true;
  lcd.setCursor(0, 1);
  lcd.print("connecting       ");
  if (client.connect()) 
  {
    lcd.setCursor(0, 1);
    lcd.print("connected        ");
    client.println("GET /tijd.php HTTP/1.0");
    client.println();
  } 
  else 
  {
    lcd.setCursor(0, 1);
    lcd.print("failed          ");
    busy = false;
  }
}

I'm quite sure i tried pin 7 - 2 already :-/

Any ideas what could have gone wrong before?

I do see a lot of garbage on the LCD during flashing of the code to the Arduino.. Which pins are causing that?

cheers!

Matthijs

I do see a lot of garbage on the LCD during flashing of the code to the Arduino.. Which pins are causing that?

With this pin set?

Garbage on the LCD usually means that you are using pin 0 or 1 as one of the data pins, but that's not the case with this pin set.