Newbie question

Hi peeps,
so, I am more or less brand new to the arduino world.
I am building an existing project for a buddy.
The display used is a .91" OLED on I2C.

He wants a bigger OLED screen. ( circa 256 x 64), but most are SPI.
There is only 1 I/O pin left.

Is there a simple way to slave an SPI display somehow. ( a 2nd arduino or something).

Your topic has been moved. Please do not post in "Uncategorized"; see the sticky topics in Uncategorized - Arduino Forum.


You will have to provide some more details. E.g. what all is connected and how. A wiring diagram could be useful.

If you don't have any other I2C devices, you will have two pins extra and you can possibly free the SPI bus.
If you have multiple SPI devices there is no problem because you can use the free pin that you have as a chip select.

Which board are you using?

1 Like

Does the project use any other SPI devices? An SPI OLED could share MISO/MOSI/SCK with other SPI devices. Only one pin would need to be dedicated to the OLED (CS).

no, no other SPI devices

hi,
there is no wiring diagram available as such. project uses a custom pcb shield of some sort.
I am trying to figure it all out. it seems as though some of the digitally controlled outputs actually come from the analogue pins ( code configures up to pin 16, so guessing these are the pins labelled on the Uno board as A0-A5).
currently project has 4 x 18BS20 I2C sensors. this might increase. also analogue voltage & current sensors.
current screen is an I2C OLED 0.96". he wants a bigger screen but also likes the OLED type, which seem to mainly be SPI ( probably for good reason)

They are not i2c, they use the 1-wire interface.

Correct.

Yes, for screens with more pixels, i2c interface can be slow. SPI is much faster.

Is your sensor a DS18B20 temperature sensor? If so it needs only 1 wire to communicate with your MCU. Which Arduino are you using?

These displays are larger (2.4") and i2c. Does your friend want a larger display, or a larger display with more pixels?

ideally both larger and more pixels ( at least 256 x 64 i think. to display 6 lines of text)

I do have a 4 pin version of that 2.4" on order as it happens. just in case.

Thanks

Uno clone of some kind.

I have managed to figured out so far that the 4 x DS18B20's can all come in on 1 pin.
I have also figured out the 64 bit address for all 4 sensors.

yes,
you are correct, 1 wire not I2C.
My mistake. sorry about that.

8 lines of text can be displayed on a display with 64 pixels vertically. Probably 20 columns, if a 6x8 font is chosen.

I notice that some of these OLED have an address select pin, so it should be possible to have 2 displays on the i2c bus.

Not ideal for a 256x64 display!

If the Adafruit library has been used, Uno may not have enough RAM to support 256x64.

If the U8G2 library was used, Uno's RAM will be enough, but updates may be slow.

I am trying to keep text a reasonable physical size, so easy to read.
I did ponder using 2 displays, to separate the info displayed.
eg running info ( run time, Volts, amps) on 1 screen and 4 x temps on another.
Dual screen on I2C does not seem hugely difficult ( i hope). mainly seems to be physically addressable screens, via resistor on PCB and printscreen addressing in the code, if I understand it correctly

is dual screen on SPI much more complicated than dual I2C?
Would it require even more pins?

In your case, yes. You have told us the SPI pins are not available, I think?

If they are available, then approximately as complex as dual i2c displays, but will require 1 more pin because each display will need it's own CS pin.

U8G2?
is this just an alternative to the Adafruit library (presumably with less code).

I did wonder how close this Uno board is running to MAX resources. i have not figured thing out that deeply yet.

its a big learning curve, in at the deep end :rofl:

Yes, but it has several advantages. One is that it can be configured to use less RAM.

Uno has only 2KB RAM. If you exceed 80% usage, the
Uno becomes unstable.

With the Adafruit library, you are at 50% usage with one 128x64 display because it allocates 1024 bytes to hold the data. (It won't be reported like that by the IDE, but it is).

With the U8G2 library, it can use as little as 128 bytes, but the code may need to be restructured to allow this, because it updates the display in sections.

Another advantage of U8G2 is that it includes a text-only mode which uses far less RAM and is fast to update.

1 Like

good to know, thanks

To be honest, I am not entirely sure how many of the pins on Uno are configurable.
i was surprised to learn that the A0 to A5 can also be digital.

(my code only lists up to pin 16)

but I am guessing that makes 20 configurable pins (D0 to D13) and A0 to A5).
is this correct?

if it is, I prob have enough spare pins for SPI

what I can confirm from code is this...

pin 0 - A2D conv
pin 1 not used
pins 2 through 13 digital I/O all used.
pins 14 & 15 not used (as far as i can tell)
pin 16 used for digital I/O, n.o. switch

nothing listed in code beyond pin 16.

D0 and D1 are not configurable, they are used for uploading code and using serial monitor.