4D systems display adapter and an Arduino Ethernet shield

Hi,

I have these: - http://www.4dsystems.com.au/product/3/19/Arduino_Display_Modules_and_Shields/uLCD_32_PTU_AR/ - http://arduino.cc/en/Main/ArduinoEthernetShield

And I am starting to think that they are not compatible without some modifications. Does anyone here have any stories to share regarding using the two?

Best, Sammi

If you configured the display adapter shield correctly there should be no interferences between the two. How did you set the jumpers J1 to J4 on the shield? D4 is used by the Ethernet shield for the SD card CS signal. If you configured it as the display's reset, you might get problems.

Thanks.

The jumper is configured so that pin 4 is the reset because I want to be able reset it - just in case.

D4 is used by the Ethernet shield for the SD card CS signal

I have no SD card in the Ethernet shield. Would there still be a conflict??

If I don't do any "write" to the display then the Ethernet shield works fine and sends messages normally. But if I communicate with the screen via genieWriteObject then Ethernet stops working normally. I get a garbled message every three seconds or so - as if the controller is having problems.

Show the code you're using.

Hi,

Here is the code. But to just to clarify the problem by explaining it from the other way around. The screens works perfectly until I start the ethernet. So if I don’t call Ethernet.begin(mac); then the screen works.

#include <genieArduino.h>

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

const int analogInPin = 5;
int sensorValue = 0;
int digits[5] = {0};

// Network
byte mac = { 0x90, 0xA2, 0xDA, 0x0F, 0x17, 0xD1 };
IPAddress ipLocal(10, 1, 1, 150); // Only used if we fix the IP. Can also use DHCP
int portLocal = 4333;

IPAddress ipRemote(10, 1, 1, 119);
int portRemote = 13000;

EthernetUDP Udp;

void setup()
{
genieBegin (GENIE_SERIAL, 9600);

pinMode(4, OUTPUT);
digitalWrite(4, 1);
delay(100);
digitalWrite(4, 0);

// Start the ethernet using DHCP
configureEthernet(true);

delay (3500); //let the display start up

}

void loop() {

sensorValue = analogRead(analogInPin) * 10;
int splitSource = sensorValue;

// First split the incoming long into five separate digits
digits[0] = int ( splitSource / 10000 );
splitSource = splitSource % 10000;
digits[1] = int ( splitSource / 1000 );
splitSource = splitSource % 1000;
digits[2] = int ( splitSource / 100 );
splitSource = splitSource % 100;
digits[3] = int ( splitSource / 10 );
splitSource = splitSource % 10;
digits[4] = splitSource % 10;

genieWriteObject(GENIE_OBJ_VIDEO, 0x00, digits[4]);
genieWriteObject(GENIE_OBJ_VIDEO, 0x01, sensorValue >= 10 ? digits[3] : 10);
genieWriteObject(GENIE_OBJ_VIDEO, 0x02, sensorValue >= 100 ? digits[2] : 10);
genieWriteObject(GENIE_OBJ_VIDEO, 0x03, sensorValue >= 1000 ? digits[1] : 10);
genieWriteObject(GENIE_OBJ_VIDEO, 0x04, sensorValue >= 10000 ? digits[0] : 10);

delay(10);

// This is just here to check if ethernet works with ethernet shield and LCD shield
Udp.beginPacket(ipRemote, portRemote);
Udp.write(sensorValue);
Udp.endPacket();
}

void configureEthernet(boolean useDHCP)
{
if (useDHCP)
{
Ethernet.begin(mac);
}
else
{
Ethernet.begin(mac, ipLocal);
}
Udp.begin(portLocal);
}

Can you describe your problems in more detail? You get scrambled UDP packets while the screen shows garbage? Can you take a photo of that garbage and post the content of the UDP packet you get?

In your code I cannot find a reason for your problems. Can you make a picture of your setup to check the wiring? What kind of Arduino are you using?

I cant see any problems either with what you have posted, other than the display reset pin.
If you remove the reset code for the display, does it start to work?

If it does, then you could remove the J1 jumper and run a jumper wire from the centre pin of J1, to one of your GPIO which is not used by anything else, and change your reset code to suit. Or move the J1 jumper to the PR side, and then run a jumper wire from the RES pin of the “4D PROG CABLE/ADAPTOR” H2 Header, if you aren’t using that, to a free GPIO, and change the reset code to suit. Both have the same effect, just which way is more suitable for you is for you to determine.

