EVADE – Space shooter for the Arduboy

Introduction

One of my very first projects at Modus Create has been to work on EVADE.

EVADE is a side scrolling shooter for the Arduboy. For those of you not familiar with the Arduboy, it is a credit card sized hand held games “console”. As you can probably guess from its name it resembles a the Nintendo Gameboy.

Unlike the Gameboy, it is based on the Arduino platform and holds only a single game at a time. These can be uploaded from the Arduino IDE via a USB cable.

A number of sites online carry to the Arduboy including Adafruit.

So let’s take a look at EVADE.

EVADE

When I said let’s take a look at EVADE, I really meant look. The team at Modus Create put together an awesome cinematic trailer, you can watch it right here:

EVADE Cinematic trailer from Modus Create on Vimeo.

It’s a video game in the classic sense. Three bosses, three enemies and four lives. You navigate through a star field as waves of aliens attack your ship!

Hopefully this has wet your appetite to the play the game. The files can all be downloaded from the GitHub repository:

https://github.com/ModusCreateOrg/evade-arduboy-game

Once you have them, plug in your Arduboy, upload and play!

Also don’t forget to check out the Modus Create blog for further updates on how we built this nifty project.

 

 

Raspberry Pi Home Automation with Arduino 2nd Edition

Everyone,

I am happy to announce the 2nd edition of Raspberry Pi Home Automation with Arduino is now released.

3927_raspberry20pi20home20automation20with20arduino20second20edition_cov

2nd Edition cover

 

Raspberry Pi Home Automation with Arduino 2nd edition It’s available from all good bookstores and Amazon of course. After much editing and refinement here is a taster of what the book covers:

  • Arduino Uno
  • Raspberry Pi
  • Cooking Hacks Arduino to Pi bridge shield
  • Relays
  • Temperature sensors
  • Water sensors
  • Motor shields
  • Humidity sensors
  • Pressure sensors (FRS)
  • Networking
  • Python
  • C++ and Arduino sketches

Sadly we didn’t end up with space to cover the YUN this time round.

A brief introduction to BreakfastSerial

Introduction

In my post on Y-Hack I touched upon a Python based technology called BreakfastSerial. Some of you Arduino fans out there may already be familiar with it, but for those who are not I have provided  short guide below.

BreakfastSerial is a Python based library that allows you to write Python code that can be run on the Ardunio.

The technology

The library runs on top of a technology called Firmata.

Firmata is a generic protocol for communicating with Microcontrollers from software running on a host computer.

You can read more about the Arduino implementation of Firmata at the Arduino.cc website:

http://arduino.cc/en/Reference/Firmata

BreakfastSerial works by allowing you to interact with Firmata loaded onto your Arduino by writing Python code.

You simply upload Firmata to your Arduino board, and then can start writing Python applications that use it.

We will look at an example next.

Setting up Firmata

In this post I will only be covering the steps for the older boards such as the Uno. There is a separate post in the works for the YUN. I will also be assuming you are using a Linux like environment (Ubuntu, Mac terminal window, Cygwin etc.)

To start with you will need to open up the Arduino IDE sketch pad, if you haven’t download it already you can find it at:

http://arduino.cc/en/Main/Software

Note, that depending on your Arduino model (e.g. Uno versus YUN) there are different versions of the IDE.

Once you have the IDE installed, you can find the Firmata software under:

File -> Examples -> Firmata -> StandardFirmata

Next connect your board up to your computers USB port and upload the sketch.

Once uploaded you can then move onto the testing out BreakfastSerial.

Installing BreakfastSerial

Open a terminal window on your machine and using pip grab the latest version of BreakfastSerial from PyPi
pip install BreakfastSerial
I tend to work in a virtual environment when using Python. If you wish to do the same, you can create a virtual environment as follows
virtualenv --system-site-packages Ardunio
This will create a new directory called Arduino with a Python virtual environment in. From within this, you can activate it using
./bin/activate

If you don’t have virtualenv on your machine you can grab it using pip:

pip install virtualenv

Next we can create a test project using Python. Before we do this though, take an LED and attach it to digital Pin 13 and Ground on your Arduino – yes you guessed it we are going to make the LED blink.

Once you have your hardware hooked up, create a new Python file called blink.py for example:

vim blink.py

Inside this file we are going to add the following code:
from BreakfastSerial import Arduino, Led
Here we are importing Arduino and Led from the BreakfastSerial library.

Next let’s add the following code:
board = Arduino()
pin = 13
led = Led(board, pin)

This sets up a variable board with an instantiation of Arduino and a
pin variable set to 13 (where you attached your LED). Finally the
led variable is declared with a copy of Led(), which we pass board
and pin to as arguments.

Once you have added the above, we can include the final piece of code that creates the blinking action:
led.blink(200)
the above is pretty self explanatory. The led is switched on, we wait two seconds and then it is switch off.

Save the file and exit.

We can now test our application. From the command line run:

python blink.py

You should now see your LED blink.

And that’s all there is too it really.

There are a host of examples you can try located on the BreakfastSerial site:

https://github.com/theycallmeswift/BreakfastSerial/tree/master/examples

have fun!

 

Yale Hack-a-thon (Y-Hack)

Y-Hack

This weekend I had the opportunity to be a mentor at Y-Hack. Y-Hack was Yale University’s first (inter)national Hack-a-thon event that saw teams from all over the US, Canada and England gather for a 24 hour coding battle.

The prizes included the chance to present your software to Google and Microsoft, cash, gadgets and books.

