Archive | tutorial

Review – “Ardublock” graphical programming for Arduino


After helping many people get started with the world of Arduino and electronics,  we still find a small percentage of people who are turned off by the concept of programming or have trouble breaking larger tasks into smaller ones with regards to writing algorithms for their code/sketch.

So after being introduced to a new graphical programming tool called “Ardublock“, we were excited about the possibilities wanted to share it with our readers. Ardublock provides a truly graphical and non-coding solution to controlling an Arduino, that is an open-source product and thus free to download and try for yourself.


Ardublock is a Java application that runs from inside the Arduino IDE, which can be downloaded from here. It’s only one file, that needs to be placed in a new folder in the Arduino IDE. The folder names must be the same as shown below:

ardublock installation folder

Once you’ve copied the file, simply open the Arduino IDE and select Ardublock from the Tools menu:

arduino ide tools menu ardublockFrom which point a new window appears – the Ardublock “development environment”:

ardublock development environment

 Using Ardublock

It’s quite simple – you simply select the required function from the menu on the left and drag it into the large area on the right. For a quick example where we blink the onboard LED on and off – watch the following video:


The following image is the screen capture of the program from the video:

ardublock LED Blink

As you can see the “blocks” just fit together, and parameters can be changed with the right mouse button. After a few moments experimenting with the Ardublock software you will have the hang of it in no time at all.

And thus you can demonstrate it to other people and show them how easy it is. And there is much more than just digital output controls, all the functions you’re used to including I2C, variables, constants, servos, tone and more are available.

The only technical thing you need to demonstrate is that the Arduino IDE needs to stay open in the background – as once you have finished creating your program, Ardublock creates the required real Arduino sketch back in the IDE and uploads it to the board.

This is also a neat function – the user can then compare their Ardublock program against the actual sketch, and hopefully after a short duration the user will have the confidence to move on with normal coding.


Ardublock provides a very simple method of controlling an Arduino, and makes a great starting point for teaching the coding-averse, very young people or the cognitively-challenged. It’s open source, integrates well with the official IDE and works as described – so give it a go.

And if you enjoyed this review, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.


In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in ardublock, arduino, software, software review, tronixstuff, tutorial3 Comments

Tutorial – Arduino and the TLC5940 PWM LED Driver IC

Use the Texas Instruments TLC5940 16-Channel LED Driver IC with Arduino in Chapter 57 of our Arduino Tutorials. The first chapter is here, the complete series is detailed here.


Today we are going to examine the Texas Instruments TLC5940 16-channel LED driver IC. Our reason for doing this is to demonstrate another, easier way of driving many LEDs – and also servos.  First up, here is a few examples of the TLC5940


The TLC5940 is available in the DIP version above, and also surface-mount. It really is a convenient part, allowing you to adjust the brightness of sixteen individual LEDs via PWM (pulse-width modulation) – and you can also daisy-chain more than one TLC5940 to control even more.

During this tutorial we’ll explain how to control one or more TLC5940 ICs with LEDs and also look at controlling servos. At this point, please download a copy of the TLC5940_data_sheet (.pdf) as you will refer to it through this process. Furthermore, please download and install the TLC5940 Arduino library by Alex Leone which can be found here. If you’re not sure how to install a library, click here.

Build a TLC5940 demonstration circuit

The following circuit is the minimum required to control sixteen LEDs from your Arduino or compatible. You can use it to experiment with various functions and get an idea of what is possible. You will need:

  • An Arduino Uno or compatible board
  • 16 normal, everyday LEDs that can have a forward current of up to 20 mA
  • a 2 kΩ resistor (give or take 10%)
  • a 0.1uF ceramic and a 4.7uF electrolytic capacitor

Take note of the LED orientation – and remember the TLC5940 is a common-anode LED driver – so all the LED anodes are connected together and then to 5V:

TLC5940 Arduino circuit

For this particular circuit, you won’t need an external 5V power supply – however you may need one in the future. The purpose of the resistor is to control the amount of current that can flow through the LEDs. The required resistor value is calculated with the following formula:

R = 39.06 / Imax

where R (in Ohms)  is the resistor value and Imax (in Amps) is the maximum amount of current you want to flow through the LEDs. For example, if you have LEDs with a 20 mA forward current – the resistor calculation would be:

R = 39.06 / 0.02 = 1803 Ohms.

Once you have the circuit assembled – open up the Arduino IDE and upload the sketch BasicUse.pde  which is in the example folder for the TLC5940 library. You should be presented with output similar to what is shown in the following video:

Controlling the TLC5940

Now that the circuit works, how do we control the TLC5940? First, the mandatory functions – include the library at the start of the sketch with:

and then initialise the library by placing the following into void setup():

x is an optional parameter – if you want to set all the channels to a certain brightness as soon as the sketch starts, you can insert a value between 0 and 4095 for in the Tlc.init() function.

Now to turn a channel/LED on or off. Each channel is numbered from 0 to 15, and each channel’s brightness can be adjusted between 0 and 4095.

This is a two-part process…

First – use one or more of the following functions to set up the required channels and respective brightness (PWM level):

For example, if you wanted to have the first three channels on at full brightness, use:

The second part is to use the following to update the TLC5940 with the required instructions from part one:

If you want to turn off all channels at once, simply use:

You don’t need to call a TLC.update() after the clear function. The following is a quick example sketch that sets the brightness/PWM values of all the channels to different levels:

and the sketch in action:

The ability to control individual brightness for each channel/LED can also be useful when controlling RGB LEDs – you can then easily select required colours via different brightness levels for each element.

Using two or more TLC5940s

