A New Android Brain for Hera

Remember all that time I spent wiring up Hera? Fitting her with an accelerometer, configuring her internet access, all that jazz? Well it’s all been destroyed.

Three weeks in prototyping time is a long time and Hera was starting to become old and doddery, fortunately, unlike you’re confused little grand mother, when Hera gets to that stage, we can give her a brain transplant. Hell I gave her a brain after 20 years, I can bloody well replace it for a better one too… I know what you’re thinking but the fact is, Hera doesn’t need a heart nor courage, she is fearless and without emotion >:)

So what’s this new brain I’ve got her? Well I’m sure you already know after reading the title and seeing the photo at the top.

Yesterday, I invested in an HTC Wildfire, it’s my first Android phone and with a few downloads and some quick coding, I’ve now got Hera’s Ailerons (bits on the wings that control how much she rolls) being controlled by the phone. When it tilts, the Ailerons move to compensate. This is the same as what I had before but my gods, is it more precise?!

This was made especially easy by the Amarino Toolkit, a mixture of an Android app and an Arduino library. I’ll go into more technical details in a future post.

Tomorrow’s task is to write an Android App that will send the same data to Hera’s website along with GPS information too so you’ll be able to watch her travel… or sit on my desk.

Third Place for Hera

Well, Hera came third place, winning me £75 of Amazon vouchers. Second place went to “Mood Tunes,” a system that would play tunes from spotify depending on what mood your last tweet suggested you were in. Finally, 1st place went to the Twitter Controlled train set that my friends designed (see last post) which means they each won a trip to Yahoo’s Open Hack in Bucharest.

What now? Well I’m not going to talk about the future of Project Hera because, right now, Yahoo’s paid for a bar tab, right now we’re getting pissed ;]

Hera goes on show

Today’s the day. It’s Yahoo Hack Day, Dundee 2011 and we’re all setting up our work. Groups of Third Year students are all running around desperately getting final pieces of code written and adjusted in time for their presentations. I decided I didn’t want to have a mad rush on the day so was up to 3AM in the labs last night fixing a major bug on Hera’s new website.

The weather gadget collects the local weather around Hera using Yahoo’s YQL engine. Unfortunately, with a site that refreshes itself every second came a slight problem. Yahoo doesn’t look kindly on greedy people and after just a few hours, andybarratt.co.uk had been blocked. A mad rush of refactoring changed the code so that it would only query Yahoo for updates every ten minutes.

Meanwhile, Hera was recalibrated so that she would run off batteries. My problem is this, while in her prototype stage, Hera uses WiFi to get a connection, this will be changed to GPRS in the future for flight but for this presentation, it’s WiFi using an Arduino WiShield. My problem? The WiShield feasts on batteries! After several minutes of use, a standard 9V battery is drained enough to cause the Arduino to crash with no hope of powering up again. I suspect I’m going to have to do this presentation using a USB cable connected to her with an explanation that in future, she’ll have bulky lead acid battery on board.

Otherwise, we’re ready to go. Go check out what she’s up to on www.andybarratt.co.uk/hera

Hack Day is a competition, with prizes. So I am competing. Feet away from me are my friends, Jane Wilson, Ross Warren and James Bennet who have also gone down the arduino/models road with a twitter controlled train set. I suspect they’re my main competition today. That said, I’m aiming to place and after all, I’m just an individual, Hack Day is meant to be a group work thing but then, I’ve never been one for working in groups.

Teaching Hera to balance.

You know when you’re a kid, to learn how to walk, you have to learn how to stand, because to learn how to stand, you must master your own balance. The same applies to Hera.

My main goal right now is to be able to fly Hera manually by radio control, however for her to handle her own balance. The Ailerons on the wings control how much she rolls so with these controlled by the Arduino and and accelerometer secured inside her, Hera can now balance herself out simple by measuring how much she’s tilting and deciding which way to roll based on that.

The Yahoo Hackday is on Friday so I’m running out of time. I have decided not to use Twitter anymore but instead to create a website for her to send her data to. When you go to the website, you’ll see an illustration that demonstrates what Hera knows. Basically, it’ll show when she’s rolling or pitching. In the future, it would show her altitude, her location, her speed, everything. But right now, let’s keep things simple shall we?

