Saturday, November 30, 2024

Minimalist Linux

Honestly, I am not a fan of the minimalist Linux movement. Today's machines are more than capable of handling what we throw at them and RAM is cheap. There is no reason not to use Gnome or KDE and even if you prefer a more legacy look, MATE and Cinnamon work just as well. The problem with minimalist desktops is you sacrifice ease of use and functionality. I don't care what anyone says ctrl-t is not easier than clicking on a button.

Having said that, there is some use for such a setup, for instance if you have a low end machine with limited RAM and no upgrade paths. In this case a GUI that eats less than 512 MB of RAM is nice. I have a Lenovo ideapad-1 with a Celeron G4020 and 4 GB of RAM, I like it because it is light and easy to carry around a busy airport. Gnome or KDE would bring this system to its knees and even MATE is a bit much for it.

In a case like this, I would forgo a Desktop Environment (DE) altogether and just use a Windows Manager (WM), in this case Openbox. A WM provides the basics, windows and decorations nothing more, a DE goes a step further and add the bells and whistles that make things easier to use and flashier.

The first step is to install Debian 12, when you get to the part where it asks what Desktop you want, uncheck everything except the bottom two options. Once that is done, reboot and log in as root, update the system and add the user you created to the sudo group. Then reboot again and log in under you user account.

Next comes installing what you need

sudo apt install xorg xbacklight xbindkeys xvkbd xinit xinput xserver-xorg-input-all xterm openbox obconf dunst dbus-x11 feh hsetroot i3lock libnotify-bin libxcb-xinerama0 lxappearance lximage-qt menu picom rofi scrot tint2 volumeicon-alsa xfce4-power-manager alsa-utils fonts-dejavu fonts-firacode fonts-font-awesome fonts-liberation2 fonts-ubuntu fonts-jetbrains-mono gtk2-engines-murrine gtk2-engines-pixbuf network-manager network-manager-gnome papirus-icon-theme pavucontrol pipewire-audio qt5-style-plugins rox-filer conky

Here we are installing our applications, I am avoiding heavy duty applications like LibreOffice and GIMP in favor of applications like Abiword and Inkscape, which eat less memory. Adjust to taste.

sudo apt install firefox-esr audacious thunderbird vlc emacs abiword gnumeric atril pluma mate-calc tilix inkscape
These next commands setup our WM in a basic configuration

