Raspberry Pi Digital Clock, written in Python programming language

This was challenging for me to get into Python programming and setting Raspberry Pi to my own needs. I know this is overkill but also this is a path for future projects for example info display which can display time, the temperature in your place, and maybe turn on lights in the living room and the list goes on and on.

Hardware requirements:

Raspberry Pi
Waveshare 5inch HDMI LCD
MicroSD Card
PSU for Raspberry Pi

1. create micro sd card with raspberry pi os lite

Here we need to enter the path and name of the image we want to write to the sd card instead of “/ source_image_file” and instead of “/ destination_disk_drive” we need to enter the path and name of the disk we want to write to.

sudo dd if=/source_image_file of=/destination_disk_drive

2. enable SSH

To be able to access over SSH we need to create an empty file named SSH in the boot partition of our Micro SD card.

sudo touch /media/your_username/boot/SSH

3. setup hostname

sudo nano /media/ebaketa/rootfs/etc/hostname

4. edit the host’s file and replace “myhostname” with the desired hostname:

sudo nano /media/your_username/rootfs/etc/hosts

127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname

5. setup a static IP address

sudo nano /media/your_username/rootfs/etc/dhcpcd.conf

# Example static IP configuration:
interface eth0
static ip_address=192.168.x.xxx/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.x.x
static domain_name_servers=192.168.x.x 8.8.8.8 fd51:42f8:caae:d92e::1

6. edit Raspberry Pi OS configuration file config.txt

These lines below we need to add to “config.txt” to configure 5 inch HDMI LCD. The best is to add lines to the end of the file.

max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
hdmi_drive=1

7. insert micro SD to the target machine, boot OS, and login over SSH

Now we can insert an SD card into Raspberry Pi, connect the power supply and boot into OS.

8. update Raspberry Pi OS

sudo apt update
sudo apt upgrade

9. reboot Raspberry Pi OS and login over SSH

10. start raspi-config tool

sudo raspi-config

change default password
set boot options -> console autologin
set language and regional settings
set keyboarad layout
set time zone

11. reboot Raspberry Pi OS and login over SSH

12. install xorg, xinit, x11-server-utils

sudo apt -y install --no-install-recommends xserver-xorg
sudo apt -y install --no-install-recommends xinit
sudo apt -y install x11-xserver-utils

13. install openbox, lxterminal, lxtask, lxappearance

sudo apt -y install openbox obconf obmenu lxterminal lxtask lxappearance

14. install PyGObject

sudo apt -y install python-gi python-gi-cairo python3-gi python3-gi-cairo gir1.2-gtk-3.0

15. create .bash_profile file and add a line below

touch ~/.bash_profile && sudo nano ~/.bash_profile

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then exec startx; fi

16. create openbox autostart file and add lines below

mkdir ~/.config && mkdir ~/.config/openbox && touch ~/.config/openbox/autostart && sudo nano ~/.config/openbox/autostart

# disable screen saver
xset s off &
xset s -dpms &
# run python digital clock
python ~/Projects/python/digital_clock/digital_clock.py

17. create directories for projects and get projects via wget

mkdir ~/Projects && mkdir ~/Projects/python && mkdir ~/Projects/python/digital_clock && cd ~/Projects/python/digital_clock

wget https://raw.githubusercontent.com/ebaketa/digital_clock/master/digital_clock.py

18. reboot Raspberry Pi OS

And that’s it with the next boot you should have a Raspberry Pi digital clock. If you find any mistakes in commands, please let me know, so I can correct them!

Github repo: https://github.com/ebaketa/digital_clock

Till the next time!

Amazing RPi 4 setup with 250GB SSD and 1.5TB storage space!

Of course, this is not the best and most powerful setup but it is an interesting
solution. All these hard drives I have laying around so I decided to
use them and it is a great addition to Raspberry Pi 4.

So what we do have here:
The first component here is the case for Raspberry Pi 4, Argon One. Very well design aluminum case with controlled fan for cooling and power on/off button. The fan has a little bit annoying sound. This housing is excellent for overclocking Raspberry Pi 4, I’m running all day on 2 GHz without any problem.
The second piece of the puzzle is a USB 3.0 hard drive docking station. Sabrent USB
3.0 4 Bay 2.5″ Hard Drive/SSD Docking Station with Fan. This is excellent for the system drive and for storage. In my system, I’m having 250 GB SSD for
system and programs and three 500 GB hard drives for storage.
I’m pretty happy with this setup, fast boot over SSD and enough space for
storage.
Thanks for visiting!
Till the next time.

How to setup File Server with Raspberry Pi

We are gonna kick off with preparing fresh copy of Raspberry PI OS Lite on empty SD card with Raspberry Pi Imager software. When is all done SD card has to be removed and inserted back into card reader so Windows can see newly created partition. In my case i’m using Notepadd++ to create empty file called “SSH” without file extension and we are gonna save it to boot partition of our SD card.