It could also be power related. How are you powering the system? When you start up the Ethernet Shield it may start drawing more power, I am not sure. I don’t have one. You might need to change J2 to the PR side, and use your 4D Programming Cable/Adaptor on the “4D PROG CABLE/ADAPTOR” H2 Header, so the display is powered off a separate USB. Assuming you are USB powering this whole thing, rather than off the barrel jack of the Arduino.

Hope that helps

Thank you both for your help. It is really appreciated. I think I have narrowed the problem at least a bit so it could be easier to solve. I can reproduce the issue with this simple sketch. In this case I am not really doing much. Just starting the Ethernet and then try to reset the screen. No special communication with the screen or the network. So we don’t have to think udp packages or serial messages.

For some reason the screen doesn’t even reset if I first start the ethernet. It does restart if I comment out that Ethernet.begin line. So there is something that makes the ethernet shield conflict with the screen once I enable ethernet.

My setup is:

  • Arduino UNO R3
  • Ethernet Shield R3
  • 4D Arduino Adaptor Shield V2

It is powered with a regulated 9v 1900mA adapter

I did follow WanaGo’s advice and moved J1 to the PR side and run a jumper wire from H2 RES to free pin on the UNO. I also removed all other wiring from the setup to rule out anything else. You can see my wiring and jumper settings on the image.

#include <genieArduino.h>

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x17, 0xD1 };

void setup()
{
  genieBegin (GENIE_SERIAL, 9600);

  // Start the ethernet
  Ethernet.begin(mac);

  // Give some breathing space just in case it helps
  delay (3000);

  // Reset the screen
  pinMode(8, OUTPUT);
  digitalWrite(8, 0);
  delay(100);
  digitalWrite(8, 1);

}

void loop() {

}

How are you getting power for the display? If you are using the Arduino 5v bus, it may not be able to provide enough current for the display and the w5100. Try powering the display adapter with an external 5v supply. If you try that, insure you have a good ground connection between the Arduino and the display.

edit: The display adapter has a jumper that allows you to use an external power supply according to its datasheet.
http://www.4dsystems.com.au/downloads/Arduino/AR-Packs/AdaptorShield/4D-Arduino-Adaptor-REV2.xx-Datasheet-REV1.1.pdf

Hi,

I will look into that. My power adapter is 1900mA so I thought that would be enough. I don't know the first thing about electronics so I may be completely wrong assuming it would be enough.

Sammi

It is not a matter of your power supply to the Arduino. It is the Arduino's onboard voltage regulator that may have problems providing the regulated 5 volt power.

ok thank you for that hint. I will look into this right know. Currently digging for information on how to actually power the display with external power.

I have moved J2 to the PR side as I am supposed to when using external power. Now I just have to use my limited electronics skills to figure out how to power the screen safely :)

Sammi

Connect your external 5 volt regulated supply to the H2 connector 5v and GND pins.

Will do. Thanks :slight_smile:

As a side note. With the current setup I tried to measure the volts going to the screen. As you see on the picture it looks like it is 4.94. Should that be ok?

Sammi

A DMM may not catch the voltage sags associated with initializing these devices. The w5100 is a bit of a power hog on its own. Adding that display may be too much. I would try it with an external power supply.

Ok. I wish I knew a bit more about electronics.

Anyway, I did try to connect an external 5v to the 5v on the H2 on the adapter. The screen turned on successfully - but behaves the same.

I am starting to think that I have faulty parts?? But still - they work just fine on their own.

Sammi

Hi and thank you all for helping me out here. Problem seems to have been solved.

I was noticing that even if I did not have the Ethernet shield connected the screen was updating a bit slowly. So I decided to load the Visi Genie project up again and change the baud rate to 115200 and change it as well in the Arduino sketch. Everything updated really fast so then I connected the Ethernet shield again and - voila!!

It works perfectly!

So after all this mess - upping the baud rate solved the problem.

Best, Sammi

Glad you got it working.

Comes down to your code then and how often you are updating the screen it seems. If you run at a slow baud rate, then the arduino may be doing too much work to try and process the Ethernet side of things and update the display, as updating the display takes so long at 9600 baud.

If you want to post your code then we may be able to help figure out why that is.

Hi,

Yes so it seems. The code is the same as I pasted earlier - just with a higher baud rate.

But thank you for help again.

Sammi

Right, so you are doing genieWriteObjects every single loop. Kinda a bit excessive really. Chuck it in a delayed if statement like you find in the 'blink without delay' example that comes with the Arduino, and only send to the display every 50ms or 100ms or something, and you might find you can run at a lower baud rate.

Really don't see the point in trying to update the display every loop, you wont get any benefit but have issues such as you are seeing now no doubt.

Updating the data 10 times a second should be plenty, even that may be excessive.