Together with the DMD

128x128 pixel 1.5" full colour OLED display with MicroSD card slot. [Product page]
Post Reply
charlest
Posts: 75
Joined: Sat Jul 27, 2013 6:08 pm

Together with the DMD

Post by charlest » Tue Aug 27, 2013 8:58 pm

Hi, I was wondering whether it would be possible for the Eleven R3 board to use this OLED display together with the DMD?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Together with the DMD

Post by angusgr » Wed Aug 28, 2013 1:13 am

Hi Charles,

The answer is "yes but not simply". The OLED128 and the DMD can share the SPI bus, but they both prefer different SPI clock frequencies. OLED128 runs at 8MHz and the DMD runs at 125kHz.

You can simply run the OLED128 at 125kHz, you'll just have very very slow screen updates. Alternatively you may be able to run the DMD slightly faster than 125kHz, but it's unsupported and you may find you get some pixel corruption.

The command you'd need to mess around with is:
http://arduino.cc/en/Reference/SPISetClockDivider

The OLED setup calls

Code: Select all

SPI.setClockDivider(SPI_CLOCK_DIV2);
For an 8MHz clock

And the DMD setup calls

Code: Select all

SPI.setClockDivider(SPI_CLOCK_DIV128);
For a 125kHz clock.

Probably the best way around this will be to run the SPI clock at 8MHz normally, but switch it down to 125kHz whenever you update the DMD display, ie:

Code: Select all

SPI.setClockDivider(SPI_CLOCK_DIV128);
dmd.scanDisplayBySPI();
SPI.setClockDivider(SPI_CLOCK_DIV2);
... which is a bit hacky but will probably give you the best of both worlds. This is a bit more hairy if you're using timer interrupts or similar, but it's straightforward otherwise.

The only other thing to remember is to wire up the OLED128 so its three configurable digital pins (CS, DNC & RST) don't clash with any digital pins used by the DMD. The SPI pins can be shared between the two.

Finally if you decide the overhead is too much you could always get a second microcontroller board to drive the OLED, and have them communicate with each other via i2c or something!

- Angus

charlest
Posts: 75
Joined: Sat Jul 27, 2013 6:08 pm

Re: Together with the DMD

Post by charlest » Wed Aug 28, 2013 7:56 am

angusgr wrote: Finally if you decide the overhead is too much you could always get a second microcontroller board to drive the OLED, and have them communicate with each other via i2c or something!
Hi Angus, thanks for your reply & suggestion. I like your ideas of having a second MCU. Would the new board "Goldilocks" be able to drive the OLED display & DMD together, it seems to have 2 separate MCUs on the board.

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Together with the DMD

Post by angusgr » Thu Aug 29, 2013 12:04 am

Yes, the Goldilocks would be capable of doing this. It'd be a fairly advanced application, though, probably one that might require writing AVR code directly rather than via the Arduino IDE.

For now I'd suggest going with the single MCU you have, perhaps look at something small like a LeoStick for a second device if you find resources are stretched too thin.

charlest
Posts: 75
Joined: Sat Jul 27, 2013 6:08 pm

Re: Together with the DMD

Post by charlest » Thu Aug 29, 2013 7:54 pm

angusgr wrote:For now I'd suggest going with the single MCU you have, perhaps look at something small like a LeoStick for a second device if you find resources are stretched too thin.
Great, I'll give it a go with my LeoStick & R3 board. Would you be able to suggest readings on i2c for the two Arduino to talk to each other.

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Together with the DMD

Post by angusgr » Fri Aug 30, 2013 12:44 am

Nothing specific, but a quick google turned up this:
http://all-about-embedded.blogspot.com. ... g-i2c.html

I'd really recommend using the single MCU first, though, and only make it more complex with two if you discover that you need to.

Keen to hear how you get on in either case.

- Angus

charlest
Posts: 75
Joined: Sat Jul 27, 2013 6:08 pm

Re: Together with the DMD

Post by charlest » Fri Aug 30, 2013 9:54 am

I'll keep you posted. Thanks for your help.

Post Reply