Giter Club home page Giter Club logo

sku_rm0004's Introduction

SKU_RM0004

The project supports running on RaspberryPi, Ubuntu, HomeAssistant,You can also use Python to call compiled DLLs on these platforms.

RaspberryPi

Deployment service

Clone SKU_RM0004 library

git clone https://github.com/UCTRONICS/SKU_RM0004.git

Compile

cd SKU_RM0004
make

Add automatic start script

./deployment_service.sh   

reboot your system

sudo reboot

How to uninstall the uctronics-display.service

sudo systemctl disable uctronics-display.service
sudo rm /etc/systemd/system/uctronics-display.service
sudo systemctl daemon-reload

How to use NVMe

Note: only for Raspberry Pi 5 and UC-B86 NVMe hat

https://github.com/UCTRONICS/SKU_RM0004/blob/main/data/NVMe_User_Guide.md

sku_rm0004's People

Contributors

dennis-ard avatar geerlingguy avatar jeff-arducam avatar uctronics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sku_rm0004's Issues

Display & Button on bare Debian 11

I'm running Debian 11 (server) on my Raspberry Pi 4B and can't get the display and power button to work.
Here is my journey so far - hope someone can help...

I did everything as described in the manual:

  • /boot/config.txt
    (also tried with line breaks in between each parameter)
dtparam=i2c_arm=on,i2c_arm_baudrate=400000
dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up

Since make wasn't working I've read through all the other reported issues and installed some packages:
make, gcc, i2c-tools, python, python3-pip python3-dev python3-pil python3-setuptools python3-rpi.gpio

