Thursday, 20 March 2014

Guest Post: Brandon and his server monitor project

This post is a guest post by one of my students that displayed a Raspberry Pi project at our STEM Fair yesterday.

When Darren asked me to work on a project using the Raspberry Pi for the STEM Fair, my mind instantly jumped to ideas involving things like a Parrot AR Drone, a Kinect and voice recognition software, all of which were a little outside of my comfort zone. I kept looking into it and played around with some libraries and APIs, but the real idea for the project came to me after some unexpected downtime of one of my servers.


[Network Traffic graph from server web panel]

Due to a poorly developed/configured application, the server was outputting a lot of traffic (near 100Mbps). The server host detected it and shut down the server under the assumption that it had been compromised and was being used for malicious activity. I didn't find out about the issue until several hours when I tried to SSH into it and my password was being rejected due to 'rescue mode'. After several more hours communicating back and forth with the support team, we finally resolved the issue, but we had to wait for the Datacenter team to check that the server had been secured, which could take a few hours. At this point, I was tired and heading to bed and wouldn't be up for when the server came back online, yet I wanted users to know when it had returned so that they could continue using the websites and other services I have running.

I wrote a quick little application in Java that would ping the server to see if it was online and send a tweet when it returned. I gave the application to a small handful of friends that had either computers that they never turned off or servers of their own to run the application for me. Whilst writing the application, I thought about how useful it would be to have a computer or server somewhere in the world that does nothing but monitor online services and alerts people when there is a change in their online status. It wouldn't take much in the way of resources: minimal RAM, low-end CPU, next to no HDD space required. Pretty much the exact description of a Raspberry Pi. The application I was already working was quick, dirty and almost finished, so I finished that and got it running, but contemplated writing an application that was extensible and had a nice API so could be hooked in other applications if necessary.

