0
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« on: January 09, 2011, 12:23:47 am » |
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,
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35538
Seattle, WA USA
|
 |
« Reply #1 on: January 09, 2011, 10:05:27 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #2 on: January 09, 2011, 12:33:05 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35538
Seattle, WA USA
|
 |
« Reply #3 on: January 09, 2011, 12:41:51 pm » |
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.
|
|
|
|
« Last Edit: January 09, 2011, 12:42:44 pm by PaulS »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #4 on: January 09, 2011, 12:51:40 pm » |
I'm planning to use the SparkFun 8 x 8 matrix. http://www.sparkfun.com/products/760The 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?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35538
Seattle, WA USA
|
 |
« Reply #5 on: January 09, 2011, 07:24:40 pm » |
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. 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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #6 on: January 09, 2011, 11:43:46 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35538
Seattle, WA USA
|
 |
« Reply #7 on: January 10, 2011, 07:32:04 pm » |
Or does it need to be done at the library level? What library are you talking about?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #8 on: January 10, 2011, 07:33:39 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 316
Posts: 35538
Seattle, WA USA
|
 |
« Reply #9 on: January 12, 2011, 05:46:54 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #10 on: January 12, 2011, 09:14:07 pm » |
Got it. Thanks, Paul. When the hardware arrives, I'll bash my head on this problem a little.
Cheers.
|
|
|
|
|
Logged
|
|
|
|
|
|