You can daisy-chain quite a few TLC5940s together to control more LEDs. First – wire up the next TLC5940 to the Arduino as shown in the demonstration circuit – except connect the SOUT pin (17) of the first TLC5940 to the SIN pin (26) of the second TLC5940 – as the data travels from the Arduino, through the first TLC5940 to the second and so on. Then repeat the process if you have a third, etc. Don’t forget the resisotr that sets the current!

Next, open the file tlc_config.h located in the TLC5940 library folder. Change the value of NUM_TLCS to the number of TLC5940s you have connected together, then save the file and also delete the file Tlc5940.o also located in the same folder. Finally restart the IDE. You can then refer to the channels of the second and further TLC5940 sequentially from the first. That is, the first is 0~15, the second is 16~29, and so on.

Controlling servos with the TLC5940

As the TLC5940 generates PWM (pulse-width modulation) output, it’s great for driving servos as well. Just like LEDs – you can control up to sixteen at once. Ideal for creating spider-like robots, strange clocks or making some noise. When choosing your servo, ensure that it doesn’t draw more than 120 mA when operating (the maximum current per channel) and also heed the “Managing current and heat” section at the end of this tutorial. And use external power with servos, don’t rely on the Arduino’s 5V line.

To connect a servo is simple – the GND line connects to GND, the 5V (or supply voltage lead) connects to your 5v (or other suitable supply) and the servo control pin connects to one of the TLC5940’s outputs. Finally – and this is important – connect a 2.2kΩ resistor between the TLC5940 output pin(s) being used and 5V.

Controlling a servo isn’t that different to an LED. You need the first two lines at the start of the sketch:

then the following in void setup():

Next, use the following function to select which servo (channel) to operate and the required angle (angle):

Just like the LEDs you can bunch a few of these together, and then execute the command with:

So let’s see all that in action. The following example sketch sweeps four servos across 90 degrees:

And the following video captures those four servos in action:


If you servos are not rotating to the correct angle – for example you ask for 180 degrees and they only rotate to 90 or thereabouts, a little extra work is required. You need to open the tlc_servos.h file located in the TLC5940 Arduino library folder and experiment with the values for SERVO_MIN_WIDTH and SERVO_MAX_WIDTH. For example change SERVO_MIN_WIDTH from 200 to 203 and SERVO_MAX_WIDTH from 400 to 560.

Managing current and heat 

As mentioned earlier, the TLC5940 can handle a maximum of 120 mA per channel. After some experimenting you may notice that the TLC5940 does get warm – and that’s ok. However there is a maximum limit to the amount of power that can be dissipated before destroying the part. If you are just using normal garden-variety LEDs or smaller servos, power won’t be a problem. However if you’re planning on using the TLC5940 to the max – please review the notes provided by the library authors.


Once again you’re on your way to controlling an incredibly useful part with your Arduino. Now with some imagination you can create all sorts of visual displays or have fun with many servos. And if you enjoyed the tutorial, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.


In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, BOB-10616, COM-10136, LED, PWM, servo, TI, tlc5940, tronixstuff, tutorial15 Comments

Tutorial – Arduino and the MAX7219 LED Display Driver IC

Use the Maxim MAX7219 LED display driver with Arduino in Chapter 56 of our Arduino Tutorials. The first chapter is here, the complete series is detailed here.


Sooner or later Arduino enthusiasts and beginners alike will come across the MAX7219 IC. And for good reason, it’s a simple and somewhat inexpensive method of controlling 64 LEDs in either matrix or numeric display form. Furthermore they can be chained together to control two or more units for even more LEDs. Overall – they’re a lot of fun and can also be quite useful, so let’s get started.

Here’s an example of a MAX7219 and another IC which is a functional equivalent, the AS1107 from Austria Microsystems. You might not see the AS1107 around much, but it can be cheaper – so don’t be afraid to use that instead:

MAX7219 AS1107

 At first glance you may think that it takes a lot of real estate, but it saves some as well. As mentioned earlier, the MAX7219 can completely control 64 individual LEDs – including maintaining equal brightness, and allowing you to adjust the brightness of the LEDs either with hardware or software (or both). It can refresh the LEDs at around 800 Hz, so no more flickering, uneven LED displays.

You can even switch the display off for power saving mode, and still send it data while it is off. And another good thing – when powered up, it keeps the LEDs off, so no wacky displays for the first seconds of operation. For more technical information, here is the data sheet: MAX7219.pdf. Now to put it to work for us – we’ll demonstrate using one or more 8 x 8 LED matrix displays, as well as 8 digits of 7-segment LED numbers.

Before continuing, download and install the LedControl Arduino library as it is essential for using the MAX7219.

Controlling LED matrix displays with the MAX7219

First of all, let’s examine the hardware side of things. Here is the pinout diagram for the MAX7219:

MAX7219 pinout

The MAX7219 drives eight LEDs at a time, and by rapidly switching banks of eight your eyes don’t see the changes. Wiring up a matrix is very simple – if you have a common matrix with the following schematic:

LED matrix pinoutsconnect the MAX7219 pins labelled DP, A~F to the row pins respectively, and the MAX7219 pins labelled DIG0~7 to the column pins respectively. A total example circuit with the above matrix  is as follows:

MAX7219 example LED matrix circuit

The circuit is quite straight forward, except we have a resistor between 5V and MAX7219 pin 18. The MAX7219 is a constant-current LED driver, and the value of the resistor is used to set the current flow to the LEDs. Have a look at table eleven on page eleven of the data sheet:

MAX7219 resistor tableYou’ll need to know the voltage and forward current for your LED matrix or numeric display, then match the value on the table. E.g. if you have a 2V 20 mA LED, your resistor value will be 28kΩ (the values are in kΩ). Finally, the MAX7219 serial in, load and clock pins will go to Arduino digital pins which are specified in the sketch. We’ll get to that in the moment, but before that let’s return to the matrix modules.

