Maker Faire RGBPongClock

UPDATE! I have finished a PCB for the RGB Pong Clock (or any other project using an RGB Matrix panel) and have sent it off for a quick run. It works with both the Core and the Photon and is designed to attach to the back of the panel. Once it is tested, I’ll be making it available to everyone. Here is a peek at the top of the board (sorry for the small size):

One of the projects I brought for Maker Faire in San Francisco is the RGBPongClock and I wanted to share the code with everyone. The project uses an Adafruit 16x32 RGB Matrix panel and presents a clock with multiple faces including Pong, Weather, Spectrum analyzer and more! The code and instructions are available here:

Cheers!

The goal of this tutorial is to build the RGBPongClock I demonstrated at the last Maker Faire. The clock used a hand soldered Adafruit perma protoboard and an older Particle Core.

As a start, we will build the clock using a breadboard, some jumper wires and the new Particle Photon. I hope to have a PCB designed by the end of the tutorial so a permanent version can be built. SO LET’S GET BUILDING!

Here is what you need before you start:

  • 1 Photon
  • 1 Medium or long breadboard (a medium one is used here)
  • 1 [Adafruit Medium 16x32 RGB LED Matrix Panel][1]
  • 1 5V, 2A switching power supply ([Adafruit has this one][2])
  • A set of jumper wires
  • 1 USB cable to power the Photon from a PC (also to communicate)

STEP 1 - INITIAL SETUP

For this build and to keep things simple, the LED matrix will be powered by its own supply while the Photon will be powered via USB (from a PC or power adapter). I suggest you follow Adafruit’s tutorial for connecting the power to the panel.

Place the Photon mid-board and connect a jumper (black if possible) from the Photon GND pin to one of the protoboard power rails. This will allow 4 ground connections to be made to the RGB panel.

The Complete Wiring

The ribbon cable supplied with the panel must be connected to the panel’s INPUT connector. For reference, the connector pin assignment is as follows:

The image is a top view of the connector, as it appears on the back of the panel.

You will note the connector on the right side of the board. This will represent the connector on the other end of the ribbon. We will be inserting the jumper wires directly into each hole of the connector.

I will pause here because of 2 reasons. First, I have to confirm the pins to be used on the Photon as they may change from the original Core assignment. Second, the RGBPongClock requires SparkIntervalTimer which is in the process of being ported to the Photon. More specifically, it has been ported but the firmware to support it has not been released yet. This pause give me a chance to do a little more planning (aka, learning fritz and making sure I get this tutorial right!) … stay tuned :smile:

The Magic of Webhooks

The RGBPongClock makes use of a webhook to do all the work of fetching the 7-day weather forecast data. It also does all the parsing of the (lengthy) JSON data returned from the api.openweathermap.org website. The webhook looks like this:

"event": "weather_hook",
"url": "http://api.openweathermap.org/data/2.5/forecast/daily",
"requestType": "POST",
"headers": null,
"query": {
    "q": "Ottawa,ON",
    "mode": "json",
    "units": "metric",
    "cnt": 7
    },
