osoyoo.com https://osoyoo.com Project Tutorial for Arduino compatible products Tue, 19 Mar 2024 07:29:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to install webcam in Raspberry Pi Bookworm OS https://osoyoo.com/2024/03/19/how-to-install-webcam-in-raspberry-pi-bookworm-os/ https://osoyoo.com/2024/03/19/how-to-install-webcam-in-raspberry-pi-bookworm-os/#respond Tue, 19 Mar 2024 05:57:21 +0000 https://osoyoo.com/?p=57205 ...Read the Rest]]> Hardware:
OSOYOO Web Camera Module for Raspberry Pi
Pi Board: Raspberry Pi 4 (with CSI cable) or Pi 5

Software Installation:
OS: Raspberry Pi Bookworm or Raspberry Pi Legacy Bulleye OS

1)Install utream server
Please run   following commands:

sudo apt install libevent-dev libbsd-dev libcamera-v4l2

sudo apt-get install libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++
wget https://osoyoo.com/driver/v5car/ustreamer.tar.gz
wget https://osoyoo.com/driver/v5car/utbegin.sh
tar -zxvf ustreamer.tar.gz
cd ustreamer 
make

If you feel above commands are too complicated, don’t worry, we have put these commands into a shell script file, you can   simply run following commands to install ustream

wget https://osoyoo.com/driver/v5car/installut.sh

bash installut.sh

2)Start the server
If you are using Bookworm OS,  To start the webcam server, please run following command:

libcamerify ./ustreamer --host 0.0.0.0 --port=8899 --device=/dev/video0 -m yuyv --encoder=m2m-video --device-timeout=5 --buffers=3 --resolution=1280x720 --desired-fps=20

If you feel above command is too long, you can  simply run

bash utbegin.sh

What if I am using legacy Bulleye OS, don’t worry, the installation processing are exactly the same, the only difference is to start the ustreamer server by following commands:

cd ~/ustreamer
./ustreamer –device=/dev/video0 –allow-origin=\* –host=0.0.0.0 –port=8899

Once you started the ustreamer server, you can use your web browser to visit :
http://your_raspberry_pi_ip_address:8899 to see the web camera

If you don’t know your_raspberry_pi_ip_address, please type following command in Raspberry Pi terminal:

hostname -I

For example, if your hostname -I command shows:

192.168.1.19 2604:3d08:507c:c800::639d 2604:3d08:507c:c800:4310:a8e3:a8fc:a5e2 

it means your Pi IP is 192.168.1.19, so you can use
http://192.168.1.19:8899 to see your web camera video stream

]]>
https://osoyoo.com/2024/03/19/how-to-install-webcam-in-raspberry-pi-bookworm-os/feed/ 0
V5 Generic Robot Car for Raspberry Pi: Basic Movement by Raspberry Pi https://osoyoo.com/2024/02/28/v5-generic-robot-car-for-raspberry-pi-basic-movement-by-raspberry-pi/ https://osoyoo.com/2024/02/28/v5-generic-robot-car-for-raspberry-pi-basic-movement-by-raspberry-pi/#respond Wed, 28 Feb 2024 10:55:06 +0000 https://osoyoo.com/?p=57117 ...Read the Rest]]> Motor   Connection:


Circuit Connection:

下图 ENA IN1 IN2 IN3 IN4 ENB 指 Model Y的BOUT 侧控制线


Software Preparation:

Imager utility:

Win32DiskImager utility

Download for free
Format Tool:
SDformatter (Optional)
Download for free
SSH Tool:
PuTTY (for Windows users)
Download for free

Operation System for this robot car:  Raspberry Pi New Bullseye OS.

 
Step 1: Download  Raspberry Pi Bullseye Operation System(OS)  image file from following link:
https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy

Step 2: Connect Wifi

Firstly, Connect Raspberry Pi to your HDMI monitor or TV. Put a keyboard and mouse into Raspberry Pi USB ports. Insert an SD card into the slot on your Raspberry Pi.

Click on the wireless icon top right on the desktop, it should give a list of access points, select your wifi ssid and connect it. Once your Pi is connect to Wifi,

you can hover your mouse to the wifi icon to see your IP address, or your can type hostname -I command in the terminal. Your local ip address  will look like

192.168.50.182 fd00:bc4d:fba4:fea2:c4a1:a409:4853:917d