In the last few months there has been a proliferation of inexpensive kits that contain a MAX7219 or equivalent, and an LED matrix. These are great for experimenting with and can save you a lot of work – some examples of which are shown below:

MAX7219 LED matrix modules

At the top is an example from, and the pair on the bottom are the units from a recent kit review. We’ll use these for our demonstrations as well.

Now for the sketch. You need the following two lines at the beginning of the sketch:

The first pulls in the library, and the second line sets up an instance to control. The four parameters are as follows:

  1. the digital pin connected to pin 1 of the MAX7219 (“data in”)
  2. the digital pin connected to pin 13 of the MAX7219 (“CLK or clock”)
  3. the digital pin connected to pin 12 of the MAX7219 (“LOAD”)
  4. The number of MAX7219s connected.

If you have more than one MAX7219, connect the DOUT (“data out”) pin of the first MAX7219 to pin 1 of the second, and so on. However the CLK and LOAD pins are all connected in parallel and then back to the Arduino.

Next, two more vital functions that you’d normally put in void setup():

The first line above turns the LEDs connected to the MAX7219 on. If you set TRUE, you can send data to the MAX7219 but the LEDs will stay off. The second line adjusts the brightness of the LEDs in sixteen stages. For both of those functions (and all others from the LedControl) the first parameter is the number of the MAX7219 connected. If you have one, the parameter is zero… for two MAX7219s, it’s 1 and so on.

Finally, to turn an individual LED in the matrix on or off, use:

which turns on an LED positioned at col, row connected to MAX7219 #1. Change TRUE to FALSE to turn it off. These functions are demonstrated in the following sketch:

And a quick video of the results:

How about controlling two MAX7219s? Or more? The hardware modifications are easy – connect the serial data out pin from your first MAX7219 to the data in pin on the second (and so on), and the LOAD and CLOCK pins from the first MAX7219 connect to the second (and so on). You will of course still need the 5V, GND, resistor, capacitors etc. for the second and subsequent MAX7219.

You will also need to make a few changes in your sketch. The first is to tell it how many MAX7219s you’re using in the following line:

by replacing X with the quantity. Then whenever you’re using  a MAX7219 function, replace the (previously used) zero with the number of the MAX7219 you wish to address. They are numbered from zero upwards, with the MAX7219 directly connected to the Arduino as unit zero, then one etc. To demonstrate this, we replicate the previous example but with two MAX7219s:

And again, a quick demonstration:

Another fun use of the MAX7219 and LED matrices is to display scrolling text. For the case of simplicity we’ll use the LedControl library and the two LED matrix modules from the previous examples.

First our example sketch – it is quite long however most of this is due to defining the characters for each letter of the alphabet and so on. We’ll explain it at the other end!

The pertinent parts are at the top of the sketch – the following line sets the number of MAX7219s in the hardware:

The following can be adjusted to change the speed of text scrolling:

… then place the text to scroll in the following (for example):

Finally – to scroll the text on demand, use the following:

You can then incorporate the code into your own sketches. And a video of the example sketch in action:

Although we used the LedControl library, there are many others out there for scrolling text. One interesting example is Parola  – which is incredibly customisable.

Controlling LED numeric displays with the MAX7219

Using the MAX7219 and the LedControl library you can also drive numeric LED displays – up to eight digits from the one MAX7219. This gives you the ability to make various numeric displays that are clear to read and easy to control. When shopping around for numeric LED displays, make sure you have the common-cathode type.

Connecting numeric displays is quite simple, consider the following schematic which should appear familiar by now:

MAX7219 7-segment schematic

The schematic shows the connections for modules or groups of up to eight digits. Each digit’s A~F and dp (decimal point) anodes connect together to the MAX7219, and each digit’s cathode connects in order as well. The MAX7219 will display each digit in turn by using one cathode at a time. Of course if you want more than eight digits, connect another MAX7219 just as we did with the LED matrices previously.

The required code in the sketch is identical to the LED matrix code, however to display individual digits we use:

where A is the MAX7219 we’re using, B is the digit to use (from a possible 0 to 7), C is the digit to display (0~9… if you use 10~15 it will display A~F respectively) and D is false/true (digit on or off). You can also send basic characters such as a dash “-” with the following:

Now let’s put together an example of eight digits:

and the sketch in action:


We have only scratched the surface of what is possible with the MAX7219 and compatible parts. They’re loads of fun and quite useful as well. And finally a plug for our own store – – which along with being Australia’s #1 Adafruit distributor, also offers a growing range and Australia’s best value for supported hobbyist electronics from DFRobot, Freetronics, Seeedstudio and much much more.


Posted in arduino, as1107, COM-09622, LED matrix, lesson, max7219, part review, tronixlabs, tronixstuff, tutorial

Kit Review – Sinclair Cambridge Calculator


It’s no secret that I enjoy kit reviews – it’s always interesting to see how well a kit goes together, along with the quality of parts, documentation and so on. But what about kits from the past? And not 2003. Recently a very rare opportunity to purchase a sealed Sinclair Radionics Cambridge calculator kit appeared on ebay – so it was ordered rapidly and duly delivered to the office. And thus the subject of this review.

You may be familiar with the Sinclair name – Sir Clive Sinclair introduced many innovative and interesting products to the UK and world markets in his own style. Some were a raging success, such as the ZX-series home computers – and some were not. However in 1973 Sinclair introduced a range of calculators, starting with the “Cambridge”. It’s a simple four-function calculator with an LED numeric display and a somewhat dodgy reputation.

The design evolved rapidly and at the Mark III stage it was sold assembled and as a kit. At the time handheld calculators were quite expensive, so the opportunity to save money and get one in kit form would have been quite appealing to the enthusiast – in January 1974 the kit retailed in the UK for 24.95 (+ VAT):