Over the next couple of months, I worked on the project for several hours a day, most days of the week. I focused on small but extremely nice (in my opinion as a user) details, such as full user configuration (even though JSON is notorious for being difficult from a user point of view), lightweight and clean. I also started commenting code (something I've never done) so if any other developers wanted to look at it, they knew exactly what it did. I wrote 2 or 3 versions of the same program, deleting everything I had and starting again or rewriting whole classes just because they didn't look neat or efficient. However, I finally got it finished enough in time for the STEM Fair. It had full status checking capability and would send a tweet as the only form of notification currently, but it worked. Mostly. Sort of.


[Twitter with tweets from StatusNotifier]

At the STEM Fair, I got the application running. For some reason, it didn't want to demonstrate the offline checking feature unless I gave it a 'Malformed URL', which wasn't ideal to demonstrate services coming up and going down over time. Luckily, I had a few downtime issues with my test host anyway, so it wasn't all bad. An unfortunate happenstance was that the majority of the attendees of the STEM Fair were young children and teenagers, and my application is slightly more focused at business' or System Administrators, which I'm fairly certain none of these young people were. However, it appeared that the older attendees that were interested in what my application did were impressed with it, which made me feel great. I'm not sure they really were interested, but as long as I think they did, it doesn't matter, right?

I plan on continuing development of this project as I plan to use it personally in the near future. I also agree with something that my web lecturer (Don MacSween) said: the fact that I have an application that can be seen as useful for a wide range of people is a good step in the door leading to professional development, as well as the potential to earn a little free money in the way of voluntary contributions as appreciation of my work. I'm 19 years old, of course money is always a good motivator.


[Prototype of my WIP site, designed by https://twitter.com/encrypted_curse]

Darren said he's okay with putting some personal details of mine on the blog such as websites and stuff. I currently own the domains http://www.y3ti.me/ and http://www.branicyeti.co.uk/ that I plan to use for professional and not-so-professional portfolios, as well as other sites like a portal to my connections and a blog. I hope for all of the sites and sub-sites I run on those domains to be completely custom, and hopefully open sourced if you're interested in that sort of thing. They're not finished yet, but I will be working on them as soon as I get time. I am also the lead developer in a development group called NotoriousDev. At the moment, we focus on Minecraft development using the Bukkit API, but we also have some other somewhat useful utilities available on our Gitlab and Jenkins instances such as a YAML abstraction layer (YamlConfig) and a simple IRC Twitter bot (TwitterBot). All of the links for that community are on http://www.notoriousdev.com/.

Thanks for reading?

Brandon

Wednesday, 19 March 2014

Learn Python Course At PRC

This post is really for those in the Peterborough area who want to learn Python.
Peterborough Regional College are looking to run an 8 week learn Python course after Easter.
It would run on a Tuesday from 6pm to 8pm and if can get 16 people signed up cost £100.

If you are interested in signing up for the Learn Python Course contact myself on the following email address:
darren.christie@peterborough.ac.uk

As an experiment this course is only being advertised via social media.

Minecraft on Pi Controlling A Robot Arm

So basically my student using the python api for Minecraft on the Raspberry Pi has coded it so that when you hit a block it controls part of the USB robotic arm.
I'll put the code up later as an update to this post.

UPDATE 1: This setup will be on show Monday 24th at our Open Evening as well for those that would like to see it in real life.
UPDATE 2: Here is a link to the Python code that was written by my student that does all the stuff you see in the video. It should link to a shared directory on Google Drive (let me know if there are any problems).
UPDATE 3: Here is a link to the java code for the status updater that was developed and shown by my student at the STEM Fair yesterday.

Tuesday, 18 March 2014

Pi Wars Competition Thoughts

The next CamJam (May 10th tickets are now available see this post for links) starts the journey for hopefully many people in creating a Pi controlled robot, which hopefully will be entered in the culmination of the journey the Pi Wars Competition at the December CamJam.

I've already started planning my entry for the Pi Wars and I will be making use of the workshops at CamJams to brush up my skills like soldering (hey I'm software not hardware).

Apart from the education track at the May CamJam (and you should be going along to this really) this build a Pi controlled robot is a great idea for a class project or after school club.

There are a few approaches that you can take with this project and several learning opportunities along the way. For instance there are several robotic kits on the market that contain everything that is required (except the Pi), some are inexpensive, while others cost more. Or you could go along the custom build route, where you source the parts yourself from the chassis, motors, wheels, sensors, etc. You could of course also modify an existing robotic device like a Bigtrak toy (see MagPi back issues for project details of using one to make a scutter [Red Dwarf reference] ).

The above options assume that you are going to use the Pi to rely on sensors to interact and move around the environment. But you could also build a Pi controlled robot that uses a game controller wirelessly to control direction and speed.

The advantage of this sort of project is that it combines skills. So there is the obvious electronics, soldering, robotic practical skills. But there is planning, and also the software programming skills required.

I'm not a big Scratch fan but using ScratchGPIO it should be possible to control your Pi controlled robot using Scratch. This isn't the ideal solution as Scratch is an extra overhead that would slow things down, but it does make the whole project open to a younger audience. So the trade off may be worth it.

The next programming option for the Pi controlled robot is the one I expect most people to go with and that is Python. Python is well supported, and the majority of examples on the net for controlling and interacting with motors and sensors will be in Python on the Pi, and I think all the kits come with examples in Python (I bet some-one will now find a kit that does not have Python examples/libraries). Other options of course would be Java, C/C++ and Arm Assembler. Theses will be able to communicate over the GPIO port, but the examples out there to look at are a lot less. At the end of the day it comes down to what language you are comfortable in, and can support your students in using.

Don't forget this project spans the last half of the academic year and the first part of the following academic year. So for the really keen student this gives them something they can work on during the Summer holidays too. And for those students keen to do this I would have some Pi's spare that can be used as loan units.

I think the guys at CamJam have come up with a great idea that will be a lot of fun to take part in, and a great fun learning opportunity for students. Hope to see you in the Pi Wars arena in December.

P.S. My personal entry is going to be a custom job, possibly with the software written in Arm Assembler.

Friday, 7 March 2014

CamJam Focus On Education Tickets Out Now


10th May sees the next CamJam being held. The tickets for this are now available and will set you back £3.50. However thats not bad, and definitely worthwhile.
The next CamJam will have an Education Focus in the talks being given in the lecture theatre. There will also be workshops going on in the foyer, how to solder session (I need that I think), a small marketplace, and a show and tell area too.
I like the CamJam, they are great guys running it, welcoming and helpful (if you read this blog regularly they leant me their Pibrellas for my CAS talk).
So if you are in education you should be getting yourself along to this CamJam - that's the bottom line (really? did I just quote Stone Cold Steve Austin on here?)

You can get your ticket here (I've already bought mine), and hopefully see you there.

Monday, 3 March 2014

Pibrella Now Available To Buy


The subject line says it all really. From today it is now possible to buy the Pibrella.
As you know from the three or so posts I have done on the Pibrella, and the fact I did a CAS session on it, that I am a fan of the Pibrella.
While I was playing around with a pre-production version of the Pibrella I had to work the GPIO directly to get the LED, switch or buzzer to work. Now a brand new site is available for the Pibrella (click here to visit it), and also a nice looking library for accessing the various parts of the Pibrella.

So the official price of the Pibrella is £10 + p&p (ordered mine today, well I do have to return the ones I was leant).

Once I get mine I will do an official review, and update the materials I did for the CAS session to use the new libraries for the Pibrella. Although I will also leave the original versions up as well (I think there is some value in them still, especially for those that want to use the GPIO directly).

Update 3/3/14: Here is a link to the github for the official library/examples click HERE