Autostart Service in Raspberry Pi

Posted on Tue 20 March 2018 in raspberry-pi

If our application needs to autostart as a service in Raspberry Pi, we will write a simple systemd service file.

[Unit]
Description=Example Application
After=bluetooth.service
Requires=bluetooth.service

[Service]
PermissionsStartOnly=true
Type=simple
User=pi
Group=pi
ExecStartPre=/bin/mkdir -p /var/log/example_app
ExecStartPre=/bin/chown pi …

Continue reading

Serial Programming in Raspberry Pi

Posted on Wed 14 March 2018 in raspberry-pi

Raspberry Pi uses serial port for console tty. In order to use this serial port to communicate with Mac machine, we will temporarily disable getty service:

$ sudo systemctl stop serial-getty@ttyS0.service
$ sudo chmod 666 /dev/ttyS0

Then the application can use /dev/ttyS0 to communicate with other device using …


Continue reading

Bluetooth Programming in Raspberry Pi

Posted on Tue 13 March 2018 in raspberry-pi

Raspberry Pi Zero W comes with added wireless LAN and Bluetooth connectiviy. We can use PyBluez library to program Bluetooth in Python.

In order to install PyBluez, we first need to install Bluetooth development. In Raspberry Pi, run the apt command:

$ sudo apt install libbluetooth-dev

Then install PyBluez using pip …


Continue reading

Raspberry Pi with Python

Posted on Mon 12 March 2018 in raspberry-pi

I've got a project using Raspberry Pi Zero W, and it make me so happy that I can use Python to program in Raspberry Pi. This tiny device is backed by Raspbian, a free operating system based on Debian optimized for Raspberry Pi hardware. The latest version is based on …


Continue reading