Raspberry Pi Setup

RPi Setup for Specific Use Cases I’ve added some notes here to assist with setting up a Raspberry Pi for different use cases.  These notes were consolidated from many other sources and as versions change and things are updated these instructions may not always work, but here they are for anyone’s use. Initial Setup Install using standard Noobs or Rasbpian with Desktop. Using Raspi-Config enable the Camera and SSH for future use. Change the Node Name, change the password, set the localization. Note: You have to scroll up to get the English US keyboard after selecting the US. Drop the background to just grey, no image. Remove all the icons but the terminal from the top panel. Resolution for 7” Monitor Open raspi-config and set the resolution to 28. Add plantfloor User Reference: https://www.raspberrypi.org/documentation/linux/usage/users.md sudo adduser plantfloor Add sudo sudo visudo Find the line under the commented header # User privilege specification: root ALL=(ALL:ALL) ALL Copy this line and switch from root to plantfloor. To allow passwordless root access, change to NOPASSWD: ALL. The example below gives the user plantfloor passwordless sudo access: # User privilege specification root ALL=(ALL:ALL) ALL plantfloor ALL=(ALL) NOPASSWD: ALL Save and exit to apply the changes. Be careful, as it’s possible to remove your own sudo rights by accident. Also, make sure this line is the LAST line in the file. Assign Static IP sudo nano /etc/dhcpcd.conf. interface eth0 static ip_address=192.168.1.XX/24 Optional: (Only do if internet access is required.) static routers=192.168.1.1 static domain_name_servers=192.168.1.1 Make plantfloor the Default Auto Login sudo nano /etc/lightdm/lightdm.conf Uncomment these two lines: autologin-user=plantfloor autologin-user-timeout=0 WARNING – These lines may occur in a different section. Look for the [Seats:*] section. (The last section. You’ll be replacing the pi autologin user.) Reboot and then: Drop the background to just grey, no image. Remove all the icons but the terminal from the top panel. Install Thunar for Network File Access Since this is the first package we are installing, be sure to at least run: sudo apt-get update to refresh the repository locations. sudo apt-get install thunar For Python PLC Comms Copy the pylogix_master folder from the 10_Installables on the NAS. To access the network folders you will have to use Thunar. Enter smb://<ip address of pc with shares> into the address bar. Reference: https://github.com/dmroeder/pylogix Add RDP Support sudo apt-get install xrdp Make a Python Program Run on Startup Putting it in the users autostart file should have worked. Don’t use “sudo” that file belongs to the user. Code: nano ~/.config/lxsession/LXDE-pi/autostart Add the program to the bottom like this: @sudo /usr/bin/python /home/plantfloor/python_apps/<program name.py> The autostart file won’t run until after login to the desktop, even if the login is automatic, since it has to know who the user is to apply the correct desktop settings. By that time the rest of the system is ready. Piface Digital 2 Installation Install the packages if not installed already. sudo apt-get install python-pifacedigitalio or sudo apt-get install python3-pifacedigitalio Apply the patch to the python2.7 folder to fix … Continue Reading →