Toto smaže stránku "Create your own Image"
. Buďte si prosím jisti.
Sometimes it is necessary, that you create your own image-file. For Example: If you want to use a newer or another Raspberry Pi Linux-Version as the given Raspberry Pi image-file. To do so, you need to do some configurations at the fresh installation of the Raspberry Pi operating system. The first step is to download your favorite Linux operating system for the Raspberry Pi and to install the image file to a SD-Card. This is the same procedure, which was explained in section: Copy Image to a SD-Card.
Note: Other Linux operating systems especially for the Raspberry Pi can you find under: https://www.raspberrypi.org/downloads/
To setup your own raspberry pi image-file is classified into the following steps:
After completing the setup of your Raspberry Pi Image you can download the API and the test-programs from the repository and test it.
After booting up your Raspberry Pi you need to activate the serial port. If you want to communicate with the Pi over ethernet, you also need to activate SSH. To do so, run the bash-command:
sudo raspi-config
The picture below shows the raspi-config
.
Under the category "Interfacing-Options" you can activate SSH and the serial-port. If you want, you can also do changes at the localization, hostname, etc. or you can activate other interfaces you need [1].
Note: This step is only necessary, if you use a Raspberry Pi 3.
The biggest change of Raspberry Pi 3 was the integrated WLAN and Bluetooth. But the Bluetooth module uses the serial (UART) interface of the Pi. So after activating the serial interface with raspi-config
, there only a Mini-UART available over the GPIO pins. The Mini-UART has a big disatvantage: the baudrate of the Mini-UART depends of the Clock-Speed of the CPU, so a stable serial connection is not possible. You can change that by disabling the Bluetooth module and reconfigure the UART to the GPIO pins.
Open the "config.txt" at the boot directory with admin privilege.
sudo nano /boot/config.txt
Add a new line with dtoverlay=pi3-disable-bt
and if it is not set by raspi-config
, add a line with enable_uart=1
[2]. Now open the file:
sudo nano /boot/cmdline.txt
Delete the part with console=serial0,115200
[3]. Now you need to stop BT modem trying to use UART:
sudo systemctl disable hciuart
After a reboot, the UART should work like at the previous Raspberry Pi version. The UART is available under "/dev/ttyAMA0".
The test-programs needs the following python-modules:
You can check, whether these modules are available with the bash-command:
pip3 list
If one of these modules are missing, you can install it with the bash-command:
pip3 install <module-name>
The test-programs uses PiGPIO to access the GPIO pins. The PiGPIO module needs a daemon-process, which handles the communication between GPIOs and the module [4]. You can start the daemon-process with:
sudo pigpiod
If you want to start the daemon-process with every bootup of the Raspberry pi, you need to open the rc.local
:
sudo nano /etc/rc.local
There you add a line with pigpiod
before exit 0
. The file should be look like:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
pigpiod
exit 0
[1] Raspberry Pi
Raspi-Config
https://www.raspberrypi.org/documentation/configuration/raspi-config.md (20/08/2017)
[2] Hudson, G.
Raspberry Pi 3 compatibility (BT disable & serial port remap fix)
https://openenergymonitor.org/forum-archive/node/12311.html (20/08/2017)
[3] Raspberry Tips
UART auf dem RaspberryPi nutzen
https://raspberry.tips/raspberrypi-einsteiger/uart-auf-dem-raspberrypi-nutzen/ (20/08/2017)
[4] PiGPIO
PiGPIO Daemon
http://abyz.co.uk/rpi/pigpio/pigpiod.html (20/08/2017)
Hochschule Anhalt | Anhalt University of Applied Sciences | Department 6 EMW
Xcom-API
Tobias Müller, M. Eng.
📧 Tobias.Mueller@HS-Anhalt.de
© es-lab.de, 31.10.2017
Toto smaže stránku "Create your own Image"
. Buďte si prosím jisti.