In this project we are going to show you how to create a Network Attached Storage (NAS) with UDOO starting from recycling electronic components you can easily find at home. This device is going to be the new center of your digital life: use it as a backup server, DLNA server, torrent server and create your private cloud, thank to open source and DIY.
This won't be an ordinary NAS, by the way. What we like to do here at Udoo is creating fun stuff. So, even if our Udoo-powered Network Attached Storage is an excellent companion for backing up our valuable data, sharing our medias via DLNA, downloading torrents and much more, we just wanted to give it that extra touch of Nerdgasm it deserves!
So, it will notify us when a Torrent is completed, by emitting a loud "Bazinga!" sound and making a little disk spin and light up with the same word written on it. That’s a fair example of what you can create with Udoo.
No ordinary device will be the same after Udooing it!
Part 1: Hardware
Part 2: Software
We’re going to use Open Media Vault, an open source NAS solution, made by Volker Thiele. This OS is superb for this purpose: it's reliable, relatively easy to use and has tons of features, further expanded by community build plugins.
You can grab a specific UDOO's tailored Open Media Vault here.
The Video will show you how to start from the very beginning, and guide you through some extended functionatilities of Open Media Vault.
After this set up, voilà, your Udoo powered Network Attached Storage is ready to host and serve all your data.
If you want to know how to flash your SD card, see these tutorials:
- Creating a bootable micro SD card using Windows from image
- Creating a bootable micro SD card with Mac OSX from image
- Creating a bootable micro SD card with Linux Ubuntu from image
If you need to know how to find UDOO’s ip address, click here and see the tutorial.
Part 3: Hardware setup
What we really don’t like about our shiny brand new NAS is that it only goes from A to B, just doing perfectly fine its job. We’re makers, and we want our devices to be smarter, funnier and more interactive. So, what’s the plan?
Nerdgasm!
One of the main purposes of our NAS (at least here, in UDOO's HQ) is to download and seed our OS images torrents. We're eager to test new distros as soon as they come out, so we are patiently waiting for those torrents to finish. Why not having a feedback when this happens?
Complying to nerd’s bible, we are going to hack a little our NAS, enabling it to give us a visual and auditory feedback when a torrent is completed.
The idea is this. At a torrent completition, a sound will come out from our NAS. It will be a ringing “Bazinga”. You know why.
Then, we’ll have a LED to turn on and light up a small spinning disk, with the word Bazinga on it.
How are we going to make it happen? We setup OpenMediaVault to launch a bash script when a torrent download is completed. This script launchs two kind of actions:
- Plays the file Bazinga.wav on the Analog jack, with aplay
- Sets the serial port properly, and sends “1” on it
Then, we upload an Arduino sketch on UDOO’s SAM3x, which will turn pin 7 (LED) and pin 8 (motor) to HIGH state for 4 seconds when “1” is received via serial. That way, the motor will spin and the light will turn on when a torrent is completed.
Let’s do it!
This is the software configuration guide, to see how to wire things up, just refer to the Video of this project.
First, let’s configure OpenMediaVault, to launch the Bazinga.sh
script on Torrent completion.
Before doing that, we just want to make sure the serial port is properly set, at the same speed of the serial reading set in the Arduino Sketch, and with proper permissions. So we connect to OpenMediaVault with SSH add this line to /etc/rc.local
:
This ensures that both Imx6 and SAM3x could talk to each other via serial.
Then, we create the bazinga.sh
script, on /bazinga/bazinga.sh
:
And we write the bazinga script:
Ctrl+x
to save.
Then, give execution permission to our script with:
This is a very basic script: it just writes 1 on serial (/dev/ttymxc3
) and plays bazinga.wav
, which we previously uploaded into /bazinga/
.
To be sure that the script is executed with proper permission, we just give Transmission root privileges. To do so, we just edit the transmission starting script with:
and edit the USER
line, making it look like that:
Save with Ctrl+x
and reboot.
Please note that this is a dirty trick, as giving Transmission root privileges may not be the best idea in the world. But we can be safe with that, as it is the quickest way. If you plan to implement this, it is strongly suggested that you just give openmediavault root privileges only for that file.
Then we configure OpenMediaVault to launch this script, on torrent completition. To do so we log in into the OpenMediaVault administration panel, select Transmission then server, and scroll till the end. Then simply select “Run script at torrent completion”, and insert/bazinga/bazinga.sh
on script path. Then save it.
To check that everything is alright, we just read on /dev/ttymxc3
with:
And, if we start a torrent, when it completes we should have as output: 1
Then we just upload the Arduino Sketch on the Arduino compatible controller, the SAM3x.
This is our sketch. It basically listens on serial, and when it reads "1" it sets pin 7 and 8 to HIGH state for 4 seconds. This will make the LED to turn on, and our motor to spin.
As you may have noticed, there's delay(15);
at the end of the sketch. This is just a precaution in order to avoid serial overload. We just tell the SAM3x to wait 15 milliseconds from one read to another.
After it has been compiled and uploaded, here we are! Our software configuration is completed.
Just set the wirings as shown in the video, and your UDOO-powered NAS with UberNerd powers is complete!
Comments