Posts tagged: Adafruit

Automatically mount a NAS, at boot, on a Raspberry Pi

Cyborg by Son of 8-Bits, on FlickrNow that I am able to control the Raspberry Pi with Synergy, as well as via SSH from another computer on the network, I’d like my multimedia files (music, movies, etcetera) to be readily available to me on the machine. XBMC/OpenElec has neat little GUI’s and even an on screen keyboard to configure your local shares, but Raspbian does not. So we’re gonna mount a NAS via CIFS (or any other CIFS compatible share, like SMB, known as Samba) so I can get to my files.

We’re starting at your home folder (YOUR_USER, pi by default)

$ cd /home/YOUR_USER/

Again, the default username is pi.

$ mkdir NAS

Or any other name you’d like the Folder containing your shares to have. You can use this new folder to mount the NAS, meaning the shared files’ll appear right here. But I made sub-folders because my NAS has multiple shares. If you’d like to make multiple mounts as well, enter:

$ cd NAS

Or the name you picked in the step before this one. and enter:

$ mkdir FOLDER

Name this new subfolder whatever you like, I went with the same name as the shared folder on the NAS so it’ll be easy to recognize. The name of the shared folder on the NAS is the same as SHARED_FOLDER in the text you’ll have to enter below, but first enter:

$ sudo nano /etc/fstab

This file we’ve opened and are about to edit is the file which tells the OS (Raspbian) to mount these shares as soon as you boot/login. (Sidenote: I’m not sure at which point this happens, as I’ve set my Raspberry to boot straight into the Desktop environment, LXDE.)

Go past whatever text is already there and enter the string of data below, don’t forget to edit the CAPITALIZED text to match your info. (Olawd, that rhymed!)


For IP_OF_NAS you can also set the name of the computer, which is also it’s domain name. If you don’t know what this is, ignore it and make sure the local IP of the NAS is correct. The SHARED_FOLDER is the shared folder we’re trying to mount.

Satellite dish by Son of 8-Bits, on FlickrIf you have your NAS set to accept any connection (shared folder-wise) without authentication, you can enter “guest” as the username and leave the password empty. This should work, but is however untested as I’ve secured my own NAS. You can always enter the admin username and password of the device, if you the credentials.

If you’ve entered this correctly it should automatically mount the shared folder(s) on the next login/boot. When you enter the folder(s) we’ve made earlier the files (and folders) contained in the share will appear as if they’re right there on your Raspberry Pi! But in fact it’s still just the NAS. Now you should be able to use these files in your applications. Please note: I can’t delete or edit files unless I use a sudo command, this might be different for you depending on your NAS and it’s configuration. Anyway, if you’re ready to try this auto-mount thing out, reboot the Raspberry Pi by entering:

$ sudo reboot


Running Synergy on Raspberry Pi (Raspbian) at boot

So we’ve got our little Lego-encased RasPi up and running…


After getting the Debian installation (Berryboot, Wheezy 5/’13) up and running he 1st things I wanted to achieve were to change the username of the Pi, make it boot straight into the desktop environment again after a reboot, and to start running a Synergy client so it automatically connects to the Synergy server on my Mac. After searching for a long, long time on google and trying numerous ways that wrecked X11 beyond repair (forcing me to reinstall Raspbian), I found the answer accidentally while looking through the files in the LightDM folder. So if you too are still looking for this, here’s how incredibly simple it is.

In the terminal type:

$ sudo nano /etc/lightdm/lightdm.conf

Search for this function:


And change the ‘pi’ entry to whatever username you are currently using, so it looks like this:


Press ‘ctrl+x’, ‘y’ to confirm you want to save, and the enter button to confirm. You’re done! The Raspbian installation will now automatically boot into the desktop with your username logged-in.


Next, I wanted to run Synergy on the Raspberry Pi. With Synergy you can share a keyboard and mouse across multiple computers, no matter what operating system. It looks and works just like having multiple screens connected to one computer, and it’s awesome! Luckily, there’s already a build for our RasPi flavour of Debian. So, lets start-off by installing Synergy, if you hadn’t already:

$ sudo apt-get install synergy

Wait for it to complete installing. Next we’re gonna make a file to tell Synergy to start at boot when X11 starts. Enter the following three commands into the terminal:

$ cd /etc/X11/Xsession.d
$ sudo touch 12synergy
$ sudo nano 12synergy

In this empty file that just popped-up when you enter the ‘nano’ command, paste the following:

/usr/bin/killall synergyc
sleep 1
/usr/bin/synergyc –daemon –restart –name CLIENT_NAME SERVER_IP_ADDRESS

CLIENT_NAME is the name you want to send to the server for identification and SERVER_IP_ADDRESS is, what else, the server’s local IP address. Press ctrl+X to quit the nano editor, press “Y” to save your changes and the enter key to confirm. Next we’re gonna give this file executing rights, by typing in:

$ sudo chmod +x 12synergy


Credits for this go to this blog, except that the 2nd part of that tutorial doesn’t work for me cause there’s no gdm to be found on the Pi! So I did some digging around in the files (finding the auto-login solution above in the process) and here’s what needs to be done:

$ cd /etc/X11/
$ sudo nano Xsession

In this file, scroll all the way down to the last ‘fi’ and type/paste the following before ‘exit 0’:

/usr/bin/killall synergyc
sleep 1
//usr/bin/synergyc –daemon –restart –name CLIENT_NAME SERVER_IP_ADDRESS

ctrl+x, y, enter. And you’re done!! Again, CLIENT_NAME is the name you want to send to the server and SERVER_IP_ADDRESS is the server’s IP address. On the next reboot synergy will automatically run, and if you configured both the client and server correctly, will connect right away! If you’re ready to try this out, end with the following command to reboot the Raspberry Pi.

$ sudo reboot

 EDIT: I was originally planning to do a VNC tutorial on this blog as an alternative to using Synergy. However, the ‘how to’ provided by Adafruit couldn’t be any easier. They show you how to install and run VNC, but also how start it at boot the easy way. So if that’s what you’re looking for, head on over to ‘Running VNCServer at startup‘.

Edit 14/12/2013: Adafruit has also released a tutorial about installing Synergy on the Raspberry Pi. Which takes the approach of having it boot with the desktop environment by utilizing the autostart features of lxde at user-level. The tutorial includes building Symergy from source which might be daunting for some user, but it’s very educative nonetheless. I reckon using apt-get like in my tutorial’ll work fine as well, so if the source-code part scares you, try that instead.
Setting up a Synergy Server‘.


Home Studio Hacks: The Acid Station

(Mis)using an item to suit other needs and perhaps making it more useful in the process

Acid Station

A simple lifehack in the same vein as Ikea hackers. This is not a big hack, but it makes for a great (home-)studio mod.

I was thinking of a way to achieve this (pictured) and I noticed the cheapest model of the bunch, the Apextone LS-01, suited my needs perfectly. At only €15,- it’s by far the cheapest laptop-rack/stand money can buy. There’s an optional tray for another €15,-, and that’s what the Roland TR-606 is sitting on.

Let me share another small hack for in the home studio: Get a bunch of switchable plugs like pictured below. They’ll save you some power-usage and in some cases are an easy way to switch on your instruments and effects. These are the european variant, but I’m sure you can buy a local version wherever you live.