Tag Archive for: raspberry pi

Five Go on a Hacking Weekend

Last weekend (25th & 26th November 2016) Dogsbody Technology headed off to St. John’s church Hoxton in Shoreditch, London to attend (what turned out to be the last) Over the Air 2016.

Over the Air is an annual 2-day mobile developer event with a mix of technical workshops put on by the community, a Hackathon to celebrate programming & making as a creative discipline, and Lightning Talks to entertain and inspire.

This year the Dogsbody Technology team decided to do their first hack and enter the Hackathon Challenges for the first time – and boy did we have fun! It all started with us finding a 4ft Stormtropper while out shopping which we knew we could improve on! We named it ‘Dolly Stormageddon‘, or Stormy for short.

On Friday morning we packed the car full with Raspberrys Pi’s, Arduino’s, Lasers, Lego, wire, speakers, batteries, soldering irons, microphones, USB dongles, cable ties, SD cards, cables, drills, duct tape, sleeping gear and more! Heading off with a general plan of what we wanted to try and achieve.

After the welcome speech and Friday keynote presentation by Hadley Beeman on the effects of Brexit and Trump to the tech industry, we set ourselves up in the Crypt under the church and got to work.

We had a list of stuff we really wanted to do and a list of nice to haves as we knew time was limited to less than 24 hours!

Nexmo was a sponsor of Over the Air and so we decided to use their SMS API to make Dolly read out text messages. Rob set up the Nexmo SMS API and we used an existing Pushover script to communicate this to a Raspbery Pi which then used Amazon Ivona text to speech software (we picked Welsh) to read the text message out over a speaker we put in Dolly’s leg. This was all scripted/set up by Gary. We even added the function that if someone texted ‘shoot’ it made a blaster noise!

For a good demo you always need lights and movement so Dan wired up a laser pointer to his gun and Jim used Lego to mount a servo and programmed an Arduino to get his head to move side to side.

Finally we added an NFC Tag inside his chest with the number for people to text.

Testing included texts such as “I’ve got a brand new combine harvester” and the complete lyrics to Queens “I want to break free” – which is slightly strange spoken by a 4ft Stromtropper in a Welsh accent!

We entered three categories in the Hackathon Challenges –  The Nexmo APIs Challenge, The Best Hardware / IoT  Entry and The Best Use of Other Features. Below is our Show & Tell! We had exactly 90 seconds to present what we worked on.

WE WON!!!

The Best Hardware / IoT  Hack!! with an Nexmo Honourable mention

We got a pile of new toys to play with from our win and we couldn’t be happier

Dan, Jim, Claire and Rob attended a few talks but the hack took up most of our time, the always interesting and funny lightening talks included a  talk on ’10 stupid stuff I’ve bought on the internet’ (he had to narrow that down from over 40!) which include 1000 plastic ducks and entering an inflatable marathon whilst intoxicated.

Dolly and the Dogsbody Team are now home and the ultimate idea is Dolly will be in our office and alert us when a server goes down..we will rebuild Dolly better, faster, stronger…

Dogsbody Technology would like to say a BIG Thank you to the Organisers and sponsors of Over The Air throughout the years for a great event. We had an amazing time!

 

Feature image by Andy Piper

Adding an external harddrive to a Raspberry Pi

We believe the native place for a server is in a datacentre and as such don’t run any infrastructure from our office.  This caused us a small problem when testing new setups as we would sometimes need to build a new development server (locally in a virtual machine) and have to pull down all the ISO’s and packages needed.  We have a fast internet connection but we are also impatient.

We needed a way to mirror the latest releases of the popular Linux distributions that we use so they are easily accessible for when we need them in the office. We decided that the best way to do this was to setup a script mirroring these popular repositorys on a Raspberry PI that we use for various things in the office.

We had a spare 1TB external harddrive that seemed like the perfect fit, and as it’s always best to start projects with a clean slate we did a full shred of the disk to make sure it was completely clean. This was done with the following command:

sudo shred -n 1 -z /dev/sda &

This performs a pass on the disk filling it with random bytes and then a second pass that writes 0’s to the disk.

The next step was to create some partitions on our disk, one of these we were going to use as swap space for the Raspberry PI and the other for storage of all our ISO’s we were going to mirror. We used fdisk to partition the disk and created two primary partitions, the first partition was 1GB of swap (it’s always better to make your swap partition first as it will be created on the inner sectors of the disk where the disk spins faster). The second partition was for our storage and used the rest of our available disk space.

After partitioning our disk we need to format the partitions accordingly, our storage partition was /dev/sda2 so we formatted it as ext4 with:

sudo mkfs.ext4 /dev/sda2 -L storage

And then mounted it as /mnt/storage with the following commands:

sudo mkdir /mnt/storage
sudo mount /dev/sda2 /mnt/storage

We now had around 1TB of storage under /mnt/storage that we could use to store all of our ISOs for easy access over the office network meaning we always have the latest and greatest versions at our disposal.

Finally to setup our Raspberry PI swap partition and enable swapping on it we did the following:

sudo mkswap /dev/sda1
sudo swapon /dev/sda1

We will also need to disable the standard Raspberry PI swap that uses the SD card with the following commands:

sudo dphys-swapfile swapoff
sudo dphys-swapfile uninstall
sudo chkconfig dphys-swapfile off

The command:

sudo swapon -s

Will now show our new 1GB swap partition on /dev/sda1.

Finally we need to add some lines to our fstab file so the partitions are automounted at boot. We edited /etc/fstab and added the following lines:

/dev/sda2 /mnt/storage ext4 defaults 0 2
/dev/sda1 none swap sw 0 0

Save that file and you should be all done! You can reboot to make sure that all of the partitions are automounted and that your Raspberry PI is now swapping on the new 1GB swap partition we made.