Category: Arduino

I’m Batman…

Well, I have to do something with my holidays, and considering no one wanted me for summer vacation work experience  (Anyone out there?), I decided to play electronics geek. Don’t look so surprised.

I recently (for Christmas) came into possession of one of these.

A nice Arduino compatible LED Dot Matrix screen. Spent Boxing day wiring up and ATX to give me 5V and setting this baby going.

The concept of using and ATX PSU for a bench supply is in no way a new one. You can, in fact, get some really cool modifications to turn them into variable bench supplies. Considering the only reason I used an ATX is because I am at my parents house for Christmas and hence don’t have my work bench, I didn’t really need a fancy job, just a switch to turn it on and a plug to break out 5 and 12 volts from molex. I had better clarify at this point, the LED Matrix draws a nominal 5V from the Arduino to light up the LEDs, but for increased brightness, you can feed in 5V from another source. Guess what the max. Ampere it reckons it can draw from the extra 5V?

40 amps.


40 of em.

But it does look like a small sun when plugged in.

Back on track.

To turn on an ATX PSU with no Motherboard plugged in, you simply need to short the green wire with the black wire on the 20/24 pin plug. Many people use a paper clip, and that is a pretty good idea, but I seem to have a loathing of paper clips since Microsoft Word 97…


So I threw together a nice reusable plug and switch combo. Pretty no? I have become a convert to heat shrink, so much neater compared to electrical tape. Really all it does is short the green and black wires. A handy tool to keep none the less.To break the voltage out of the molex plug, I found in Dads draw, a molex voltage breaker-outer. So I didn’t even have to make one! It may or may not go back into the draw.To the LED Matrix!It simply plugs into pins 6-13 + GND + AREF of an Arduino, as you can see below. It uses the SPI interface to push data and commands to the screen. It all comes with libraries to easily get the Matrix working with minimal fuss. You simply need to get an extra library from the interwebs to ensure it works, the TimerOne library.

Run the sample code, viola!

Now, what else can I display on this baby?

How about a giant Facebook notification screen? How pointlessly awesome? Right, lets get onto that.


That is all I am going to say about Facebook’s API. So painful. After much research, I decided on using Java and RestFB to grab notification data from currently logged in user of the computer. After finally working out how to generate an Application key, Application secret key and an Auth token, I managed to finally grab notification data from Facebook, and parse the data form JSON form to a class form.

Java Source Code with Notification Class

To generate the app keys, you have to create an app in the Facebook developers site. You can get temp auth tokens from an auth token generator from the dev site as well. The Auth token generator is only really useful for debugging. You really need to set up a way to grab one properly for any deployed apps. Here, I’ll link it for you.

Data! How nice of it to finally work. Here I am only grabbing the Notification_ID from the JSON results, because all I want to do is display total count of unread notifications. If you want more data, modify the file to reflect what data you want to grab from the JSON. Next was pushing the data to the board. Here I hit a snag that I haven’t fixed yet. When the data was transmitted to the board, the Matrix would clear and would display nothing again. I checked the USART and SPI pins, they don’t clash. So must be code somewhere. Well, here was my Arduino sketch I threw together anyway. Keep in mind, it doesn’t work. The serial code for the Java, as you may have noticed, is commented out in the above Java source code.

Arduino Sketch

Well, I then decided to do something silly with the screen.

Batman Logo.

Most annoying bit was plotting the logo to a 16×32 image then translating that to a 2D array. I grabbed a logo image, scaled it down to 16×32 then wrote out by hand where each pixel was then manually entered it into an array. In hind sight, I could have gotten the 16×32 image, then written a nice C code to translate it into an array, but that would have probably taken just as long anyway. Might throw one together anyway for future use.

Well, the fruits of my labours!

And here’s the source codes. The Batman Logo array is in the batmanlogo.h file. Go nuts.

Main Sketch and Batman Logo.

Compressed, grouped files? Who do you think I am? Get them individually. Maybe when I port to a new file server I’ll do that.

Because I’m Batman.

Analog RAM and CPU Meters: Update

So I finally found time to fiddle with the CPU and RAM meters again today. Between Uni assignments and The Witcher 2, I haven’t really had much time for hacking, but after finishing The Witcher 2, I had to do something to procrastinate.

So I sat down and wrote a little Python script to grab the current CPU load and RAM usage. To do this, a module needed to be imported into the script. WMI. Windows management instrumentation. Other given modules are also needed. For example, serial and time. So we can actually TALK to the Arduino. You know, I hear that’s handy for what I’m doing…


As you can see, I’m sending the data as a string of characters, with a begin and end byte.

So, I’ve got the data, and I’m pushing it to the Arduino, now all I need to do is get the Arduino to do something with it! Remember those bytes I put in between the data bytes? Yep. Let’s use those to tell the micro controller what data packet is going to which display.
Basically, on Serial.available > 0, we check the byte, if it’s the byte that precedes the CPU byte, we set a flag as 1, if it’s the byte that precedes the RAM byte, we set the flag as 0, if it’s the byte at the end of the stream, do nothing, we don’t need that data. Ultimately I could remove it, but I like having the option for letting the micro controller know that the transmission is finished, but I digress. With any other byte, we check the flag and output the value to the corresponding meter. Simple.

Arduino Source

I originally tried to be all fancy like and send it in 2 data packets with the Most significant nibble of each byte in the first packet, then the least significant byte as the second packet. Basically multiplexing the data. For no real reason but to try and implement something I had learnt in my communications theory class. Well, as you can see, that fell through. The Python script managed to encode and send the data, but for the life of me I couldn’t get the Arduino to decode the data. I’ll probably keep fiddling, but for now, it’s working.


The left meter is RAM and the right is CPU. You can also see where I’m working on the SD card interface.
The CPU output is quite jumpy because the CPU load is changing all the time, I’m working on some action smoothing methods that I can implement on the Arduino, just something else I need to work on.

The final product plan is a mounted set of monitors with LED backlighting and a custom back planes. As you can see, I’m not really measuring mA, so I was planning on scanning in the current back planes and photoshooping some new ones that suit my project, just to give it that finished look.

Yeah I know, I’m avoiding the SD interface. I’m a little daunted by it honestly. But to be fair, I’m avoiding a lot of things, aka, uni work. So on that note, I leave you. Enjoy this quick update!