Mount and sync a USB drive on RPi Ubuntu with GPIO

Actions:image
  1. So first the USB is plugged in.
  2. It is automounted using a GPIO button press. Flash red if this fails.
  3. Blue light will flash light during rsync cp (copy). If an error occurs show red LED and turn off blue LED.
  4. Send email with results on completion.
  5. Unmount USB and show steady blue LED indication turn off blue LED.

Continue reading “Mount and sync a USB drive on RPi Ubuntu with GPIO”

RPi GPIO: Adding switches and lights

Goal:

Create a pair of LED’s and push buttons on my RPi which can run scripts. ?One will shut down the Pi (updated here), the other will rsync a directory to a USB. Also I will read the status of a UPS. This may/will become more complicated since the UPS doesn’t have any useful interface (requiring an Arduino to:

  • Watch the UPS battery voltage and tell the RPi to power down.
  • Monitor whether mains power is applied.
  • Once mains is re-powered, restart the RPi after a UPS shut down using the hardware reset pins on the Pi.)
Instructions:
  1. As in these RPi ubuntu instructions I installed python.. I removed sudo from the last command to make the command output happy
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-pip
pip install RPi.GPIO
  1. Initially I set up a breadboard as in this youtube video (using the linked files)
    from time import sleep
    import RPi.GPIO as GPIO
    GPIO.setmode(GPIO.BOARD)
    GPIO.setup(12, GPIO.OUT)
    while 1:
     GPIO.output(12, False)
     sleep(1)
     GPIO.output(12, True)
     sleep(1)

    Continue reading “RPi GPIO: Adding switches and lights”

Install Samba on Ubuntu (on an RPi 2)

Note: The RPi2 with officially supported Ubuntu is proving problematic, I want to move to something more reliable.

After installing Ubuntu on my RPi, I’ll now install Samba. This will allow USB drives attached to the RPi to be accessed by other computers, making the RPi into a NAS device.

  1. Install Samba:
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install samba
  2. Duplicate original samba settings:
    sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old

    Continue reading “Install Samba on Ubuntu (on an RPi 2)”