-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,7 +92,7 @@ An operating system (OS) is fundamental software that manages computer hardware | |
- User interface: Providing a way for users to interact with the computer | ||
2. **Components**: | ||
- Kernel: The core of the OS that manages hardware resources | ||
- Shell: The user interface for interacting with the OS | ||
- bash: The user interface for interacting with the OS | ||
- File system: Organizes and manages data storage | ||
- Device drivers: Software that allows the OS to communicate with hardware | ||
|
||
|
@@ -160,11 +160,11 @@ The easiest way to interact with the Rasp-Zero is via SSH ("Headless"). You can | |
1. Find your Raspberry Pi's IP address (for example, check your router). | ||
|
||
2. On your computer, open a terminal and connect via SSH: | ||
```shell | ||
```bash | ||
ssh username@[raspberry_pi_ip_address] | ||
``` | ||
Alternatively, if you do not have the IP address, you can try the following: | ||
```shell | ||
```bash | ||
ssh [email protected] | ||
``` | ||
for example, `ssh [email protected]` , `ssh [email protected]` , etc. | ||
|
@@ -173,19 +173,19 @@ The easiest way to interact with the Rasp-Zero is via SSH ("Headless"). You can | |
|
||
When you see the prompt: | ||
|
||
```shell | ||
```bash | ||
mjrovai@rpi-5:~ $ | ||
``` | ||
|
||
It means that you are interacting remotely with your Raspi. | ||
It is a good practice to update/upgrade the system regularly. For that, you should run: | ||
|
||
```shell | ||
```bash | ||
sudo apt-get update | ||
sudo apt upgrade | ||
``` | ||
You should confirm the Raspi IP address. On the terminal, you can use: | ||
```shell | ||
```bash | ||
hostname -I | ||
``` | ||
|
||
|
@@ -198,7 +198,7 @@ When you want to turn off your Raspberry Pi, there are better ideas than just pu | |
|
||
For safety shut down, use the command line: | ||
|
||
```shell | ||
```bash | ||
sudo shutdown -h now | ||
``` | ||
|
||
|
@@ -220,43 +220,43 @@ Let's create a text file on our computer, for example, `test.txt`. | |
|
||
To copy the file named `test.txt` from your personal computer to a user’s home folder on your Raspberry Pi, run the following command from the directory containing `test.txt`, replacing the `<username>` placeholder with the username you use to log in to your Raspberry Pi and the `<pi_ip_address>` placeholder with your Raspberry Pi’s IP address: | ||
|
||
```shell | ||
```bash | ||
$ scp test.txt <username>@<pi_ip_address>:~/ | ||
``` | ||
|
||
> Note that `~/` means that we will move the file to the ROOT of our Raspi. You can choose any folder in your Raspi. But you should create the folder before you run `scp`, since `scp` won’t create folders automatically. | ||
|
||
For example, let's transfer the file `test.txt` to the ROOT of my Raspi-zero, which has an IP of `192.168.4.210`: | ||
```shell | ||
```bash | ||
scp test.txt [email protected]:~/ | ||
``` | ||
![](images/png/transfer_file.png) | ||
I use a different shell profile to differentiate the terminals. The above action happens **on your computer**. Now, let's go to our Raspi (using the SSH) and check if the file is there: | ||
I use a different profile to differentiate the terminals. The above action happens **on your computer**. Now, let's go to our Raspi (using the SSH) and check if the file is there: | ||
|
||
![](images/png/list_archives.png) | ||
|
||
##### Copy files from your Raspberry Pi | ||
|
||
To copy a file named `test.txt` from a user’s home directory on a Raspberry Pi to the current directory on another computer, run the following command **on your Host Computer**: | ||
|
||
```shell | ||
```bash | ||
$ scp <username>@<pi_ip_address>:myfile.txt . | ||
``` | ||
|
||
For example: | ||
|
||
On the Raspi, let's create a copy of the file with another name: | ||
```shell | ||
```bash | ||
cp test.txt test_2.txt | ||
``` | ||
And on the Host Computer (in my case, a Mac) | ||
```shell | ||
```bash | ||
scp [email protected]:test_2.txt . | ||
``` | ||
|
@@ -266,7 +266,7 @@ scp [email protected]:test_2.txt . | |
Transferring files using FTP, such as [FileZilla FTP Client](https://filezilla-project.org/download.php?type=client), is also possible. Follow the instructions, install the program for your Desktop OS, and use the Raspi IP address as the `Host`. For example: | ||
```shell | ||
```bash | ||
sftp://192.168.4.210 | ||
``` | ||
|
@@ -278,7 +278,7 @@ and enter your Raspi `username and password`. Pressing `Quickconnect` will open | |
Using `htop`, a cross-platform interactive process viewer, you can easily monitor the resources running on your Raspi, such as the list of processes, the running CPUs, and the memory used in real-time. To lunch `hop`, enter with the command on the terminal: | ||
```shell | ||
```bash | ||
htop | ||
``` | ||
|
@@ -292,27 +292,27 @@ By default, the Rapi-Zero's SWAP (Swp) memory is only 100MB, which is very small | |
|
||
First, turn off swap-file: | ||
|
||
```shell | ||
```bash | ||
sudo dphys-swapfile swapoff | ||
``` | ||
|
||
Next, you should open and change the file `/etc/dphys-swapfile`. For that, we will use the nano: | ||
|
||
```shell | ||
```bash | ||
sudo nano /etc/dphys-swapfile | ||
``` | ||
|
||
Search for the **CONF_SWAPSIZE** variable (default is 100) and update it to **2000**: | ||
Search for the **CONF_SWAPSIZE** variable (default is 200) and update it to **2000**: | ||
|
||
```shell | ||
```bash | ||
CONF_SWAPSIZE=2000 | ||
``` | ||
|
||
And save the file. | ||
|
||
Next, turn on the swapfile again and reboot the Rasp-zero: | ||
|
||
```shell | ||
```bash | ||
sudo dphys-swapfile setup | ||
sudo dphys-swapfile swapon | ||
sudo reboot | ||
|
@@ -332,7 +332,7 @@ The Raspi is an excellent device for computer vision applications; a camera is n | |
|
||
1. Power off the Raspi: | ||
|
||
```shell | ||
```bash | ||
sudo shutdown -h no | ||
``` | ||
|
||
|
@@ -345,7 +345,7 @@ sudo shutdown -h no | |
3. Power on again and run the SSH | ||
3. To check if your USB camera is recognized, run: | ||
|
||
```shell | ||
```bash | ||
lsusb | ||
``` | ||
|
||
|
@@ -355,7 +355,7 @@ You should see your camera listed in the output. | |
|
||
5. To take a test picture with your USB camera, use: | ||
|
||
```shell | ||
```bash | ||
fswebcam test_image.jpg | ||
``` | ||
|
||
|
@@ -367,7 +367,7 @@ This will save an image named "test_image.jpg" in your current directory. | |
|
||
Open a terminal **on your host computer** and run: | ||
|
||
```shell | ||
```bash | ||
scp [email protected]:~/test_image.jpg . | ||
``` | ||
|
||
|
@@ -379,7 +379,7 @@ scp [email protected]:~/test_image.jpg . | |
7. If the image quality isn't satisfactory, you can adjust various settings; for example, define a resolution that is suitable for YOLO (640x640): | ||
|
||
```shell | ||
```bash | ||
fswebcam -r 640x640 --no-banner test_image_yolo.jpg | ||
``` | ||
|
||
|
@@ -401,13 +401,13 @@ For stream video (which is more resource-intensive), we can install and use mjpg | |
|
||
First, install Git: | ||
|
||
```shell | ||
```bash | ||
sudo apt install git | ||
``` | ||
|
||
Now, we should install the necessary dependencies for mjpg-streamer, clone the repository, and proceed with the installation: | ||
|
||
```shell | ||
```bash | ||
sudo apt install cmake libjpeg62-turbo-dev | ||
git clone https://github.com/jacksonliam/mjpg-streamer.git | ||
cd mjpg-streamer/mjpg-streamer-experimental | ||
|
@@ -417,15 +417,17 @@ sudo make install | |
|
||
Then start the stream with: | ||
|
||
```shell | ||
```bash | ||
mjpg_streamer -i "input_uvc.so" -o "output_http.so -w ./www" | ||
``` | ||
|
||
We can then access the stream by opening a web browser and navigating to: `http://<your_pi_ip_address>:8080`. In my case: http://192.168.4.210:8080 | ||
We can then access the stream by opening a web browser and navigating to: | ||
|
||
`http://<your_pi_ip_address>:8080`. In my case: http://192.168.4.210:8080 | ||
|
||
We should see a webpage with options to view the stream. Click on the link that says "Stream" or try accessing: | ||
|
||
```shell | ||
```bash | ||
http://<raspberry_pi_ip_address>:8080/?action=stream | ||
``` | ||
|
||
|
@@ -445,31 +447,31 @@ Here is another example of a v2 Camera Module, which has a **Sony IMX219** 8-meg | |
|
||
Any camera module will work on the Raspis, but for that, the `onfiguration.txt` file must be updated: | ||
|
||
```shell | ||
```bash | ||
sudo nano /boot/firmware/config.txt | ||
``` | ||
|
||
At the bottom of the file, for example, to use the 5MP Arducam OV5647 camera, add the line: | ||
|
||
```shell | ||
```bash | ||
dtoverlay=ov5647,cam0 | ||
``` | ||
|
||
Or for the v2 module, wich has the 8MP Sony IMX219 camera: | ||
|
||
```shell | ||
```bash | ||
dtoverlay=imx219,cam0 | ||
``` | ||
|
||
Save the file (CTRL+O [ENTER] CRTL+X) and reboot the Raspi: | ||
|
||
```shell | ||
```bash | ||
Sudo reboot | ||
``` | ||
|
||
After the boot, you can see if the camera is listed: | ||
|
||
```shell | ||
```bash | ||
libcamera-hello --list-cameras | ||
``` | ||
|
||
|
@@ -481,7 +483,7 @@ libcamera-hello --list-cameras | |
|
||
Let's capture a jpeg image with a resolution of 640 x 480 for testing and save it to a file named `test_cli_camera.jpg` | ||
```shell | ||
```bash | ||
rpicam-jpeg --output test_cli_camera.jpg --width 640 --height 480 | ||
``` | ||
|
@@ -498,7 +500,7 @@ While we've primarily interacted with the Raspberry Pi using terminal commands v | |
1. Enable the VNC Server: | ||
- Connect to your Raspberry Pi via SSH. | ||
- Run the Raspberry Pi configuration tool by entering: | ||
```shell | ||
```bash | ||
sudo raspi-config | ||
``` | ||
- Navigate to `Interface Options` using the arrow keys. | ||
|
@@ -518,7 +520,7 @@ While we've primarily interacted with the Raspberry Pi using terminal commands v | |
3. Once installed, you should confirm the Raspi IP address. For example, on the terminal, you can use: | ||
```shell | ||
```bash | ||
hostname -I | ||
``` | ||
|
@@ -548,15 +550,15 @@ While we've primarily interacted with the Raspberry Pi using terminal commands v | |
## Updating and Installing Software | ||
1. Update your system: | ||
```shell | ||
```bash | ||
sudo apt update && sudo apt upgrade -y | ||
``` | ||
2. Install essential software: | ||
```shell | ||
```bash | ||
sudo apt install python3-pip -y | ||
``` | ||
3. Enable pip for Python projects: | ||
```shell | ||
```bash | ||
sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED | ||
``` | ||
|