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.

Ahh. Holidays. What better time to fiddle with projects?
Not a lot to report on the project front today. More of a quick update on my analog meters, planned projects and new toys.

Remember last post I talked about making new covers for the meters?
Well! Here they are!

Purty no? On the upside, I learnt GIMP doesn’t like doing colour inversions, but paint does… Riddle me that internet, riddle me that…

That’s the only update I have for you on that project. I have kinda lost some inspiration on the SD card logging when I couldn’t get some example codes working. Just needs more time than I have had recently.

Moving right along!
New projects!
What are several things a electronics hobbyist needs?

  • Soldering Iron
  • Multimeter
  • Oscilloscope
  • Bench Power Supply

Yes? We are in agreement? Ok, maybe not the oscilloscope quite that much, but still. Would be pretty handy…

So I have a solderin iron. It’s old and the tip is burnt through, but it works pretty well. Multimeter? Check. A cheapo $20 one picked up from leading edge electronics when I was 12 I think… Once again. It works to everything I need it to, so far. Oscilloscope? I wish… I’m saving for one at the moment. A cathode ray would be awesome, but I just don’t have the space. So lately I have been thinking of and looking at the digital scopes. As of yet, I don’t know. Peoples thoughts?

Now. Bench power supply. That, I am missing. At the moment I just use the 5V line from my arduino. That’s not really the best way to do things due to the current limitation from that line. We don’t want to be burning out my arduino board now do we? That would just be inconvenient.

So. what to do? A variable bench supply is too expensive. I could mod an ATX powersupply to feed me the 5V and 12V lines from the molex plugs, but the only spare ATX supply I have is dying and they draw a bit of power even with no load attached.
What to do?
Enter brilliant idea.
Build a simple 5V and 3.3V power supply.

Using an LM7805 and a LM317 voltage regulators, feed 12V from an old wall power pack I found lying around into the regulators. Take the output from the LM7805 for 5V, output of LM317 as 3.3V, output direct from the wall pack as 12V. Throw some regulating capacitors and backwards current protector diodes in. Throw a heatsink on the regulators just in case. Simple! I can even build a little adapter to plug in a 9V battery instead of the wall pack. Some pretty LEDs in and switches to turn each segment of the supply on or off. Best idea ever. Best thing is, I have most of the components! Just not the important ones. Like the LM317 and the capacitors… Looks like I’m going back to Jaycar.

After a bit more research I will be ready to draw up a proper cicuit diagram.

Onto my new toy. 😀

Thanks to a post at Hack A Day, I managed to pick up a Texas Instruments experimenter board for half price. Only $13.66! That included shipping! An offer I could not refuse.

The board was a MSP-EXP430FR5739. This board was developed to show off a new(ish) system of memory called FRAM (Ferroelectric Random Access Memory). FRAM boasts a write endurance of 100,000,000,000,000 cycles. What the hell? Thats a huge number. Over 100 billion times more than FLASH memory. That thumb drive with all you back-ups isn’t looking all that safe anymore now is it?
FRAM also writes a hell of a lot faster than FLASH. like, 100 times faster.

You must be thinking, “If FRAM is so good, why do we still use FLASH memory?”
I’m glad you asked that.
While FRAM is more reliable, faster and uses less power, it also have several flaws.
As with all new stuff, It’s expensive! That is the main point in it not taking over FLASH. No one likes spending lots of money, especially big corporations who cut corners to save 1c per product…
Capacity. It just doesn’t, at the moment, have the same capacity for storage compared to FLASH.

That’s enough of me plugging the FRAM. On to plugging the experimenters board infront of me.
This little baby is a 16 bit RISC architecture MCU running at 8MHz. On the board there is a 3 axis accelerometer, a thermistor, 8 LEDs and 2 switches. Other TI boards can be connected to it via a couple of header plugs at the back of the board. All PC and USART conections go through a micro-usb plug at the top of the board. Power is also drawn from USB.

Wow that’s a piss poor photo. Man, I need a new camera…

3 axis accelerometer and a PC interface? I think a gesture control for my PC is on the cards…

Well enough from me today. This short post turned into quite a long one. I should probably go do the washing up now… Have fun!

Next project time!

This one is rather simple and easy, just to introduce me to the arduino and its capabilites. A couple of analog panel meters to show realtime cpu and ram usage, then have the data logged onto an SD card.

I’ve got the panel meters and have tested them. How they are gonna work is a simple PWM signal with the duty cycle adjusted to current load sent from the computer via serial port. The panel meters I have chosen are 0->1mA. So some calibration circuitry is needed so i can adjust the voltage and get a linear approximation of the data from the cpu. Now, this is rather simple.
What we want is 1mA of current being drawn when the PWM is driven to 100% duty cycle, and 0 mA when the PWM duty cycle is 0%. So, back to basics. Remember V=IR? I surely do. Bit of gypsy magic and we get R = V/I. Lets just assume the panel meter has no resistance, when it actually does, and calculate a “Perfect” resistance needed to get out 1mA.

R = 5v/1*10^-3
= 5kohms.

Tweasy. All we have to do is add a 5kOhm resistor in series between the PWM pin of the arduino and the panel meter. If you want to check that the response is linear as the voltage varies, compute I = V/R for several points and plot. You will notice it is a linear relationship*. Just what we want.

Plug it into the arduino, and you will find that it works! Fancy! Maths is again useful! <- Much to my dismay…

Nexzt, I’m gonna be working on the data logging to SD card. Now this would be MUCH more useful if I could find a particular library called uFat2 made by SirMorris. But alas, his code host no longer has it and I cannot find links to it anywhere else, So if any readers out there have it or can find it, let me know! Please!

Peace out.

*Technically, Ohms law is not a linear realtionship, as temperature varies, the line becomes less and less linear. For most applications though, we can ignore that…