Completing my ECDL

Yesterday, I completed the last 2 exams for my ECDL (ECDL stands for European Computer Driving License). It was only meant to be my penultimate exam (Excel), but after I’d finished that we asked if I could sit the last one (improving productivity)  as well and just pay another exam fee.

I passed both of these exams and my overall score equates to an A* GCSE, bet that’ll look good on my CV, especially as I did it at 10!

I completed the improving productivity exam in 15 minutes as well, the invigilator said that most students take the 1 hour that they are allowed to use for the test.

I’m feeling very pleased with myself for this achievement, and I hope I achieve more things like this in the future.

Programming a Lego mindstorm

Someone recently lent me their Lego mindstorm for me to have a play around with, and I’ve loved it.

I’ve mostly been programming it via bluetooth, because bluetooth is quick and easy to set up and use as long as you are able to interface with it using a computer. I’ve written a couple programs for it already which I’ve listed below:

  1. Anger.ev3:
    Makes the robot happy until you press the center click button on the robot, then it starts making noise, charging forward, and frantically moving anything on it that’s connected to a motor.
  2. Battle.ev3:
    Allows the robot to be controlled using a special remote; the controls are as follows:

    Button pressed What it does
    Top button Puts the robot to sleep (stops the engine sound, changes the eyes displayed on the screen to shut eyes and plays a snoring sound until you press another button) (The robot won’t do anything until you wake it up)
     Top left button  Moves the robot forward and changes the eyes displayed to eyes that are wide open
     Top right button  Makes the robot turn around and changes the eyes displayed to narrowed eyes that are pointing in a certain direction
    Bottom left button  Swings its back weapon back and forth once while changing the eyes displayed to evil eyes and playing the sound of someone shouting “HEY YA!”
     Bottom right button  Opens and closes its claws twice while playing a SNAP! sound and displaying open eyelids with spirals in the middle
     Touch Sensor (On the robot)  Plays a power down sound, changes the mindstorm’s eyes to tired eyes and the exits the program (This only works if the robot is awake)
     Nothing (If not asleep)  Keeps the eyes displayed as angry eyes and plays an engine sound

Here is a video of my battle program running on my lego mindstorm

I wish I didn’t have to give the robot back next week as I’m enjoying it so much. Thanks to Kurt because he is part of the family that lent me the mindstorm and was the one who earned the money that was used to buy the mindstorm in the first place, you can visit his website at http://morganelectronics.co.uk/.

Making my first game that uses the Xbox controller

I’m currently creating a game that uses the Xbox controller. The aim of the game is to keep your rocket ship alive for as long as you can by avoiding asteroids. I’m hoping to finish it in time for a jam that’s coming up soon, so that I can show it off there.

Check out the video below to see it running (as of version alpha_28_01_16):

I will write a new post with the download link after the game is finished.

Hacking an Xbox controller

I’ve managed to use an Xbox controller with my Raspberry Pi. This blog post will tell you about what I’ve managed to do with it and how to do it yourself.

What I’ve managed to do so far

I’ve managed to map the D-pad, and the A, B, X & Y buttons to keys on the keyboard so that they can be used by any application, and create a desktop icon that starts the driver

How you can do it yourself (on the Raspberry Pi)

  1. Type the following into a terminal window to update the cache and install the driver program (press enter after each line):
    sudo apt-get update
    sudo apt-get install xboxdrv
  2. Run this command to remove something that conflicts with the driver (You’ll have to run this once per boot):
    sudo rmmod xpad
  3. Run this command to start the driver and map the keys (You’ll have to run this with your desktop open):
    sudo xboxdrv --ui-clear --ui-buttonmap a=XK_Return,b=XK_Escape,x=XK_x,y=XK_y --ui-buttonmap dl=XK_Left,dr=XK_Right,du=XK_Up,dd=XK_Down

It’d be nice if we didn’t have to enter those two commands every time we wanted to use the controller so let’s write a script to do that for us

  1. Open a new file in your text editor and type in the following:
    #!/bin/bash
    sudo rmmod xpad
    sudo xboxdrv --ui-clear --ui-buttonmap a=XK_Return,b=XK_Escape,x=XK_x,y=XK_y --ui-buttonmap dl=XK_Left,dr=XK_Right,du=XK_Up,dd=XK_Down
  2. Save your file with a name that you’ll remember and recognize as a file for this purpose (like start-xbox-driver)
  3. Type the following in a terminal window to make it executable (replace pathToScript with the path to your script):
    sudo chmod +x pathToScript
  4. You can run the script by typing the following into a terminal window (again, replace pathToScript with the path to your script):
    bash pathToScript

 

I hope this is useful to anyone who wants to get started with using an Xbox controller with their Raspberry Pi and I’ll keep you updated when I do more with it.

What I’ve done and what I want to achieve

Hi everyone and have a happy new year! I thought it would be cool to share what I’ve done and achieved this year, and also what I’d like to achieve and do next year.

What I’ve achieved this year

  • I’ve built and programmed a pi robot
  • I’ve started a blog (This one)
  • I’ve created a cool minecraft program and got it featured in the The Magpi (my natural disasters program)
  • Highly commended award in astro pi and my code getting sent into space
  • Learned a bit of Java.