Sinclair Cambridge Calculator Kit advertisement


Putting the Cambridge together required a balance of healthy paranoia, patience and woodworker mentality (measure twice – cut once). There wouldn’t be any second chances, or quick runs down to Altronics for a replacement part (well … there was one) so care needed to be taken. If you’re curious about the details, I’ve uploaded 82 full-resolution images from the build, including both instruction manuals and schematic onto flickr. Now to get started.

 The kit arrives in a neat, retail-orientated package:

Sinclair Cambridge Calculator Kit box

… with the components on one side of the foam:

Sinclair Cambridge Calculator Kit contents

… and the other side held he assembly guide (underneath which was a very short length of solder and the carrying case):

Sinclair Cambridge Calculator Kit guide

At this point I was starting to have doubts, and thought it would be better off in storage. But what fun would that be? So out with the knife and the shrink-wrap was gone, revealing the smell of 1974 electronics. Next to whip out the instructions and get started:

Sinclair Cambridge Calculator Kit instructions

They are incredibly detailed, and allow for two variations of enclosure and also offer tips on good construction – as well as the schematic, BOM and so on. Like any kit it’s wise to take stock of the components, which gave us the PCB:

Sinclair Cambridge calculator PCB

Sinclair Cambridge calculator PCB bottom

… the passives, diodes and transistor – and some solder wick:

Sinclair Cambridge Calculator Kit

At this point it turned out the all but one of the resistors were anywhere near the specified values in the instructions, and I wasn’t going to trust those electrolytic capacitors after 39 years. The replacement parts were in stock – including the original 1n914 diode that was missing from the kit. Thanks Clive. There was also a coil of unknown value:

Sinclair Cambridge Calculator Kit coil

… and the ICs, which included the brains of the operation – a General Instrument Microelectronics CZL-550:


… and an ITT 7105N:

ITT 7105N

… a bag of battery clips, buttons and adhesive-backed foam (which deteriorated nicely):

Sinclair Cambridge buttons battery cliips

At this point it was time to fire up the Hakko and start soldering, not before giving the PCB a good hit with the Servisol cleaner spray. I was worried about the tracks lifting while soldering due to heat and old-age, however the PCB held up quite well. The first step is to solder in the clips that hold (just) four AAA cells:

Sinclair Cambridge battery clips

… then the resistors and diodes:

Sinclair Cambridge calculator resistors

… followed by the transistor, ITT IC, ceramic capacitor and coil:

Sinclair Cambridge calculator assembly

Uh-oh – that ceramic went in the wrong hole. One leg was soldered where the coil was to sit. Without wanting to damage the PCB, de-soldering it was a slow, slow process. Then of course I didn’t have a ) 3.3nF in stock, so a quick spin to Altronics solved that problem (I bought 50) – one of which finally went in:

Sinclair Cambridge assembly

The transistor was also a bit of a puzzle, I hadn’t seen that enclosure type and the manual wasn’t much help, so the semiconductor analyser tester solved that problem:

transistor analysis

The next step was to fit the display, which is wedged in the large gap at the top of the PCB. The tracks on the PCB are supposed to meet the display, however time had affected the tracks on the display module, so I soldered small wire links across the gaps:

Sinclair Cambridge Display installation

Following the display were the two (new) electrolytics:

Sinclair Cambridge electrolytic capacitors

And now to the main IC. There wasn’t any second chances with this, and after some very gently pin-bending it dropped in nicely:

Sinclair Cambridge CZL550

After a short break it was time to assemble the keypad, which went smoothly. After cleaning all the foam dust off the buttons, they dropped in to their frame which in turn dropped into the enclosure, followed by the keypad layers:

Sinclair Cambridge keypad installation

You can also see in the display window and shroud have been fitted. From here the PCB is inserted:

Sinclair Cambridge assembly

… and a sticker from years gone by, as well as the metal clip over the bottom of the power switch. At this point a quick test with four AAA cells showed signs of life on the display, so the rear enclosure could be fitted:

Sinclair Cambridge Calculator

Now for the battery and final cover, and it’s ready to go!

Sinclair Cambridge Calculator

The digits are quite sharp, but very small – and set back from the window. This makes photography quite difficult. At the time if your calculator didn’t work, you could send it off to Sinclair and they’d repair or possibly replace it for you:

Sinclair Cambridge return form

Using the Cambridge

Well it works, so you have a calculator which is genuinely useful. However the Cambridge has a few quirks, which are attributed to the basic functions of the main IC. For example, when entering numbers the screen is filled with leading zeros until you select a function, however by using the manual you can complete complex work including square roots, percentages, loan repayments and much more.

Furthermore the Cambridge is quite the silent achiever, you can work with numbers as small as 1x10E-20 and up to 9.9999999E79. You simply enter the numbers in decimal form (e.g. 0.000000000123) … even though the display won’t show all the digits, they’re being stored in a register. To then extract the result, you continually multiply or divide by ten (making note of how many times you do that) until the digits appear on the screen. It sounds nuts today – but in 1974 it would have been a cheap way of avoiding a more expensive calculator. In the following video you can see th Cambridge in action, plus the results of dividing by zero:

More about Sinclair

The following video is a BBC dramatisation of the rise of the home computer in the UK market, and the competition between Sir Clive Sinclair (Sinclair) and Adam Curry (Acorn Computers) – which is quite entertaining:

You can find out more about the history of Sir Clive Sinclair here, and the calculator range here. If anyone can connect us with a Science of Cambridge MK14 computer, contact us.


From a 1974 perspective, that would have been a great kit to make, with some love and care it would have been successful. By today’s standards it was quite average – however you can’t really judge it from a 2013 perspective. Nevertheless, kudos to Sir Clive Sinclair for his efforts in knocking out a useful product as a kit. If you’re a collector, and see a sealed unit on ebay or elsewhere, give it a whirl. Just take your time, “think before doing”, and replace as many of the components as possible. I’ve put all the images in full resolution up on flickr, so you can follow along in more detail.