Arduino wired cockpit.

Project Hera – Arduino Powered Unmanned Air Vehicle (UAV)

Project Hera Avatar

I’ve been getting some funny looks these past few days, these are usually due to weird whining noises coming from a large model airplane sitting on my desk in the labs.

The plane was bought for my brother when I was eight years old, fifteen years ago, it was already several years old and he never flew it. Always fascinated by it, I took it out of my mother’s attic a couple of years ago and brought it home with me to Dundee where it has resided under my bed since.

A couple of weeks ago I took it out and realised just how simple the mechanisms controlling the plane were. Inside, are four, simple, 180 degree servos, one for each controllable part: throttle, ailerons, rudder and elevator. Nothing was soldered, it could all just be unplugged and replugged however I liked. So I’ve plugged it into an Arduino.

Each servo has been mapped to a different pin on the Arduino and I’ve written functions with understandable names for each control (banking, pitch, yaw, throttle).

The plan is to have an accelerometer or giro (haven’t worked out which one yet). If the plane starts to roll left, it’ll automatically set the ailerons to bank right. If it starts to nose dive, it’ll set the elevator to climb. Next I’d have a compass, if the heading is due north and the plane starts turning, the rudder will be told to correct this. This should sort out a nice little autopilot/cruise control.

I’m doing much of this as my project for the Yahoo Hack Day that we have each year here at Dundee University’s School of Computing for third year students.

This happens to be an Internet Programming assignment so I’m throwing in tweeting. When the plane makes an adjustment, it’ll send a tweet to let us know, hopefully it’ll have GPS so it’ll also geotag them. See Project Hera’s Twitter Feed Here.

This poor plane is around twenty years old and has never been named so I have done her the honour of calling her Hera, after the Greek Goddess of women, marriage and most importantly, the sky and the starry heavens.

Hera is a twenty year old plane which through Arduino, is being given a new life.

Quotes – Hector and Apache Cassandra Twitter Clone using JSP, JSON and JQuery,

My latest project for third year was to recreate twitter in Java using Hector and Apache Cassandra.

The name Cassandra comes from Greek mythology, she was granted the gift of prophecy by Apollo who was in love with her. Hector was Cassandra’s brother.

In computer terms, Cassandra is a No-SQL database, originally created by Facebook, that is fully scalable. Hector is a Java Class Library that is used to interface with it.

You can interface with Cassandra directly in Java however, Hector is supposed to make the whole experience a lot easier. It builds the relevant code to interface with Cassandra. Much like we use SQL to interface with other libraries.

The thing about Hector isn’t so much that it is over complicated (and believe me, it is), the problem with Hector is that is is undocumented.

In Java terms, documentation doesn’t mean having a document that explains what everything does and how to use it, it means that special comments have been placed in the code to do that for you. When using an IDE like Eclipse or NetBeans, we can see the various methods and classes available to use along with a description of what they do, what parameters they take and what they return. In the case of hector, the writer has put nothing like this and the parameters its methods take are always along the lines of “arg0, arg1, arg2, arg3” as opposed to meaningful names like “keyName, columnFamily” and so on, thus making it even more difficult to write for.

After a lot of stress induced headaches, I have completed my twitter clone in the for of “Quotes,” a site used for posting quotes you’ve heard or read. These could be exerts from books and music, things you’ve heard on the news or even just something funny or meaningful you heard your friend say.

The entire site makes use of JSP pages and Java servlets and when quotes are taken from the database, they are rendered in JSON, an XML like system that uses a C based structure in the same way as Java, C#, C++ and many other languages do.

The JSON is then read by a JQuery script that prints it onto the page.

You can currently view it working on our JSP server here at the Dundee School of Computing at http://jspnet.computing.dundee.ac.uk/quotes/

I have also placed all the code in a GIT repository that can be found on GitHub at https://github.com/apbarratt/Quotes

I’d love to continue development of though will have to look into running costs as Java and Cassandra hosting costs money so I’ll warn you now, if you do decide to register on Quotes, there’s a chance it may not be there forever.