Go Down

Topic: Arduino w/ Ethernet & Sparkfun LED matrix? (Read 1 time) previous topic - next topic

YeahNo

Hi there.

I have an Arduino Uno and an Ethernet shield, along with some working code that gets the weather from a web API.  It's all working just fine, but now I'd like to display the output, ideally to an 8 x 8 Sparkfun LED matrix (or even two units, daisy-chained).

I'm no expert, but it seems like I have to have the SPI pins MISO and MOSI available in order to pipe data to the matrix backpack. Both of these are already in use by the Ethernet shield, which I believe means that they can't be available for the Matrix.

Questions:

1. Are my assumptions about the pin-outs correct?

2. Is there a way to assign the remaining pin outs in order to make the LED matrix work?

3. Is there another way I haven't considered to get the matrix working with the Ethernet shield in place?

Cheers,

PaulS

The MISO and MISO pins are used to output data. Where that data does is defined by which chip is selected to receive the data. The Ethernet shield uses one CS pin. You can connect the LED matrix (or matrices) to a different CS pin.

Set the Ethernet CS pin HIGH to talk to the ethernet shield, and LOW to talk to something else. Set the matrix CS pin HIGH to talk to the matrix, and LOW to talk to something else.

YeahNo

So the MISO and MOSI pins can be shared between the devices?

Can you give me a pointer on how to reassign the CS pin?  Would this be done at code level, or do I need to use something like NewSoftSerial or another library?

PaulS

#3
Jan 09, 2011, 06:41 pm Last Edit: Jan 09, 2011, 06:42 pm by PaulS Reason: 1
The LED matrix should have an input/output pin labeled CS (or chip select or something similar). Connect that line to any unused digital pin. Select the LED matrix as the output device by writing it's CS pin HIGH.

Post a link to the LED matrix if you have trouble determining the chip select pin.

YeahNo

I'm planning to use the SparkFun 8 x 8 matrix.

http://www.sparkfun.com/products/760

The wiring diagram for the serial backpack is here:

http://wiring.org.co/learning/basics/rbgbackpack.html

+5 and Gnd are easy.  MISO isn't used, apparently, just MOSI, CS & SCK.  So MOSI and SCK goes to the Ethernet shield's MOSI and SCK.  Then CS gets assigned to a different digital pin?

PaulS

Quote
So MOSI and SCK goes to the Ethernet shield's MOSI and SCK.

They go to the Arduino's MOSI and SCK pins, which are used by the ethernet shield, too.

Quote
Then CS gets assigned to a different digital pin?

I believe that the ethernet shield uses pin 10 as the CS pin. The SD card on the ethernet shield, if you have that feature, uses pin 4 as the CS pin. So, the LED matrix connects to any other digital pin, which become it's CS pin.

YeahNo

So all I have to do is reassign the CS pin for the Matrix?  Great!  Now...how do I go about doing that?  In the sketch? Or does it need to be done at the library level?

PaulS

Quote
Or does it need to be done at the library level?

What library are you talking about?

YeahNo

NewSoftSerial.  Do I need to use it to move the CS pin to an unused pin? Or do I simply declare the CS pin I want to use inside the sketch code?

PaulS

NewSoftSerial does not know anything about the chip select pin. It assumes that the TX and RX pins it talks to are always connected to the device it is talking to.

You attach the CS pin of the LED matrix to an otherwise unused pin, set the pin HIGH to talk to the device, and LOW to talk to some other SPI device.

You need to declare the CS pin in your sketch, AND set it.

YeahNo

Got it.  Thanks, Paul.  When the hardware arrives, I'll bash my head on this problem a little.

Cheers.

Go Up