Hosted in Yale’s West Campus, over a 1000 students gathered into teams of four and grabbed any free office and cube space going. From 6pm on Friday through 6pm Saturday teams battled away at building original software and hardware projects.

I staid at the event from 6pm until 6am – the overnight shift – and got the chance to see some great talks on the various frameworks and APi’s out there. I also had my first taste of Google glass which was interesting.

One talk in particular that caught my eye was BreakfastSerial – a Firmata based Python toolkit for interacting with Arduino over serial. I’ll be following up on this in more detail in my next blog post.

A team from NYU (Laser Lock) also built a project using Arduino and LEDs (and won four copies of my book!) and another group were using Arduino to build a breathalyzer, so lots of fun projects for the judges to review on the Saturday when it came to prize time.

Hopefully the team at Yale will host this again next year.

I also have special shout out to the team from Rose Hulman for using HTSQL to build the PIXL site and winning the HTSQL prize:

https://pixl-rhccdc.rhcloud.com/

The list of winning teams can be found on TechCrunch:

http://techcrunch.com/2013/11/09/yale-adds-another-stop-to-the-college-hacker-circuit/

And a list of entries can be found at Hacker League’s website:

https://www.hackerleague.org/hackathons/y-hack-at-yale/hacks/

All in all a great event!

Project updates

Things have been a little quiet as of late due to me being busy.

The various projects have been progressing nicely in the background and I’ll be getting their progress written up into blog posts as soon as time permits.

In the interim here is a quick update on where things are at:

Wireless thermostat

My Arduino YUN has arrived. This is going to be the perfect piece of equipment for completing my WiFi thermostat project. It takes away the need to worry about hooking up a separate wireless shield. I’ll just need to attach one of my touch screen shields to it and hook up a relay and thermistor and it will be ready to go.

My next wireless thermostat post will go into more detail on this.

Ethernet Thermostat

The Ethernet thermostat is almost complete. The next post on this will detail each component I used, how to set it up and will also discuss connecting it to baseboard heaters and the types of relay needed.

Thermostat controller

The Java based thermostat controller running on the Pi is coming along nicely. The next posts on this will tie in with my earlier post on parallel computing.

The controller is going to leverage Hadoop which is running on other devices in my home to process temperature data. Expect a guide to setting up Hadoop on the Raspberry Pi and also a further look at MPI for C based applications that can also leverage spare processing capacity.

There will also be code uploaded to BitBucket which you can download and use as a base for your projects.

 

Upcoming reviews

I have some upcoming reviews on the Arduino YUN, the Pebble smart watch and Mint floor sweeper.

 

 

Quick update

Just a quick update.

1.) Exams are done, so plenty of time to work on various projects.

2.) In the coming weeks I’ll be doing an interview with Marco of Open Home Automation.

3.) Wrapping up the controller module on the Raspberry Pi

4.) Completing the Ethernet and wireless thermostats

5.) A review of the Mint robot sweeper

6.) A closer look at Nest

7.) Baseboard heaters and wireless thermostats

8.) HPC with the Raspberry Pi

 

Raspberry Pi Home Automation with Arduino

So the book has finally been published!

Raspberry Pi Home Automation with Arduino - book cover

Raspberry Pi Home Automation with Arduino

The title is: Raspberry Pi Home Automation with Arduino and it is available from Packt publishing at the following URL:

http://www.packtpub.com/raspberry-pi-home-automation-with-arduino/book

 

A bit about the book

Raspberry Pi Home Automation with Arduino is a basic introductory guide for using your Raspberry Pi technology and the Arduino Open Source framework, for building small home automation projects. The book will walk you through the basics of getting setup, trying out some basic electronic components such as photo-resistors and DC motors and building some introductory projects.

I’ve tried to keep the book accessible to beginners and steered clear of anything too complex. Once you are comfortable with the material in the book you’ll be able to move onto the more challenging projects.

Some of the topics covered in the book include:

  • Install an operating system for your Raspberry Pi
  • Set up the Raspberry Pi and Arduino bridge shield
  • Learn how to work with electronic components to build small circuits
  • Develop applications that interact with your circuits
  • Use thermistors and photoresistors to monitor and control your surroundings
  • Control your own mains power with a relay shield and even connect a motor to your Raspberry Pi

Cooking Hacks shield 

Due to delays in the Gertboard shipping, when originally writing the book I found an excellent replacement for this component. This is the Cooking Hacks Raspberry Pi to Arduino connection bridge shield, which can be found here.

As you may have seen in some of my earlier posts I have given some video examples on the bridge shield being used to connect a Arduino Relay and Arduino Motor shield to the Raspberry Pi.

I would recommend checking this component out if you plan to do any home automation projects with your Raspberry Pi and want to re-use existing Arduino shields.

Wrap-up

If you have any question or queries feel free to post them here. If you spot any Errata (yes the dreaded typo as well) you can send through a correction form here.

Book update

Just a quick update on the book. It is currently going through the pre-final proof reading stage where hopefully we will weed out any typos!

Once I have a confirmed release date I will include those details here – we are looking at around the end of February for it hitting the stores I would guess though.

For anyone that buys it and has comments or questions you can use this blog as a medium to contact me.

Raspberry Pi to Arduino shield thermostat – a sneak-peek

Here is a sneak-peek of the Raspberry Pi to Arduino shield based thermostat project I have worked on for the upcoming book.

The prototype you see below is part of a project in one of the chapters:

This uses a relay shield attached to the Raspberry Pi to Arduino shield. The relays are then switched on and off based upon a change in temperature. Connected to the relay shield is a wall powered electric fan.

Enjoy!