Closed qyc206 closed 3 years ago
Follow instructions in 1.3.3 Connect the SSD1306 OLED screen and 1.3.4 Scan the I2C bus and find OLED screen address of the lab manual, and make sure you get the same output.
Show photograph of connection, and show terminal output when you scan the I2C bus.
Library is at https://github.com/adafruit/Adafruit_Python_SSD1306
Install the library with
git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
cd Adafruit_Python_SSD1306
sudo python3 setup.py install
Make sure you can run python3
and in the Python terminal, run
import Adafruit_SSD1306
without error (to verify the library installation).
We need to add an install_requires
to setup.py so that it has this library as a pre-requisite. See this link. After adding this, test by running the install for the eui library again, and make sure it checks that the SSD1306 library is installed.
Show:
Importing Adafruit_SSD1306 library:
Installed Adafruit_SSD1306 library successfully. Then followed lab instructions 1.3.3 and 1.3.4 to display the cat picture onto the OLED screen. After that was finished, I then looked into the other files in the Adafruit OLED github page. I was able to run the animate.py and shapes.py files by commenting out the first disp line of code and uncommenting the second disp line of code. The end result is as follows.
# 128x32 display with hardware I2C:
# disp = Adafruit_SSD1306.SSD1306_128_32(rst=RST)
# 128x64 display with hardware I2C:
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST)
This was done for image.py, animate.py, and shapes.py
Added the following code to setup.py file.
install_requires=['Adafruit_Python_SSD1306']
dependency_links=['git+https://github.com/adafruit/Adafruit_Python_SSD1306']
Got the following error before I added the dependecy_links line. I had to interrupt the reading because it was taking a long time.
After adding the dependency_links line, I got this error:
I then changed the command from
sudo python3 setup.py install
to pip install stubby_eui
which gave me the following error:
I'm not sure where the websites (https://pypi.org/simple, https://www.piwheels.org/simple) are showing up.
From the previous error, I tried the following (using this website as the error reference)
I think I need to use the requirements.txt method. I previously saw some users criticize that method so I was initially against it, but I will try it before asking the professor for assistance.
Used the following command to create a requirements.txt file: pip3 freeze > requirements.txt
Found from this link: https://stackoverflow.com/questions/31684375/automatically-create-requirements-txt
Deleted the dependency_links line from the setup.py file. End result:
Issue: not sure how to install setup.py file. Forgot to document it last time.
Result 1 (same error as above):
Result 2 (didn't work because of same issue as last time):
Result 3 (after reading error message and changing the install_requires, which changes the https://pypi.org/ link):
from install_requires=['Adafruit_Python_SSD1306']
to install_requires=['Adafruit-SSD1306']
Finished installing
I was also able to install
Pi connections to OLED screen
In lieu of filling the display functions in the stubby_eui.py file, I tried to wire the OLED again. I turned on I2C and followed the instructions in the lab manual (linked above), but to no avail. The i2cdetect -y 1
command does not work: it does not show any i2c devices. However, the lsmod | grep i2c
command does work (I think).
Works now. Think it was just needing to turn on i2c at the start instead of turning it on half way and needing to reset the connection.
Turn on spi/i2c using sudo raspi-config
and check with lsmod | grep i2c
In case OLED/i2c connection is broken, use the following commands:
disable the I2C driver with
sudo rmmod i2c_dev
sudo rmmod i2c_bcm2835
re-enable it with
sudo modprobe i2c_dev
sudo modprobe i2c_bcm2835
Can upload custom image after cloning repository on my computer computer.