Howto setup Raspbian for serial read: Difference between revisions
(→-7-) |
(→-7-) |
||
(25 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
=Hardware and OS= | =Hardware and OS= | ||
This applies to all Raspberrypi. | This applies to all Raspberrypi. If using the image from Emoncms (emonpi) then this setup is not needed. | ||
Tested with OS: <br> | Tested with OS: <br> | ||
Line 15: | Line 15: | ||
Raspbian Buster '''2020-02-13-raspbian-buster-lite.img''' <br> | Raspbian Buster '''2020-02-13-raspbian-buster-lite.img''' <br> | ||
Rasberry Pi OS '''2020-05-27-raspios-buster-armhf.img''' <br> | Rasberry Pi OS '''2020-05-27-raspios-buster-armhf-lite.img''' <br> | ||
Rasberry Pi OS '''2020-08-20-raspios-buster-armhf.img''' <br> | Rasberry Pi OS '''2020-08-20-raspios-buster-armhf-lite.img''' <br> | ||
Rasberry Pi OS '''2020-12-02-raspios-buster-armhf-lite.img''' <br> | |||
Rasberry Pi OS '''2020-01-11-raspios-buster-armhf-lite.img''' <br> | |||
Rasberry Pi OS '''2021-03-04-raspios-buster-armhf-lite.img''' <br> | |||
=Steps= | =Steps= | ||
Line 26: | Line 26: | ||
Download the image from the raspberrypi website. | Download the image from the raspberrypi website. | ||
https://www.raspberrypi.org/downloads/ | https://www.raspberrypi.org/software/operating-systems/ | ||
Or you can directly get the torrent for the latest supported image from the links below: | |||
[https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-01-12/2021-01-11-raspios-buster-armhf-lite.zip.torrent Lite 2021-01-11] | |||
[https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2021-01-12/2021-01-11-raspios-buster-armhf.zip.torrent Desktop 2021-01-11] | |||
==-2-== | ==-2-== | ||
Line 41: | Line 47: | ||
Power up the raspberrypi and connect it to the ethernet network. <br> | Power up the raspberrypi and connect it to the ethernet network. <br> | ||
From a computer access the raspberrypi with ssh.<br> | |||
===Linux based OS=== | ===Linux based OS=== | ||
Line 59: | Line 66: | ||
==-5-== | ==-5-== | ||
Run the raspi-config tool | Run the raspi-config tool | ||
$ sudo raspi-config | $ sudo raspi-config | ||
Then disable the login uart | Then disable the login uart | ||
5 Interfacing Options | 3 Interface Options <<-- Use option ''5 Interfacing Options'' instead if using the image before 12 DEC 2020 | ||
P6 Serial | P6 Serial | ||
'''Would you like a login shell to be accessible over serial?'''<br> | |||
Select '''No''' to the login shell question.<br> | Select '''No''' to the login shell question.<br> | ||
'''Would you like the serial port hardware to be enabled?'''<br> | |||
Select '''Yes''' to the serial port hardware to be enabled question.<br> | Select '''Yes''' to the serial port hardware to be enabled question.<br> | ||
Line 73: | Line 84: | ||
Back at the menu select '''finish'''. | Back at the menu select '''finish'''. | ||
'''Would you like to reboot now?'''<br> | |||
Select '''No''' to the reboot question (we will do that later).<br> | Select '''No''' to the reboot question (we will do that later).<br> | ||
Line 81: | Line 93: | ||
==-7-== | ==-7-== | ||
This step must be performed regardless if you have a Raspberrypi 3 or 4. | |||
Edit the /boot/config.txt file | Edit the /boot/config.txt file | ||
$ sudo nano /boot/config.txt | $ sudo nano /boot/config.txt | ||
At the end of the file add the following line: | At the end of the file add the following line: | ||
dtoverlay= | dtoverlay=disable-bt | ||
<small>(note the above will disable bluetooth - if bluetooth is needed do not execute this step and use ttyS0 instead of ttyAMA0 for what follows).<br> | <small>(note the above will disable bluetooth - if bluetooth is needed do not execute this step and use ttyS0 instead of ttyAMA0 for what follows).<br> | ||
A one liner of the above command would be<br> | A one liner of the above command would be<br> | ||
sudo bash -c 'echo "dtoverlay= | sudo bash -c 'echo "dtoverlay=disable-bt" >> /boot/config.txt' | ||
</small> | </small> | ||
Save and Exit file. | Save and Exit file. | ||
==-8-== | ==-8-== | ||
Line 109: | Line 122: | ||
stty -F /dev/ttyAMA0 raw speed 38400 | stty -F /dev/ttyAMA0 raw speed 38400 | ||
cat /dev/ttyAMA0 | cat /dev/ttyAMA0 | ||
At that point the data will be shown on the terminal. This is an example with the RPICT3T1 below.<br> | |||
[[File:Screenshot_2021-03-12_21-27-04.png]] | |||
Please refer to the dedicated page of the board for the details of each field. | |||
The cat command above is the most basic form for reading out the data from any RPICT unit. Do not skip this test. | |||
==-11-== | ==-11-== |
Revision as of 15:11, 26 April 2021
This howto will cover the steps to setup a Rasperrypi for reading CSV stream from RPICT series board.
Hardware and OS
This applies to all Raspberrypi. If using the image from Emoncms (emonpi) then this setup is not needed.
Tested with OS:
Raspbian Jessie 2017-06-21-raspbian-jessie.img
Raspbian Stretch 2017-09-07-raspbian-stretch-lite.img
Raspbian Stretch 2018-06-27-raspbian-stretch-lite.img
Raspbian Stretch 2018-10-09-raspbian-stretch-lite.img
Raspbian Stretch 2018-11-13-raspbian-stretch-lite.img
Raspbian Buster 2019-06-20-raspbian-buster-lite.img
Raspbian Buster 2020-02-13-raspbian-buster-lite.img
Rasberry Pi OS 2020-05-27-raspios-buster-armhf-lite.img
Rasberry Pi OS 2020-08-20-raspios-buster-armhf-lite.img
Rasberry Pi OS 2020-12-02-raspios-buster-armhf-lite.img
Rasberry Pi OS 2020-01-11-raspios-buster-armhf-lite.img
Rasberry Pi OS 2021-03-04-raspios-buster-armhf-lite.img
Steps
-1-
Download the image from the raspberrypi website. https://www.raspberrypi.org/software/operating-systems/
Or you can directly get the torrent for the latest supported image from the links below:
-2-
Write the image to the SD card. Follow instructions given by the raspberrypi website.
https://www.raspberrypi.org/documentation/installation/installing-images/
-3-
Once the image written create an empty file called ssh in the boot section of the image.
-4-
Power up the raspberrypi and connect it to the ethernet network.
From a computer access the raspberrypi with ssh.
Linux based OS
This is as simple as issuing.
$ ssh pi@raspberrypi
Use password raspberry
On other systems (windows, ios)
We recommend to use the putty tool. Download here
As above use
hostname: raspberrypi
user: pi
password: raspberry
This will give you access to a terminal window in which you can issue commands on the raspberrypi.
-5-
Run the raspi-config tool
$ sudo raspi-config
Then disable the login uart
3 Interface Options <<-- Use option 5 Interfacing Options instead if using the image before 12 DEC 2020 P6 Serial
Would you like a login shell to be accessible over serial?
Select No to the login shell question.
Would you like the serial port hardware to be enabled?
Select Yes to the serial port hardware to be enabled question.
Select Ok at the summary.
Back at the menu select finish.
Would you like to reboot now?
Select No to the reboot question (we will do that later).
-6-
[OPTIONAL]
Update the Raspbian OS.
sudo apt-get update
-7-
This step must be performed regardless if you have a Raspberrypi 3 or 4.
Edit the /boot/config.txt file
$ sudo nano /boot/config.txt
At the end of the file add the following line:
dtoverlay=disable-bt
(note the above will disable bluetooth - if bluetooth is needed do not execute this step and use ttyS0 instead of ttyAMA0 for what follows).
A one liner of the above command would be
sudo bash -c 'echo "dtoverlay=disable-bt" >> /boot/config.txt'
Save and Exit file.
-8-
[OPTIONAL]
Disable hciuart
sudo systemctl disable hciuart
-9-
Reboot
sudo reboot & exit
return to the ssh session again once the raspberrypi up and running again.
-10-
Insert the RPICT board on the RPI. Configure and read from serial port
stty -F /dev/ttyAMA0 raw speed 38400 cat /dev/ttyAMA0
At that point the data will be shown on the terminal. This is an example with the RPICT3T1 below.
Please refer to the dedicated page of the board for the details of each field.
The cat command above is the most basic form for reading out the data from any RPICT unit. Do not skip this test.
-11-
[OPTIONAL] It might be useful to get the board with all utilities ready at this point. Just issue the commands below:
sudo apt-get install python-serial wget lechacal.com/RPICT/tools/lcl-rpict-config.py.zip unzip lcl-rpict-config.py.zip sudo mv lcl-rpict-config.py /usr/local/bin