Russ's Pi Recipie

From OpenCircuits
Jump to navigation Jump to search

This is a list, for russ, by russ for setting up a raspery pi. You may use it or make your own.

Newer ??[edit]

Pi Setup Nov 2016 Pi Setup Dec 2017 Stretch


Pi Setup Python 3 MySql

Initial Log On[edit]

User management in Raspbian is done on the command line. The default user is pi, and the password is raspberry. You can add users and change each user's password.

CHANGE YOUR PASSWORD passwd

Bring Your System Up to Date[edit]

Before installing new application or service in Raspbian, make sure to always type this into terminal:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Set Up Remote Desktop[edit]

  1. use this command to setup the pi
sudo apt-get install xrdp


  1. on the windows machine go to router admin and get tcpip address of the pi or
  2. on the pi issue the command
ifconfig
  1. and read the tcpip address of the pi( inet addr )

on the windows machine run "Remote Desktop Connection" in it enter the pi address and the user name ( default pi ) click connect, if you need a password the default is raspberry.

  1. you should now be able to use your windows machine as the keyboard, mouse, and
  2. screen.
  3. if this step does not work try a reboot of the pi and try again, if that does not work
  4. try googling, it is beyond me.

I have been having some issues around which session ( there can be many ) rdp connects to. I have not solved it yet but the most useful ref so far is

Power Icons[edit]

make these icons by copying over to desktop and then editing. A few more details here would be nice.



sudo pcmanfm   -- runs the file manager so it can change permissions on the shared drive
sudo leafpad   -- runs the editor and can save to protected places

/home/pi/Desktop

Static IP[edit]

Pi Setup: Static IP this may be a newer way



my table of addresses D:\Russ\0000\Farm\FarmNet.ods my first pi 192.168.0.175

look at current config

cat /etc/network/interfaces


look for dchp


>>>

ifconfig