"responseTemplate": "{{#list}}{{temp.day}}{{#weather}}~{{id}}~{{/weather}}{{/list}}",
"json": null,
"auth": null,
"mydevices": true
}```

You will need to cut and paste the webhook text into a file named "weather.json"

**For the following step, you will need to install the Particle CLI tool following  [these][3] instructions.**

Configure the webhook
-------
The RGBPongClock.ino file contains a #define HOOK_NAME that defines the "event name" of the webhook. The name defined after the hook-response/ part must also match the #define HOOK_PUB and the event defined in the webhook. In the example, the event is named weather_hook.

In order to get the weather for your area, you will need to change the "q" and "units" query parameters to match your city and temperature units. For Fahrenheit, me "units" parameter line can be removed entirely.

The JSON parsing template is defined by responseTemplate following the Mustache stateless query format.

DON'T FORGET to create the webhook using Particle CLI:

```particle webhook create weather.json```


  [1]: http://www.adafruit.com/product/420
  [2]: https://www.adafruit.com/products/276
  [3]: http://docs.particle.io/photon/cli/
13 Likes

**Paul it was great to meet you at the Maker Faire today and I bought the Photon kit today and just ordered the led panel. Let me know what’s next to get this project off the ground. I’m excited if you can’t tell.

Mike**

3 Likes

@Miketheone2, it was great meeting you as well. What a weekend! Guidng you through the building this project will be an adventure. With the Photon being so now, it will be fun. So if you are ready for the adventure, then here we go…

First, tell me if you have a basic knowledge of electronics. Second, have you done soldering before? Based on this, I will decide on the best way for you to put this project together. :smile:

Paul,

I have spent time soldering before and this is my first circuit build.

The LED screen will be in soon… Maybe Friday or Monday.

Let me know what else I need to order?

Thank you,

Mike

1 Like

@Miketheone2, great! There are two ways to build this clock. One using the protoboard you have but it is a “non-permanent” build. The other is to use a circuit board like the one I used and have a more permanent circuit since everything would be soldered. Using the protoboard may be a good first start and then you can move to the more permanent solution.

If that sounds good, you will need to order some breadboarding male-to-male jumpers like these:

You can use the shorter ones for wiring on the board itself and the 6" one to connect to the ribbon cable from the matrix panel.

The software for the RGBPongClock was designed for the Core and I am in the process of porting it to the Photon. This is the first really low-level ports I have done for the new Photon! :smiley:

Any pictures to share of this project?

@Bspranger, good point! I’ll post some pictures this weekend :smile:

Ok I ordered both sets of jumpers and the display will be in Tuesday.
How is the porting going over the Photon. Im excited to see this all come together.

BTW I have a Mac if the changes anything.

Thank you again.

Pictures would definitely help when we get into setting up the board.
This should be on Instructables.com at some point too.

@Miketheone2, pictures and Instructables is a great idea. The Photon open source code is on the verge of being released. The key library to be ported is the SparkIntervalTimer library. It will require some special work by Particle to allow users to “capture” interrupt handlers for use by user code. The amazing @mdma at Particle is working on this and will let me know when it is available. In the meantime, we can focus on assembly.

Having a Mac is no problem since most of the Elites and all Particle folks uses Macs. :smiley:

Peekay,

Sounds good to me and pictures will definitely make this easier.
It looks like the jumpers will be coming in Tuesday along with the LED Panel.

Thank you,

Mike

1 Like

@Miketheone2, the first pictures will be of be of the working display. Then, as we assemble everything on a breadboard, I will take pictures along the way. :smile:

1 Like

All the parts are in and we’re ready to begin.

@Miketheone2, very well then! I will dismantle my clock and start the process of taking pics and adding instructions. In the meantime, @mdma is adding the necessary timer stuff to be tested by folks compiling locally. :smile:

I am just waiting on the fritzing part from the Particle team so I can create great working diagrams instead of pictures. In the meantime, I suggest you claim your Photon if you haven’t already done so. There is huge progress on porting the library to the Photon, though still in beta.

Sorry this feels like baby steps. I honestly think doing this right will make the whole experience better and more duplicatable. :smiley:

2 Likes

Sounds good to me and I have the photon as well. I have everything laid out. Thank you again and I can’t wait.

@Miketheone2, by using Fritzing I may be able to create a PCB for the final part of the project where we go from a breadboard to a soldered solution. I’m excited about that as well!

I’m ready. I have all my parts laid out and organized.

@Miketheone2, I have the Fritzing diagram from @Brett so I’ll be starting the steps soonly! As we do each, you can tell me if the instructions suck or not :wink:

1 Like

@Miketheone2, I’m trying to find a better way to do this tutorial and might move it to hackster.io. Stay tuned!

UPDATE: I decided that I will publish to hackster.io once I finish this tutorial

Sounds good and ill order the Power Supply and follow the instruction and get this going.
Thank you,

Mike

1 Like