MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.89k stars 498 forks source link

NanoPi NEO/2/Air | I²C OLED display: NanoHat #2532

Open Velociraptor85 opened 5 years ago

Velociraptor85 commented 5 years ago

Creating a feature request

It would be nice to have the ability to use a NanoHat OLED Display for NanoPi Neo/Neo2/Air. Also I think that these boards aree used a lot so other people would probably also benefit ^^.

Is your feature request related to a problem? Please describe:

Describe the solution you'd like:

Describe alternatives you've considered:

Additional context

Here some links to libraries and documentation

MichaIng commented 5 years ago

@Velociraptor85 Thanks for your request.

I add this as software request since the install script/pre-req match many of what we install via dietpi-software as well, too much to do this inside the dietpi-config script. We can add it to dietpi-config, which then redirects you to dietpi-software or triggers an automated install via: dietpi-software install <ID>

The I²C module/overlay is enabled by default on NanoPi?

Velociraptor85 commented 5 years ago

I will check on the weekend. What should I do to check if the I²C module/overlay is enabled?

Also Thanks for thinking of implementing it ^^

MichaIng commented 5 years ago

@Velociraptor85

What should I do to check if the I²C module/overlay is enabled?

lsmod should contain something related.

Velociraptor85 commented 5 years ago

@MichaIng so lsmod shows following:

root@DietPi:~# lsmod Module Size Used by ir_lirc_codec 16384 0 lirc_dev 16384 1 ir_lirc_codec snd_soc_simple_card 16384 0 snd_soc_simple_card_utils 16384 1 snd_soc_simple_card sunxi_cir 16384 0 rc_core 32768 4 ir_lirc_codec,lirc_dev,sunxi_cir rtc_ds1307 24576 0 g_mass_storage 16384 0 usb_f_mass_storage 36864 1 g_mass_storage libcomposite 45056 2 g_mass_storage,usb_f_mass_storage

meaning I cant see anything related to I²C

MichaIng commented 5 years ago

Okay, so if not it is hardcoded into the kernel, it seems we also need to enable the overlay/module first.

Ah the install.sh contains this. It pulls the BakeBit installer which contains I²C setup: https://github.com/friendlyarm/BakeBit/blob/master/Script/install.sh

Hmm using https://github.com/friendlyarm/NanoHatOLED/blob/master/install.sh on the one hand is easy and makes sense. But it is a bid ugly using rc.local 🤔 and this even a way that might not work due to it's exit 0. So we need an own systemd unit or postboot.d entry for this. Also the automated reboot in BakeBit's install.sh is something we need to work around.

Usage libraries:

Velociraptor85 commented 5 years ago

Hi, so regarding the libraries, these where just some references which I found in the interwebs by your commonly used search engine.

Regarding the install.shI could test that from NanoHatOLED. As far as I understand it:

For me this would mean that the actual i²C support is the BakeBit part.

Additionally squidpickles uses a device path /dev/i2c-0 which is present on my current DietPi setup. Not sure though if it would work. Seems like he uses RUST which might need to be installed for this to work.

dmesg | grep i2c showed

[ 1.619783] i2c /dev entries driver

bdleung commented 5 years ago

The v2 script posted by Phillski at https://dietpi.com/phpbb/viewtopic.php?t=3077 is also useful to prevent OLED burn in (which unfortunately happened to mine... :( )

Velociraptor85 commented 5 years ago

@bdleung thanks, the instructions worked like a charm

MichaIng commented 5 years ago

@bdleung Many thanks for linking the forum topic, which matches/verifies the instructions above. Anti screen burn is brilliant, totally forgot about this.

bdleung commented 5 years ago

@Velociraptor85 @MichaIng Not a problem, glad I could help. Can verify the OLED panel supplied in the NanoPi kits are very susceptible to burn in. I found out the hard way after initially not using the script...

Velociraptor85 commented 5 years ago

The instructions in from the forum did not work for dietpi 6.25.3 ... i had to skip step 3 sudo pip install --upgrade ssd1306 everything else worked