Raspberry Pi Tutorial

Last revision 2025/12/29

This tutorial guides you through setting up Raspberry Pi for real-time monitoring with MJPG-streamer and remote control via the Bottle framework, providing detailed commands and configurations for seamless integration in DIY projects.

Raspberry pi

  • Execute the following actions under the directory Pan-Tilt-HAT/RaspberryPi/:
  • Execute this if using ambient light
    command: cd Light_Sensor/
  • Execute this if using pan servo
    command: cd Servo_Driver

BCM2835 Example

command1: cd bcm2835
command2: make clean
command3: make
command4: sudo ./main

wiringpi Example

command1: cd wiringpi
command2: make clean
command3: make
command4: sudo ./main

python Example

command1: cd python
command2: sudo python main.py

MJPG-STREAMER Software Monitoring in Real-time

MJPG-streamer can be used to collect image from a camera and transfer image to a browser by IP-based network in the form of stream.

  • Run raspi-config command to start the camera before using

command1: sudo raspi-config

Select Enable Camera, select YES

11

For CSI interface camera, the system cannot find the device node of /dev/video0. It is required to add bcm2835-v4l2 in /etc/modules file.

command2: sudo nano /etc/modules

Add:

1. bcm2835-v4l2

12

This module will be loaded when the system starts. Restart the system:

command1: sudo reboot
command2: ls /dev/video*

The device node of video0 can be found now:

13

Note: after the above steps finished, check whether the operation and command are correct.

  • Run the command below:

command1: sudo apt-get update
command2: sudo apt-get install libjpeg8-dev cmake
command3: cd Pan-Tilt-HAT/RaspberryPi/web_Python
command4: git clone https://github.com/jacksonliam/mjpg-streamer
command5: cd mjpg-streamer/mjpg-streamer-experimental/
command6: sudo make clean all
command7: sudo ./start.sh

Input the Raspberry Pi address into Google address bar(other browsers may not support this). Port COM 8080. Click stream, the content captured by the camera will be displayed in real-time. For more information, please refer to: https://github.com/jacksonliam/mjpg-streamer.

14

Remote Control via BOTTLE

Bottle is a simple and efficient micro Python web framework that follows WSGI, through which web control can be quickly realized. It only supports Python2.

Install Library:

command1: sudo apt-get install python-bottle
command2: cd Pan-Tilt-HAT/RaspberryPi/web_Python/
command3: sudo python main.py

Input the Raspberry Pi address into Google address bar(other browsers may not support this). Port COM 8001. The following interface will appear, click the button to control remotely.

15

Support controlling by mobile phone and PC without using APP.

Controlled by mobile phone:

16

Contolled by PC:

17

Was this article helpful?

ON THIS PAGE

TOP