And while you’re here – are you interested in Arduino? Check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.


Posted in calculator, kit review, radionics, sinclair, tronixstuff, tutorial, vintage9 Comments

Review – Freetronics 128×128 Pixel Colour OLED Module


Time for another review, and in this instalment we have the new 128×128 Pixel OLED Module from Freetronics. It’s been a while since we’ve had a full-colour graphic display to experiment with, and this one doesn’t disappoint. Unlike other displays such as LCD, this one uses OLED – “Organic Light-Emitting Diode” technology.

OLEDs allow for a faster refresh rate, and to the naked eye has a great amount of colour contrast. Furthermore the viewing angles are excellent, you can clearly read the display from almost any angle, for example:

freetronics OLED display bottom view

freetronics OLED display side

However they can suffer from burn-in from extended display of the same thing so that does need to be taken into account. Nevertheless they provide an inexpensive and easy-to-use method of displaying colour text, graphics and even video from a variety of development boards. Finally – there is also a microSD socket for data logging, image storage or other uses. However back to the review unit. It arrives in typical retail packaging:

freetronics OLED display

and includes the OLED display itself, a nifty reusable parts tray/storage box, and two buttons. The display has a resolution of 128 x 128 pixels and has a square display area with a diagonal size of 38.1 mm. The unit itself is quite compact:

freetronics OLED display front


The display is easily mounted using the holes on the left and right-hand side of the display. The designers have also allowed space for an LED, current-limiting resistor and button on each side, for user input or gaming – perfect for the  included buttons. However this section of the PCB is also scored-off so you can remove them if required. Using the OLED isn’t difficult, and tutorials have been provided for both Arduino and Raspberry Pi users.

Using with Arduino

After installing the Arduino library, it’s a simple matter of running some jumper wires from the Arduino or compatible board to the display – explained in detail with the “Quickstart” guide. Normally I would would explain how to use the display myself, however in this instance a full guide has been published which explains how to display text of various colours, graphics, displaying images stored on a microSD card and more. Finally there’s some interesting demonstration sketches included with the library. For example, displaying large amounts of text:

… the variety of fonts available:

freetronics OLED font demonstration

… and for those interested in monitoring changing data types, a very neat ECG-style of sketch:

… and the mandatory rotating cube from a Freetronics forum member:

Using with Raspberry Pi

For users of this popular single-board computer, there’s a great tutorial and some example videos available on the Freetronics website for your consideration, such as the following video clip playback:


Along with the Arduino and Raspberry Pi tutorials, there’s also the Freetronics support forum where members have been experimenting with accelerated drivers, demonstrations and more.


For a chance to win your own OLED display, send a postcard with your email address clearly printed on the back to:

OLED Competition, PO Box 5435 Clayton 3168 Australia. 

Cards must be received by 24/10/2013. One card will then be selected at random and the winner will be sent one Freetronics OLED Display. Prize will be delivered by Australia Post standard air mail. We’re not responsible for customs or import duties, VAT, GST, import duty, postage delays, non-delivery or whatever walls your country puts up against receiving inbound mail.


Compared to previous colour LCD units used in the past, OLED technology is a great improvement – and demonstrated very well with this unit. Furthermore you get the whole package – anyone call sell you a display, however Freetronics also have the support, tutorials, drivers and backup missing from other retailers. So if you need a colour display, check it out.

And for more detail, full-sized images from this article can be found on flickr. And if you’re interested in learning more about Arduino, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

[Note – OLED display was a promotional consideration from Freetronics]

Posted in arduino, freetronics, LCD, OLED, product review, raspberry pi, review, tutorial0 Comments

First look – Arduino Yún


After being announced in May this year, the new Arduino Yún has arrived in the crowded marketplace – and I snapped up one of the first to arrive in Australia for an initial review. The purpose of which is to run through the out of box experience, and to see how easy it was to get the Yún working with the promised new features.

[Update – over time we’ll publish tutorials specifically for the Yún, which are listed here.]

The Yún introduces some interesting new combinations of hardware and connectivity, all within the familiar form-factor. Which gives us plenty to examine and write about, so let’s get started. First, a quick look around the Yún:

Arduino Yun Yún front

Notice the stickers on the header sockets, useful for beginners or the absent-minded…

Arduino Yún Yun right side

The usual TX/RX and D13 LEDs, plus notifiers for power, WiFi, LAN and USB use…

Arduino Yún Yun sockets

Ethernet, USB programming, USB host…

Arduino Yun Yún top side

Again with the stickers…

Arduino Yun Bottom Yún

The rear is quite busy. You can also see “Made in Taiwan” – a first for Arduino. I believe the reason for this was due to the new Atheros chipset requirements. Did you notice the multiple reset buttons? There are three – one for the Arduino, one for wifi and one to reboot Linino. As you can see there’s a lot of circuity on the bottom of the Yún, so it would be prudent to use some short standoffs to elevate the board and protect the bottom. Before moving on, you might like the following video where the Arduino team introduce the Yún:


The Yún is based around the Arduino Leonardo-specification board – thus you have the ATmega32U4 microcontroller and the usual Leonardo functions. Note you cannot feed wild DC voltages into the Vin pin – it must be a regulated 5V. And the DC socket has gone, so for a solid connection you might want to make or buy your own power shield.

However there is so much more… underneath a small metal shield below the digital I/O pins is an Atheros AR9331 CPU running a Linux distribution based on OpenWRT named Linino. This Atheros part of the board is connected to a microSD socket, 10/100 Ethernet port, a USB 2.0 socket for host-mode functions and also has IEEE 802.11b/g/n WiFi, and Power-over-Ethernet support (with an optional adaptor).

