8.3. Servo And Light
The LED headlights and the camera servo are controlled via PWM signals. To get a jitter-free PWM signal, a library, supporting hardware PWM, is required. For example pigpio
.
8.3.1. Install PIGPIO
Raspbian
$ sudo apt-get update && \
sudo apt-get install pigpio python-pigpio python3-pigpio
Ubuntu
$ wget https://github.com/joan2937/pigpio/archive/master.zip && \
unzip master.zip && \
cd pigpio-master && \
make && \
sudo make install
8.3.2. Enable The Daemon
Ubuntu only
You need to create the pigpiod.service
file at /etc/systemd/system
.
[Unit]
Description=Pigpio daemon
[Service]
Type=forking
PIDFile=pigpio.pid
ExecStart=/usr/local/bin/pigpiod
[Install]
WantedBy=multi-user.target
Raspbian and Ubuntu
Enable the service
$ sudo systemctl enable pigpiod.service
and run the service
$ sudo systemctl start pigpiod.service