🎁📬❄️📦 Holiday Shipping Deadlines are approaching! International customers and domestic ground - get your orders in 12/9/2020 📦❄️📬🎁
0

QT PY : displayio not found
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

QT PY : displayio not found

by hepaestus on Tue Nov 17, 2020 8:42 am

Hello,
I am trying to set up a QT PY with some sensors and an OLED.

I have loaded the latest CIrcuitPython but "displayio" is still not found I am not sure where else to look. I have tried the bleeding edge latest circuitpython and the latest ver 6.0 with no luck. Everything I have found says that the displayio is part of the base CP install, however, I cannot find it.

See the notes below:
REPL OUTOUT:
Code: Select all | TOGGLE FULL SIZE
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 6, in <module>
ImportError: no module named 'displayio'


Code: Select all | TOGGLE FULL SIZE
Line 6: import displayio


Code: Select all | TOGGLE FULL SIZE
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-278-g66fb09506 on 2020-11-17; Adafruit QT Py M0 with samd21e18
>>> help("modules")
__main__          digitalio         pulseio           supervisor
analogio          gc                pwmio             sys
array             math              random            time
board             microcontroller   rotaryio          touchio
builtins          micropython       rtc               usb_hid
busio             neopixel_write    storage           usb_midi
collections       os                struct
Plus any modules on the filesystem


File System LIBS:
Code: Select all | TOGGLE FULL SIZE
adafruit_display_text  adafruit_displayio_ssd1306.mpy  adafruit_lsm6ds  adafruit_ssd1306.mpy

hepaestus
 
Posts: 40
Joined: Sat May 07, 2016 6:54 am

Re: QT PY : displayio not found

by hepaestus on Tue Nov 17, 2020 12:07 pm

It seems like I found the issue here in the OLED screen description:
"Just wire up to your favorite micro and read through our detailed tutorial with both Arduino and Python/CircuitPython libraries for text and graphics. You'll need a microcontroller with more than 512 bytes of RAM since the display must be buffered."

Seems like I need to get the add on memory chip (https://www.adafruit.com/product/4763) and install so there is enough room for all my code and the required libraries. Furthermore it states that if you use the "SPI flash chip to the bottom of your board, you must use the Haxpress version of CircuitPython for the Adafruit QT Py for the flash to work!".
https://circuitpython.org/board/qtpy_m0_haxpress/
Built-in modules available: _pixelbuf, analogio, audiocore, audioio, board, busio, digitalio, displayio, gamepad, math, microcontroller, neopixel_write, nvm, os, pulseio, pwmio, random, rotaryio, rtc, storage, struct, supervisor, terminalio, time, touchio, usb_hid, usb_midi, vectorio



Thanks,
P.

hepaestus
 
Posts: 40
Joined: Sat May 07, 2016 6:54 am

Re: QT PY : displayio not found

by hepaestus on Mon Nov 30, 2020 2:14 pm

I have added the SPI Flash chip to my QT PY but I keep having memory issues where I cannot load all the libraries I need on the QT PY.

From the adafruit article:
In CircuitPython, the SPI flash is used natively by the interpretter and is read-only to user code, instead the Flash just shows up as the writeable disk drive!


Also Here:
Once soldered in, you can access the SPI flash in Arduino on SPI1 and chip select pin 17. In CircuitPython, a 'haxpress' version of the runtime will need to be installed, so it knows to look for the larger filesystem. There is more hardware support in the haxpress CircuitPython build because we can add more code to the internal flash instead of using it for a filesystem


How do I, in the Circuitpython code, access this extra space?

The 2MB IS showing up in the F: Drive when I connect the QT PY. But I get the memory error below:
Code: Select all | TOGGLE FULL SIZE
code.py output:
Traceback (most recent call last):
  File "code.py", line 7, in <module>
  File "adafruit_lsm6ds/__init__.py", line 73, in <module>
MemoryError: memory allocation failed, allocating 64 bytes


Thanks,
P.

hepaestus
 
Posts: 40
Joined: Sat May 07, 2016 6:54 am

Re: QT PY : displayio not found

by tannewt on Mon Nov 30, 2020 5:12 pm

MemoryError is due to running out of RAM, not flash. Please post your code.py and maybe folks can suggest memory optimizations. The SAMD21 only has 32K so it gets tight quickly.

tannewt
 
Posts: 1922
Joined: Thu Oct 06, 2016 8:48 pm

Re: QT PY : displayio not found

by hepaestus on Mon Nov 30, 2020 5:45 pm

Hello,

I am trying to get the sensor output from an LSM6DSOX and a BMP_280, then output text on an 128x32 oled display. As well as manage a button and output a signal to another peripheral.

But I can't hold all that code in Memory :( Maybe I should switch to a different controller board? I just wanted them all the easily plug into each other,

Code: Select all | TOGGLE FULL SIZE
import board
import busio
import gc
import displayio
import adafruit_bmp280
# from adafruit_lsm6ds.lsm6dsox import LSM6DSOX
import adafruit_display_text 
import adafruit_displayio_ssd1306

# I2C setup
i2c = busio.I2C(board.SCL, board.D4)
tmp = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
# sox = LSM6DSOX(i2c)

tmp.sea_level_pressure = 1015.91
display_bus = displayio.I2CDisplay(i2c, device_address=0x3c)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)

while True:
    print("(", end=" ")
    print(" %.2f" %(gc.mem_free()), end=", ");
    #print(" %.2f, %.2f, %.2f, " %(sox.acceleration), end="")
    #print(" %.2f, %.2f, %.2f" %(sox.gyro), end="")
   
    print('Temp:, {}C, '.format(tmp.temperature), end=", ")
    print('hPa:, {}, '.format(tmp.pressure), end=", ")
    print('Alt:, %0.2f m' % tmp.altitude, end=", ")
    print(")")
    time.sleep(0.25)

hepaestus
 
Posts: 40
Joined: Sat May 07, 2016 6:54 am

Re: QT PY : displayio not found

by tannewt on Mon Nov 30, 2020 6:43 pm

A controller with RAM is the easiest solution.

You can also try and optimize the libraries for size. They may include functionality that you aren't using.

tannewt
 
Posts: 1922
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.