After that make did finally work but now ./display said that it doesn't find the firmware needed.
(don't know if I remember this point right - could be that it was still make that reported that problem)

  • I then updated all the brcm firmware (as described here: https://wiki.debian.org/Firmware#Firmware_missing_from_Debian)
    wget -r -nd -e robots=no -A '*.bin' --accept-regex '/plain/' https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/brcm/

  • and since that didn't work I downloaded the exact firmware file that dmesg reported missing
    wget https://github.com/RPi-Distro/bluez-firmware/raw/master/broadcom/BCM4345C0.hcd

Right now there is no error in dmesg anymore:

...
[   11.571108] Bluetooth: hci0: BCM4345C0
[   11.572665] Bluetooth: hci0: BCM4345C0 (003.001.025) build 0000
[   11.575869] bluetooth hci0: firmware: direct-loading firmware brcm/BCM4345C0.hcd
[   11.578964] Bluetooth: hci0: BCM4345C0 'brcm/BCM4345C0.hcd' Patch
[   11.589223] audit: type=1400 audit(1671710145.915:2): apparmor="STATUS" operation="profile_load" profile="unconfined" name="lsb_release" pid=403 comm="apparmor_parser"
[   11.595411] audit: type=1400 audit(1671710145.915:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=404 comm="apparmor_parser"
[   11.602100] audit: type=1400 audit(1671710145.915:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=404 comm="apparmor_parser"
[   11.737081] bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
[   11.740812] bcmgenet fd580000.ethernet eth0: Link is Down
[   12.407201] Bluetooth: hci0: BCM43455 37.4MHz Raspberry Pi 3+-0190
[   12.409774] Bluetooth: hci0: BCM4345C0 (003.001.025) build 0382
[   15.845143] bcmgenet fd580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   15.848534] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   21.224634] vc4-drm gpu: [drm] Cannot find any crtc or sizes

But ./display does nothing... (already did make and reboots multiple times)
Any idea what I'm missing?

PS: I'm fairly unexperienced using Linux so please bare with me if the problem is obvious

Hard Disk Usage Miscalculation

Running Ubuntu Server 22.04.2 LTS on an SSD connected using the provided USB adapter results in two partitions being created:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       440G  3.5G  419G   1% /
/dev/sda1       253M  149M  104M  59% /boot/firmware

The logic used to calculate the hard disk usage seems to assume there is one single partition which results in the hard disk usage being miscalculated.

/*
* get hard disk memory
*/
uint8_t get_hard_disk_memory(uint16_t *diskMemSize, uint16_t *useMemSize)
{
  *diskMemSize = 0;
  *useMemSize = 0;
  uint8_t diskMembuff[10] = {0};
  uint8_t useMembuff[10] = {0};
  FILE *fd = NULL;
  fd=popen("df -l | grep /dev/sda | awk '{printf \"%s\", $(2)}'","r");     <----------
  fgets(diskMembuff,sizeof(diskMembuff),fd);
  fclose(fd);

  fd=popen("df -l | grep /dev/sda | awk '{printf \"%s\", $(3)}'","r");     <----------
  fgets(useMembuff,sizeof(useMembuff),fd);
  fclose(fd);

  *diskMemSize = atoi(diskMembuff)/1024/1024;
  *useMemSize  = atoi(useMembuff)/1024/1024;
}

Does not automatically start Ubuntu 22.10 server

After following the instructions the screen script does not automatically start.

Running
cd SKU_RM004
make clean
enter sudo password
make
./display

will work. But on reboot the script doesn't seem to run to start the screen

Display & Button on shutdown

Is there a way to shut off the display and button when shutting down the Raspberry Pi?
Currently on shutdown the display freezes but is still active. The button is also still lit.

Happens on all of my Pis using Raspberry Pi OS.

Unable to get the screen and power button operating correctly.

So it appears theres quite a bit of trouble getting the power button and the screen information to operate correctly. I had read @geerlingguy thread and tried everything that was mentioned there but the only way I can get the screen to show the information is to run ./display and it will only operate whilst that command is active. I have not been able to automatically run it in the background with the provided scripts. The power button just does nothing too. How do i get this stuff resolved??

Power button does not shutdown Raspberry PI with Ubuntu OS (resolved)

I was having an issue with the power button not working on my Raspberry PI's with Ubuntu OS. Pressing the button would turn its LED off but not shut down the Raspberry PI. The power button's LED would not light up again unless I power cycled the PI.

Unlike the Raspberry Pi OS, which stores its config.txt file in the /boot directory, Ubuntu uses the /boot/firmware directory. Ubuntu 20.04 recommended adding user configurations to the usercfg.txt file, read by an include statement in config.txt, however this is no longer the case with Ubuntu 22.04 LTS. Ubuntu now merged /boot/firmware/config.txt and /boot/firmware/usercfg.txt into one file, so that the /boot/firmware/config.txt file is only required. askUbuntu article

At the top of the config.txt file under the [all] section, I commented out the existing dtparam and added the entry for UCtronics.

[all]
# Enable the audio output…..
# Commented out by me
#dtparam=i2c_arm=on
# Added this dtparam for UCtronics
dtparam=i2c_arm=on,i2c_arm_baudrate=400000

At the bottom of the config.txt file under the [all] section, I added the dtoverlay entry.

[all]
# Added this overlay for the UCtronics shutdown feature
dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up

After a reboot the power button now operated properly within Ubuntu. Hopefully this will help others experiencing the same issue.

CPU 0%

Hello everyone, I have the display ready now. However, the CPU always shows 0%, otherwise everything is fine. Anyone an idea? Thanks.

Clarify display protocol used and display IC or provide datasheet

Hello, I'm looking to do a pure python implementation of the display driver for the display on the RM0004 module (UC-910). According to the headers in this repo, the display should be using an ST7735 display IC. The existing ST7735B and ST7735R libraries do not work with this display. There appears to be additional hardware between the display and PI.

I am looking for clarification on what this is, or, a datasheet that makes plain what it is.

Thank you in advance!

gcc error when running make on the project

When trying to get this setup, it seems to be erroring out when running make. I can't figure out a way around this error.

jameswlane@nextcloud:~ $ git clone https://github.com/UCTRONICS/SKU_RM0004.git
Cloning into 'SKU_RM0004'...
remote: Enumerating objects: 67, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 67 (delta 11), reused 12 (delta 8), pack-reused 35
Receiving objects: 100% (67/67), 42.46 KiB | 1.29 MiB/s, done.
Resolving deltas: 100% (16/16), done.
jameswlane@nextcloud:~ $ cd SKU_RM0004/
jameswlane@nextcloud:~/SKU_RM0004 $ make
gcc -c  -I project/  -I hardware/rpiInfo  -I hardware/st7735 -o obj/display.o project/display.c
make: gcc: No such file or directory
make: *** [Makefile:25: obj/display.o] Error 127
jameswlane@nextcloud:~/SKU_RM0004 $ 

PoE PI Hat w/ Fan

It seems that all PI hats w/ fans while using heat sinks are just a bit to high to fit into the opening for each "tray". I was able to mod the case using and this UCT PoE Hat u6110.

I had to make two modes (see attached pictures)

  • cut away a little of the top lip of the rack bay (will make it better, the image below is just to see if it fit)
  • add pin extension headers then cut them away after the PoE hat

It would be nice to make the bay entry big enough to support other PoE hats and fans.

Pic 1 - Rack
pirack1

Pic 2 - PoE Hat w/ pin cuts
pirack2

Pic 3 - Heat Sinks
pirack3

Steps to set up Pi Rack Pro OLED Ubuntu 22.04.3 LTS

This is a quick write up to get the OLED's working for those who are using Ubuntu Server 22.04.3 LTS as the instructions provided from UCTRONICS are specific to Pi OS.

Note that I've not got the Pi's to work with the shutdown button using aftermarket PoE hats. This will come later and I'll edit this post when I find it.

Steps to set up Pi Rack Pro OLED Ubuntu 22.04.3 LTS

Install raspi-config
sudo apt install raspi-config

enable i2c
sudo raspi-config
Select 3. Interface Options and press enter
Select I5. Enable/Disable automatic loading of I2C kernel module and press enter
Select Yes
Select Finish

Add all of the following to the /boot/firmware/config.txt

Add all of the following to the /boot/firmware/config.txt under the second [all] section, and place a # in front of "dtparam=audio=on" to comment it out/disable it.

sudo nano /boot/firmware/config.txt

dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=400000
dtoverlay=gpio-shutdown
dtoverlay=gpio_pin=4
dtoverlay=active_low=1
dtoverlay=gpio_pull=up

Control O to save, Enter to commit the changes, Control X to exit

Install the following python packages
sudo apt install -y python3-pip python3-dev python3-pil python3-setuptools python3-rpi.gpio i2c-tools

Add your user to the i2c group - Be sure to change (username) with your user ID
sudo usermod -aG i2c username

Clone the RM0004 repository
git clone https://github.com/UCTRONICS/SKU_RM0004.git

Running the "./deployment_service.sh" file in the SKU_RM0004 directory:

Be sure to edit the "deployment_service.sh" file - you will want to update the /boot/config.txt information to reflect /boot/firmware/config.txt, and save it.

**Change the deployment_service.sh file
cd SKU_RM0004
sudo nano deployment_service.sh

  • find the BOOT section and edit to reflect "boot/firmware/config.txt.
  • control O , enter, control X

After you've saved it, you should be able to successfully run it.

Compile
cd SKU_RM0004
make

Run the display
./display

you should see the IP of your host, CPU, Memory, Ram, and Temp

Control C to exit the display

**Now add the automatic start script - change (username) to the userID **

sudo nano /etc/rc.local

#!/bin/sh -e
cd /home/username/SKU_RM0004
make clean
make
./display&
exit 0

Control O to save, Enter to commit the changes, Control X to exit

Change rc.local from read only to executable
sudo chmod -v +x /etc/rc.local

Enable rc.local
sudo systemctl enable rc-local.service

Start rc.local
sudo systemctl start rc-local.service

Validate rc.local service is active
sudo systemctl status rc-local.service

  • you should see " Active: active "

Reboot
sudo reboot

Your OLED should magically work now without manually running the ./display file.

There are a few folks here that contributed to the overall solutions and want to Thank - WhirlyHat for finding the correct path to the boot file, and bigbrovar for the i2c info and python packages. The Automatic start up script, I had to google and got the answer.

Use systemd unit file for service management

Instead of using rc.local and recompiling the binary every reboot, it seems like it may be more efficient to use systemd to manage the LCD display service.

That's what I did by creating the following unit file at /usr/lib/systemd/system/lcd_display.service:

[Unit]
Description=LCD Library

[Service]
WorkingDirectory=/opt/SKU_RM0004
ExecStart=/opt/SKU_RM0004/display
Restart=always

[Install]
WantedBy=multi-user.target

Then I ran sudo systemctl daemon-reload to reload the daemon, sudo systemctl start lcd_display to start the display, and sudo systemctl enable lcd_display to make sure it starts at boot.

This setup assumes you're running the latest version of Raspberry Pi OS, Debian 11, or Ubuntu 20.04 or later.

deployment_service.sh errors due to /boot/config.txt

The deployment_service.sh script will fail with the following errors if the /boot/config.txt file does not exist prior to executing the script.

grep: /boot/config.txt: No such file or directory
deployment_service.sh: line 77: [: -lt: unary operator expected

grep: /boot/config.txt: No such file or directory
deployment_service.sh: line 80: [: -lt: unary operator expected

I added the following code below the BOOT_CONFIG="/boot/config.txt" line that will test for the file's existence and create it if missing.

Current code:

BOOT_CONFIG="/boot/config.txt"

if [ `grep -c "dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up" $BOOT_CONFIG` -lt '1' ];then
    sudo bash -c 'echo dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up >> /boot/config.txt'
fi

Modified code:

BOOT_CONFIG="/boot/config.txt"

# Insert this section
if [ ! -e "/boot/config.txt" ]; then
    echo "Creating /boot/config.txt..."
    sudo bash -c 'touch /boot/config.txt'
    if [ $? -ne 0 ]; then
        echo "Failed to create file. Exiting."
        exit 1
    else
        echo "Successfully created file."
    fi
# Section end

if [ `grep -c "dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up" $BOOT_CONFIG` -lt '1' ];then
    sudo bash -c 'echo dtoverlay=gpio-shutdown,gpio_pin=4,active_low=1,gpio_pull=up >> /boot/config.txt'
fi

Would be helpful to include a section like this to test for the file.

64-bit

I was able to compile the C version on my Pi running 64-bit OS. But the dynamic library used by Python is precompiled and 32-bit. Is there a makefile for building librm0004_display.so?

deployment_service.sh does not launch

The deployment_service.sh script does not appear to do anything when launched. The code below the "Deploy the function service" line tests whether the service exists, and if it does, prompts if you want to reinstall/overwrite. However in the event that the service is not installed, the code will never run the install_service function.

It looks like that portion of the code is missing an else statement to run the function.

Current code:

# Deploy the function service
if [ -e "$file_path""$service_name" ]; then
    echo "Service already exists. Do you want to overwrite? y/n"
    read -r answer
    if [ "$answer" = 'y' ] || [ "$answer" = 'Y' ]; then
        install_service
    else 
        exit 0
    fi
fi

Corrected code:

# Deploy the function service
if [ -e "$file_path""$service_name" ]; then
    echo "Service already exists. Do you want to overwrite? y/n"
    read -r answer
    if [ "$answer" = 'y' ] || [ "$answer" = 'Y' ]; then
        install_service
    else 
        exit 0
    fi
else
    echo "Installing UCtronics display service"
    install_service
fi

SSD activity LED ON when idle

The SSD activity LED is ON by default, and blinks off when the drive is active. This seems counter-intuitive.

Is this behavior intentional? If so, is there a way to invert it so the light is off by default and flashes on when the drive is active?

disk size

Is there a way to have the dispaly list all disks install and the percent full?

IP address defaults to wlan (might be more useful to default to eth0)

I just realized after reading through #2 and also seeing @TiVoHomeUser's fork (main...TiVoHomeUser:SKU_RM0004:main), that the default for the IPADDRESS_TYPE is currently set to WLAN0_ADDRESS:

#define IPADDRESS_TYPE WLAN0_ADDRESS

That means my Pis, which are connected via wired network, aren't able to show their IP address.

I think for the rackmount unit, most people will be plugging in wired Ethernet, so it might make sense to default that value to ETH0_ADDRESS like @TiVoHomeUser does.

A few suggestions for improvements

I had a few issues with my initial setup of the LCD for my rack unit, and not all of these are problems, but a few suggestions too:

1. Enabling I2C didn't work

Using the provided instructions, when I tried running the display, I got the following error:

Device I2C-1 failed to initialize

Indeed, even with dtparam=i2c_arm=on,i2c_arm_baudrate=400000 appended to my boot config and after a restart, I would keep getting that error.

I found out after a bit of debugging I had to put the dtparam=i2c_arm=on line earlier in my /boot/config.txt file. I was putting it near the end but for some reason that wasn't working. There was a commented line earlier in the file, and I uncommented that line, and everything works.

When I ran sudo raspi-config and enabled the I2C interface via that CLI interface, it also seemed to work, whereas manually enabling it by uncommenting the line didn't always. Not sure why, and I tried on both Buster and Bullseye.

So maybe updating the statement in the README to uncomment the existing line, and add on the i2c_arm_baudrate at the end, would be less prone to failure.

2. IP address always displayed as xxx.xxx.xxx.xxx (see #4)

My Pis are all plugged in via Ethernet, and if I run ip a I see something like:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether dc:a6:32:1a:68:4f brd ff:ff:ff:ff:ff:ff
    inet 10.0.100.10/24 brd 10.0.100.255 scope global dynamic noprefixroute eth0

But the IP address is never shown on the LCD. It looks like lcd_display_cpuLoad calls get_ip_address (though the comment there mentions wireless... it looks like the code looks for eth0...), but for some reason it never gets the IP for my Pis.

3. Simpler display preferred

The default settings make a display that refreshes parts and has four different displays cycling at all times. For my purposes, I would just like the IP address, and maybe the CPU temperature displayed (or something similarly simple, like hostname and IP). It would be great if this script could be customized to just display one thing and refresh every 5 seconds or something... or just display a text string on the screen.

I can see how to do that in the C, but having a little more flexibility could be nice. Otherwise, maybe someone in the community has a nice library that can do it separately... I noticed that the default setup would cause 3-5% CPU load every five seconds or so. Nothing crazy, but it is a lot of load just to update an informational display (which will not be looked at 99% of the time).

Display Freezes

I've followed the steps closely and the display freezes unless I have a terminal open to the rasbpi and RUN ./display in cd SKU_RM0004 do I have to setup a chron job or something to have this cycle through the various readings?

My expectation is that following the steps the display just cycles through the various readings after polling the hardware.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.