……

in the above example, 192.168.50.182 is your Raspberry Pi IP Address, you will use it in Step 3) ssh command.

Step 2:  Enable SSH 

press Ctrl-T and open command terminal. Then type :
sudo raspi-config

You will go to the configuration menu, select Interface Options ->SSH -> Yes ->OK ->Finish

Now reboot your Raspberry Pi, you can use Putty or SSH to remotely access raspberry pi.

Step 2:  use putty or ssh to connect your raspberry Pi by typing
ssh pi@192.168.50.182 (this address is from Step 1)

Admin: pi
Password: raspberry

Step 3: Enable I2C

If you have not enable I2C, please run following command to enable I2C.

sudo raspi-config

Then select Interfacing Options->I2C->Yes->Ok->Finish

Step 4: If you don’t have rpi.gpio and adafruit-pca9685 library, use the following command to install the library.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install rpi.gpio



Now install pca9685 and servokit library :
If you are using Bulleye OS, please run following commands:

sudo pip install adafruit-circuitpython-pca9685
sudo pip install adafruit-circuitpython-servokit

If you are using Bookworm system in Raspberry Pi 5, please run following commands:

sudo pip install  --break-system-packages adafruit-circuitpython-pca9685
sudo pip install  --break-system-packages adafruit-circuitpython-servokit

Step 5: Type following command to download the sample code.

wget https://osoyoo.com/driver/v5car/picar-basic.py

Then run following command:

python picar-basic.py


After the above python is running, your motors will move forward for 0.75 seconds and then move backward for 0.75 seconds, turn left for 0.75 seconds and turn right for 0.75 seconds then stop.

]]>
https://osoyoo.com/2024/02/28/v5-generic-robot-car-for-raspberry-pi-basic-movement-by-raspberry-pi/feed/ 0
OSOYOO 2WD Robot Car Starter Kit Lesson 5: Remote Control with Wi-Fi APP https://osoyoo.com/2024/02/25/osoyoo-2wd-robot-car-starter-kit-lesson-3-remote-control-with-wifi-app/ https://osoyoo.com/2024/02/25/osoyoo-2wd-robot-car-starter-kit-lesson-3-remote-control-with-wifi-app/#respond Sat, 24 Feb 2024 16:27:02 +0000 https://osoyoo.com/?p=57088 ...Read the Rest]]>                                                 Introduction                                      Next

Contents

Authorized Online Retailers

Objective

In this lesson, we will use a Mobile APP to control the 2WD robot car through ESP8266 Wi-Fi Chip. You will learn how to install ESPWebmaster library, how to get Wifi Network IP address of your Arduino board and how to communicate between Arduino board and Wi-Fi net through Serial port.

top

Hardware Installation

Hardware installation and motor connection are   exactly the same as Lesson 1, you must make sure the lesson 1 project works well. Otherwise, this project can’t get through.

You also need to connect the two ESP_TX to D4 and ESP_RX to D5 through the jumper caps showed in the red jumper cap icon in following picture:

top

Software Installation

Step 1) 

Download OSOYOO Wi-Fi UDP Robot Car control APP
In Google Play or Apple Store, please search keywords “OSOYOO IoT UDP Robot Car”, you will find a red icon APP as following (Note: If you can not find this APP in Google Play, you can directly download the APP from following link: https://osoyoo.com/driver/udp-app.apk ):

Step 2)  Please download the WifiESP-Master library zip file from https://osoyoo.com/driver/WiFiEsp-master.zip

Open Arduino IDE →click Sketch →Include Library →Add .ZIP library, then load above two zip files into OSOYOO Basic Board for Arduino.

Step 3) Please download STA mode sketch code from https://osoyoo.com/driver/2wd/lesson5.zip. Unzip the file, you will see a folder “lesson5”. Open Arduino IDE → click file → click Open → choose code “lesson5.ino” in above folder, load the code into OSOYOO Basic Board for Arduino.

Note: You need to change the code in line 71,72

char ssid[] = “***”; // replace *** with your router wifi SSID

char pass[] = “***”; // replace *** your wifi password

Now upload the lesson5.ino sketch to OSOYOO Basic Board for Arduino. Finally, click the Serial monitor window in upper right corner of Arduino IDE, you will see following result:

In the above example, I can see an IP address 192.168.0.117, which is the Arduino board   IP address assigned by our router. Please write down this IP address and click Setting to set up robot IP address and set this IP address to your APP Setting section and Port to 8888 in settings.

For example, if your Serial monitor shows your Arduino IP address is 192.168.1.81 , you can set it to APP as per the following pictures:

Final Testing:
you can click the  button to make left turn (rotate steering wheel counterclockwise), click ► button to make right turn (rotate steering wheel   clockwise), if you keep press these two buttons, it will turn at sharper angle.
 button will make car move forward and  key will make car move backward. Press the [] button in the middle can stop the car,

Notice: Shut off your battery or unplug your power adapter when upload sketch code to Arduino. top

Disconnect Arduino from PC, put 2 fully-charged 18650 battery into battery pox (check the box instruction and make sure polar direction is correct, otherwise it can destroy your device and cause fire hazard). Please install your battery as per the following instruction:

top

Parts and Devices:

No. Picture Device Qty. Data sheet Buy in Link
1 OSOYOO basic board 1 click here Click here to buy
2 OSOYOO UART Wi-Fi shield V1.3 1 click here Click here to buy
3 OSOYOO model X motor driver module 1 click here Click here to buy
4 IR receiver 1 click here Click here to buy
5 IR remote controller 1 click here Click here to buy
6 Tracking sensor module 2 click here Click here to buy
7 HC module 1 click here Click here to buy
8 Gear motor 2 Click here to buy
9 Metal Motor Holders with screws 2 Click here to buy
10 Wheel 2 Click here to buy
11 Universal Wheel 1
12 6pin male to 6pin female jumper wire 1 Click here to buy
13 OSOYOO 2pin PnP cable 20 cm 1 Click here to buy
14 20Pin jumper wire Male to female 15 cm 1 Click here to buy
15 Philips screwdriver 1 Click here to buy
16 Hex Screwdriver 1 Click here to buy
17 18650 battery box 1 Click here to buy
18 Battery charger for 18650 battery 1 Click here to buy
19 1Pair 18650 batteries 1 Click here to buy
20 M3*5 Hex Screws 10
21 M3*10 screw 4
22 M3 nut 4
23 Copper pillar 4
24 Screw for wheel 2
25 M3 plastic screw 15
26 M3 plastic pillar 15
27 M3 plastic nut 15

top

                                                                                              Introduction                                                                  Next

]]>
https://osoyoo.com/2024/02/25/osoyoo-2wd-robot-car-starter-kit-lesson-3-remote-control-with-wifi-app/feed/ 0
How to use OSOYOO 3.5HDMI resistive touchscreen with Bookworm(RPi5) https://osoyoo.com/2024/02/01/how-to-use-hdmi-3-5-with-rpi5/ https://osoyoo.com/2024/02/01/how-to-use-hdmi-3-5-with-rpi5/#respond Thu, 01 Feb 2024 09:27:51 +0000 https://osoyoo.com/?p=56996 ...Read the Rest]]> 1. Buy 3.5 Inch HDMI Screen from following link:

Buy from OSOYOO Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

2. Buy 3.5 Inch HDMI Screen with case:

Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES Buy from JP

Overview

The OSOYOO 3.5HDMI resistive touchscreen does not work properly when using the default Wayfire graphics system on the Raspberry Pi 4B and 5B. However, if you change the default graphics system on these models to X11, it will work fine.

The tutorial you mentioned for adapting the OSOYOO 3.5HDMI resistive touchscreen on the Bullseye system should still be applicable. However, the touchscreen functionality does not seem to work on Bookworm’s default Wayfire graphics system. If you want to adjust this resistive touchscreen to the default Wayfire graphics system in Bookworm, you may need to perform additional configuration steps. In this case, you may need to explore other methods or configurations to make the ADS7846 touchscreen compatible with Wayfire in Bookworm. It is recommended that you consult the official documentation or community forums for Bookworm and Wayfire for further assistance in adjusting the touchscreen.

Click here for more information about Bookworm.

Getting Started

Hardware Connection

Connect the GPIO and HDMI interface

Raspberry Pi leads out 40 GPIO pins, while the screen leads out 12 pins. When connecting, pay attention to the corresponding pins and Raspberry Pi pins.

Install image file

