[Tutorial] How to get your NanoHatOLED to work

Guides and tutorials for various stuff. Posted by DietPi users.
Post Reply
User avatar
Phillski
Posts: 9
Joined: Fri Feb 02, 2018 9:52 am

[Tutorial] How to get your NanoHatOLED to work

Post by Phillski » Tue Apr 17, 2018 12:33 pm

For those of us that were all excited about getting their NanoPi with the NanoHatOLED screen ... http://www.friendlyarm.com/index.php?ro ... uct_id=189
Neo2.jpg
mmm ... so sexy
... but had the sad feelings when you could not get the OLED screen to work using DietPi then I have some good news!

Here are the steps I used to get it up and running (everything works!)

Step 0: Make sure you only log into the DietPi using a non-Root account (eg. dietpi:dietpi)

Step 1: Make sure the following components have been installed using the DietPi Software configuration tool.
<Software Additional> => 130 Python Pip
<Software Additional> => 16 Build Essentials
<Software Additional> => 17 Git

Step 2: Execute the following code

Code: Select all

sudo apt-get install libfreetype6-dev libjpeg-dev
Step 3: Execute the following code

Code: Select all

sudo pip install --upgrade ssd1306
Step 4: Execute the following code (system will reboot at the end)

Code: Select all

git clone https://github.com/friendlyarm/NanoHatOLED.git && cd NanoHatOLED && sudo -H ./install.sh
Once the system reboots you should see the FriendlyElec logo flash up and then everything should just work!


HOWEVER ...

After running mine 24x7 for about a month I discovered that my little OLED screen had developed a nasty case of "screen burn" :shock:
This inspired me to do a little hacking and make a few fixes.

Executing the following code will do two things:
1. Replace the default script with one that turns off the screen after five(ish) minutes (as soon as you click a button it will turn back on for another five minutes).
2. Replaces the boot image with a muuuch better one. <cough>dietpi logo</cough>

Code: Select all

wget -O NanoHatOLED.zip http://dietpi.com/phpbb/download/file.php?id=1033 && sudo unzip -o NanoHatOLED.zip -d NanoHatOLED/BakeBit/Software/Python
Reboot and all should be good with the world.
Attachments
NanoHatOLED.zip
(5.59 KiB) Downloaded 86 times

ripplingwater
Posts: 8
Joined: Sat Mar 31, 2018 3:38 pm

Re: [Tutorial] How to get your NanoHatOLED to work

Post by ripplingwater » Wed Aug 29, 2018 1:21 pm

That's pretty cool! Btw just a quick question - would this work with a NanoPi-NEO2? I should be receiving one very soon and would want to use this OLED ... and with DietPi.

User avatar
Phillski
Posts: 9
Joined: Fri Feb 02, 2018 9:52 am

Re: [Tutorial] How to get your NanoHatOLED to work

Post by Phillski » Thu Aug 30, 2018 12:12 am

It will indeed work with the Neo2! (I'm using the 1st gen Neo2, looks like you will be using the 3rd gen with the silver case)

If you want to use my custom script that will avoid screen burn I've uploaded a new version that has a few changes
- retains the FriendlyElec logo on bootup (shows the DietPi logo after)
- turns off the screen after two minutes (old version was set to five minutes)
- has a better way of working out the IP (makes sure it grabs eth0 and not tun0 when using a VPN)
- uses 0% CPU when it has turned the screen off (the old script would use between 2-5%)

Code: Select all

wget -O NanoHatOLED.zip http://dietpi.com/phpbb/download/file.php?id=1101 && sudo unzip -o NanoHatOLED.zip -d NanoHatOLED/BakeBit/Software/Python
Reboot after installing :)
Attachments
NanoHatOLED v2.zip
(5.74 KiB) Downloaded 37 times

Post Reply