Introduction: LittleGoal: World Cup Match Notifier
Can't watch the World Cup football games, but want to know when important game events (ie. goals) happen? Then littleGoal is for you!
The littleGoal setup will monitor the game's progress, and alert you via vigorous flag-waving and a photogenic Goal! sign when anything of importance happens during your World Cup game.
It is intended to be quickly assembled, minimalistic, and pretty much ready to use for your next game!
Step 1: Ingredients
The wire modules make it easier to place the relevant pieces, while the fork+buzzer is only needed if you want sound effects as well besides the light effects.
The little bit parts were all included in the single littleBits Deluxe Kit, except for the Arduino module.
The power is originally provided by a 9V battery. Servos use quite a bit of power, though, so I ended up adding a 9V wall plug that fit the same power module to make sure the Arduino doesn't go under voltage and restart on me...
Step 2: Mechanical Setup
The major part of the mechanical setup concerns the way the team flags are hung up and waved by the servo modules. Tried to make it as simple as possible, and can use whatever you find around you.
Here in Taiwan we have a lot of spare bamboo chopsticks, and those are great for scaffolding. The first step was cutting in the top of the chopsticks so that a string can be hung from there without dropping (making the flagpost). I used a wood saw, but anything is good that makes a little groove on the top.
The post base is a foam board, just made a hole, and secured (hm, not very securely) the sticks with tape. If you have better idea, please do that, this was a quick and dirty way. The two posts are some 20cm apart, something convenient.
We've printed the flags in colour. Got the SVG (vector graphics) files from Wikimedia and used Inkscape to arrange them. The printed size is 8cm on the long edge, but could use whatever fits your setup. Might need some playing around with the image files. I got lucky that the person on the team taking care of the flag arrangement knew what she was doing. :) Double-side printing, cut and fold.
Strings taped in the inside of the flags to hang them. A string is then taped to the bottom part of the flag and tied to the servo. Pulling on the bottom allows bigger (more exaggerated) movements for the flag when pulled.
The strings can be simply tied to one of the servo's holes (the servo comes with a few different moving pieces, this was the default piece, good enough. The servo control should be switched to "turn" mode.
Step 3: The GOAL! Lights
The remaining main part is the GOAL! sign. Fortunately we already had some experience with electroluminescent wire from the Cool Neon Build Night (here's our music controlled Hack sign and galloping horse), and knew how to make something cool relatively quickly.
- Use a board that you can easily modify, but it's still sturdy enough (we had a piece of display foam board)
- you can design your text by first outlining with a marker pen.
- can make holes in the board to hide the wire behind the board to have breaks in the text, eg. between letters
- tape it down to the board to secure it on the front
- when testing, you might need to turn down the light a bit, EL wires are not that bright...
We had enough remaining wire to have an outline to the board's edge too, it made it even more sign-y.
Mentioned in the ingredients part that it's optional to add a buzzer module. This is especially nice if you are a fan of vuvuzela from the last World Cup! Since all the games are after midnight here in Taiwan, and the walls are very thin, I chose to remove it, but in testing it worked very nice!
Step 4: Software
The software has two major part: the code running on Arduino to work the hardware, and a server to tell Arduino what to do.
The littleBits Arduino does not have much documentation yet. Things you need to know:
- its hardware is Arduino Leonardo compatible, chose that type in the Arduino IDE
- to power it, just connect the power module to any of the incoming pins (left side)
The Arduino code is up on Github. It's parts are:
Set up the pins used for the home and away flags, and the GOAL! sign. The Arduino module only has easy access to output on D1, D5, and D9 pins. D5 and D9 should be switched to PWM mode. In the code at the moment the home team (team0) is pin D9, the away team is D5, and the sign is D1.
Listen on the serial port:
Listen on the serial port for "H", "A", or "G":
- H means home team score: wave the flag and blink the sign
- A means away team score: wave the flag and blink the sign
- G means game event (start or finish of game): wave both flags together
The last part was tricky, the servos did tend to lock up until I've put a 25ms delay between the commands to the two servos. This solution was confirmed by other servo-masters I asked later, so this is a good knowledge for future project. Fortunately cannot really notice the effect of this delay on the behaviour here, so all good. The servo also needs at least about 300ms to move to properly wave. Less than that and it might behave weird, much more than that makes it much less wavy.
The code is very hacky, was written in a short time, so probably could be done much better. Your mileage might vary!
The server pulls the game information and instructs the Arduino what to do. It's a very simple Node.js server.
I'm using Kimonolabs' Unofficial World Cup API this time.
- Sign up for Kimonolabs for an API
- Find the game of your interest in the explorer (matches tab, best way is maybe by the time of the game), copy match "id".
- Check out the littleGoal code from Github, install the dependencies ("npm install" in the project directory)
- copy "config.json.example" to "config.json" within the directory, add your API key, updated the game id, and your Arduino port
I've tested it on Linux, should be the same everywhere else where Node.js can be run.
Step 5: Altogether Now!
To put everything together:
- flash the program to the Arduino
- connect all the parts (littleBit modules, USB between Arduino and computer)
- turn on the Arduino, wait until the "rx" pin blinks once (also signalled by the servos stopping their boot-time wiggle)
- run the server on the computer; if everything is correct, you should see the logs in the console window
When the game start, the two flags will be waving together, and the same will happen when the game reaches full time.
When there's a score, the appropriate side's flag should be waving. Check out the attached video of how does it look like!
From testing, there's an approx. 1-2 minute delay between score and when the computer hears about it. This shouldn't be a problem if you are not watching the game in the same time (in which case you probably don't need littleGoal anyways:)
As you can tell from the flags, I wanted to test with the Brazil - Chile game, but the servos gave me grief, and couldn't debug them until the next game. Hence the low-tech update to the Netherlands - Mexico flags.
*Spoiler alert*: the Netherlands beat Mexico to get to the quarterfinals in the World Cup. And littleGoal was working pretty neat!
There are only about 9 games left from this World Cup, so I probably won't modify this set up this time, but it could be reused for any other football or sports event that has an accessible web API (after modifying the server code).
Could also add:
In the meantime, enjoy the rest of the games, and make something awesome!
We have a be nice policy.
Please be positive and constructive.