Skip to content

**** ****

Raspberry Pi A+: First run!

November 25, 2014


The Pi A+ has had my attention since it first launch and I have eagerly been awaiting for mine to arrive. Today that day finally came and I saw the package waiting to be opened on my desk.

I ordered my Pi from Adafruit along with a pre installed SD/Micro SD combo card with Raspian. I’ve already played the OS install and self setup game for many years and for this project I just wanted to get up and go as soon as it arrived.

IMG_3074The Pi comes in an updated box, the original was just a plane looking white package while this one sports the RPi foundation logo, element14 and product details on the back.

The new form factor of the A+ is really what had my attention and I just had to see it for myself. It is 1/3 shorter than the B models I have. The eventual goal for this Pi is a track view camera for train club powered by a power bank.

First boot

Now the A+ only has 1 USB and no ethernet so for initial setup it is a good idea to have a USB hub around to allow you to connect more peripherals. In my case I already had a hub that I bought when I got my first B model almost 2 years ago. I plugged in my keyboard and mouse, inserted the microsd card (which has a nice push spring release too) and connected the HDMI and power.

The Initial setup screen popped up, I used my whole SD card and set my overclock to 950 (standard among my Pi’s) and rebooted again.IMG_3082

I logged into the OS and ran startx. There was a Minecraft Pi icon on the desktop, this seemed like a good first run test.

I don’t actually play minecraft but the application ran very smoothly and I chopped away at the mountain side with a sword for a bit.

The first boot test was over and the A+ gets an A+.

Projects

First I am going to test the limits of this Pi by having it run in my Arcade controller. We will see if can match or come close to the same perf as the B with the reduced RAM. I believe it will and this will open up the possibility for a 2 player arcade Pi down the pipes. The A’s extra GPIO slots make a full 2 player deck possible. If it doesn’t hold up there is always the B+ model.

Secondly the actual intention for this Pi will be to convert one of my HO scale flatbed train cars into a camera car for the GNMRE club layout. The reduced power footprint of the A+ should make it more co-operative with the small power bank I would like to use whereas the B’s used too much power for it to be possible.

So keep an eye out you’ll be hearing more from me in the coming weeks!


Time machine backups to the Raspberry Pi

November 22, 2014


Time machine is Apples computer backup solution and it works great. I have been using it for 6 years and even supported it for a couple years in Applecare way back when. The nice part about it is you plug a new hard drive and it prompts you with a question asking to use for backups and bam off to the races in 1 click.

Under the hood

Just like all of Apples fancy magic GUI based tools Time machine is actually backed by command line goodness that the power user can make Time Machine go above and beyond the basic “magic” way of getting things done. In Time machines case you can use the command line to make any mountable volume into a backup disk. Now this might not sound like that big of a deal but what it means is that you can use any hard drive formatted in any manner using a variety of protocols to backup your Mac if that’s what you desire. In my case I have a Raspberry Pi in the living room with a 3TB exfat Hard drive that is only barely used and I decided it would make a good network backup server as well.

IMG_1196On the Pi

The easiest way to do this with the Pi would be Samba. Samba is an open source project that allows you share volumes out as Windows shares.

In some cases your distribution may already have a share for mounted USB devices but in this case I’ll assume it doesn’t

Make sure your external drive/usb stick/flashcard/whatever is mounted to your Pi somewhere. Sometimes these are mounted for you automatically by the distribution like in Rasbmc’s case all USB drives get automatically mounted to /media/

If that is not your case mount the disk to a folder of your choosing (usually in /mnt or /media) then proceed

Install Samba

sudo apt-get install samba samba-common-bin

 

Once installed use the editor of your preference to edit the configuration file.

vim /etc/samba/smb.conf

 

Here is a basic configuration that will allow you to mount and read/write the drive from the Mac

[BackupShareName]
browsable = yes
read only = no
valid users = pi
path = /media/BackupVolumeName
force user = root
force group = root
create mask = 0660
directory mask = 0771

 

This uses the already existing Pi user, like I said I was being basic. it would be sensible to make a new user/password for this purpose.

Restart/start Samba

/etc/init.d/samba restart

 

You should be able to mount the drive from the Mac now and it should appear on the sidebar of Finder. You will have to use “Connect As” and change the credentials. If it did not appear on the sidebar you can use the Go menu on Finder and “Connect to Server” with smb://your.pi.ip.address.

On the Mac

The Mac should now have a mounted volume in Finder that you can write to. What we need to do now is create a Sparse bundle disk image on the mounted volume. Go into Applications -> Utilities and open the Disk Utility.diskutil

Don’t select any volumes yet

  • Click New image
  • Name the image
  • Set the appropriate size for your backup volume
  • Format Mac OS Extended Journaled (if you formatted your OS as case sensitive you’ll need to use that as well)
  • Encryption: None (unless you want to I suppose)
  • Partitions: Single Partition GUID
  • Image Format: Sparse bundle disk image
  • Make sure you have expanded the advanced carrot on the save location and save it to the mounted remote volume
  • Click Create

Now you have a sparse bundle on your mounted volume. Time to make the Time Machine magic happen.

First open the sparse bundle and it will mount on the sidebar of Finder. What this also does is puts it into /Volumes on the filesystem which is the key to pulling this all together. Essentially anything you can get to mount can be used for Time Machine if it is in the proper Mac filesystem format.

Second, use the tmutil command from the command line to set the backup

sudo tmutil setdestination /Volumes/MountedSparseBundleName

 

