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 →

Raspberry Pi 2 4G Raspbian Image Gotcha

I ran into an issue setting up a new 8G micro SD card for use with my Raspberry Pi 2 and wanted to capture the description of the problem, here, because I wasted at least 2 hours fighting this and not finding anything on the internet that described the exact problem I had.  The final solution was a real “DUH!” moment. Steps: I simply downloaded the Raspbian generic image and used dd to load the image onto my 8G SD card.  Then booted the Pi 2 with new image successfully and then ran sudo apt-get update and finally sudo apt-get upgrade.  The upgrade seemed to take a long time, but I wasn’t too concerned since this is a Pi, not an AMD 8350. Symptoms: – The upgrade took a long time. – After the reboot the Pi would not show the normal system loading screen, only a black screen with a sporadically flashing cursor in the upper left corner.  The green LED would flash and almost make it seem like it was going to do something, but nothing ever happened. Problem: The actual problem is a matter of storage space.  Palm to forehead!!!  The files of the Raspbian image took up the majority of the 4G partition it created on the 8G SD card.  Then when I ran the upgrade the packages that were downloaded completely filled the remaining space and didn’t successfully install.  Because the upgrade took so long I walked away and didn’t babysit the install and figured everything was okay. Rebooted and WHAMMO!  NO JOY!!!  I kept thinking something was wrong with the SD card. Solution: The key is to resize the disk to expand the partition back to the full 8G size.  There is a simple way to do this right from the default GUI.  THEN, do the apt-get update and upgrade.