KD0YTE's Ham Radio, Linux, and other stuff.

Entries from April 2024.

mobaxterm Rocks
8th April 2024

I sometimes use a terminal on a windows machine to log into an ssh session on linux host.
Tonight I discovered MobaXterm at https://mobaxterm.mobatek.net/
This is a great terminal program. By default runs an xserver so you can run xwindows apps (even without using the -X switch)
also has a directory structure at the left that allows quick navigation to other places on the host.

It also honors linux colors which my previous fave tabby has issues with.

Give it a try!

Tags: linux.
Temperature recording with the pi
17th April 2024

I have a semi sheltered area that I want to put some plants in but springtime in NE MO is hit and miss and I dont want to damage the plants.
I also have a garage that is unheated that i want to monitor how cold it gets this winter.
So I fixed up raspberry pi zeros to keep a temp monitor of those areas.

installed pi os 32 bit lite version

On it installed pyhon3-pip
sudo apt-get install python3-dev python3-pip
sudo python3 -m pip install --upgrade pip setuptools wheel

Also installed the ADafruit library for the DHT11
sudo pip3 install Adafruit_DHT

Then i came up with a script to read from the sensor and report temp in Fahrenheit and humidity
named it tempf.py

import Adafruit_DHT
import time

DHT_SENSOR = Adafruit_DHT.DHT11
DHT_PIN = 4

humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN)
tempf = (temperature*1.8)+32
print (today, ",", now, ",", tempf, " ,", humidity )
# print (humidity, "%,")

2nd found a script to output current date and time
named it dateit.py

  1. Import the 'datetime' module to work with date and time
    import datetime
  1. Get the current date and time
    now = datetime.datetime.now()
  1. Create a datetime object representing the current date and time
  1. Display a message indicating what is being printed
    print("Current date and time : ")
  1. Print the current date and time in a specific format
    print(now.strftime("%Y-%m-%d %H:%M:%S"))
  1. Use the 'strftime' method to format the datetime object as a string with the desired format

Then I wrote a bash script to call those 2 and send output to tempout.txt
temprec.sh

#!/bin/bash

python dateit.py >> ftemp.txt
python tempf.py >> ftemp.txt

Finally setup a crontab to run it every 5 minutes
crontab -e

*/5 * * * * /home/pi/temprec.sh

This could probably be done from 1 single python script but I am just not that good with python.
This works well. I might change to a longer interval for readings.

Output looks like this

2024-09-20 , 10:00:02.247606 , 78.80000000000001 , 64.0
2024-09-20 , 11:00:01.831673 , 82.4 , 61.0

Tags: linux, raspberry pi.
Screen command basics
18th April 2024

The screen command is one of those linux commands that many newbs don't know about or don't see the usefulness of right away.
It is actually quite powerful.
If you ssh into a linux machine and want to start a process that stays running for a long time if your ssh session dies or
you need to log out the process will be killed.
However with screen you can keep it running in the background.

How to use screen:

You may need to install screen as it isn't installed by default on many distro's

Say you have a command that looks like this.
python dht11.py for example.

type screen python dht11.py
Screen will start the process running.

press ctrl A and then d to detach the screen and be returned to the command prompt.
The process is still running and you can log out of your ssh session.

Log back in and type screen -r to bring the process back to your terminal.

While i used an ssh session in my example the same applies if you are running an X terminal locally and need to close the terminal for a while.

Tags: linux.
pi5 and nvme
24th April 2024

So once the raspberry pi became availabe I purchased one.
The first pi I ever owned was a raspberry pi 2, it was a slug bug except for the simplest of tasks.
I have owned several pi 3's, a pi zero and a pi zero 2 w, and several pi 4's.
The pi 3 was much more useful than the pi 2 and the pi 4 was approaching usable for desktop use.

When I purchased the pi 5 I had heard the hype about how it was much faster than the pi 4 but to be
honest I was dissapointed. It was a little faster but not much. and for some reason about every couple of
months it would bork the sd card and I would have to reinstall. I finally purchased one of those high
endurance sd cards thinking that they would last longer. However I decided about that time to try an
nvme hat from geekworm and a patriot gen3 nvme drive.
I set boot to do nvme first then booted from the nvme drive cloned from the sdcard. (BOOT_ORDER=0xf416)
in /boot/firmware/config.txt
Holy Cow! What a difference. suddenly my pi 5 was a speed demon. chrome which always took several seconds to
load was now popping right up.

I also enabled gen3 speeds which is expiramental. that makes it faster but not profoundly faster.

If you are running pi5 from an SD Card, I highly reccomend you try nvme.
I will come back here with stabilty results after using it for a few months.

Have fun!

Tags: linux, raspberry pi.

RSS Feed