Wednesday, April 29, 2015

RaspberryPi - Cooking up a case (Follow-up)

Following on from the case I made a few weeks back, I was able to get some chestnut wood cut to size.

This one was drilled much as before -
  • four 6mm holes in the corners for the spacer nuts and feet
  • four 4mm holes in the base piece to attached the Pi (this one being a RPi-B).  Although the circuit board is drilled with 3mm holes, the 4mm ones in the base allow a little play to avoid bending the board.
  • one 16mm hole in the top for the new switch.
The Pi has no on-off switch, and powering off the GPIO pins is not advised; so I bought a small circuit from mausberry circuits.  This little circuit sits between the power supply and the MicroUSB power input on the Pi.  Two connections to the GPIO allow the power off and reboot all from the same switch.

The switch was one of these from Adafruit. Complete with blue LED light when powered up, this was easy to connect up.

The final working board looks pretty neat, if I may say so myself.
 

Sunday, April 05, 2015

Raspberry Pi - Can you hear what I hear?

The first project I wanted to use the Pi for was a media centre.

I wanted to:
1/ Stream music from my NAS drive via wifi
2/ Listen to inernet radio via wifi connection
3/ Connect output to my TV so that I could play through my DVD player/Surround Sound system

In the end, 3/ was replaced by "Connect directly to Surround Sound using 3.5mm audio jack".

I choose Volumio as the system as it seemed to do what i needed it to do.

Download and install Volumio...

Download Volumio for Raspberry Pi from here.

Burn ISO file to SD card using Win32DiskImager.

Put SD card in Raspberry Pi, add LAN and power up from PC's UB port (just initially).

Set up wifi...

On the basis of other reviews, I ordered a Edimax EW-7811UN Nano USB Adapter.


Based on the following threads:

Boot the Raspberry Pi without the WiFi adapter plugged in.

Open a Terminal session by clicking on the LXTerminal icon, and enter the following command into it:

$sudo nano /etc/network/interfaces

This opens an editor screen of the wifi configuration file you need to change.
Edit the file to include at the end:

allow-hotplug wlan0
auto wlan0
 
 
iface wlan0 inet dhcp
    wpa-ssid "ssid"
    wpa-psk "password"

..where ssid and password are replaced with mine…

When you have finished press [ctrl]x. This will ask if you want to save the modified files.

Shut down the Raspberry Pi
sudo shutdown -h now

Remove the LAN cable
Plug the WiFi adapter in
Power up...

The Raspberry Pi should connect using the WiFi adapter as it boots up.

Conneting the NAS drive...

I had some problems with getting the Raspberry Pi to find the NAS drive on start up.  I could add it through the Volumio GUI, but it wouldn't mount the drive on start up.  It took some playing around to get a solution that worked, especially some of the fstab file tags were giving errors....still, the following worked in the end.


sudo apt-get install cifs-utils
sudo mkdir /mts/NAS/SOME_NAME


sudo nano /etc/fstab

Add the following line to the end of the file:
//IPADDRESS_OF_NAS_DRIVE/NAS_FOLDERNAME /mnt/NAS/SOME_NAME cifs username=*****,password=*****,ro,users,auto,user_xattr 0 0

...where ***** is replaced by the Pi's username and password for the NAS drive.

Save, exit.

Confirm using
sudo mount -a

Reboot.

Audio output...

Finally, I realised that there was no need to run the connection via the HDMI cable to the TV, then output via optical cable to the surround sound system...as the Raspberry Pi has an 3.5mm audio out jack, and the surround sound has an input for this...


To setup Output to Audio Jack instead of HDMI, I ran the command:
amixer cset numid=3 1

The last digit is the key one; 1= analogue (audio jack); 2= HDMI and 0=automatic(maybe I could have used this?)

Anyway, it works :)



RaspberryPi - Cooking up a case

Inspired by this instructables project I thought I would have a go myself and upgrade the old Lego one.

The final case:



I had most trouble finding a couple of pieces of wood; in the end I went for something a little tougher than balsa (but not much) a a stop-gap until I find something more like the oak in the original project.

All the hardware parts were from the local Leroy Merlin store, a large DIY store that sells hardware in a 'pick and mix'.  I ended up with few false starts on the hardware; this outlines the final design. I actually made two identical cases, as I have a second pi on order for another project (so the photos may show both!)

Parts



Wood, 190mm long, 102mm (4") wide, 3mm thick, 2 off.


To hold the case together:
Bolts, M6 20mm, 8 off.
Washers, M6, 8 off.
Coupling nut, M6, 30mm long, 4 off.
Plastic caps, M6, 4 off.

To mount the Raspberry pi board:
Bolts, M3, 16mm, 3 off.
Nuts, M3, 6 off.
Washers, M3, 6 off.

Assembly

The wood parts were marked and cut out.  The pieces are quite a bit bigger than I really needed for just the basic Raspberry Pi - I wanted room to mount a few extra internal boards for future projects.  This case *just* allows access to everything - see 'for nest time' at the end for more comments.

Edges lightly sanded to remove sharp edges.

Four 6mm holes drilled 16mm in from each edge, and the two 3mm holes drilled based on the mounting hole in the Raspberry Pi.  I have the Model A board; no idea if later versions have the same layout.

Adding the hardware

On the base piece (with the 3mm holes), add one M6 bolt with a asher either side of the wood, and screw into the coupling nut.






The plastic caps act as little feet to protect surface the Pi is on:



With all four corners done, add the M3 bolts for the board mounting.  Washer either side of the wood and add a second nut to hold the circuit board off the wood:


Add a washer, the slide the board onto the bolts and add nut to hold in place:


Add the top of the case, using a washer under the wood, and an M6 bolt in each corner.

And done!

If I made another one...

The coupling nuts look nicer than a stack of nuts used in the original design, I feel, although I was lucky to find some the right length.

The thinner material can split when drilling, take care!  I put this down to user-error as much as anything.

The wood used is okay for a proff-of-concept, a thicker piece would look better and as soon as I find something I'l replace it.  The bolts used allow for easy changing of the wood pieces; indeed you could easily use plastic or even ceramic tile.

Access to the board is a little tricky...you can get everything plugged in with the case assembled, just.  the LAN cable needs a pencil to press the release tag, and putting the SD card in is an exercise in dexterity.  However, this is intended for a Volumio media driver, so will only need power and audio connections once configured.