Home » 2013 » June

Remote controlled boat using the Raspberry Pi with an Arduino

In the last 8 weeks or so I was working together with 3 other students researching some of the possibilities of the Raspberry Pi and what it could offer the school for future education and research purposes. The results of the many small research subjects came together in a remote controlled boat.

Sadly due to me getting sick this week I haven’t been able to properly finish the project myself, but the other team members were able to though.

The boat’s (server) software is a Python app running on the Raspberry Pi (model A). This app is responsible for communicating with the Arduino through I²C and basically tells the Arduino which channels to modify. The Arduino runs a simple C program for this. There are 2 separate motor controllers which are connected to the Arduino. The rudder is a single servo which is also connected to the Arduino. Initially we had planned on mounting a camera on the pan-tilt mechanism which is located up front, but the ideas we had for implementing computer vision didn’t quite work out. The pan-tilt mechanism has two servo’s, both connected to the Arduino. So in short the Arduino drives all the hardware and the Raspberry Pi tells the Arduino what to do.

The Arduino itself is ‘mounted’ to the Raspberry Pi with the use of a custom made connector board. The Arduino is placed on top of that. On top of the Arduino is a custom made shield which has pins for connecting the motor controllers and servo’s and powers both the Arduino and Raspberry Pi.

We decided to call it the Stackberry Pi.

Stackberry Pi

Here’s our workroom where the boat was being worked on.

Raspberry Pi + Arduino powered boat

And finally its first test run!

Raspberry Pi + Arduino powered boat

But motionless pictures are no fun. Here’s a video of the boat’s first test run.


In case you’d like to hear more details about the boat please do ask.

Prevent a MySQL query from using the query cache


Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /var/www/blog_htbaa_com/www/wp-content/plugins/source-code-syntax-highlighting-plugin-for-wordpress/geshi.php on line 2146

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /var/www/blog_htbaa_com/www/wp-content/plugins/source-code-syntax-highlighting-plugin-for-wordpress/geshi.php on line 2146

Whilst I was busy trying to optimize a MySQL query I got annoyed by the fact that when you make use of MySQL’s query cache that a query gets cached. When that happens a second time you execute the query it’s being looked up and the cached results are being returned. If you want to optimize a query and test its performance this can be quite annoying.

Luckily I found out there’s an easy solution to this problem. Just make use of SQL_NO_CACHE like this:

  1.  

Now when you run this query it makes sure MySQL doesn’t store it in its query cache.

FPComplete: the School of Haskell

A cool site I recently ran into is https://www.fpcomplete.com/school, which aims to teach you functional programming using Haskell. I’ve been toying with Haskell on and off for the last couple of years but haven’t really gotten further than that. Perhaps by going through some of the articles on FPComplete I can get my Haskell skill to the next level!

Why I won’t develop a Maximus for Monkey

I had originally planned for this post to be a bit different, but due to recent events the idea of a (or my) module manager for Monkey has become obsolete.

Not too long ago I asked around Twitter, the BlitzMax and Monkey forums to see if there was any interest in a module manager for Monkey. I’ve had some positive responses and so I decided to start a IndieGogo crowdfunding campaign for a Monkey Module Manager. I started to write down things I would want to do for this module manager and made a cost estimate. Setting up a decent looking crowdfunding campaign takes quite some time and I had originally planned on launching the campaign 1st of June.

20130609-150012.jpg

But then BRL released a simple module manager with a recent Monkey release. Though very different from what I had in mind it’s capable of installing modules from 3rd party developers. Although I haven’t tried it out yet and am unsure of how useful it is the fact is that there’s now a module manager for Monkey.

So what’s going to happen to the IndieGogo campaign? I’ve decided not to launch it. There now is a BRL supported way to manage and install 3rd party modules. And while I think having the option to choose which solution to use would be better (competition is always good for innovation) I have little faith in the Monkey community supporting another solution. Yes, I would’ve loved to develop a Monkey Module Manager but as it is now it’s not going to happen.

Installing HiPi on Raspberry Pi – Beware the date and time!

I’m currently in a small research group to see what the Raspberry Pi can mean for my school. Basically we’re checking out its features and capabilities. Our eventual goal is to create a remote controlled boat with a tracking camera on top of it.

Since Perl is my language of choice I decided to see what’s available already for programming the Raspberry Pi with Perl. It turns out there’s a distribution called HiPi (website) which seems to cover every possible interface the Raspberry Pi has.

Sadly I was having some issues in getting HiPi to install. When compiling the bcm2835 library the build process would fail. It turned out that the configure-process for bcm2835 detected that the files were newer than the date and time of the Raspberry Pi I was installing it to. This is something you’ll only find out if you try to install HiPi manually. When I was running the automated install script it wouldn’t give these details.

Luckily this can be fixed without any trouble. Just issue a date command like this:

$ date --set="2013-06-01T15:00"

Because the Raspberry Pi doesn’t come with a real-time clock it needs some help setting the time. You can also use NTP to keep the date and time of your Raspberry Pi updated, but this requires a network connection.