Tutorial
Table Of Contents
- 1. Premise
- 2. Raspberry Pi System Installation and Developmen
- 3 Log In to The Raspberry Pi and Install The App
- 4 Assembly and Precautions
- 5 Controlling Robot via WEB App
- 6 Common Problems and Solutions(Q&A)
- 7 Set The Program to Start Automatically
- 8 Remote Operation of Raspberry Pi Via MobaXterm
- 9 How to Control WS2812 RGB LED
- 10 How to Control The Servo
- 11 How to Control DC Motor
- 12 Ultrasonic Module
- 13 Line Tracking
- 14 Make A Police Light or Breathing Light
- 15 Real-Time Video Transmission
- 16 Automatic Obstacle Avoidance
- 17 Why OpenCV Uses Multi-threading to Process Vide
- 18 OpenCV Learn to Use OpenCV
- 19 Using OpenCV to Realize Color Recognition and T
- 20 Machine Line Tracking Based on OpenCV
- 21 Create A WiFi Hotspot on The Raspberry Pi
- 22 Install GUI Dependent Item under Window
- 23 How to Use GUI
- 24 Control The WS2812 LED via GUI
- 25 Real-time Video Transmission Based on OpenCV
- 26 Use OpenCV to Process Video Frames on The PC
- 27 Enable UART
- 28 Control Your AWR with An Android Device
- Conclusion
108
the standard program. If you are interested in this, you can try to expand more. We will offer the installation and
application methods of other functions in the follow-up tutorials. Please subscribe our Youtube channel for
more.
●Change LED Color:You can control the colors of the LEDs on the robot in real time by dragging these
three sliders. These three sliders correspond to the brightness of the three channels of RGB. In theory, you can
create 16,777,216 (256^ 3) kinds of colors through these three sliders.
24 Control The WS2812 LED via GUI
● You can use the program with a graphical interface written by yourself to communicate with the
Raspberry Pi on other devices to achieve the purpose of controlling the Raspberry Pi.
● The GUI programming method introduced in this chapter is completely done by Python language,
specifically, the Tkinter library is used.
·Tkinter is Python's standard GUI library. Python uses Tkinter to quickly create GUI applications. Because
Tkinter is built into the Python installation package, as long as Python is installed, you can import the Tkinter
library, and IDLE is also written in Tkinter. For simple graphical interface Tkinter can still cope with it.
●We use the Socket library to communicate between devices. Socket is also called "socket". Applications
usually send requests to the network or answer network requests through the "socket", so that the process
between the host or a computer can communicate.
●In this chapter, we take the remote control of the LED lights as an example, because almost all of our
robots are equipped with WS 2812 LED modules. This simpler example also helps novices to understand how
the desktop GUI program works communicate with the Raspberry Pi.
●Ready to burn the Raspbian Raspberry Pi, you can refer to the 9 module-WS2812 LED light for related
dependent libraries and connection methods. If you don't use Motor HAT, just connect the signal port (IN) of
WS2812 LED to GPIO12 (BCM 18) of Raspberry Pi.
●For the detailed definition of Raspberry Pi pins, you can see this link to understand:Raspberry Pi Pinout
●Install the Python library used to control the WS2812 LED light. If it has not been installed or the robot
installation script has not been run, you can use the following command to install it in the Raspberry Pi console:
sudo pip3 install rpi_ws281x
●We will use the Raspberry Pi as the server and the PC as the client.
●The program of the server in the Raspberry Pi is as follows:
'''
These two libraries are used to control WS2812 LED lights
'''
from rpi_ws281x import *
import argparse
'''
Import socket library to be used for TCP communication
'''