Remote L Chika with pigpio

What is this?

This is a test program for remotely controlling GPIO of raspberry pi. It was necessary to control GPIO remotely due to various reasons, so I set it in a hurry.

From various settings

For more information, please visit here.

shell


$ cat /etc/systemd/system/multi-user.target.wants/pigpiod.service

[Unit]
Description=Daemon required to control GPIO pins via pigpio
[Service]
ExecStart=/usr/bin/pigpiod -l
ExecStop=/bin/systemctl kill pigpiod
Type=forking
[Install]
WantedBy=multi-user.target

start up.

shell


$ sudo systemctl enable pigpiod
$ sudo systemctl start pigpiod
$ sudo systemctl status pigpiod

● pigpiod.service - Daemon required to control GPIO pins via pigpio
   Loaded: loaded (/lib/systemd/system/pigpiod.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/pigpiod.service.d
           └─public.conf
   Active: active (running) since Tue 2020-04-28 20:59:18 JST; 1h 16min ago
  Process: 3643 ExecStart=/usr/bin/pigpiod (code=exited, status=0/SUCCESS)
 Main PID: 3644 (pigpiod)
    Tasks: 4 (limit: 4915)
   Memory: 568.0K
   CGroup: /system.slice/pigpiod.service
           └─3644 /usr/bin/pigpiod

April 28 20:59:18 raspi4 systemd[1]: Starting Daemon required to control GPIO pins via pigpio...
April 28 20:59:18 raspi4 systemd[1]: Started Daemon required to control GPIO pins via pigpio. 

Install the necessary items on the remote PC. In my case, it's Raspberry Pi 3, so I installed pigpio.

LED Chika

This is a test program.

python


import time
import pigpio

PI = pigpio.pi("Remote ip address", 8888)

PI.set_mode(23, pigpio.OUTPUT)
PI.set_mode(24, pigpio.OUTPUT)
PI.set_mode(25, pigpio.OUTPUT)

try:
    while True:
        PI.write(23, 1)
        time.sleep(0.1)
        PI.write(23, 0)
        PI.write(24, 1)
        time.sleep(0.1)
        PI.write(24, 0)
        PI.write(25, 1)
        time.sleep(0.1)
        PI.write(25, 0)
except KeyboardInterrupt:
    pass
PI.set_mode(23, pigpio.INPUT)
PI.set_mode(24, pigpio.INPUT)
PI.set_mode(25, pigpio.INPUT)
PI.stop()

GPIO23,24,25 has 3 LEDs. It doesn't matter if you run it from localhost, but if you run it remotely, it seems to be affected by the line speed, but the movement becomes tedious.

This time, there is no problem because it is the control of the relay for turning on / off the 100V power supply, and it is not necessary to switch at high speed.

IMG_1171.jpeg

Recommended Posts

Remote L Chika with pigpio
Try L Chika with raspberry pi
RaspberryPi L Chika with Python and C #
[C, C ++, Python, JavaScript] L Chika with Edison
L Chika with Sipeed Lichee Zero (GPIO operation)
When you access the web server, L Chika with Arduino
Remote debugging with Visual Studio 2017
Automation of remote operations with Fabric
L Chika on Raspberry Pi C #
When you access the web server, L Chika (HTTPS compatible) with Arduino