1) Install the Bookworm image as the official website or follow our tutorial.
2)After the image has finished writing, save and quit the TF card safely.
3) Insert the TF card into the Raspberry Pi, power on the Raspberry Pi, and wait for more than 10 seconds to display normally. But the touch is abnormal at that time, and the touch needs to be calibrated as the following steps.

Touch settings

Note: Recommend to remotely control Raspberry Pi via ssh, VNC or other remote desktop tools, as the resolution is too high as default. (Here we use putty for Windows users. You can learn more about remotely control Raspberry Pi from: https://osoyoo.com/?p=56660)
Step 1) Set to use X11 instead of Wayland,

1. Run the following commends firstly:
sudo raspi-config

2. Then select Advanced Options, then Wayland which now controls which backend to use for the desktop, then X11. Save your settings and reboot the Raspberry Pi. In Bookworm it now defaults to Wayland on the PI4 & soon PI5, so we need to switch it to W1 X11.



Step 2) Change the Screen Configuration
Use a mouse to control your screen, then Click the Raspberry Pi icon -> Preferences -> Screen Configuration, in the new window, click layout -> screen -> HDMI -> resolution -> 680×480, then click Apply, and click OK in the new pop. We recommend setting the resolution to 640×480.
Note: Raspberry Pi OS Bookworm branch system, since dtoverlay=vc4-kms-v3d is loaded by default, it is invalid to modify the resolution in /boot/config.txt. 

Step 3) Add settings to the config.txt file
1. Run the following commend to edit config.txt. (Before installing xpt2046(ads7846) driver, we need to add settings to the config.txt file).

sudo nano /boot/config.txt

2. Add the following parameters at the end of the config.txt file

hdmi_group=2
hdmi_mode=87
hdmi_drive=1
hdmi_pixel_freq_limit=20000000
hdmi_cvt 480 320 60 6 0 0 0
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900

3. Press ctrl + X then Y, then enter to save this file, then run the following commend to reboot your Raspberry Pi

sudo reboot 

Step 4)Install xpt2046 driver, and calibrator by typing the following commends
sudo apt install xserver-xorg-input-evdev
sudo apt install -y xinput-calibrator


Step 5)Config touch calibration files

1. Run the following commends
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
sudo nano /usr/share/X11/xorg.conf.d/99‐calibration.conf

2. Add the following parameters in 99-calibration.conf,

Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "211 3942 3905 141"
Option  "SwapAxes"  "1"
EndSection

3. Press ctrl + X then Y, then enter to save this file, then run the following commend to reboot your Raspberry Pi

sudo reboot

Step 6) Calibrate touch

a. Use mouse to control your screen, then click [Preferences]-[Calibrate Touchscreen] from main menu, (or enter DISPLAY=:0.0 xinput_calibrator in the terminal), click four crossbar points on corners, it will show the calibration values which are similar to previously written to the 99-calibration.conf file.

b. After calibration (click four cross bar points on corners), it will show the calibration values which are similar to previously written to the 99-calibration.conf file.

c. Edit 99‐calibration.conf file again by typing the following commend:

sudo nano /usr/share/X11/xorg.conf.d/99‐calibration.conf

d. Replace the following lines with new values shown in the calibration result (from step b). Check touch, repeat calibration if it is not correct.
Option  “Calibration” “211 3942 3905 141”
Option  “SwapAxes” “1”


Remark: Doing so means you are no longer using Wayland. Might a temporary solution only as all Pi’s will be ‘converted’ to use Wayland and then that option will be dropped most likely. Yes – it would be great if I could figure out how to calibrate within Wayland, but I just couldn’t find anything.

For now, Wayland is only the default on Raspberry Pi 4 and 5. The performance of Wayfire on earlier platforms is still being optimized, so for now they will continue to run the old X11 display server and the Openbox window manager, but at some point these platforms will also be switched to Wayfire.

We’ll be following the official Raspberry Pi posts and updating the tutorials!

How to verify that your X11 desktop system is running properly

You can tell which one you are running by using “echo $GDMSESSION” in a terminal.(Connecting to the system using SSH-like tools and executing this command will not produce any results.)
“LXDE-pi-wayfire” means Wayland.
“LXDE-pi-x” means X11

]]>
https://osoyoo.com/2024/02/01/how-to-use-hdmi-3-5-with-rpi5/feed/ 0