Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md with Ubuntu 22.04 instructions #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 105 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ make
./display
```




## Add automatic start script
**Open the rc.local file**
```bash
Expand All @@ -50,6 +47,111 @@ make
```
**reboot your system**

# Install Instructions for SKU_RM0004 on Ubuntu Server 22.04

The following steps would be the adapted instructions for your environment (Ubuntu Server 22.04 with user `serveradmin`, adjust for your own environment):

1. Enable i2c and set the baud rate by editing the `/boot/firmware/config.txt` file. You can do this using a text editor such as `nano`. You will need to use `sudo` to edit this file because it requires root permissions:

```bash
sudo nano /boot/firmware/config.txt
```

Then, add the following lines to the file:

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

Save the file and exit the editor.

2. Install the necessary i2c packages with the following command:

```bash
sudo apt install -y python3-pip python3-dev python3-pil python3-setuptools python3-rpi.gpio i2c-tools
```

3. Add your user to the i2c group with the following command:

```bash
sudo usermod -aG i2c serveradmin
```

4. Clone the SKU_RM0004 library and compile the display driver:

```bash
git clone https://github.com/UCTRONICS/SKU_RM0004.git
cd SKU_RM0004
make
```

5. To start the display driver automatically at boot, you can either use the systemd service or the `/etc/rc.local` file.

- To use the systemd service, you will need to create a systemd service. Open a new service file in a text editor:

```bash
sudo nano /etc/systemd/system/sku_rm0004.service
```

Then, add the following lines to the file:

```bash
[Unit]
Description=Start SKU_RM0004 display
After=network.target

[Service]
ExecStartPre=/usr/bin/make -C /home/serveradmin/SKU_RM0004 clean
ExecStartPre=/usr/bin/make -C /home/serveradmin/SKU_RM0004
ExecStart=/home/serveradmin/SKU_RM0004/display
WorkingDirectory=/home/serveradmin/SKU_RM0004
User=serveradmin
Group=serveradmin
Restart=always

[Install]
WantedBy=multi-user.target
```

Save and close the file.

Then, enable the service with the following command:

```bash
sudo systemctl enable sku_rm0004
sudo systemctl start sku_rm0004
```

- To use the rc.local file method, you will need to add commands to the `/etc/rc.local` file. Note that this file may not exist or be executable by default on Ubuntu 22.04, so you may need to create it and make it executable:

```bash
sudo touch /etc/rc.local
sudo chmod +x /etc/rc.local
sudo nano /etc/rc.local
```

Then, add the following commands to the file:

```bash
#!/bin/bash
cd /home/serveradmin/SKU_RM0004
make clean
make
./display &
```

Save the file and exit the editor.

Remember to reboot your system for changes to take effect:

```bash
sudo reboot
```



Expand Down