Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

How do I use OLED with QT Py?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How do I use OLED with QT Py?

by CapArcona on Wed Mar 03, 2021 4:39 pm

I'm completely new to programming and hardware. I'm trying to make a tiny little counter that displays the count on the 0.91" 128x32 display. I have it counting in Mu but I can't seem to figure out how to get the OLED to work. What am I doing wrong?

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I use OLED with QT Py?

by dastels on Wed Mar 03, 2021 5:55 pm

How do you have the OLED wired to the QtPy. and can you post you code?

Dave

dastels
 
Posts: 6481
Joined: Tue Oct 20, 2015 3:22 pm

Re: How do I use OLED with QT Py?

by CapArcona on Wed Mar 03, 2021 8:06 pm

Code: Select all | TOGGLE FULL SIZE
import time
import board
import touchio
import digitalio

touch_pad0 = board.A0
touch_pad1 = board.A3
touch_pad2 = board.A7

touch0 = touchio.TouchIn(touch_pad0)
touch1 = touchio.TouchIn(touch_pad1)
touch2 = touchio.TouchIn(touch_pad2)
dVal=0
while True:
    if touch0.value:
        dVal=dVal+1
        print (dVal)
    if touch1.value:
        dVal=dVal-1
        print (dVal)
    if touch2.value:
        dVal=0
        print (0)
    time.sleep(0.3)


I know this is missing some stuff, I just can't seem to figure out what it is.

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I use OLED with QT Py?

by dastels on Wed Mar 03, 2021 9:37 pm

A good start would be all the code that sets up and outputs to the oled.

See https://learn.adafruit.com/monochrome-oled-breakouts/.

Dave

dastels
 
Posts: 6481
Joined: Tue Oct 20, 2015 3:22 pm

Re: How do I use OLED with QT Py?

by PippoAe on Tue Mar 09, 2021 6:58 am

Hi CapArcona
I am a total newb myself, but I am succesful with the same display using about these steps:

Code: Select all | TOGGLE FULL SIZE
#include <wire.h>
#include <U8g2lib.h>
//Create an instance of the U8g2 library.
U8G2_SSD1306_128X32_UNIVISION_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);

void setup()
{
 u8g2.begin();
}

void loop()
{
 //From here on you should easily be able to follow some u8g2 tutorials on how to draw and set some content on the oled.
}

You could also have a look at this example:
https://github.com/olikraus/u8g2/blob/m ... oWorld.ino

Hope this will get you somewhere.

PippoAe
 
Posts: 10
Joined: Sun Mar 07, 2021 4:10 am

Re: How do I use OLED with QT Py?

by CapArcona on Thu Mar 11, 2021 2:09 am

dastels wrote:A good start would be all the code that sets up and outputs to the oled.

See https://learn.adafruit.com/monochrome-oled-breakouts/.

Dave



I tried this, but I get an error that displayio is not found. I can't fit any of the display_text library on the qt py and I'm pretty sure I have all the other libraries I need onboard. I've tried running code that others got to work but it always gets stuck at displayio module not found. I am so confused!

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I use OLED with QT Py?

by CapArcona on Thu Mar 11, 2021 2:15 am

PippoAe wrote:Hi CapArcona
I am a total newb myself, but I am succesful with the same display using about these steps:

Code: Select all | TOGGLE FULL SIZE
#include <wire.h>
#include <U8g2lib.h>
//Create an instance of the U8g2 library.
U8G2_SSD1306_128X32_UNIVISION_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);

void setup()
{
 u8g2.begin();
}

void loop()
{
 //From here on you should easily be able to follow some u8g2 tutorials on how to draw and set some content on the oled.
}

You could also have a look at this example:
https://github.com/olikraus/u8g2/blob/m ... oWorld.ino

Hope this will get you somewhere.


I've been using CircuitPython on Mu editor, what are you writing in? I've never tried to learn to code before so this is all very befuddling. I thought it would be as simple as learning to code but there are libraries and hardwares and abbreviations... I am so utterly lost hahaha.

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I use OLED with QT Py?

by PippoAe on Thu Mar 11, 2021 4:22 am

CapArcona wrote:
PippoAe wrote:Hi CapArcona
I am a total newb myself, but I am succesful with the same display using about these steps:

I've been using CircuitPython on Mu editor, what are you writing in? I've never tried to learn to code before so this is all very befuddling. I thought it would be as simple as learning to code but there are libraries and hardwares and abbreviations... I am so utterly lost hahaha.


This not circuitpython, it's arduino c++.
I'm a total newb to hardware and c++ as well. Have not yet used circuit python yet, sorry :)

PippoAe
 
Posts: 10
Joined: Sun Mar 07, 2021 4:10 am

Re: How do I use OLED with QT Py?

by dastels on Thu Mar 11, 2021 9:42 am

OK, you can't use displayio on the QtPy. It doesn't have enough flash. You can add the external SPI Flash chip on the bottom of the board. The CircuitPython build for that configuration does have displayio.

Dave

dastels
 
Posts: 6481
Joined: Tue Oct 20, 2015 3:22 pm

Re: How do I use OLED with QT Py?

by CapArcona on Wed Mar 31, 2021 1:32 am

dastels wrote:OK, you can't use displayio on the QtPy. It doesn't have enough flash. You can add the external SPI Flash chip on the bottom of the board. The CircuitPython build for that configuration does have displayio.

Dave


So an update: I got the flash chip on, everything works as intended. Libraries, code, screen, all of it. Thank you so much for your help!

I want to ditch the QWIIC connector (STEMMA connector? something like that) for various reasons. It's important to the product's final size. Can I just solder the little pins at the bottom of the screen to certain pins on the board? I don't need to do anything else? As far as I understand, all I need is to connect SDA-SDA, SCL-SCL, GND-GND, and VIN-3v. No programming changes required?

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I use OLED with QT Py?

by dastels on Wed Mar 31, 2021 10:32 am

Yes, that's it. The STEMMA-QT connector is connected to those pins.

Dave

dastels
 
Posts: 6481
Joined: Tue Oct 20, 2015 3:22 pm

Re: How do I use OLED with QT Py?

by CapArcona on Wed Mar 31, 2021 2:42 pm

Awesome, my project is nearly done, then! Thanks for all your help!

CapArcona
 
Posts: 15
Joined: Wed Mar 03, 2021 4:13 pm

Re: How do I use OLED with QT Py?

by dastels on Wed Mar 31, 2021 3:12 pm

My pleasure. have fun.

Dave

dastels
 
Posts: 6481
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.