Changes

Jump to navigation Jump to search

How to enable OLED display

1,489 bytes added, 18:47, 24 July 2023
no edit summary
{{GD Template Impl}}
How to enable OLED display on Raspbian:<ref>Adafruit Python SSD1306 library: https://github.com/adafruit/Adafruit_Python_SSD1306</ref>
'''1. Update your Pi and Install the required dependencies'''<pre>sudo apt-get updatesudo apt-get -y upgradesudo apt-get -y install i2c-tools python3-smbussudo apt-get -y install python3-pip python3-pilsudo pip3 install --upgrade setuptoolssudo pip3 install --upgrade adafruit-python-shellsudo pip3 install adafruit-circuitpython-ssd1306sudo pip3 install pi-ina219sudo pip3 show pi-ina219</pre>
 
'''2. Run the following command to check the oled i2c port'''
sudo i2cdetect -y 1
for X729, the I2C address is 0x3c, (In generally, the i2c address is 0x3c)
 
Please sure teh I2C is enable before this step, please refer to [[How to enable I2C]]
 
 
'''3. Installation'''
 
3.1 Download the required scripts
<pre>
cd ~# git clone https://github.com/suptronics/oled.gitgit clone https://github.com/geekworm-com/oledcd oled<syntaxhighlight lang="Shell"/pre>pi@raspberrypi ~ $ 3.2 Install the Adafruit CircuitPython library sudo aptpython3 raspi-get updateblinka.pypi@raspberrypi ~ $ This process may take tens of minutes, please be patient  3.3 sudo apt-get -y upgradeAnswering Y and hitting Enter when reboot prompted. Then renavigate to the oled directly by entering:pi@raspberrypi ~ $ sudo apt-get -y install i2c-tools python3-smbus python-smbuscd oled 3.4 Run the script to test the displaypi@raspberrypi ~ $ sudo apt-get -y install python3-pip python3-pilstats.py ORpi@raspberrypi ~ $ sudo apt-get -y install python3x729.py  Due to different hardware, you need to choose a different project file such as <code>x729.py</code> or <code>stats.py</code> * <code>stats.py</code> is for most hardware such as [[NASPi CM4-pip python3M2]] or [[NASPi CM4-pil2.5]] or [[NASPi Gemini 2.5]] or [[X882]] shield.* <code>x729.py</code> is for [[X729]] shield. 3.5 Run the script at Raspberry Pi bootpi@raspberrypi ~ $ sudo pip3 install crontab --upgrade setuptoolse 3.6 Add a line at the end of the file that reads like this: PS: we must toogle to the /home/pi/oled directory because .ttf files is required to locate in current directory,you can refer to x729.py source file, or you can also remove the 'cd /home/pi/oled &&' if you use the absolute path of the ttf file in the source code. @raspberrypi ~ $ sudo pip3 install reboot cd /home/pi/oled && python3 /home/pi/oled/yourd-evice-upgrade adafruitname.py &[[File:X729-python-shell 9.png|none]] pi@raspberrypi ~ $ sudo pip3 install adafruit-circuitpython-ssd1306 Save and exit. In nano editor, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted.pi@raspberrypi ~ $ sudo pip3 install pi-ina219 pi@raspberrypi ~ $ sudo pip3 show pi-ina219 ==References==<references /syntaxhighlight
<!--Add review function! -->

Navigation menu