For the most recent Egham Raspberry Jam @EghamJam we did two workshops.
One was NoPi Blinky, making LEDs blink without any programming. More to come on this as during the workshop we found a few typos.
The other was Shakey Shakey.
For the workshops my goal is to do something slightly different that not only teaches the attendees something new from either a programming or electronics standpoint but also shows them creative options.
Shakey Shakey was based around really simple tilt switches. They're basically a small tube with a contact inside that moves as you tilt the tube. Really simple and really cheap. On eBay UK they're about £1.50 for 20. So, ideal when you need a bunch for the Jam
The only other things needed then were some female-female jumper wires and some 2 core wire.
I cut the female-female wires in 2 giving me a pair of wires that had the female connectors on one end and bare wire the other. Cut the 2 core wire into about 150cm lengths and used them to connect the switch to the other wires giving a nice long wire for the kids to shake without (hopefully) unplugging the wires or pulling on the Raspberry Pi.
With the hardware sorted I them did the worksheet which is available to download from GitHubalong with other Jam worksheets.
Python code to read the switch and display how many times it connects
Adding a pause to deal with debouncing
Adding a second tilt switch
Updating the code so the switches have to be activated alternatively
Final update of the code to add a timeline making it into a game
We had a full workshop and the kids who took parts seemed to really enjoy the coding and then playing the new game they created.
At the end I challenged the participants to come back to the next Egham Raspberry Jam (21st October 2018) with their own program that uses the same tilt switch controllers. The worksheet at the end gives some suggestions. Here's looking forward to the 21st of October to see what fantastic creative ideas the kids come up with.
Update: 3rd March 2017. I resurrected ZeroBall today in preparation for Guildford Innovate on Saturday and did a video.
Trivia: Previously ZeroBall ran from a Raspberry Pi A+. With the new PiZero W I thought it would be perfect to pair with the NexDock. The NexDock has Bluetooth keyboard and trackpad and the PiZero W now has Bluetooth, so can be paired to the keyboard easily. Making a nice compact solution.
On with the actual blog post.
For the recent Egham Raspberry Jam that I organised the theme was Gamification.
I already posted aboutsensecave a Raspberry Pi Sense Hat game but I wanted to do something a bit more physical and real world.
That got me thinking about Fairgrounds and the kinds of games you play there.
The final decision was a ball throwing game. Get the ball in the cups and you get points. For those who watch US teen movies the principle is similar to beer pong, but without the beer and with points and scores....
Next exercise was to figure out how to detect a ping pong ball going into a cup.
I spent a lovely afternoon trying out PIR (Passive Infrared Sensor) sensors at HackWimbledon. If you're near Wimbledon in the UK check them out. Great bunch of people and the events are every 2 weeks on a Saturday.
After an enjoyable day I figured out the PIR sensors are great for detecting movement of animals including people, but no use for my requirement as they even tripped if the ball passed over the cup since the amount of infra-red light changed. Tweeted when it failed. Luckily there was still a month to the Jam.
Plan B needed for project. Testing at @HackWimbledon revealed plan A wont work. Productive. Also had a great time.
I now have six PIR that I can use for a different project. ;-)
With PIR out of the question the alternatives I considered were a switch or an LDR (Light Dependent Resistor) . Both had their advantages and disadvantages.
Switch digital and easy to read and wire up, but most switches would need more force than a ping pong ball would provide.
LDR would give a great reading but is an analogue device which the Raspberry Pi cannot handled without additional circuitry
In the end despite needing extra circuitry I went with the LDR.
To get a reading from an LDR you have to create a voltage divider circuit so you can get a different voltage depending on the relative resistance values of the 2 resistors used.
The next thing was to get the analogue reading from the voltage divider into a the Raspberry Pi in a format that it could use. My initial thoughts were to use the analog inputs on an Arduino and then send the data over serial to the Raspberry Pi. Considered Arduino as I have used them a bunch and knew what to do, but in the end I decided this would be over kill. Why use a microcontroller to read analogue when there is a nice little chip that can do the same and people way smarter than me have already got it working with the Raspberry Pi.
May I introduce you to the MCP3008. An 8 channel, 10 bit analog to digital converter which communicates with the host over SPI.
Since SPI and the MCP3008 were all new to me I did the Google and found an great article by Raspberry Pi Spy. This guide explains exactly how to wire up the MCP3008/Pi and also RPI.GPIO code.
Using this I tested the LDR and it worked perfectly. Looks like all systems are go on the project.
Then I saw that gpiozero has built in support for the MCP3008 and decided for the final project to take advantage of the ease of use brought by gpiozero.
A little test and it all worked again. :-)
So, electronically everything works. I can use voltage dividers with an LDR and resistor along with an MCP3008 to read the sensors and then using gpiozero read the values over SPI.
So, I began construction.
Firstly, soldering the Raspberry side headers from the MCP3008 on a strip board.
When I did this I made a mistake. I should have left more room on the Pi wiring side of the MCP3008. There is no need for the chip to be this close to the edge, with only one hole for the wire to be attached. This will come back and cause me problems later...
Once this was done I moved on to creating the voltage dividers. Since there are 6 cups, 6 resistors and LDRs are needed.
In the picture above the left side is VCC (3V3 from the Raspberry Pi), right side is GND. Each 10k Ohm resistor is soldered to VCC on the left and then to one of the MCP3008 input pins. The LDRs will then be connected from the MCP3008 input pin to GND to create the divider.
I did a quick test using one LDR to make sure I did this right. Image below shows it wired to the Raspberry Pi. I used a model A+ as there isn't a requirement for network or more power. Yes, I wired it all up to power and stuff for testing.
After this the need was to add the wiring for the LDRs. That's 6 connections with 2 wires for each.
This is already starting to look a bit more complicated than the small breadboard projects I've done before. Looking at the image above you will see 6 black wires from the top edge (GND) and 6 orange wires tied to each MCP3008 input line.
All that was missing for the voltage dividers to be complete was to add the LDR for each line.
Since this is a physical build the LDRs need to be embedded in a plastic cup. I also needed the LDRs to be flat against the cup to make it register a passing ball without obstructing the path of the ball.
This is the first time the sensor is actually in a cup so I can check if the ping pong ball passing is detected correctly for the purpose. More testing of a single cup.
It worked and it worked amazing well. That's 1 cup wired up. Now just the other 5.
All wired up. A bit fiddly keeping the other cups out of the way while soldering and working with all wires the same colours to make sure I wired the correct ones for each LDR.
I had great fun at this time setting the cups up and throwing balls into them. My kids loved it too. The fact they wanted to keep doing it even when all that happened was the number on a terminal screen updated when it happened made me think the build would actually result in a compelling game.
With the electronics sorted it was onto the bit that was new to me. The physical build. I heard foam board was easy to work with and sturdy so went with that. Another new thing for me.
I cut holes in the foam board and inserted the cups. Using tape to hold them in place.
top, pretty side
bottom, business side.
As I mentioned the physical build is not something I do regularly, so I didn't have a lot of tools to hand to finesse the build. My main tools were a sharp knife, glue and tape.
Once built I again did some testing and it all worked.
The top is sloped, so the balls roll back to the player. A layer is underneath, again to have the balls roll back to the player.
In the picture below you can I see a piece on the top to direct the ping pong balls to the bottom right so the returned balls will always be in the same place. For the layer underneath the same happens. Balls return to the bottom right.
Last requirement of course was the software. I mentioned it used gpiozero for the MCP3008. For SPI to work you have to run your code as root using sudo.
I wanted the game to feel like a fairground, so music and sound effects were essential as well as a score board. All coded in Python. To make this easy (for me) I used Pygame for the display, keyboard input to start a new game and also to play the background music and sound effects when a ball goes in a cup. If you haven't used Pygame on the Raspberry Pi before then check out their recently released Make Games with Python Essentials book that is available in print, PDF, iOS and Android app.
Electronics sorted, physical build done, programming all completed. Ready for the Egham Raspberry Jam on the 17th of January.
As I was packing the night before I thought it best to test my projects as usually for me something goes wrong on the day and since I had the time (rare for me) doing some testing seemed like a good idea. Ahhhh!!!!. It didn't work. I was checking the code and the terminal output. No readings from any of the sensors.
On looking at the circuit board a couple of the wires had broken off. Remember I mentioned my thing about not leaving enough space on the Raspberry Pi side of the stripboard.
You have to love the Raspberry Pi Community. Within a few hours I had exactly the advise I needed to get my project fixed perfectly. But I had 1 day left and didn't leave enough room to do what they advised so I ignore their advice this time. Soldered the wires back on and crossed my fingers that it would all hold together.
On the day of the Jam the game was very popular. Great write up from Richard Savillwho is well worth following as he does some great Raspberry Pi projects and Kickstarters. With lots of kids and adults playing with it. When a few kids gathered around the game they would just drop the ball straight in the cups to get the points and hear the sound effects.
Overall, I'm very happy with the final game. The build is a bit rough around the edges but works great. The code held up and the kids played it all afternoon which was the desired outcome. I also had a number of conversations with adults and kids about the code and the electronics involved, so hopefully helped a few of them to learn something new and consider their own Raspberry Pi projects.
I think we might be coming to the end of the Prize announcements.
So, last but not least are the Prizes donated by 4tronixs.
Robot lovers Prizes from 4tronixs
These prizes are especially situated to the robots lovers.
Each Prize includes:
The PlayHat includes a 3x3 full colour neopixel LED matrix, 4 big buttons and a buzzer.
Great for programming with the Raspberry Pi. This is just begging out for a game of Simon to be created.
PiRoCon and iBoost64 This board is great. Te PiRoCon plugs right on top of the Raspberry P and gives you all the additional electronics needs to drive motors.
Motors are fun things. When they start they draw a lot of power (think of train pulling out of the station. It needs far more power to get going then it does to keep itself moving. Same thing for motors). This mean if you want to drive motors you need extra circuitry to do it safely without damaging your Raspberry Pi. The PiRoCon is one of the best solutions for this for the Raspberry Pi.
In addition to motors drawing a lot of power when they start and stop they can also affect the voltage and current of electronics drawing from the same power supply. This can cause difficulties in getting good readings or accurate control. This is where the iBoost64 comes in. It cleans up the signals and makes them good without affecting the rest of the circuit. Ideal for robots where there can be a lot of stopping and starting of motors as well as reading of external sensors for line following or object avoidance.
If you have robots you will need power. The final 2 boards are a 1 way and 4 way charger board for Li-Po batteries. These are great batteries for robotic as they store lots of energy and give out a consistent voltage. Cheap batteries have a power curve that means they very quickly drop from the maximum voltage which can cause lots of problems with motors. Li-Po batteries are the ones used in high quality remote control cars.
Unfortunately you can't just plug a Li-Po battery into your normal battery charger due to the way they work so custom chargers are usually provided or need to be purchased with the battery. These great little boards mean you can use a standard 5V microUSB power supply to charge the batteries. This is the same type of power supply used for the Raspberry Pi, meaning if you are building a Raspberry Pi based robot you will already have the correct power supply.
There are 2 different boards included. A 1 way, so it can charge 1 battery and a 4 way which can change 4 batteries at the same time. Giving you more than enough power for your laser guided, GPS tracking, missile shooting, web cam streaming, grabber, digger, flame thrower robot. Or maybe just a line following robot.
From the picture you can see they also provided some pens.
This time from RasP,IO who product a number of really useful and practical accessories for the Raspberry Pi.
RasP.IO Breakout / 40 pin portsplus2/26 pin ports
The Ports boards are 26 and 40 pin versions so perfect fit for both types of Raspberry Pi.
The Breakout gives you easier access to the GPIO pins and allows you to use male/male jumper wires just like Arduino, so ideal if you're like me and have a load of these already and very few male/female jumper wires. It also gives the same labeling as per the original RasP.IO ports boards. The current model available is the 26 pin version which will fit on the 40 pin B+/2.
In addition RasP.IO ran a Kickstarter for their gpioruler for the B+/2 40 pin Raspberry Pi. I supported the 4 ruler pledge and will be providing one for each prize pack.
GPIO Ruler
+Alex Eames the man behind RasP.IO has also done some fantastic videos on the Raspberry Pi that you see at http://raspi.tv
Here's looking forward to a fantastic event.
See previous posts for other prizes for Sunday.
Yesterday another pack of prizes arrived in the post for the next Egham Raspberry Jam Show and Tell Competition. http://eghamjam9.eventbrite.com to register to attend and if you wish to have a chance of winning the prizes to bring along your Project to Show off.
Two (2) PiTrolkits from Innovation in Education were waiting fro me.
These are great kits as they allow you to build your own game controller with the instructions giving step by step details on how to solder it and then a snake game is also provided that works with the controller directly.
Kit of parts
Finished PiTrol
Nevil Hunt is the lead person at Innovation in Education and I have had the pleasure of meeting him at a few Egham Jams where he has come along with the PiTrol, 7 Segments of Pi and PiDapter (link from PiTrol site)
7 Segments of Pi is another simple idea that really captures the imagination. As the name states it is a large 7 segment display and button that you solder from a kit and then code is provided to play a game
The PiDaptor allows you to connect 2 PiTrols to the one Raspberry Pi.
Each of these kits is great for learning to solder and with the provided code gives the owner the ability to understand how to read inputs from the GPIO pins and use it to play games. Who doesn't want to play games on their Raspberry Pi.
In the case of The PiTrol prize once it has been soldered up I'd expect it would be possible to then get the controller to work with the many game emulators out there and possibly with the excellent RetroPi emulation system.
The Prize Pool is getting bigger and I'm still hoping to add a few more before the event.
I really love the postal service as today another package arrived with prizes for the Show and Tell competition at the next Egham Jam on the 11th October.
This time from wonderful people at Pimoroni.
If you've been around the Raspberry Pi world for any amount of time the Pimoroni name will have popped up on your radar.
Assuming my facts are correct they are responsible for
Raspberry Pi Logo - yes that one. Pibow Rainbow Case and now in many other colour variations Unicorn HatRGB LED matrix Picade- Complete kit to make your own mini arcade machine
They also support the Picademy work and are very active in supporting the community and provide detailed tutorials. http://learn.pimoroni.com/
Specifically for the Show and Tell Competition they have provided 2 'Kit for the Book' sets
So if you have these books are considering getting them these kits include all the components and parts you need to make full use of the electronics based projects that are provided in the books.
With the Eben Upton signed cases from the Raspberry Pi Foundation, Deluxe Snap Rovers from Cyntech and now the Pimoroni prizes the Prize Pool for the Competition is growing rapidly.
If you wish to enter the competition just have a project to show at the next Egham Jam on the 11th of October. To attend (either showing or just visiting) please register on the Eventbrite page. http://eghamjam9.eventbrite.com
The 9th Egham Raspberry Jam is going to be on the 11th of October.
As always it is free to attend you just have to register on the Eventbrite page. http://eghamjam9.eventbrite.com
For this Jam we are doing something very special.
We are running a Show and Tell Competition, so bring your projects along for the chance of winning some amazing prizes.
There will be 2 categories.
Under 16
16 and over
We are still finalising the prize pool.
First into the prize bundle is an Eben Upton signed Official Raspberry Pi case.
These have been donated by the Raspberry Pi people and are real collectors items with Eben's signature.
More prizes to be confirmed as we get closer to the Jam.
Really looking forward to seeing the projects on the day.
What a great Sunday afternoon of Raspberry Pi activity.
40+ people turned up on the day with an ever greater proportion of parents with their kids with a real buzz on the day.
The most popular tables were the ones where a boy and girl were showing other kids how to program in Scratch. I had a lovely experience at the end of the event where a father and his daughter came of to say they were leaving and the daughter was beaming as she had just written her first program in Scratch. It was amazing to see the excitement on her face and the please she was experiencing from leaning a new skill.
For those interested in the latest in desktop environments +Martin Wimpress was there showing how fantastic Ubuntu Mate run on the Raspberry Pi 2 with desktop effects enabled. We had a great chat about RPi.GPIO support and what it would take to have it baked into the next build.
Martin also solved one of my questions. When navigating menus in Mate on the Pi2 sometimes they would stick and not respond. I thought this was an I/O issue but it looks like it is down to OpenOffice have massive icons SVGs so on first opening a menu the Raspberry Pi has to render the icons for display. This happens once when you go to the menu for the first time. For return visits the icons are already renders so the menu is nice and fast.
I'm trying to decide if I will uninstall OpenOffice as Abiword and Gnumeric give me everything I need and then for graphics I use GIMP and Inkscape.
Martin had a build of Ubuntu Mate that used F2FS (http://en.wikipedia.org/wiki/F2FS) This is a file system specifically designed for flash memory and is suppose to improve the life of SD cards as well as improve performance. I haven't had a chance to test yet but another win for optimisation.
As a side note GIMP and Inkscape are definitely usable on the Pi2. I have previously used both on hardware of similar performance for commercial website development. It's not going to match your i5/i7 with 16GB RAM and the latest graphics card, but it is definitely usable.
A second side note not from the Jam. I had my Ubuntu Mate Pi2 set up at home and needed to print.
It found my wifi network printer and installed all the correct drivers without me having to do anything special. I love that Graphics acceleration just work, wifi (with the right dongle) just works and printing just works. There are the 3 points that I usually have concerns about on Linux and with the Raspberry Pi they just work.
Back to the Jam details.
Among the many items on display were:
Music playing Octopus (see flickr link at the bottom for pictures)
Portable games console,
Robot arm controlled by Scratch,
Crumble board (http://redfernelectronics.co.uk/crumble/) A great little interface board programmed using an block based interface like scratch.
Minecraft fun
Robot with robotic arm and webcam all controlled using PWM to vary speed from an Android table.
Sonic Pi coding +Sonic Pi
Scratch Development
CNC machine controlled by Raspberry Pi by +Stephen Cornes
EEG Brainwave reading using Mindflex, Arduino and Raspberry Pi
7 Segment of Pi board for development
Pitrol - build it yourself controller for the Raspberry Pi
At the end of the event I got the TwitterCam running and it did take pictures and tweeted them
The pictures can be see at the @EghamJam feed
Here is a link to some pictures from the event if you want to get a flavour for what happens at the Egham Jam.
Come and try out Sonic Pi and Minecraft/Python programming. Sonic Pi is a great way to create music by programming. You can even do Live Coding giving you the ability to compose music as you playing. Sonic Pi is such an amazing way to learn about music and programming that the Raspberry Pi Foundation recently ran a competition for Sonic Pi compositions. The 10 finalists are amazing. Be a composer by coding.
Minecraft on the Raspberry Pi is a great open world environment where you can program what happens. Build a Giant Clock or how about a Town Square
How about mixing the two and creating music using Minecraft. See the Minecraft Piano
Now's your chance to try them out on the 26th April at the Egham Raspberry Jam.
The event is free to attend all you have to do is register on Eventbrite. http://eghamjam7.eventbrite.com Places are limited to 100 and last time we sold out and had a waiting list for the final week and it's looking like it will be the same again this time. So, if you're interested in trying Sonic Pi and Minecraft then get yourself registered and come along. To see more of what happens at the Egham Jams checkout the write up and some pictures from the Jam we had on had in January. http://winkleink.blogspot.co.uk/2015/01/egham-raspberry-jam-25th-of-january.html
What a day. More than double the attendees. More than double the stands, more teachers and kids attending. More fun and learning than ever before.
When the Egham Jam was announced back in December I thought we would do better than the last Jam (46 registrations) but was blown away by the response.
Maybe a lot of new Raspberry Pis were sold at Christmas.
We were not only 'SOLD OUT' but also had more people who wanted to attend as well as people who register who advised me they couldn't make it so their tickets were released.
In the end 90 attended, more than double the October event and a record for the Egham Jam.
I was also really delighted the number of educators who attended looking for ways to integrate the Raspberry Pi into their schools Computing work.
There were at least 12 show and tell standard, some of them had multiple displays making for a very interesting day. Also, very delighted that on a number of stands children were leading the show and tells. Giving great demonstrations on what they have build.
I tried to meet everybody who attended as possible and got the chance to connect teachers and people with specific needs with others who I know from previous Jams demoed a similar project.
Below are some pictures from the event. Lots of fun. Roll on the next Egham Raspberry Jam.
A year after the 4th Egham Raspberry Jam the 5th Jam was held.
A bit of fun getting it organised but in the end it was really worth it.
I put the list in Eventbrite and the Raspberry Pi Forum with a month to go and began tweeting and spreading the word.
With such a long gap between Egham Jams I was wondering if people would turn up.
On the day about 40 people came which was fantastic and there was a brilliant variety of projects on show.
Everything from home made conductive paint being used to add glowing eyes to Halloween pictures to 3D printers controlled by Raspberry Pi.
There were (count them) 4 robotic arms. A scalextric controlled from Scratch. A section of model train train controlled using the DCC protocol from RISC OS.
A Thermal printer that gave you a crossword, word search or Sudoku at the touch of a button and a nice big robot that looked like it could do some serious moving.
Also Stephen Cornes did a fantastic timelapse video of the day. For some reason I cannot embed it here. Not sure why but the link is below.