What I want to achieve next year

  • I want to pass my ECDL
  • I want to write more awesome programs
  • I want to upgrade my robot so that it is controlled over the web, has a live stream of what it currently sees with the option to stream that to your device for later use, and make it better equipped for some of the pi wars challenges so that I can enter it into Pi Wars
  • I want to get better at some of the other programming languages like Java and C.
  • I want to write a cool game.
  • I want to start writing installers for my programs so that all you need to do to get one of my programs is to run the installer (This would also be useful for making sure people agree to a copyright agreement).
  • I want to use raspberry pis with things using the GPIOs like some other people do.

I think I’ve done quite a lot of cool things this year and I want to do even more awesome things next year. I really liked my natural disasters code being featured in The MagPi and my code being sent up into space!

I think it would be great if you share what you’ve achieved this year and what you’d like to achieve next year in the comments section down below, I think it would be cool to see what you’ve all been up to.

How to Hack a Wii Remote (on the raspberry pi)

In this tutorial, I will be telling you how to hack a wii remote. I decided to do this because of a comment:

Mr.Pudding:
Can You Post The Code that you used for it & how to hack or reconfigure the wii remote? That would be awesome!

Preparing

Step 1: Get yourself a bluetooth adapter (you can get one easily from ryanteck) and a Wii remote.

Step 2: Install the required libraries and drivers by typing the following commands into a terminal window:

sudo apt-get update
sudo apt-get install python-cwiid bluetooth

Step 3: Put your pi in discoverable mode by typing the following into a terminal window:

sudo hciconfig hci0 piscan

The code

This will go through each bit of python code to do different things on the wii remote.

Type this in import the library:
import cwiid

Type this in to connect to the wii remote:
wm = cwiid.Wiimote()
Once you run that line of code, make sure to put your remote in discoverable mode by pressing the 1 and 2 keys at the same time.

This line can fail and raise a RuntimeError if it fails to connect to the remote, so you’ll want to handle this and keep attempting to connect until you’re successful

Type this in to tell the wii remote to report back the button state:
wm.rpt_mode = cwiid.RPT_BTN

Press a button and type this in to get its value:
wm.state['buttons']

You can use the values for different buttons later to compare them with the value returned by this code in a program to see if a certain button is pressed.

Type this in to change the current leds lit on the wii remote:
wm.led = replace this value with led value
The led values go up in binary, ie. led 1 is 1, led 2 is 2, led 1 and 2 is 3, led 3 is 4, ect.

Type this in to make the wii remote vibrate:
wm.rumble = True
Replace the value True in the above code with False to make the wii remote stop vibrating.

 

I think that hacking a wii remote is quite easy once you know how to and I really hope this tutorial helped!

My code has been sent up into space!

I am so excited that my code has been sent into space!

I got a highly commended award in the Astro Pi competition, and the Astro Pi people had said that only the winner’s codes would be sent up into space; but last night, at the winner’s ceremony, they invited us highly commended winners along as well (there were three of us), and told us the amazing news. I can’t believe that they hid that from us!

Interveiw
Us highly commended winners getting told the fantastic news!

Last night was great, and as well as hearing the amazing news, I got something pretty cool – a plain Raspberry Pi printed circuit board!

PIPCB
My plain Pi printed circuit board

Today, there was a launch party and graduation ceremony at the science museum. The graduation ceremony was for the Astro Science Challenge, which I completed, so I received a certificate and special gold UNSA cadet pin badge for that.

After the schools and home educated children who attended had received their certificates, we were then able to watch Tim Peake’s launch on the giant IMAX screen!  It felt really exciting, and everybody clapped and cheered when Tim gave the camera a thumbs up, and a wave, and also when he actually took off of course.

APSIGN
Me and Mum at the award celebration
HomeEdCetificates
Us home ed children holding up the certificates we were given
MiniJonMe
Me and one of the presenters.

ECDL Registering and Practice Test

Today, I went to Cambridge to register for my level 2 ECDL (European Computer Driving Licence). I decided to sit them early because it  is worth a high level GCSE and that would make me very proud to pass early.

When we got there, we had to register by giving some details, paying, and letting them do the rest.

They let me do a practice test to learn what the test environment is like and see how I got on. The test was about word processing and I scored 86%, this was very good seeing as I haven’t started the course yet! 86% would be a good pass if this was a real test.

Jpeg
My results

I feel a bit nervous but I think I’ll do very well and I’m really excited to do this.

Pi Wars

A few days ago, I went to Pi Wars, which is a yearly pi robot competition. I didn’t enter and just went to have a play around with my robot, and see some of the other robots.

My robot was made from a ryanteck robot kit, and you can learn more about my robot here.

I also got some new things including a second distance sensor (I’m planning to stop the pi robot from crashing into things so much), two pi zeros (Pi zeros are miniature raspberry pis, one of them was free with the MagPi, which is a raspberry pi magazine), and some other cool things.

The Pi Zero that came with the MagPi
The Pi Zero that came with the MagPi

Another thing I did is drive my robot on some of the courses that had been set up.
The video below is of my robot attempting to complete an obstacle course.

And this is my robot attempting to bowl:

Also at Pi Wars, I got interviewed by hackerfemo, who has a blog post about this event as well. You can check out his view of the event here.

I didn’t stay until the end of the event, but @whaleygeek managed to get a picture of all the competing robots at the end.

The picture that @whaleygeek took
The picture that @whaleygeek took

Overall, I think that Pi Wars is an awesome event and I hope that my robot will be competing next year. Let’s just hope that my Mum doesn’t try to put as many Lego minifigures on my robot next year – as this year they kept falling off!