OLED 1306 with CircuitPlayground and CircuitPython

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dogolearn
 
Posts: 25
Joined: Mon Sep 19, 2022 7:14 pm

OLED 1306 with CircuitPlayground and CircuitPython

Post by dogolearn »

Hi-

I've seen a picture of the OLED attached to the CircuitPlayground. I'm struggling to get it working. Right now mu tells me, it can't find the Displayio library which should be part of the embedded libs in the install. I can't find that library separately. While looking around for clues, the OLED 1306 says it should work with a long list of boards including "CircuitPlayground with displayio". What the heck does that mean? I went to the CircuitPython/CPX download page and sure enough - displayio is not listed in the list of built-in modules.

So, where can I find the Displayio library?
And how was the setup in the attached picture created?
https://www.adafruit.com/product/938

Dave
Attachments
Screenshot CPX plus OLED.png
Screenshot CPX plus OLED.png (144.79 KiB) Viewed 182 times

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dastels »

Displayio is written in C and is part of the CircuitPython runtime (for the boards/builds that support it); there is no separate library/module.

Use the "CircuitPlayground with displayio" build of CircuitPython: https://circuitpython.org/board/circuit ... displayio/. See https://learn.adafruit.com/welcome-to-c ... cuitpython if you need instructions on installing CircuitPython.

Dave

User avatar
dogolearn
 
Posts: 25
Joined: Mon Sep 19, 2022 7:14 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dogolearn »

OK, I've downloaded and installed the new circuit python with displayio. Now I don't hit errors about that library
However, I've only written just a few chars to the display - a mimic of the serial REPL screen
I get memory errors when I try to show a bitmap. They happen when I define the pallet. Also get them when I start working with text. Is the font a memory hog? is there a built in font that won't cost me memory?

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dastels »

You don't have much RAM on the CircuitPlayground Express, so I'm not surprised that bitmaps are problematic. Fonts are basically bitmaps that you use a bit of at a time. I believe there's the terminalio font. Have a look at https://learn.adafruit.com/adafruit-tft ... quickstart.

Dave

User avatar
dogolearn
 
Posts: 25
Joined: Mon Sep 19, 2022 7:14 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dogolearn »

Question for Adafruit: How Can you run that animation on that OLED? Perhaps without Cicuit Python? Circuit Python has some overhead, right?

User avatar
dogolearn
 
Posts: 25
Joined: Mon Sep 19, 2022 7:14 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dogolearn »

Last gasp for this combination of OLED+CircuitPlayground+CircuitPython:
Is there a way to display simple text with very little memory?
Like a built-in font? I did see just a little simple text, but I haven’t been able to reproduce it so far

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dastels »

Yes, CircuitPython has quite a bit of overhead that really shows up on a limited RAM chip like the SAMD21 on the CPX. To do something more interesting on that OLED (or any display) you can use a board with more memory (e.g. something based on the SAMD51, nRF52840, RP2040, or ESP32-S2/S3. The other option is to work in C++ instead of CircuitPython. In which case you'd use the GFX library: https://learn.adafruit.com/adafruit-gfx ... cs-library.

Yes,m there's the terminalio font that I already mentioned. It's nothing special, but it is builtin.

Dave

User avatar
dogolearn
 
Posts: 25
Joined: Mon Sep 19, 2022 7:14 pm

Re: OLED 1306 with CircuitPlayground and CircuitPython

Post by dogolearn »

Just for closure, I did get an OLED to work and display 2 lines of text. All the while I was very nearly out of memory: as in, displaying a string with too many characters would give an error. I removed characters one at a time until it started working again. The universe was being very clear: use another board!

I did get it working with the MCP9808 temp sensor alone, but when I added the OLED back in, it ran into memory errors immediately.

So, when your project needs external peripherals (displays, radios, GPS....), set your CPX aside and use another board like a feather. I'm now on a Feather (Feather M4 Express with samd51j19) and the project is back on track!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”