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”

Dynamic DNS on Ubuntu

With these settings I can plug my RPi into a router and it will configure a web URL to it’s routers IP address (although I haven’t set and UPNP stuff).

I’m using Namecheap so I simply combine this with this..
and it works! 🙂

I tested with

 sudo ddclient -daemon=0 -debug -verbose -noquiet

Returns this at the bottom

SUCCESS:  rpi: skipped: IP address was already set to 'My WAN IP'.

Also I edited my SSH config since apparently my home NAT router didn’t like keeping the connections alive. These settings went at the bottom of sshd_config – initially I used ServerAlive, which stopped SSH from working :/

ClientAliveInterval 300
ClientAliveCountMax 24

Install Samba on Ubuntu (on an RPi 2)

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)”