record inet addr – 192.168.1.81 (Pi's Current IP Address) = address

Bcast – 192.168.1.255 (The Broadcast IP Range) = broad cast

Mask – 255.255.255.0 (Subnet Mask Address) = netmask

in file format address 192.168.1.81 netmask 255.255.255.0 broadcast 192.168.1.255


>>> netstat -nr

record: ( or fix area below )

'Gateway' Address – 192.168.1.254 = gateway 'Destination' Address – 192.168.1.0 = network

gateway 192.168.1.254 network 192.168.1.0


>>> use one of the following

sudo nano /etc/network/interfaces
sudo leafpad /etc/network/interfaces


> comment out with #

iface eth0 inet dhcp


> add

iface eth0 inet static    # new for static ip
address 192.168.1.81
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254

> save


>>> release address

sudo rm /var/lib/dhcp/*

Then we'll need to reboot and check your changes. . .

sudo reboot

Log back in and run ( just to check config )

ifconfig

Arduino Setup[edit]

  1. see the link below for more directions:
  2. http://tech.cyborg5.com/2013/05/30/irlib-tutorial-part-3d-installing-the-arduino-ide-on-a-raspberry-pi/
  1. use this for installation
sudo apt-get install arduino

Access Network Drive[edit]

command line share[edit]

use your router info to get tcpip address of the share device -- might work with name but not for me do we need samba for this?

which samba

did not whow samba but apt-get install samba showed it was there

  • create mount point
mkdir /mnt/share1


>>> # works from command line but get read only access sudo mount -t cifs -o guest //192.168.0.170/share /mnt/share1

>>> seems also to work can I write? no read only sudo mount -t cifs -o username=russ,password=squeak13 //192.168.0.170/share /mnt/share1

>>> share less

code

sudo mount -t cifs -o username=russ,password=squeak13 //192.168.0.170/share/_Source/rPi /mnt/share1


>>> another thing to try this worked for read write, see http://www.lukemannering.co.uk/mount-cifs-error-13-permission-denied/

sudo mount -t cifs -o username="russ",password="squeak13",workgroup="MSHOME",file_mode=0777,dir_mode=0777,nobrl //192.168.0.170/share/_Source/rPi  /mnt/share1

But there is a graphical tool available which can browse shares and even mount them: smb4k apt get cannot find

I:\_Source\rPi and this for fstab


//192.168.0.170/share/_Source/rPi /mnt/share1 cifs user=russ,pass=squeak13,_netdev 0,0

//192.168.0.170/share/ /mnt/share1 cifs user=russ,pass=squeak13,_netdev 0,0

    sec=ntlmm instead of guest seemed to work

more recently above fails but using


sudo rpi-update
sudo reboot


makes it work see: https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=20301

//10.1.10.50/share /mountpoint cifs sec=ntlm,noauto,x-systemd.automount 0 0

except that file manager cannot see the directories or files there but can be coaxed to see them if you put in the sub dir like /mnt/share1/_Global this is real odd http://www.raspberrypi.org/forums/viewtopic.php?t=60699


http://www.raspberrypi.org/forums/viewtopic.php?t=60699


https://unix.stackexchange.com/questions/124342/mount-error-13-permission-denied

then look in dir /rPi copy over this win_to_pi_info.txt so have reference there


when share works copy over to /pi so you can refer to it without a share ( or put on web? ) http://www.raspberrypi.org/forums/viewtopic.php?t=60699


command line for this would be ( need sudo? )

using fstab[edit]

  1. using fstab this will let you auto mount

for nano ctrl O writes a file

sudo leafpad /etc/fstab
sudo nano    /etc/fstab            


note that fstab may be hidden file >> //192.168.0.170/share/_Source/rPi /mnt/share1 cifs user=russ,pass=<password_in_quotes??>,_netdev 0,0


rp-cifsinfstab

this looks good for stab

mounting-and-automounting-windows-shares-on-raspberry-pi/


 # For Guest Login
     //WindowsPC/Share1 /mnt/mountfoldername cifs guest 0 0

For Password Protected Login //WindowsPC/Share1 /mnt/mountfoldername cifs username=yourusername,password=yourpassword 0 0

//192.168.0.170/share/_Source/rPi /mnt/share1 cifs user=russ,pass=squeak13,_netdev 0,0

Auto Python[edit]

How To Autostart Apps In Rasbian LXDE Desktop
method1
sudo leafpad /etc/xdg/lxsession/LXDE-pi/autostart
rh: this was found but not the same as the other file note the - pi ??

-----

my line for auto
@python  /home/pi/autopython.py
@python  /home/pi/autoexec.py

ls  /home/pi/autoexec.py

---------


..... and more 

method 2
sudo leafpad ~/.config/lxsession/LXDE/autostart
rh: file was empty or not found 
..... and more 

You can auto-launch your own Python scripts by adding the line :

@/usr/bin/python /home/pi/example.py


sudo leafpad /etc/rc.local

and add at end

python /home/pi/autoexec.py &


Shortcut icons and Menu Maintenance[edit]

Shortcut Icons[edit]

http://www.raspberry-projects.com/pi/pi-operating-systems/raspbian/gui/desktop-shortcuts


Create a new text file called yourname.desktop in the /home/pi/Desktop/ directory, e.g. /home/pi/Desktop/yourname.desktop As far as I can tell the name yourname has no particular meaning.

leafpad  /home/pi/Desktop/pi.desktop

leafpad  /home/pi/Desktop/pi2.desktop


It should contain the following: ( one shortcut per file, do not repeat [Desktop Entry] )


[Desktop Entry]
Name=My Name
Comment=My application which does this
Icon=/usr/share/pixmaps/openbox.xpm
Exec=/usr/bin/leafpad
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;

All the new icons are here if you need access to them for your own documentation or apps… /usr/share/icons/PiX


/home/pi/Desktop/yourname.desktop


how i ran my python smarttermainal

[Desktop Entry]
Name=SmartTerminal
Comment=My application which does this
Icon=/usr/share/pixmaps/openbox.xpm
Exec=python /home/pi/SpyderP/SmartTerminal/smart_terminal.py
Path=/home/pi/SpyderP/SmartTerminal
Type=Application
Encoding=UTF-8
Terminal=false
Categories=None;


Menu[edit]

An editor perhaps:

[laurent@localhost applications]$ cat ~/.local/share/applications/hardinfo.desktop


[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Hardware info
Name[en_US]=Hardware info
Exec=/usr/bin/hardinfo
Comment[en_US]=Hardware info
StartupNotify=true

leafpad /etc/xdg/menus/lxde-applications.menu It’an XML file that contains a bunch of <Menu> tags describing the menu layout. On my Fedora box, the “Accessories” section is described like this:

<Menu>
   <Name>Accessories</Name>
   <Directory>lxde-utility.directory</Directory>
   <Include>
      <And>
         <Category>Utility</Category>
         <Not><Category>System</Category></Not>
      </And>
   </Include>

fix it maybe: rdp[edit]

The problem:





connecting to sesman ip 127.0.0.1 port 3350
sesman connect ok
sending login info to sesman
login successful for display 10
started connecting
connecting to 127.0.0.1 5910
error - problem connecting

IF this is the same issue you are having I fixed it thusly...

CODE: SELECT ALL

sudo apt-get install tightvncserver

Other RDP Issues[edit]

Does not always connect back to the same session....... seems to be based on using different ports on different connects Google offers hints to things that may help

these files may exist and be in use

  • sudo leafpad /etc/xrdp/xrdp.ini
  • sudo leafpad /etc/xrdp/sesman.ini