timemachineOpen Time Machine from System preferences and you should see that it now shows a backup Volume being active.

If you do have a case sensitive system and you didn’t make a case sensitive bundle you will get an error. Go back and re create the bundle to match your computers filesystem.

Now when you wish to do a backup all you need to do is mount the remote volume and sparse bundle on your Pi and let it run.


Greater Niagara Model Railroad Engineers open house!

October 31, 2014


The GNMRE is hosting open houses on 2 weekends in November. The first is on November 8th and 9th and the second on the 22nd and 23rd. A year ago I first visited the GNMRE on an open house so it is a great time to come see the layout and maybe even stick around afterwards and join!

Below is the flyer with the dates, times and directions hope to see you out there!

 

flyer

Click image to enlarge


SD40-2 Chessie System restoration

October 16, 2014


I picked up a new engine a few weeks ago and new is a relative term as in it means I just recently own it. The engine had some rough points to it. The back truck cover was missing, the railings were broken missing or bent, no horn, no couplers but the body itself was in good shape.

 

The engine is an old blue box era Athearn so it had metal railings and when you first get the engine you have to put a lot of the parts on yourself. Personally I liked this era as you couple get decent engines at fairly reasonable prices. Nowadays that isn’t the case everything is RTR and costs twice as much. I picked this up for 30 bucks which really was a bit much given its state but to me the shell alone was worth 20-25.

I made a stop to Just Train Crazy on Friday and low and behold they had an undecorated Athearn blue box with the parts unassembled powered + a dummy for another 30. I picked it up and took it home to see what could be applied to the Chessie.

First I put the new trucks on. A train isn’t complete without trucks. This wasn’t hard they mainly snap back into place. They sat off a wee bit so I used some plastic adhesive to hold it in place.

Next I added a Kadee couple box. This unfortunately sat too low and there didn’t appear to be another Athearn style in the box. The dummy SD40-2 sacraficed its couple box.

After some running tests of the undecorated vs the Chessie it was obvious the undecorated had never been run before and was in perfect condition so the shell was transplanted to the new/unused motor and trucks.

I used some adhesive to get the railings to stay in their upright position, many of the rails had the hook part broken at some point. The glue did a well enough job of holding it in place. Some of the broken clips now stuck up over the railings and I eventually clipped these down to match where the railing wire sat.

Finally I glued a new horn in place and Voila! A restored Chessie SD40-2 with just enough natural aging on the colouring to give it character!

IMG_2996


Pi shutdown button: Details

October 7, 2014


 

mattcomment

It’s rare to get someone who actually goes through the comment process on my blog but since they took the time to not only read my post but also to provide feedback I try to oblige. In this case Matt would like some of the finer details to my Shut down button I did on my media Raspberry Pi so here we go!

The button

The button itself is a flat Japanese style arcade button in translucent red. It was originally used in my first Arcade project and acquired from Adafruit. The features of this particular style of button are it is dead simple for beginners which at the time I was exactly that. There are 2 small prongs on the button and the basic jist of getting this whole thing to work is that 1 pin goes to a live GPIO pin and the other goes to a ground pin.

The cable

Now, Adafruit being as thorough as they are on their tutorials also provided a simple all in 1 cable with the appropriate female connecting prongs on one end and on the other end a double jumper so you can place it over a ground pin and GPIO pin in one step.

 

GPIO

As I mentioned in another post shortly after my shut down button post if you connect a button to Pin 5, better known as GPIO 3 on the GPIO image a Pi in stand by mode will wake up/boot when pressed so if you want a dual function shutdown and power on button you should connect your button to GPIO 3. For the purposes of the equipment I use this also has the extreme convenience of being right across from a ground pin.

GPIO Rev2

GPIO Rev2

Retrogame

Once again hands off to Adafruit for creating this little gem I have since turned it into my Swiss army knife of GPIO button interaction. My version can be found here on my Github account. If you just want duplicate functionality then retrogame-xbmc.c is all you need it is already set up in that source file and you just need to compile it to a binary and go. However, details being what they are….

In the definition of io[] (line 89) in the C file I made sure the last entry in the table pointed to pin 3. Technically the table could be just that one line as I don’t actually use any of the other pins on this particular machine. The key it presses doesn’t matter but it is a good idea to make sure it isn’t a key that whatever application your Pi is running acts on.

{ 3, KEY_LEFTALT }

Line 131 I changed the mask to the same values, this allows it to work as 1 button instead of the 2 the original developer had set it up for.

const unsigned long vulcanMask = (1L << 5) | (1L << 5);

Line 394 I changed the #if condition to always exist, this was blocked off by the original developer as they moved away from this style of shut down method. I suppose I could just take the block out but I was just looking for functionality not cleanliness. I don’t believe this code even exists anymore in the main retrogame tree but with me it will live forever!

		} else if(timeout != -1) { // Vulcan timeout occurred
#if 1 // Old behavior did a shutdown
			(void)system("shutdown -h now");

 

However if you don’t care about any of that an easy way to get started is:

git clone https://github.com/CrazySpence/Adafruit-Retrogame.git
cd Adafruit-Retrogame
cp retrogame-xbmc.c retrogame.c
make

It’ll complain about gamera being missing or something but don’t worry about that retrogame will be compiled. If it complains about anything else make sure you have GCC, make and the uinput kernel module installed on your OS.

Run on boot

Make sure to add “/pathto/yourbinary/retrogame &” to /etc/rc.local file and then it will start on boot and stay in the background.