Because SSH is enabled with placing empty file called SSH in root partition of SD card, we do not need to connect Monitor, Keyboard and  Mouse to our Raspberry Pi. We are gonna be using SSH connection from another computer or even from another Raspberry Pi. From Windows computer we can use PuTTY software and from Linux computer we can to simply from terminal window.
Before we power on our Raspberry Pi, we need to insert SD card into Raspberry Pi,  connect LAN cable to network Router, connect USB hard drive and we are ready to power up Raspberry Pi.
Next step is to find out IP address of our future File Server. Because we didn’t connect monitor to our File Server, the best way to find it is to login into Router and from there read IP address of our File Server.
I’m using Linux terminal for connection to server, but once you are connected commands are the same from Linux or Windows.
To connect from Windows, we need to open the PuTTY software, enter IP address of our File Server and click on Open button.
In the next Window we need to enter valid username and password. Default username for Raspberry Pi OS is “pi” and password “raspberry”.
For Linux computer we need to just open terminal and enter command:
sudo ssh pi@IP_Address
and when asked enter valid password and we are connected. Now we are ready to make necessary changes to our File Server system and install necessary software.
So let’s get started, first we are gonna open raspi config software by typing:

    sudo raspi-config

First option is to change password for “pi” user, so here we can set desired password. Next under Network Options we are gonna change default hostname to our needs, i personally like to change it to “FileServer”.
After changing Hostname, raspi-config software is gonna ask to reboot our new File Server.
In next step we have to login an update our Raspberry Pi OS on our FileServer, so to do that we are gonna enter next two command:
sudo apt update
sudo apt upgrade
Create folder for mounting our USB drive:
sudo mkdir -m 1777 /media/USB_Drive
Edit “fstab” file and add mount point for our USB Drive:
sudo nano /etc/fstab
Add at end of file next line for ntfs formated hard drive:
/dev/sda1    /media/USB_Drive    ntfs    defaults    0    1
Save changes and mount partition with next command:
sudo mount -a
Install samba server:
sudo apt install samba samba-common-bin
Edit samba config and add our share at end of file:

sudo nano /etc/samba/smb.conf

[Network share]

  comment = Network shared folder

       path = /media/USB_Drive
       browseable = yes
       writable = yes
       only guest = no
       create mask = 0777
       directory mask = 0777
       public = yes
       guest ok = yes

Add pi user to samba and set password:
sudo smbpasswd -a pi
Restart samba service:
sudo service smbd restart
And with restarting samba service we are ready to open File Manager and browse our FileServer.
So from now on our server is ready to go, even if you turn off Raspberry Pi, everything is starting automatically with booting Raspberry Pi OS.
Thanks for visiting!
Till the next time.

How to make a fresh copy of micro SD card for Raspberry Pi from Windows 10 operating system

In this article, I will explain how to prepare a micro SD card from Windows 10 with a fresh copy of Raspberry Pi OS, so let’s start:

The first step is to refer the web browser to the official website raspberrypi.org and download the Raspberry Pi Imager software, which we will use to prepare a micro SD card for installing the Raspberry Pi OS on a Raspberry PI computer.

  • Open the Raspberry Pi Imager software on your Windows 10 computer.
  • Click the CHOOSE OS button.
  • Select the version of the OS you want to install.
  • Click the CHOOSE SD CARD button.
  • Select the SD card, which you want to prepare for the installation of the Raspberry Pi OS.
  • Click on WRITE button to start writing to SD card.
  • Wait until writing is complete.

  • Wait a little bit more, until the written data is verified.
  • Clicking the DONE button completes the SD card preparation.
And all we have to do is insert the SD card into the Raspberry Pi and install the Raspberry Pi OS.
Until next time, thanks for visiting!

Raspberry Pi 4 Native USB Boot

It has finally arrived, unfortunately in beta but it still works, RPi 4 Native USB Boot. Say goodby to micro SD. I have been using RPi 4 for about four months or a little more, as a personal computer and I am mostly satisfied. Settings “boot” partition on micro SD card and “root” partition on
SD disk, works without any problems. But recently it has been possible to set up RPi 4 to boot directly from a USB drive!
My RPi 4 Setup (RPi 4, 4GB, Samsung SSD 250GB, USB to S-ATA adapter, sertronic RPI4-ARC-FA case with cooler)

First I found a video on Youtube and tried to make it and I failed. Then an article came out on the portal, so I followed the instructions and again I failed. 
Opsss! What is happening? 
I used NOOBS for OS instead of Raspbian (oooo noooo). So I came to the conclusion that Native USB Boot does not work on NOOBS.
The following is a step-by-step guide on how to set up RPi 4 for Native USB Boot, or to Boot without micro SD.
So let’s get started:
  1. make a fresh copy of micro SD with Raspbian OS (Raspbian Imager, works on Windows, Linux and macOS)
  2. insert micro SD into RPi4 and power on
  3. install OS
  4. update OS:
    • sudo apt update
    • sudo apt full-upgrade
    • sudo rpi-update
  5. reboot RPi
  6. edit rpi-eeprom-update:
    • sudo nano /etc/default/rpi-eeprom-update
    • FIRMWARE_RELEASE_STATUS value from “critical” to “beta”
  7. update firmware:
    • sudo rpi-eeprom-update -d -f /lib/firmware/raspberrypi/bootloader/beta/pieeprom-2020-05-15.bin
  8. reboot RPi
  9. check firmware version:
    • vcgencmd bootloader_version
  10. clone micro SD to USB Drive (SD Card Copier)
  11. shutdown RPi
  12. remove micro SD
  13. power on RPi
And that should be it, now we have an RPi with an SSD that is significantly faster than a micro SD. Lots of fun and I hope this step by step guide is helpful.
Until next time, Thanks for visiting!