0

Using a display with Circuit Playground Express
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Using a display with Circuit Playground Express

by dredwingz03 on Wed Oct 11, 2017 8:11 pm

Hello there.

I have searched some and cannot find anyone using a Circuit Playground Express to control a display.

I have looked at a 128x32 I2C OLED display
https://www.adafruit.com/product/931

and a standard 16x2 LCD display.
https://www.adafruit.com/product/181

The first one needs an I2C data and clock pin as well as one other input pin. It also needs 512 bytes of RAM. The second one needs 6 input pins and a 5V power source. The Circuit Playground Express has these capabilities it appears.

I have limited electronics knowledge, so I am looking for confirmation that the Circuit Playground Express can be used with these displays.

Thank you
Paul

dredwingz03
 
Posts: 2
Joined: Wed Oct 11, 2017 8:02 pm

Re: Using a display with Circuit Playground Express

by adafruit_support_mike on Wed Oct 11, 2017 11:28 pm

You can use I2C displays with the Circuit Playground Express, but so you know, most of our code development for that board is focused on CircuitPython right now.

Support for bootloader programming through the Arduino IDE is pretty bare-bones, and is lumped in with a project to refactor our microcontroller libraries to support lots of different microcontrollers. You can download the libraries and try to compile the code with the CPX as the build target to see if things work before buying the actual hardware.

adafruit_support_mike
 
Posts: 45817
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using a display with Circuit Playground Express

by dredwingz03 on Thu Oct 12, 2017 12:27 am

Thank you for your reply.

I have some experience with C. Is CircuitPython similar?

Is there a possibility the 16x2 display could work with the Circuit Playground Express also? It seems like it would be the easier of the two to set up.

I have downloaded the Adafruit GFX library as well as the Adafruit SSD1306 library. Where can I find the code to try and compile to try and provide an indicator if the OLED display may work before purchase?

Could you please point me to a more appropriate board if this doesn't work out? I think I need more I/O pins, unless there's a way to control 2 or more buttons from one IO pin. My goal is a user interface consisting of the display, 8-10 LEDs or NeoPixels, and 8-10 buttons for each LED/NeoPixel that would turn off its light when pressed. Two or three more buttons to use as user inputs for setting LED lights based on times of the day, so I would need a clock. I assume there's a clock that could keep accurate timing built into the Circuit Playground Express?

Thank you very much
Paul

Edit: After reading a little more, it appears there is a delay function in Arudino IDE that could act as a clock. I'm sure CircuitPython has the capability since it's more advance. Also, it appears I could use an input analog pin and use different resistors to control multiple buttons off the same pin. Thank you for any advice you can give.

Edit2: I found this.
https://www.adafruit.com/product/3295
It requires I2C, which would be occupied by the OLED display. Or could sometime like that still work?

dredwingz03
 
Posts: 2
Joined: Wed Oct 11, 2017 8:02 pm

Re: Using a display with Circuit Playground Express

by adafruit_support_mike on Thu Oct 12, 2017 11:01 pm

Python belongs to the C-style family of computer languages, in that it has variables, functions that take parameters and return values, etc. The biggest difference is that Python uses semantic whitespace instead of braces.

Instead of defining a function like this:

Code: Select all | TOGGLE FULL SIZE
int foo ( int parameter ) {
    //  function code goes here
}
Python does it like this:

Code: Select all | TOGGLE FULL SIZE
def foo( parameter ):
    this_is_function_code()

but_this_is_not()
It was originally developed as a teaching tool by a CompSci professor, sort of like Pascal back in the early 1980s, and has evolved in the "there is exactly one right way to do anything" direction. It's an interpreted language with conveniences like garbage collection and some type interpolation, so you don't have to deal with memory allocation the way you do in C.

dredwingz03 wrote:Edit2: I found this.
https://www.adafruit.com/product/3295
It requires I2C, which would be occupied by the OLED display. Or could sometime like that still work?

I2C is a shared-bus interface, so yes, you can connect multiple devices to the SDA and SCL lines.

Eash I2C device has a hardware address between 0x01 and 0x7f, and the bus controller starts each transmission by emitting the address of the device it wants to talk to. All other devices ignore what's happening on the bus until they see a transmission for their own address.

adafruit_support_mike
 
Posts: 45817
Joined: Thu Feb 11, 2010 2:51 pm

Re: Using a display with Circuit Playground Express

by eduncan911 on Sun Oct 22, 2017 1:00 pm

For the record, when I got our Circuit Playground Educator's kit, one of the first things we experimented with (after the initial remote LED blink test) was an I2C 1602 Serial LCD that I had laying around - and has worked with numerous RPi and Arduino devices in the past.

When I connected it to the Circuit Playground Express, I ran a sample Arduino sketch that would probe for the I2C address - and it saw and found the unit (can't remember what the address was). This only worked because I was able to change the pins that the I2C used for that probing library.

I then attempted to load like a dozen different Arduino Sketch libraries and examples, trying to talk to the I2C device. There are many LiquidCrystal_I2C C libraries under Arduino Sketch. And a whole lot of variations, making it quite difficult in pinpointing a library for your project and install custom ones that don't conflict.

None of them worked. I was however able to control the backlight on/off function, as part of these libraries. That's the odd part - backlight worked, but no display. I was able to detect the I2C address. But attempting to output any display would just remain blank regardless of the library.

The conclusion I came to is that the Circuit Playground Express has a different pinout than the standard ATSAMD21 ARM Cortex M0 arduino boards that these libraries normally support - and this includes different pins for the I2C bus. This is something that isn't clear in the libraries, examples and documentation for the Circuit Playground Express (or the Classic edition either). Inspecting their C code on Github for the Circuit Playground shows the assignment differences between Classic and Express editions.

But how was I able to control the backlight on/off if the I2C pins were different?

I tried to modify several LiquidCrystal I2C libraries; but, my C skills weren't good enough to tweak the pin assignments by cross referencing how the Circuit Playground library was set up. I think they all were using some lower-level I2C libraries that expected the I2C pins hardcoded at certain addresses. I never did figure out exactly what pins have changed - just that they are different.

I have ran into this three times now with the Circuit Playground Express and various projects we have been attempting. The biggest one being the FastLED library that does not work with the Express edition (it only works on the processor on the Classic edition). So we're going to pick up a couple of the Classic editions so we can finish some projects.


My advice would be to inspect the C dependencies of the Sketch libraries of the Adafruit Classic Playground library on github and figure out what pins the I2C are. Then hopefully you can translate that to some custom Python script. I have my doubts though as most python libraries just use compiled C code, and since I suspect the pins are at different addresses, perhaps none of the Arduino Python libs out there are going to work as they may just use some incarnation of the LiquidCrystal_I2C library.

May have better luck trying to figure out what libs the LiquidCrystal I2C Sketch libraries use and trying to modify them, and then pull them into your updated LiquidCrystal_I2C version. That was beyond the time I had allocated when teaching my daughter simple programming with the Playground.

eduncan911
 
Posts: 10
Joined: Tue Aug 08, 2017 10:37 am

Please be positive and constructive with your questions and comments.