Things used in this project
The Wireless MQTT connected Super Mario Bros Coin Box is an example of the cool things that can happen when IoT is thrown in the mix while having fun, the idea originally came up as a demonstrator for the IoT meetup in Barcelona, in the context of the launching the new Zolertia's flagship: the Re-Mote.
Basically upon hitting the Coin Box, the familiar sound of a coin will be played while the cube is lit, then a publication is made to a topic in the mosquitto MQTT broker running locally on a Raspberry Pi, where a MQTT Paho Client subscribed to the topic receives the message, then takes a photo of the person hitting the box, and uploads it to twitter,
The Re-Mote was jointly developed with universities and
industrial partners in the frame of the European research project RERUM (REliable, Resilient and secUre IoT for sMart city applications).
Periodically the Con Box publishes its status to The Things.IO, sending data such as RSSI level, Uptime, Core temperature, Battery level and default IPv6 route. The Things is a cloud IoT platform, which has a cool feature to allow visualizing data in real time, and has the advantage of providing support for RESTfull, CoAP y MQTT.
We also have a Node-RED flow running in the Raspberry Pi, reading a Twitter account searching for instances of a given hashtag, then publishing to a MQTT topic, then triggering the Coin Box to play the Super Mario Bros star sound, this way we will not miss any mention from our beloved community.
Under the hood of the Coin Box known protocols in the Wireless Sensor Networks and M2M applications are present, such as MQTT, 6loWPAN, RPL (mesh routing), TCP, Low Power MAC protocols, etc, all powered up by Contiki OS, so basically with the proper configuration this Coin Box could be accessible from anywhere in the world using IPv6 addressing, built on top of protocols and industry-level code extensively used in commercial products and research. For the Border Router with the Re-Mote attached to the Raspberry Pi we use 6LBR with the following configuration in
The Re-Mote by default connects to port
/dev/ttyUSB1, while the Z1 mote defaults to
/dev/ttyUSB0. We are using the
aaaa::/64 for the Ethernet side (using the
aaaa::1 for the host!) and
bbbb::/64 for the Wireless Sensor Network (just the opposite as the default installation, I don't know what I was thinking...). If the Raspberry Pi is connected to WiFI instead of Ethernet, change
The BSD-3-Clause is related only to the Contiki source code, as it was inherited from the base MQTT demo example and libraries, the rest of the components (coin box cube, schematics, etc) is totally open and available to fork and use in any way desired, just drop me a link to see the amazing things derived from this project.
Demo presentation at IoT meetup
Below you can download the slides from the Barcelona IoT meetup, with more information about the setup.
A more detailed description of the scenario is available above in a PDF format. This is a work likely to be updated constantly because we are having so much fun with it.
Laser cutting the Coin Box
The Adobe ilustrator files (.ai) to laser cut your own Coin Box are available below, we used 3mm methacrylate plastic and assembled glueing parts together. Special thanks to Cecilia Tham from MOB (Makers of Barcelona) for lending us the laser cut machine to create the cube and her endeless ideas and enthusiasm, and Jeray Pérez Vallejo for actually making the design of the cube... you guys rock!
Below are the wiring of the Super Mario Coin Box modules.
Audio files converted to AD4
The sound files used for the demo are available below, already converted to AD4 format. We have used only the coin and star-invincible sounds, but there are others included like the hurry-up and game over sounds.
The MQTT coin box application
The original MQTT implementation and example rests at Contiki repository, however at the time of this project was released, the Re-Mote was not officially merged into Contiki, and the platform source files are currently being staged for an upcoming pull request.
You can start in Contiki by either downloading the Instant Contiki Virtual Machine, or by checking out the repository and installing the required toolchains for each platform, in case of the Re-Mote the instructions are in the README.
In the meantime, a pre-compiled binary for both the MQTT coin box is available below. We are using channel 26 instead of default cc2538dk channel 25. For the 6LBR border router you will need an IEEE 802.15.4 compatible device running as a
slip-radio, you can use for a Zolertia Re-Mote or Z1 mote as well.
make TARGET=z1 savetarget && make slip-radio.upload
Mosquitto MQTT broker running in the Raspberry Pi
Python script running in the Raspberry Pi
The python script uses Eclipse Paho Client to subscribe and publish to the local MQTT broker, binded to the
aaaa::1 IPv6 address, upon receiving a message from the broker about the
iot-2/evt/knock/fmt/json topic it will send a twitter message, using tweepy python client, with a given #hashtag, message and URL.
This page has neat instructions on how to install tweepy and more explaination about how it works.
Original MQTT example
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!