mkdir -p ~/.config/openbox
cp /etc/xdg/openbox/* ~/.config/openbox/
systemctl --user --now enable wireplumber.service
Then we are going to setup the utilities needed for the basic functioning of the desktop. Type the following;

nano ~/.config/openbox/autostart
And add these lines;

hsetroot -solid "#000000"
xfce4-power-manager &
dunst -config ~/.config/dunst/dunstrc &
tint2 &
(sleep 5; volumeicon) &
nm-applet &
The hsetroot command sets the background color, #000000 is hexadecimal for black, for a nice blue, use #2e86c1, if you want to choose your own color, this site will help, https://htmlcolorcodes.com/ . You can set a picture as your background using a program call feh, but I am not covering that here.

Next we need to edit the .xinitrc file so when xorg starts, it knows what WM we are using. Type this command;

nano .xinitrc

and add these lines;

#!/bin/bash
exec openbox-session
Now, type startx and Openbox will start. You will see a blank screen, with a bar at the bottom. Right click on the background and choose terminal off the menu. In the terminal type in;

rofi-theme-selector

Rofi is the tool we will use to find and run programs. In its default state a window pops up in the middle of your screen, I prefer a bar at the top. Off the menu of choices, choose the demnu theme, to set the theme. Then we will want to configure rofi, so it shows icons with the programs. Type in the terminal;

nano .config/rofi/config.rasi

and add these lines to the file;

configuration{
display-drun: "Applications:";
display-window: "Windows:";
font: "JetBrainsMono Nerd Font Medium 10";
modi: ["drun", "window", "run"];
icon-theme: "Papirus";
show-icons: true;
}

@theme "/usr/share/rofi/themes/dmenu.rasi"
The final step is to setup our hotkeys for running the applications we use the most. Type in the following command;

nano ~/.config/openbox/rc.xml

search for </keyboard> and add these lines just above that line;

 <!-- Launch rox-filer when windows-f is pressed -->
  <keybind key="W-f">
    <action name="Execute"><command>rox-filer</command></action>
  </keybind>
<!-- Launch rofi when windows-m is pressed -->
  <keybind key="W-m">
    <action name="Execute"><command>rofi -show drun</command></action>
  </keybind>
<!-- Launch firefox when windows-w is pressed -->
  <keybind key="W-w">
    <action name="Execute"><command>firefox-esr</command></action>
  </keybind>
<!-- Launch tilix when windows-t is pressed -->
  <keybind key="W-t">
    <action name="Execute"><command>tilix</command></action>
  </keybind>
<!-- Launch thunderbird when windows-e is pressed -->
  <keybind key="W-e">
    <action name="Execute"><command>thunderbird</command></action>
  </keybind>
<!-- Launch audacious when windows-a is pressed -->
  <keybind key="W-a">
    <action name="Execute"><command>audacious</command></action>
  </keybind>
<!-- Launch vlc when windows-v is pressed -->
  <keybind key="W-v">
    <action name="Execute"><command>vlc</command></action>
  </keybind>
<!-- Launch scrot for screen caps when windows-print is pressed -->
  <keybind key="W-Print">
    <action name="Execute"><command>scrot 'screenshot-%Y-%m-%dT%H%M%S.png'</command></action>
  </keybind>

With this configuration, your keybindings will be as follows.

ROX-filer         windows-f(ile manager)
Rofi                 windows-m(enu)
Firefox-ESR    windows-w(eb)
Tilix                windows-t(erminal)
Thunderbird   windows-e(mail)
Audacious      windows-a(udio)
vlc                  windows-v(ideo)

Switch Desktops;
  ctrl-alt-right
  ctrl-alt-left
Print Screen  windows-prtscn

All that is left to do is right click on the background and choose Exit, this will drop you back to the command line, reboot the system and log back in. Then type startx to get back to your desktop. To run a program you do not have a hotkey for, simply press the Windows Key + m, at the top rofi will appear, simply start typing the name of the program and when it appears, highlight it and press enter.

Keep in mind, this is a very basic and plain setup. As I said earlier, you can set a background picture and you can add some interesting bling using conky. I may go into these things later. But for now, enjoy your minimalist desktop that consumes less than 512 MB of memory.

Tuesday, November 26, 2024

Building a Firefox Kiosk

 In my home lab I have been experimenting with various types of virtual machines. Mostly this has been complete operating systems. However one of the things Broker servers can do for you is give access to single applications, without the need for complete operating systems. Broker software like VMWare Horizon is expensive, but honestly, something like Remmina, which is a multi protocol desktop connection client, serves the same purpose.

In this example, I am setting up Firefox as a app, when the VM is launched Firefox is all the user has access to. If you wanted to, you could install this setup on a PC and just use it as a kiosk, no virtualization is really needed.

The first step is installing Debian 12, you can use Ubuntu server as well. We want a minimal install, no extra software outside of ssh server, not even a desktop environment. The resource requirements are very low; 1 core, 2 GB of RAM and 8 GB of storage will be more than enough. Once you are done, log in as root and install the needed software

apt update && apt upgrade

apt install sudo firefox-esr xorg openbox lightdm tigervnc-standalone-server tigervnc-common

Once that is done you will need to add the kiosk user, which is the account which the system will automatically log into when anyone accesses the virtual machine.

useradd kiosk

Next, enter the kiosk user account;

su - kiosk

Now we are going to make 2 confiuration files, one for VNC so the account can be accessed remotely and one for Openbox, which is the window manager we will use.

mkdir .vnc

nano .vnc/config

Enter the following text into the file, then press ctrl-x, save the file and exit.

session=openbox
geometry=1200x720
localhost
alwaysshared

Then move on to Openbox;

mkdir -p .config/openbox

nano .config/openbox/autostart

Enter the following text into the file, then press ctrl-x, save the file and exit.

env DISPLAY=:1 firefox-esr -kiosk 'http://url' &

If you want to setup a different application, this is the place to do it. Firefox can be replaced with Chrome or LibreCalc, just make sure the appropriate software is installed. Go a head and exit the kiosk user account by typing exit and you will be back in the root account.

We now want to give over display :1 to the kiosk user so when when someone logs in via RDP, Firefox will display on the VNC connection instead of the local display.

nano /etc/tigervnc/vncserver.users

Enter the following text into the file, then press ctrl-x, save the file and exit.

 :1=kiosk

The next step is to make it so the system booting directly into the kiosk user account and starts the VNC server.

 nano /etc/lightdm/lightdm.conf

Go to the bottom of the files and add these lines, then press ctrl-x, save the file and exit;

[SeatDefaults]
autologin-user=kisok
user-session=openbox
[VNCServer]
enabled=true
command=/usr/bin/Xvnc -rfbauth /etc/vncpasswd
port=5901
width=1200
height=720
depth=32

Finally, we want to setup the VNC password, that will be required when the user initiates a VNC connection.

vncpasswd /etc/vncpasswd

Now, reboot the system. On the local display, you will get a blank screen, if you right click on the background, you should get a menu. When you access it with VNC, Firefox should automatically start up in kiosk mode.

Tuesday, November 19, 2024

Installing VNC Server software into Debian 12

 Something that should be easy to do in Linux is getting VNC server software up and running without too much problem, except its not. All the instructions I found used TightVNC or TigerVNC and for whatever reason required the installation of XFCE to make work. XFCE is not bad really, but it is not the desktop environment that I normally used.

This got me to wondering whatever happened to vino, which was a VNC package I used years ago but no longer seemed to be in favor. I looked around and although it is still available it is no longer being maintained. Further, because of a bug, the last person who worked on it, removed the configuration dialog, which forced the user to configure it with a command line tool. Ultimately though, it is still pretty easy to install and get running without all the extra hoops needed for TightVNC or TigerVNC.

sudo apt install vino
gsettings set org.gnome.Vino prompt-enabled false

Then run this command to make sure the prompt is disabled.

gsettings list-recursively org.gnome.Vino

Finally, add this to your startup programs and reboot the system;

/usr/lib/vino/vino-server --display=:0 &

That is pretty much it. You should now be able to access the desktop with Remmia or similar using port 5900.

Saturday, July 20, 2024

10 things to do after you get your ClockworkPi uConsole

Note: For a more up to date version of this post, please see my github.

https://github.com/cjstoddard/Clockworkpi-uConsole

Unless you bought your uConsole from ebay for way too much money or you bought it from a sketchy Alliexpress seller, you probably waited months to receive it. Once you have it, the question is, what now? Well, The first thing you probably did was  assemble it, I am not going to cover that, there are plenty of Youtube videos out there for that. I am going to cover the things I had to do after I assembled it to get it where I wanted it to be in terms of software and usability. Here are the 10 things you can do to improve your uConsole experience. This list does require some working knowledge of Linux and Raspberry Pi's in general.

1. Get the Community OS image

The first thing t do is either boot to the SD card sent with the uConsole, if you did not get an SD card, get a 32GB SD card and download the stock image.

https://github.com/clockworkpi/uConsole/tree/master#uconsole-os-images

Burn it to the SD card and boot your uConsole with it. Test it out, make sure everything works. Now shut it down, remove this card and set it aside. This is your base line, if something goes wrong you can always boot off this SD card to make sure your problem is not just wonky software.

Next get a 64, 128 or bigger SD card, a 32 GB SD will fill up fast. Go download the community image.

https://forum.clockworkpi.com/t/bookworm-6-6-y-for-the-uconsole-and-devterm/13235

This image is based on a much newer version of the Raspberry Pi image along with an updated kernel. Burn this image to the larger SD card. Use it to boot up your uConsole and make sure everything works.

2. Update your system

Having an up to date system is paramount for any system, run these commands on a regular basis.

sudo apt update

sudo apt upgrade

3. Install useful programs

The first set of programs are text mode programs that I find useful, the second set are GUI programs I use. Adjust according to taste.

sudo apt install sudo mc links cmus htop neofetch tmux ffmpeg net-tools build-essential lame zsh mailutils git ufw default-jre tty-clock calcurse git wget curl flex bison bc libavcodec-extra -y
sudo apt install synaptic tilix audacious flameshot thunderbird filezilla transmission remmina gdebi thonny mozo vlc zim code -y

4. Change Desktop Environment (DE)

I am not a big fan of Wayfire or Wayland. If you want to change your DE to something else, use Tasksel to install the DE of your choice. I would also select Debian desktop environment, this will install things like LibreOffice and GIMP, but if you prefer a minimal setup, then leave it unchecked.

sudo tasksel
If you do this, the default Display Manager does not let you change your DE, for that you will need to install sddm.
sudo apt install sddm
The problem with sddm is when you reboot it will be sideways, so follow the next set of instructions to correct the screen orientation for sddm before you reboot.
sudo echo "xrandr --output DSI-1 --rotate right" >>  /usr/share/sddm/scripts/Xsetup

sudo echo "[X11\]" >> /var/lib/sddm/state.conf

sudo echo "DisplayCommand=/usr/share/sddm/scripts/Xsetup" >> /var/lib/sddm/state.conf

Once you have logged into your new DE, you will likely have to go to the display settings and rotate the display.

5. Safely Overclock your uConsole

The Raspberry Pi Compute Module CPU speed is 1.5 Ghz, and the GPU speed is 500 Mhz.  Most people find this barely usable. You can kick this up by overclocking your CPU and GPU. I have done this many times and I have never had a problem with these settings. While this speed is still not great, you will find the system much more usable. Run the following command;

sudo nano /boot/firmware/config.txt
add these lines to the bottom of the file, save and reboot.
over_voltage=6
arm_freq=2000
gpu_freq=750
gpu-mem=256
After your reboot run;

vcgencmd measure_clock arm
To make sure your CPU is running at 2 Ghz. You can try to set the CPU speed higher using arm_freq=2147, but not all devices will handle this speed gracefully. If you are going to experiment, please do so carefully and don't blame me if your shit breaks.

6. Setup Firewall

If you are going to be using your uConsole in public places, you will want to take some steps to secure it from bad actors. If you have not installed ufw yet, do so now with "apt install ufw".  Before you enable the firewall, you will want to allow ssh connections through your firewall so you can connect to it remotely.

sudo ufw allow ssh
sudo ufw enable

7. Secure ssh access to your system

Next you will want to setup your uConsole so it will only accept ssh connections from system you want it to. First log into your uConsole from the system you want to access it from, then log back out, then run the following command to generate a private and public key set.

ssh-keygen

Just hit enter three times to generate the keys. Next you will want to copy your public key to your uConsole with the following command;

ssh-copy-id remote_username@remote_server_ip_address

Now you should be able to log in using ssh, but the uConsole will not require a password. Repeat these steps from each machine you want to remotely access the uConsole from. Once you have done that, you will now want to disable password authentication so that only connections from systems that the uConsole has a key for will be allowed to log in. Run the following command;

sudo nano /etc/ssh/sshd_config

Search for the line "#PasswordAuthentication yes", delete the # and change yes to no. Save the file and then reboot the system.

8. Install Flatpak

Raspberry Pi OS has the same issue as Debian, the packages tend to fall behind long before a new release is made.  If you have programs that you want to stay up to date on, Flatpak is the way to do it. If you have not installed Flatpak, please do so now with "sudo apt install flatpak". Then to enable the repo run the following command;

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Now you can install programs from the Flatpak repo, which will be more up to date without breaking your install. For instance, if you want to install Discord, run the following;
flatpak install --user --assumeyes flathub com.discordapp.Discord
You can go to https://flathub.org/ to see what programs are available.

9. Get a screen protector

LCD screens are prone to  getting scratched, so this is a necessary step to preserve you investment in this device. Fortunately the uConsole screen is pretty close to the Blackmagic Pocket Cinema 6K Camera in screen size, so almost any screen protector for it will work for a uConsole.

https://www.amazon.com/dp/B07WCQD1NZ?ref=ppx_yo2ov_dt_b_product_details&th=1 

10. Get a carrying case

A nice hard shell is also a good idea. The one I am using is Hermitshell Hard Travel Case. It is designed for VR headsets, but works great for the uConsole and accessories.

https://www.amazon.com/gp/product/B01DVMTJQE/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Bonus. Build Emacs from source

This is not particularly necessary, you could just install it with "apt install emacs" or "flatpak install flathub org.gnu.emacs", but what fun is that. Besides showing your Hacker Street Cred, this is also a good way to stretch the legs of your new uConsole and make sure that the overclock settings are not causing any problems. For this exercise you will need to enable the source repo's in /etc/apt/sources.list and run "sudo apt update".

sudo apt install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev
sudo apt build-dep emacs

flatpak install flathub org.gnu.emacsflatpak install flathub org.gnu.emacs

git clone https://github.com/emacs-mirror/emacs.git
cd emacs
./autogen.sh
mkdir build
cd build
../configure --with-cairo --with-xwidgets --with-x-toolkit=gtk3
make -j4
sudo make install

Doing it this way means you cannot update Emacs using apt or flatpak and you will need to do it manually. I would make shell script out of this and run it once a month or whatever.

cd emacs
git pull
cd build
make -j4
sudo make install

Alternatively, if you prefer Neovim, here is how to build it from source.

sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip curl doxygen
sudo apt build-dep neovim

git clone https://github.com/neovim/neovim.git
cd neovim
make -j4 CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install

Tuesday, July 16, 2024

M5Stack Cardputer

 

On the other side of the cool hardware spectrum from the uConsole, is the M5Stack Cardputer. This is a neat little gadget, with some medicore bits of software. The Cardputer runs about $30, but if you buy it from the manufacturer it will be on a slow boat from China, literally. It is better to grab one off of ebay. I got mine for $45 shipped and had it in 3 days.

In 1985 if you had asked me what a computer would look like in 2025, this is probably what I would have described. Basically what we had back then, maybe slightly more powerful, but definitely smaller. This has a lot in common with the Commodore 64, limited RAM, can only run one program at a time, the main difference being you copy firmware onto the internal storage rather than swap cartridges and it requires a reboot to switch programs.

I do see some potential for this little device, but I struggle to find anything super useful to do with it. It does run Doom pretty well, but beyond that most of the programs pranks and low grade hacking tools. Even the Mp3 players available are not particularly good, mostly because of the under powered hardware. The best program I have found so far is the Pipboy Demo, which does actually have one or two useful features, like a web radio and note pad.

It does have four exposed GPIO pins, one for 3.3v power, one for ground and two for communication, again pretty limited when compared to something like the Rasperry Pi Pico or just about any Arduino.

In theory, this is a neat idea, but in practice, not terribly useful. I think someone needs to port Basic to it and make it easy to swap out programs without rebooting the bloody thing. Until it finds its niche, I suggest skipping this one.

ClockworkPi uConsole, My new favorite toy

 

This is something I ordered months ago and finally received. Clockwork Pi is terrible at getting product out the door, it is so bad, I had basically forgotten that I ordered it. The uConsole hand held costs $189.00 with the Raspberry Pi CM4 board, if you can source your own, they cost $119.00, which is what I suggest you do, simply because you can then get the CM4 with 8 GB of RAM, rather than the 4 GB they send. If you do not want to wait months and months to get one, they regularly become available on ebay, but you will pay a premium for them. You should also be prepared to assemble this yourself, which for me was half the fun.

Things I didn't like:

The screen is a bit small for my eyes, but considering its size, it is a trade off I am willing to make. I am not much of a thumb typist, so the keyboard took some getting use to. The assembly can be a bit tricky and the instructions are a bit vague. The big mistake I made was putting the CM4 in upside down, it would not boot, but I quickly figured the issue out when I saw an actual picture of what it was supposed to look like, so I had to tear it apart again. The default image of the Raspberry Pi OS provided by the company is based on an old version of Debian. Fortunately there is a community image based on the current version of Debian that seems to work really well. Finally, you will find your wifi signal to be weak, it is just a design flaw with positioning of the antenna. It was not a serious problem for me, but if you find it is, there are a couple of hacks out there for fixing the problem.

Things I liked:

This is just fucking cool. On the box it calls the uConsole a "Fantasy Console" and I agree with them. When I very first read Neuromancer back in the late 80's, this was what I envisioned a cyberdeck to looked like, the only thing it is missing is a headset. I like the tiny track ball, it is nicely calibrated for the screen and has a nice feel to it. While the keyboard does take some getting use to, the buttons are very tactile and feel solid. The screen, while a bit small, is very clear with a solid refresh rate. The CM4 with 8 GB of RAM make this a peppy little system, even though the OS does run off an SD card. If your are familiar with the Raspberry Pi 4, runs about the same.

Overall:

I think with some practice this could easily replace my laptop for traveling. Usually when I am out and about, I am not doing anything heavy duty. I don't think I could do any heavy lifting on this system, but for web browsing, email, light document creation and quick programing projects, this would exceed my expectations. Honestly, this thing is a work of art. It is beautiful to behold and a heck of a lot of fun to put together.

Tuesday, June 18, 2024

Radxa X2L Single Board Computer Part 2

I have been experimenting with the Radxa X2L One of the conclusions I have come to is the Picomite Basic firmware is easier to work with on an RP2040 than MircoPython or Circuit Python. I am aware that the Basic programing language is not exactly in vogue these days and Python is superior in almost every way, but really no programing language beats Basic for rapid prototyping. On top of that, I really do like this Basic implementation, it keeps a lot of what made the old 1980's Basic fun, while adding modern features.

  https://geoffg.net/picomite.html

 To keep everything in line, I also opted to use FreeBasic on the Intel side of this system. FreeBasic is a pretty good implementation of the Basic language and even has some switches to make it compatible with old Basic code.

 https://www.freebasic.net/

This project is going to show you how to use FreeBasic to retrieve the IP address of your system in Linux, then transmit your IP address to the RP2040, which will then use Picomite MMBasic to display the data on a SSD1309 OLED. This is useful for systems in a DHCP environment IP addresses change frequently. You could also use this method to display CPU temperatures or even a joke of the day.

 The first thing you will need to do is flash the firmware into the RP2040, this is covered in the Picomite documentation and a dozen or so Youtube video, so I will not go over it. The second thing you will need to do is wire your OLED to the RP2040 GPIO pins. Again, there are plenty of tutorials about how to do this.

Next you will need to connect to the RP2040 through the serial port. I use Minicom in Linux

minicom -D /dev/ttyACM0

Finally before we can start programming, we need to configure the Picomite software to use I2C and the SSD1306 OLED. You do this by typing the following two lines into your terminal program, you will only have to do this once.

OPTION SYSTEM I2C GP2, GP19

OPTION LCDPANEL SSD1306I2C, LANDSCAPE

The GP2 and GP19 switches tell the software what wires you are using for communication, if you are using different GPIO pins, you will need to adjust your command appropriately. The first one is the SDA pin, the second is the SCL pin.

 Now, in your terminal, type edit and press enter. This will open the built in text editor. Go a head and type this program in.

'RP2040.BAS

CLS
Box 0, 0, 128, 64, 2, RGB(WHITE), RGB(BLACK)
Text 10, 10, "Connected", "L", 1, 1, RGB(WHITE), RGB(BLACK)

Input "IP Address: ", ipaddr$
Text 10, 20, ipaddr$, "L", 1, 1, RGB(WHITE), RGB(BLACK)

 The first line is simply a comment stating the name of the program. I do this because when you save a program to the flash memory, it automatically names it whatever is in the first line. Doing this makes it easy to identify which is which.

The next five lines;

  1. Clear the OLED screen
  2. Draws a framing box around the edge of the display
  3. Writes "Connected" to the screen
  4. It then waits for input
  5. Once it receives input, it writes that input to the OLED.

Once you have typed in the program, or done a copy/paste, press the F1 key to save it. Next type "FLASH SAVE 1", This will save the program to the build in storage, so it can be retrieved later. Lastly, you will want to type "run", you should see is waiting for input, leave it be.

Now open a new terminal, if you have not installed FreeBasic, you should do so now. Type "nano intel.bas" and enter this program.

dim as string ipaddr
open pipe "for input as #1ip -4 addr show | grep wl* | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
        line input #1, ipaddr
close #1

open "/dev/ttyACM0" for output as #1
print #1, ipaddr
close #1

Each line of this program

  1. Defines the variable ipaddr as a string
  2. Runs a shell command to retrieve the IP address of the system
  3. Sets the ipaddr variable to the IP address of the system
  4. Closes the pipe used for running the shell command
  5. Opens the serial port so it can be written to
  6. Transmits the ipaddr variable to the RP2040
  7. Closes the serial port

Once the program has been written, press Ctrl-x, press Y and then enter. This will save the program. To compile the program, type "fbc intel.bas", you should now have an intel executable, simply type "./intel" and press enter. If all went well, you should see the IP address appear in the minicom terminal and on the OLED.

If you want this to run each time the system boots up, type "OPTION AUTORUN 1" into the minicom terminal. This will tell the RP 2040 to run the program in slot 1 on boot up. Then copy the intel executable to /usr/local/bin and add it to you startup programs.

That is pretty much it. You will still have two slots on the RP2040 to save other programs. This is a pretty good start to making the RP2040 useful to you when using the Radxa X2L. I kind of feel like all computers should have an RP2040 built in.

 

Saturday, June 1, 2024

Garbage Terminal: Part 3

 

So, I have this more or less built out, at least in its draft form. The 3D printing process did not go particularly well, which is not a surprise, I have a cheap printer and a very drafty house, so getting a good clean print is rather difficult. However, for version 0.95 I am not going to complain much. It pretty much does what I need it to do and it was built entirely out of parts I had on hand.

The first question of course, is it usable? Well, yes, however is it practical? No. Honestly I would not try to do any meaningful work on this terminal at all. It does not feel comfortable to hold, nor does the keyboard feel right. and the screen is too small for my old eyes.

On top of the feel, the Raspberry Pi Zero is just not designed to be useful in this sort of capacity. The CPU is too slow and the memory is too limited. If I were buying the parts for this today, I would have went for a Raspberry Pi 4 or 5 and a much better miniature keyboard, but even then I am not sure it would be terribly useful for anything, even with a GUI and a touchscreen.

Of course this also leads me to wonder if buying a professionally built hand terminal would be all that useful too me either. There is nothing this can do that a laptop can't do or heck, a bit of hacking and my phone could do most of it. Both of those options would be more useful and more comfortable to use. So yeah, realistically I think I will pass on the idea of a hand terminal.


Sunday, May 26, 2024

Garbage Terminal: Part 2

First things first, I found out that 3 AA batteries will not in fact power a Raspberry Pi Zero with an LCD screen attached. My wife offered up her Jackery Mini battery bank as her contribution to this project. Thankfully this works great. Second things second, I have been trying to work out a 3D printed case for this mess, but so far I have not had a lot of luck.


 This is the current state of the project. It is fully functional, but as you can see, it is waiting for some sort of case. The biggest problem with this build is the keyboard. I remembered why I never used it in a project, it sucks to type on. The size is not the problem, it is the buttons themselves that are the problem.

As you can see here, without the 3D printed cover, the buttons are literally little finger hating buttons. The cover makes it more tolerable, no let me rephrase that, the cover makes it usable. The downside of course is the cover also makes it harder to read the the letters, but if you are going to use this keyboard, the cover is an absolute must.


 

The instructions for getting the keyboard to work are here;

https://github.com/ian-antking/cardkb

The STL files for the keyboard cover are here;

 https://www.thingiverse.com/thing:3359571

Installing the  Pimoroni HyperPixel 4.0" LCD is not terribly difficult, the instructions for getting it to work are here;

https://github.com/pimoroni/hyperpixel4/issues/177


One of the issues I ran into, was the Pimoroni HyperPixel 4.0" LCD screen will not work if I2C is enabled on the Raspberry Pi with the raspi-config tool. I think the driver for the LCD hijacks I2C in some way. This is fine though, because it seems to provide its own I2C driver and a place on the back to attach devices. The keyboard shows up on bus 11 for me. Which can be verified easily enough with "sudo i2cdetect -y 11". 

The screen also does not power off automatically when the Pi is shutdown, which is a problem for battery life. To make this happen run the following command;

 sudo nano /etc/systemd/system/hyperpixel4-backlight.service

Paste the following into the file and save it.

[Unit]
Description=Sets up gpio-poweroff to handle Hyperpixel backlight upon shutdown/reboot
ConditionPathExists=/usr/bin/hyperpixel4-init
ConditionPathExists=/boot/overlays/gpio-poweroff.dtbo
ConditionPathExists=/usr/bin/dtoverlay
DefaultDependencies=no
Before=umount.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c '/sbin/rmmod gpio-backlight;/usr/bin/dtoverlay /boot/overlays/gpio-poweroff.dtbo gpiopin=19 active_low=1'
[Install]
WantedBy=reboot.target halt.target poweroff.target

 Followed by the following commands;

sudo systemctl enable hyperpixel4-backlight.service

sudo systemctl start hyperpixel4-backlight.service

One other issue I had, although not show stopping was annoying. When the Pi booted up I was getting "Boot errors: reached target sound card and error stopped target sound card". This is kind of to be expected because the Pi Zero does not have any sound device. To fix this open /boot/config.txt;

sudo nano /boot/config.txt

Find;

dtoverlay=vc4-kms-v3d

and change it to;

dtoverlay=vc4-kms-v3d,noaudio

Then find;

 dtparam=audio=on

and change it to;

dtparam=audio=off

 After the next reboot, you should not see those errors anymore.

I think that sums up the initial build pretty well. Once I have a case for it and had a chance to actually use it, I will do a part three and discuss software, battery life and usability.

Saturday, May 25, 2024

Radxa X2L Single Board Computer

 I will be coming back to the Garbage Terminal shortly, I had some hiccups with my original design, which is what happens when you pull a bunch of junk out of a parts box.

In the mean time, I have been messing around with a new bit of hardware I bought. Up until version 5, I was a big fan of the Raspberry Pi. With the Raspberry Pi 5 however, I felt it had jumped the shark. Yes, it was a good product, but it has reached the point where they are just as expensive as a low end computer and therefore lost much of their original luster. Enter the Radxa X2L, powered by an 4 core Intel Celeron Processor J4125. This little board costs as little as $39 for the 2GB of RAM version, I picked up the 4GB version for $52 and there is an 8GB version for $82. You can also get them with various amounts of EMMC storage. The really cool thing about this board is it comes with an RP2040 microprocessor built in, along with exposed GPIO headers very similar to the Raspberry Pi Zero.

The first thing I should say about this is don't bother getting it with any EMMC storage. EMMC is stupid slow and for about the same cost as the upgrade, you can get a 128GB NVME M.2 SSD, trust me, you will be happier. Second don't bother getting the M.2 wifi card either, they cost $20-$30 plus shipping, it is just not worth it. Instead just go find a $10 wifi dongle on Amazon, yes it takes a USB port, but the price makes it worth it.

Things I liked:

This board is basically a complete computer the size of my cell phone. It is a larger than an Raspberry Pi, but still reasonably small, so you can mount it on the back of a monitor or an out of the way corner of your media center, even with a 3D printed case.

I love having an RP2040 integrated into this board, I think all computer should have this.

The BIOS has CSM options for booting non UEFI operating systems like FreeDOS. Fewer and fewer systems are coming with this option and I am glad to see Radxa decided to include it.

Considering this is a Celeron CPU, it performs pretty well. X.org runs smoothly, Chrome and Firefox render well and no problems with Youtube.

Things I didn't like:

 When I was messing around with the RP2040, I found some problems than annoyed me. First off, it does not play well with Micropython, I could not get any I2C hardware to work. I had to use CircuitPython instead. 

The second thing I found was I could not chain multiple I2C devices together. I should be able to chain a dozen devices, but I could not even get two to work properly.

I am not sure what the issue here is, I know it is not the RP2040 itself, I have several Raspberry Pi Pico's and a couple of Waveshare Pico Zero's, I2C and Micropython  work flawlessly on these devices. I should not be having these problems and the GPIO is really the selling point of this board, otherwise I might as well just buy a Mini PC.

What am I going to do with this?

The short answer is I don't know. The longer answer is, I have a couple of idea, like maybe a Cyberdeck, ie a custom built hand made computer with flare and style. However, before I start on something, I need to work out the RP2040/GPIO problems I am having. I am currently working on getting some form of two way communication going via serial between the intel processor and the RP2040, once I have worked that out, I will post about how I did it, along with source code.

Mastodon