64 Line Oled Support

Have you considered adding 64 line Oled support? Maybe the install script could give the option of 32 or 64 line support.

I believe the only difference is the line

cc -o oled oled.c fontx.c -lwiringPi -lpthread -DI2C -DX32
would become
cc -o oled oled.c fontx.c -lwiringPi -lpthread -DI2C

We would then need a way in the other scripts to test if 32 or 64 lines are supported.
On my Backup Box I have replaced the lines

# If display support is enabled, notify that the storage device has been mounted
if [ $DISP = true ]; then
     oled r
     oled +a Storage OK"
    .....

with the following, this way when the storage media is inserted it tells me the media size, percent used and available space on the media.

# If display support is enabled, notify that the storage device has been mounted
if [ $DISP = true ]; then
    storsize=$(df /dev/sda1  -h --output=size | sed '1d')
    storused=$(df /dev/sda1  -h --output=pcent | sed '1d')
    storfree=$(df /dev/sda1  -h --output=avail | sed '1d')
    oled r
    oled +a "Storage: $storsize"
    oled +b "   Used: $storused"
    oled +c "   Free:$storfree"
    oled +d "Insert Card ..."
    sudo oled s
fi

Yes, it’s on my to-do list. :slight_smile:

Thanks Dimitri for this awesome project and all your work.

1 Like

Hello i have not done any work on showing percent of files copied but I have used the following code to display the number of files that are to be copied

filecount=$(rsync -avtr --progress --dry-run --stats "$CARD_MOUNT_POINT"/ "$BACKUP_PATH" | fgrep 'Number of created files' | cut -d' ' -f5 | tr -d ,)

  if [ $DISP = true ]; then
      oled r
      oled +a "Photo card OK"
      oled +b "$filecount files are"
      oled +c "being copied ..."
      sudo oled s
  fi
1 Like

Hi Trevorh,

That script looks great. it would be exactly what this project needs. im sorry to be a noob, but how have you managed to get the oled to work. i have it all working except for the oled display, even when i run the test script, i cannot get anything to display. once i get it working i am hoping i can implement the script you have written above.

Looking forward yo your reply

thank you

Hi Paul
There are a number of requirements for successful Oled deployment check the following;

1.This project currently only suports I2C Oled displays, some similar displays are SPI these won’t work.
2. The Oled display must use the SSD1306 chipset.
3. When you run the install script you need to say yes to the Oled support question.
4 . Do what the install script says to do after the script completes
Run the following command sudo raspi-config
Go to the Interfacing Options section and enable I2C - the Pi does not compile I2C support into the kernal by default so this step is important to enable support for the I2C interface
Reboot
5. Also be aware that the SCA and SCL pins are not in the same order as the pins on the PI
On my pi the connections are

      OLED Pin            PI 3+ Pin    Pi Zero
        GND               9 - GND      9 - GND
        VCC               1 - 3.3v     1 - 3.3v
        SCL               5 - GPIO3    5 - GPIO9
        SCA               3 - GPIO2    3 - GPIO8

After a reboot it should all just work and you start to see messages. You can also goto into the Oled library sub directory and run the test script to see the display run through the various text options it supports.

The following has some details about testing that might be useful as well.
https://learn.sparkfun.com/tutorials/raspberry-pi-spi-and-i2c-tutorial/all

Hope this helps.

1 Like

Hi Trevor,

I have pushed a merge request which uses an additional script to report:

  • %age complete (as reported by Rsync using --info=progress2)
  • transfer rate in Mbps (as reported by Rsync using --info=progress2)

It updates after each file is transferred. The code which parses the rsync output also has the filename and file count so they could also be output on a 4 line Oled.

File changes are visible at: https://github.com/dmpop/little-backup-box/pull/50/files

Would it also be useful at start up to report that the script had started and any parameters that the user may find useful?

So something like:

if [ $DISP = true ]; then
oled r
oled +a “Little Backup Box”
oled +b " ver 1.0"
oled +c " Card Backup Script"
oled +d " GNU GPL v3.0"
sudo oled s
sleep 2
oled -b
oled -c
oled -d
if [ $SYNCTHING = true ]; then
if !(curl -s http://127.0.0.1:8384/rest/system/ping | grep ‘{“ping”:“pong”}’ > /dev/null 2>&1); > then
oled +b “Syncthing: $SYNCTHING”
oled +c “ERROR SYNCTHING”
oled +d “NOT RUNNING”
sudo oled s
sleep 2
else
oled +b “Syncthing: $SYNCTHING”
oled +c “Syncthing running”
IPADDR=“ip route get 1 | awk ‘{print $NF;exit}’”
oled +d “IP: $IPADDR”
sudo oled s
sleep 2
fi
fi
fi

1 Like

Hi Simon

Yes I’m all for keeping people informed as best as possible about the current state of the apps progress. I think unless there is a narrower font available that message lines can only be 16 characters long with the current oled library. You have done some good work there Simon!

Kind Regards
Trevor

Hi Dmitri and Simon

Just had a thought about how we could probably add a progress bar without using a graphics library. The oled +R command turns on reverse text but only for any text characters on a line including spaces, so if we get the percent of the rysync job that is completed and divide it by 6.25 that would be the number of spaces we write to the reverse highlighted line. This would produce a course update bar and after 3 spaces are full we could also start writing the xx% figure inside the bar, OK that means no text until at least 20% but without going the full graphic option it’s the best that can be achieved.

Kind Regards
Trevor

2 Likes

This looks awesome!