And all of that is connected to the Arduino side of things via a simple serial “bridge” connection (with it’s own library) – which gives the Arduino side of the board very simple methods of controlling the other onboard hardware.

Getting started with the Yún WiFi

First thing is to download and install the new IDE, version 1.5.4. This is for Due and Yún, so keep your older installations as well. On the general Arduino side of things nothing has changed, so we’ll move on to the more interesting side of the board. The first of these is to setup and experiment with the onboard WiFi. After connecting your board to USB for power, you can connect to it with your PC’s WiFi:

Arduino Yun Yún office wifi

… at which point you connect to the Yún network. Then visit from a web browser, and you’re presented with a page that asks for the default password, which is … “arduino”:

Arduino Yún Yun wifi setup

At which point you’re presented with the relevant details for your Yún:

Arduino Yún  Yun wifi details

… such as the IP address, MAC address, etc. Make note of your MAC address, you might need it later. From here you can configure the Yún WiFi details, for example the name and password, and also the details of your existing WiFi network which can be used to access the Yún. Once you save those, the Yún reboots and tells you to connect the PC back to the existing WiFi network:

Arduino Yun Yún WiFi setup complete

If for some reason it doesn’t work or you entered the wrong settings – hold down the “WLAN RST” button (next to the USB host socket) for five seconds. This sets the WiFi details in the Yun back to the default … and you can start all over again.

Note that the Yún’s preset IP of may not be suitable for your own network. For example, if your home router is you need to do some detective work to find out the IP address for the Yún. Head into your router’s administration pages and look for your DHCP Client Log. It will show a list of devices that are connected to the network, including their MAC and IP address – for example:

Arduino Yún Yun new IP address DHCPThen it’s a simple matter of finding the MAC address in the list and the matching IP. Once you have the IP address, enter that into a web browser and after being prompted for the Yún’s password, you’re back to the welcome page with the IP, MAC addresses etc.

WiFi Sketch Uploading

Once your Yún is on the same WiFi network as the PC running the IDE – you can upload a sketch over WiFi! This is possible due to the bridge between the Atheros section on the board and the Arduino hardware. Just select the board type as normal in the IDE, and the port (the IP address version):

Arduino Yun WiFi sketch upload  Yún

… then hit Upload as normal, enter the password:

Arduino Yun WiFi sketch upload  Yún

and you’re done. Awesome.

Console-based control of Arduino over WiFi

There’s a neat example that demonstrates how you can control the Arduino over the WiFi using a console terminal on the PC. Upload this sketch (from

Then load your terminal software. We use PuTTY on Windows. Run the terminal software, then login as root, then telnet to “localhost 6571”:

Arduino Yún  Yun terminal console putty

You can then send characters to the Yún just as you would with a USB-connected Arduino via the serial monitor. With the example above you’re turning the D13 LED on and off, but you can get the idea.

The “Internet of Things”

Arduino has teamed up with a service called “Temboo” – which gives you over 100 APIs that your Yún can hook up with to do a myriad of things, such as send tweets, get weather data from Yahoo, interact with Dropbox, etc. This is done easily and explained quite well at the Temboo website. After signing up for Temboo (one account seems to be free at the moment) we tried the Yahoo weather API.

You enter the parameters using an online form in Temboo (in our example, the address of the area whose weather forecast we required), and the Temboo site gives you the required Arduno sketch and header file to upload. And you’re done. With this particular example, I wanted the weather in Sydney CBD – and once running the data is returned to the serial monitor, for example:

Temboo Arduino Yun yahoo weather Yún

It was great to see that work the very first time, and a credit to Temboo and Arduino for making it happen. But how?

There is a Temboo client in the Linino OS, which is the gateway to the API via WiFi, and also communicates with the Arduino via the serial bridge. The Arduino Temboo library can then interact with the Linino client without complex code. The weather data is then returned back from the Internet via the Temboo client and fed to the Arduino serial port, where you can parse it with your own code. This looks like a lot of fun, and also could be quite useful – for example capturing data and sending it to a Google Docs spreadsheet. For more information, check out the Temboo website.

However you can delve deeper and create your own APIs, matching code – and perhaps other services will develop their own APIs in the near future. But for now, it’s a good start.

Where to from here? And support?

This article has only scratched the surface (but not bad considering the board arrived a few hours ago). There’s plenty more examples on the getting started page, in the IDE (under “Bridge”) – plus a dedicated Arduino Yún forum. And check out this gmail notifier. In the near future we’ll create some of our own tutorials, so stay tuned.

Is the Yún a completely open-source product? 

Well it says “open source electronics prototyping platform” on the rear, but is this true? The Arduino Leonardo-side of the board is. However the Atheros AR9331 chip is not. Nevertheless, are you really going to reproduce your own AR9331? So it doesn’t really matter. Being a pragmatist I propose that the Yún solves the problem of Arduino and Internet connectivity quite well for the non-advanced user – so not being totally OSHW isn’t an issue.


This board is very new to us here, so for questions or support please ask on the dedicated Arduino Yún forum.


Since the popularity of various single-board computers has increased exponentially over the last few months, some may say that the Yún is perhaps too little, too late. After only having the Yún for a few hours before writing this article, personally I disagree with this statement – the Yún is a device that still gives us the wide range of hardware control, and what looks to be a very simple method of connectivity that surely is cheaper and less prone to issues than the original Arduino WiFi shield.

What the Yún gives us is a simple, well-executed method of getting our Arduino connected to the outside world – and in a manner that won’t confuse or put off the beginner or intermediate user. So for now, it’s a win.

What do you think? Leave a comment below.

And for more detail, full-sized images from this article can be found on flickr. And if you’re interested in learning more about Arduino, or want to introduce someone else to the interesting world of Arduino – check out my book (now in a third printing!) “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in AR9331, Atheros, lesson, Linino, linux, review, temboo, tronixstuff, tutorial, Uncategorized, wifi, Yún8 Comments

Tutorial – LM3914 Dot/Bar Display Driver IC


This is the first of three tutorials that will examine the LM391x series of LED driver ICs. In this first tutorial we cover the LM3914, then the LM3915 and LM3916 will follow. The goal of these tutorials is to have you using the parts in a small amount of time and experiment with your driver ICs, from which point you can research further into their theory and application.

Although these parts have been around for many years, the LM3914 in particular is still quite popular. It offers a simple way to display a linear voltage level using one or more groups of ten LEDs with a minimum of fuss.

With a variety of external parts or circuitry these LEDs can then represent all sorts of data, or just blink for your amusement. We’ll run through a few example circuits that you can use in your own projects and hopefully give you some ideas for the future. Originally by National Semiconductor, the LM391X series is now handled by Texas Instruments.


Getting Started

You will need the LM3914 data sheet, so please download that and keep it as a reference. So – back to basics. The LM3914 controls ten LEDs. It controls the current through the LEDs with the use of only one resistor, and the LEDs can appear in a bar graph or single ‘dot’ when in use. The LM3914 contains a ten-stage voltage divider, each stage when reached will illuminate the matching LED (and those below it in level meter mode).

Let’s consider the most basic of examples (from page two of the data sheet) – a voltmeter with a range of 0~5V:

 LM3914 5V voltmeter circuit

The Vled rail is also connected to the supply voltage in our example. Pin 9 controls the bar/dot display mode – with it connected to pin 3 the LEDs will operate in bar graph mode, leave it open for dot mode. The 2.2uF capacitor is required only when “leads to the LED supply are 6″ or longer”. We’ve hooked up the circuit above, and created a 0~5V DC source via a 10kΩ potentiometer with a multimeter to show the voltage – in the following video you can see the results of this circuit in action, in both dot and bar graph mode:

Customising the upper range and LED current

Well that was exciting, however what if you want a different reference voltage? That is you want your display to have a range of 0~3 V DC? And how do you control the current flow through each LED? With maths and resistors. Consider the following formulae:

LM3914 formulae

As you can see the LED current (Iled) is simple, our example is 12.5/1210 which returned 10.3 mA – and in real life 12.7 mA (resistor tolerance is going to affect the value of the calculations).

Now to calculate a new Ref Out voltage – for example  we’ll shoot for a 3 V meter, and keep the same current for the LEDs. This requires solving for R2 in the equation above, which results with R2 = -R1 + 0.8R1V. Substituting the values – R2 = -1210 + 0.8 x 1210 x 3 gives a value of 1694Ω for R2. Not everyone will have the E48 resistor range, so try and get something as close as possible. We found a 1.8 kΩ for R2 and show the results in the following video:

You can of course have larger display range values, but a supply voltage of no more than 25 V will need to be equal to or greater than that value. E.g. if you want a 0~10 V display, the supply voltage must be >= 10V DC.

Creating custom ranges

Now we’ll look at how to create  a lower range limit, so you can have displays that (for example) can range from a non-zero positive value. For example, you want to display levels between 3 and 5V DC. From the previous section, you know how to set the upper limit, and setting the lower limit is simple – just apply the lower voltage to pin 4 (Rlo).

You can derive this using a resistor divider or other form of supply with a common GND. When creating such circuits, remember that the tolerance of the resistors used in the voltage dividers will have an affect on the accuracy. Some may wish to fit trimpots, which after alignment can be set permanently with a blob of glue.

Finally, for more reading on this topic – download and review the TI application note.

Chaining multiple LM3914s

Two or more LM3914s can be chained together to increase the number of LEDs used to display the levels over an expanded range. The circuitry is similar to using two independent units, except the REFout (pin 7) from the first LM3914 is fed to the REFlo (pin 4) of the second LM3914 – whose REFout is set as required for the upper range limit. Consider the following example schematic which gave a real-world range of 0~3.8V DC:


The 20~22kΩ resistor is required if you’re using dot mode (see “Dot mode carry” in page ten of the data sheet). Moving on, the circuit above results with the following:

Where to from here?

Now you can visually represent all sorts of low voltages for many purposes. There’s more example circuits and notes in the LM3914 data sheet, so have a read through and delve deeper into the operation of the LM3914. Furthermore Dave Jones from has made a great video whcih describes a practical application of the LM3914:


As always I hope you found this useful. Don’t forget to stay tuned for the second and third instalments using the LM3915 and LM3916. Full-sized images are on flickr. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in electronics, LED, LM3914, TI, tronixstuff, tutorial, voltmeter0 Comments

Kit Review – FriedCircuits LED Matrix Link


Time for another kit review, and in this instalment we’ve received some LED matrix modules and a matching Arduino-compatible controller board from Behind the name is William Garrido – who some of you may know as “mobile will” from following his blog. Over time William has created a range of small and useful products, which are now available on the tindie online store.

The system comprises of two modules. The first is a small Arduino-compatible board with an ATmega328P microcontroller – the LED matrix master. It’s quite small and is designed to be the start of a chain of matching LED matrix link boards. Each of these holds an 8×8 LED matrix and is controlled by the AS1107 LED driver IC. This is a direct replacement IC for the popular MAX7219, works exactly the same and is a great find instead of using knock-off MAX7219s. You can chain up to 8 matrix modules from the one controller. We received a matrix master and two matrix link boards to examine, which arrived in solid packaging a fun Tindie sticker:



All the surface-mount soldering is done in advance, leaving you with some simple through-hole soldering for the LED matrix and the connectors between each module. The PCBs are clearly labelled with the silk screen and have mounting holes for permanent installations:

friedcircuits master module

friedcircuits matrix module rear

So after a few minutes of soldering it’s time to get the blinking on:

friedcircuits matrix modules rear

You may have noticed by now that the master board doesn’t have  a USB socket, so you’ll need a 5V FTDI cable or a USBasp programmer to upload your Arduino sketches or AVR .hex file to get things moving.

Controlling a matrix or more

As the system is basically an Arduino-compatible with one or more MAX7219-compatible modules you can find all sorts of example sketches to experiment with. If you haven’t used a MAX7219/AS1107 before there are a couple of starting points including the Arduino library and another random tutorial. Using an example sketch on the Arduino forum by member “danigom“, and after checking the data, clock and load pins it was ready to go. Here’s the sketch for your consideration:

In the following video you can see the sketch in action with two and one matrix modules:

Where to from here? 

The matrix modules can find a wide range of uses, from simple fun and scrolling text to various LED matrix games, status displays and more. They also work well with the XOBXOB IoT USB-connected example. The design files are available for perusal on the friedcircuits github page. And don’t forget the matrix master board in itself is a tiny Arduino-compatible – with the full eight ADCs and digital I/O pins available. Thus you can embed this in another project if so desired.


The LED matrix modules are simple to use and work well together. Plus the matrix master board makes for a neat little Arduino-compatible as well. For more information and to order, visit the website. Full-sized images are on flickr. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

[Note – kits reviewed were a promotional consideration from friedcircuits]

Posted in arduino, as1107, kit review, LED matrix, max7219, tronixstuff, tutorial0 Comments

Using older Noritake Itron VFD modules


Now and again you come across interesting parts on ebay, from friends or just rooting around in second-hand stores. One example of this was a huge Noritake Itron 40 x 2 character vacuum-fluorescent display from 1994 (or earlier) which was passed on from a client. Originally it looked quite complex, however after spending some time the data sheets were found and it was discovered to have a simple serial interface – and with a little work we’ve got it working, so read on if you’re interested in classic VFDs or have a similar unit.

Getting Started

The model number for our display is CU40026SCPB-T20A. Here’s a quick walk-around, the front:

Noritake VFD

… the back:

Noritake VFD

… the interfaces:

Noritake VFD

… and configuration jumpers:

Noritake VFD

The serial interface baud rate is determined by the jumpers (above), for example:

VFD baud rate jumpersSo comparing the table above against the jumpers on our module gives us a data speed of 19200 bps with no parity. Great – we can easily create such a connection with a microcontroller with a serial output and 5V logic levels; for our examples we’ll use an Arduino-compatible board.

Wiring up the VFD is simple – see the white jumpers labelled CN2 as shown previously. Pin 1 is 5V (you need an external supply that can offer up to 700 mA), pin 2 to Arduino digital pin 7, and pin 3 to Arduino and power supply GND. We use Arduino D7 with software serial instead of TX so that the display doesn’t display garbage when a sketch is being uploaded. Then it’s a matter of simply sending text to the display, for example here’s a quick demonstration sketch:

… and the results:

noritake vfd demonstration

If you’re not keen on the colour or intensity of the display, try some Perspex over the top – for example:

Noritake VFD

Controlling the display

At this point you’ll need the data sheet, there’s a couple you can download: data sheet onedata sheet two. As you saw previously, writing text is very simple – just use .print functions. However you may want to send individual characters, as well as special commands to control aspects of the display. These are outlined in the data sheet – see the “Software Commands” and “Character Fonts” tables.

If you need to send single commands – for example “clear display” which is 0x0E, use a .write command, such as:

Some commands are in the format of escape codes (remember those?) so you need to send ESC then the following byte, for example to change the brightness to 50%:

Armed with that knowledge and the data sheets you can now execute all the commands. According to the data sheet it is possible to change fonts however no matter what the hardware jumper or command we tried it wouldn’t budge from the Japanese katakana font. Your screen may vary. If you use the “screen priority write” function heed the data sheet with respect to the extended “busy” time by delaying subsequent writes to the display by a millisecond.

 Putting it all together

Instead of explaining each and every possible command, I’ve put the common ones inside documented functions in the demonstration sketch below, which is followed by a quick video of the sketch in operation.



We hope you found this interesting and helpful. And if you have an inexpensive source for these old displays, let us know in the comments. Full-sized images are on flickr. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Posted in arduino, Itron, Noritake, tronixstuff, tutorial, VFD, vintage6 Comments

Build an Arduino-controlled Larson Scanner


For fun and a little bit of learning, let’s make a Larson Scanner. This isn’t a new project, for example we reviewed a kit in the past – however after finding some large LEDs we decided to make our own version. We’ll use an Arduino-compatible circuit to control the LEDs, and explain both the hardware and required Arduino sketch – then build a temporary small and a more permanent large version (and a bonus project).

So what is a Larson Scanner anyway? Named in honour of Glen A. Larson the creator of television shows such as Battlestar Galactica and Knight Rider – as this kit recreates the left and right blinking motion used in props from those television shows. For example:

Making your own is quite simple, it’s just eight LEDs or lamps blinking in a certain order. If you’re not familiar with the Arduino hardware, please have a quick review of this tutorial before continuing.

Small version

If you’re just interested in whipping up a solderless breadboard or small version, it will take less than fifteen minutes. Just get an Arduino Uno or compatible board and construct the following circuit (the resistors are 560Ω):

Arduino Larson Scanner

The sketch is also very simple. There are two ways to address those digital output pins, and to save sanity and clock cycles we’re going to use port manipulation instead of many digitalWrite() functions. So for our circuit above, enter and upload the following sketch: