t r o n i x s t u f f

fun and learning with electronics

Kit review – ogi lumen Nixie Tube system

Hello readers

Time to finish off the month with a fascinating kit review  - the ogi lumen nixie tube system. The younger readers amongst us may be thinking “what is a nixie tube?” Here is an example of four in a row:

If you cast your mind back to before the time of LCDs, and before LEDs… to the mid-1950s. Nixie tubes were used to display data in various forms on electrical devices, from test equipment, scales, elevator indicators, possible doomsday machines, clocks – anything that required visual output would be a candidate. Although nixie tubes are now totally out of date, as with many things there is a growing trend to use them again, for cool retro-style, nostalgia and those people who enjoy living in the past.

How nixie tubes work is quite simple, an element is within a vacuum tube full of gas, such as neon. When a high-voltage (~190 volts DC) current flows through the element, it glows. For more information, here is a great explanation. You will note that they are similar to in look but different in design to the vacuum-fluorescent displays, as used in the ice tube clock reviewed a few months ago.

The tubes used in this kit are the Soviet model IN-12A:

The IN-12A tube can display the digits zero to nine, with a nice orange glow.  For the uninitiated, sourcing and making nixie tubes can be quite difficult. Apart from procuring the tubes themselves, you need a suitable power supply and logic ICs that can handle the higher voltage to control the tubes. Thankfully Ogi Lumen have put together a system of kits to make using these nixie tubes simple and interesting.

There are three components to the system, the first being the power supply:

Note that the power supply is preassembled. This supply can generate the necessary 150 to 220 volts DC to energise our nixie tubes. Yes – up to 220 volts! For example:

However the current required is quite small – one power supply can handle up to twenty-four IN12A nixie tubes. My example in the photograph above is drawing 110~120 milliamps from a 12V DC supply. For those of you assembling these kits, please be careful. It can be easy to physically move the kit about whilst in operation, and touching the live HV pads will hurt a lot. After bumping the HV line on the PCB, my whole left arm went into a spasm and hurt for the time it took to see my doctor. So be careful.

The second item required is the driver kit. This is a board that takes care of the shift-registers and power for two of the nixie tubes. Driver kits can be slotted together to form a row of nixie tubes. The third and final item is the nixie duo kit. This contains two IN-12A tubes, matching sockets and a PCB to muont them. This PCB then slots into the driver kit PCB. You can buy the driver and duo kit as a set for a discount.

From a hardware perspective, assembling the kits is relatively simple. There isn’t any tricky soldering or SMD to worry about, however you will need a lot of solder. The contents of the duo and driver kits are as follows:

Before you start soldering, please download and take note of the instructional .pdf files available for the duo and driver board kits. Assembling the driver kit (on the right) is very straight forward. However – please read the instructions! An interesting part of note is the K155ИД1IC:

This is the Russian equivalent of the 74141. This is a BCD-decimal decoder IC that can handle the high voltages required for nixie tubes. When soldering the resistors, take care with R2 – it will need to be positioned horizontally so as to not rub against the duo board:

When it is time to assemble the duo board, you will need time and patience. At a first glance, one would imagine that the sockets drop into the PCB, and the nixie tubes will happily be seated into the sockets. This is not so, don’t solder in the sockets first! The pins on the bottom of the socket also form part of the socket for the tube legs – which can alter the positioning of the socket legs. Make sure you have the socket with pin 1 at the top of the PCB. After some trial and error, the best way to insert the tubes is to first partially place the sockets into the PCB:

… then fully insert the tubes into their sockets. Make sure the tube is the right way up – check that the digit 3 in the tube is the right way up. Then push the whole lot into the PCB. At this point you should check to make sure the sockets are in line with each other:

(Notice how thick the PCB is…) At which point you can solder them in, followed by the row of connector pins:

By this stage you will need some fresh air from all that soldering. The PCB holes for the socket pins really take a lot. Now you can connect the power supply to the driver board and give the tubes a test-toast:

All the tubes should have their elements glowing. This is a good start. The next step is to connect the appropriate microcontroller and start displaying. As noted in the instructions, the 74141 BCD-decimal ICs are controlled by standard 74HC595 shift-register ICs, so your microcontroller needs to send out a data, clock and latch line. My following examples have been created using the Ardiuno system and a compatible board.

The first example is a method of displaying integers. It uses the Nixie library which you can download here. Download the example .pde from here.

/* Nixie tube demonstration code - function to display an integer
http://tronixstuff.com - John Boxall. February 2011.
Modifed sketch originally created by Lionel Haims, July 25, 2008. Released into the public domain. */
// include the library
#include <Nixie.h>
// note the digital pins of the arduino that are connected to the nixie driver
#define dataPin 2  // data line or SER
#define clockPin 3 // clock pin or SCK
#define latchPin 4 // latch pin or RCK
// note the number of digits (nixie tubes) you have (buy more, you need more!)
#define numDigits 4
int narray[numDigits]; // holds the digits to display
int z=0;
// Create the Nixie object
// pass in the pin numbers in the correct order
Nixie nixie(dataPin, clockPin, latchPin);
void setup()
{
nixie.clear(numDigits); // clear display
}
void nixNum(int z)
// displays integer 'z' on 4-digit nixie display
// keeps leading zero, as blank still flickers somewhat
{
narray[0]=int(z/1000); // thousands value
z=z-(narray[0]*1000);
narray[1]=int(z/100); // hundreds value
z=z-(narray[1]*100);
narray[2]=int(z/10); // tens value
narray[3]=z-(narray[2]*10); // ones value
nixie.writeArray( narray, numDigits);
}
void loop()
{
nixNum(1234);
delay(2000);
for (int q=1234; q<10000; q++)
{
nixNum(q);
delay(100);
}
}

That was just an arbitrary demonstration to get some numbers displayed. Here is a short video clip of it in action:

Now for another, more useful example. By using a DS1307 real-time clock IC with the Arduino, we can make a nice clock that displays the time and date. For more information on using the DS1307 with Arduino, please visit this tutorial. You can download the example nixie clock .pde file from here. And finally, here is the clock in action:

The problem with these tubes is that you will never have enough. Already I have thought of a few things to make that require a lot more tubes, so in the next month or so stay tuned to tronixstuff.com as there will be more projects with these kits.

In conclusion, this was a great kit and anyone looking to use some numerical nixie tubes will do very well with the Ogi Lumen products. Furthermore the designs are released under Creative Commons by-sa-nc, and the files are available to download from the product pages. And finally, it is a lot of fun – people will generally ask you about the tubes as they may have never seen them before.

Remember, if you have any questions about these modules please contact Ogi Lumen via their website. Higher resolution images available on flickr.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our 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 - the kit assembled in this article was received from Ogi Lumen for review purposes]

February 27, 2011 Posted by | kit review, learning electronics, arduino, nixie | , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 6 Comments

Various 555 Timer circuits

Hello readers

The purpose of this article is to follow on from our explanation of the 555 timer IC by demonstrating some simple yet interesting, noisy and plain annoying uses of the 555. They are by no means that complex, and intended to help move theory into practice.

Button de-bouncer

De-bouncer? How does one bounce a button in the first place? Many years ago I bounced a button on the arcade Sonic the Hedgehog – hit it so hard it popped out and bounced over the table… But seriously, when working with digital logic circuits, you may need to use  a momentary button to accept user input. For example, to pulse a trigger or so on. However with some buttons, they are not all that they seem to be. You press them once, but they can register multiple contacts – i.e. register two or more ‘presses’ for what seems like only one press. This could possibly cause trouble, so we can use a 555 timer monostable circuit to solver the problem. In our de-bounce example, when the button is pressed, the output is kept at high for around half a second. Here is the schematic:

What we have is a basic monostable timer circuit. For my example the output delay (t) is to be half a second. The formula for t is: t=1.1xR1xC1. The closest resistor I had at hand was 2k ohms, so to find the required value for C1, the formula is rearranged into: C1=t/(1.1xR1). Substituting the values for t and R1 gives a value of C1 as 227.274 uF. So for C1 we have used a 220 uF capacitor.

Now for a visual demonstration of the de-bouncer at work. In the following video clip, the oscilloscope is displaying the button level on the lower channel, and the output level on the upper channel. The button level when open is high, as the 555 requires a low pulse to activate. The output level is normally low. You can see when the button is pressed that the button level momentarily drops to low, and then the output level goes high for around half a second:

Make some noise

As we know the 555 can oscillate at frequencies from less than 1Hz to around 500 kHz. The human ear can theoretically hear sounds between (approximately) 20 and 20 kHz. So if we create an astable timing circuit with an output frequency that falls within the range of the human ear, and connect that output to a small speaker – a range of tones can be emitted.

The circuit required is a standard 555 astable, with the output signal heading through a small 8 ohm 0.25 watt speaker and a 4.7 uF electrolytic capacitor to ground. The capacitor stops any DC current flowing to ground, without this we will overload the current-handling ability of the 555. (I couldn’t help myself by trying it without the capacitor – pulled 550 mA from the 555 before it stopped working…). To choose the values of R1 and C1 to emit out required frequency, the following formula is used: f (frequency) = 1.4 / {(R1 + [2 x R2]) x C1}. To cover the range required, a 100k ohm trimpot was used for R1. Here is the resulting schematic:

The input voltage can fall within the specification of the 555, however for optimum results a supply of between 5 and 9 volts DC should be used. In the following demonstration, we used a 9V supply. The purpose of the video is to learn the relationship between the tones and their frequencies. You can see the frequency on my old counter and hopefully hear the result:

Our next example is to create a  siren effect, using two 555 circuits – one for a low frequency and one for a high frequency. To determine the value for R1 for the low and high frequency, I used the previous circuit and chose two tones that were quite different, and measured the resistance of the trimpot (R1) at those frequencies. My R1 value for the ‘low’ tone is 82k ohm and 36k ohm for the ‘high’ frequency.

The switching between low and high frequency will be handled by a 4047 multivibrator – the Q and Q outputs will control NPN transistors. The transistors are used as switches to allow current to flow from the supply to the 555 high or low tone circuit. We use this method as the 4047 is not able to source enough current to drive the 555 circuits. Here is the schematic:

Don’t forget to connect pin 14 of the 4047 to supply voltage. This circuit has been tested with a supply voltage between 5 and 12 volts. As the supply voltage increases, so does the amplitude of the square wave emanating from the 555 output pins, which in turn in creases the volume of the siren. At 5 volts, the entire circuit drew only 20 milliamps. Speaking of which, you can listen to a recording of the output here. If you wish to alter the time for each tone, adjust the value of what is the 47k ohm resistor on pins 2 and 3 of the 4047.

In the meanwhile have fun and keep checking into tronixstuff.com. 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.

February 23, 2011 Posted by | 555, arduino, COM-09273, education, learning electronics | , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a Comment

Tutorial: Arduino and TFT LCD

Learn how to use the 4D Systems 1.44″ TFT serial interface LCD with Arduino in chapter twenty-nine of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

If you’re looking for an inexpensive and simple TFT LCD to use with Arduino, visit the new tutorial.

Update 20/04/2013 

The Arduino library for this module hasn’t been updated to work with Arduino v1.0.1+ – so you need to use Arduino IDE v22 or v23. And the module itself has been discontinued. For the time being I’m leaving the tutorial here until a more suitable item can be used. We can’t help you with the 4D module

Nevertheless – if you have one – here’s the subject of the tutorial- the 4D Systems 1.44″ TFT serial interface LCD:

The LCD is an LED-backlit thin-film transistor type, resolution is 128 x 128 pixels, with an RGB colour range of 65536.

As an aside, this is a very powerful piece of hardware. The module not only contains a 1.44″ square TFT LCD, there is also a dedicated graphics processor and a microSD card interface. One can program the display processor in the same manner as another microcontroller platform for incredibly interesting results. For more information, please visit here.

However in the spirit of keeping things simple, this article will focus on driving the LCD directly using our Arduino or compatible boards. There are two firmware versions of this module – the GFX and the SGC. We need to have the SGC firmware, as this allows control via the serial TX/RX pins from our Arduno board. If you have purchased the SGC module, you’re ready to go. Scroll down until you see “And we’re back…”. However if you have the GFX version, please read the following instructions on how to change your LCD’s firmware from GFX to SGC…

Changing the firmware from GFX to SGC

  • At the moment this process only seems available to users of Microsoft Windows. All complaints to 4D Systems.
  • Unfortunately this process may not work with an Arduino Mega board.
  • First of all, remove the ATmega328 from your Arduino board. Please be careful, use a chip puller if possible. We are going to use the board as a simple serial-USB converter;
  • Insert your LCD module into a solderless breadboard;
  • Connect Arduino pin 0 (RX) to display pin 7 (RX); connect Arduino pin 1 (TX) to display pin 8 (TX). [Yes - TX>TX, RX>RX];
  • Connect Arduino 5V to display pin 9; connect Arduino GND to display pin 6; your LCD should display the following:

  • Visit here, download and open the PmmC Loader application; visit here and download the .pmmc file to your local drive;
  • Connect your Arduino board via USB to the computer; then run the PmmC loader application;
  • Select the appropriate COM: port, load in the .pmmc file, then click Load. The firmware update should take less than sixty seconds;
  • When finished, you will be presented with the following on the computer:

… and the following on your LCD:

  • At this point unplug the USB lead from your Arduino board and all leads into the Arduino board;
  • Re-insert the ATmega328 back into your Arduino board;
  • Reconnect the wires from the LCD module to the Arduino, but this time connect Arduino TX to LCD RX; and LCD TX to Arduino RX.
  • Now you have  the serial-interface SGC firmware model LCD.

And we’re back…

To control this LCD, it requires commands to be sent via Serial.write(), and such commands are in the form of hexadecimal numbers. (You see something new every day). You can download the reference book with all the commands: SGC Commands.pdf and bypass the library by directly writing the hexadecimal numbers directly to the module.

However, to get up to speed as fast as possible we can use a library with more of the popular functions included. Kudos and thanks to Oscar Gonzalez for writing a very useful library. Download the library from here and install into your ../Arduino-002x/libraries folder, then re-start the Arduino IDE if you had it running. You may be wondering why the library is named displayshield4d - the LCD manufacturer sells this LCD on an Arduino shield. Although that would be great for experimenting, one would need to purchase another standalone LCD if their project moved forward – myself included. So that’s why we’re using the bare LCD board.

To connect the LCD to our Arduino is very simple:

  • LCD pin 5 to Arduino RST;
  • LCD pin 6 to Arduino GND;
  • LCD pin 7 to Arduino D1;
  • LCD pin 8 to Arduino D0;
  • LCD pin 9 to Arduino 5V.

In the following examples we will demonstrate the various functions available in the library. As this is chapter 29, I will no longer explain the more basic functions or ideas that you should know by now, instead relying on comments within the sketch if it feels necessary. It can take a short moment for the LCD controller to process, so always put a short delay between functions.

When uploading a sketch to your Arduino you may need to disconnect the LCD from Arduino D0/D1 as it can interfere with the serial process.

Firstly we will demonstrate text display. Initialising the display requires a few functions:

#include <displayshield4d.h> // include the LCD library
DisplayShield4d  lcd;

The second line creates an instance of lcd to be used with the relevant functions. Next, within void setup():

Serial.begin(115200);  // LCD speed is very high
lcd.Init(); // wake up LCD
lcd.Clear(); // clear the LCD, set background to black

To write text to the LCD, the following function is required:

lcd.setfontmode(OLED_FONT_TRANSPARENT);  // set font background type

This line sets the font transparency. If we use the parameter OLED_FONT_TRANSPARENT the unused pixels in the character area will be transparent and continue to show what they were set to before the text was over-written with. You can also use OLED_FONT_OPAQUE, which blocks the item displayed “behind” the text.

Whenever a function requires a colour parameter, we use:

lcd.RGB(x,y,z);

where x, y and z are numerical values (between 0 and 255) for the red, green and blue components of the required colour. If you need an RGB numerical reference, download this handy chart. Finally, to display some text we use the following:

lcd.drawstringblock(a, b, c, lcd.RGB(255, 255, 255), d, e, "Hello, world");

The parameters required are:

  • a – the x-position of the first character. E.g. if this was a zero, the top-left pixel of the first character would be on the left-most pixel column of the LCD;
  • b – the y-position of the first character. e.g. if both a and b were zero, the text would start from the top-left of the LCD;
  • c – numerical code for the font to use: 1 is for 5×7 pixel characters, 2 for 8×8 and 3 for 8×12;
  • the three values within the lcd.RGB() function determine the colour of the text;
  • d – x-axis resolution multiplier. E.g. if you double this and use the 5×7 font, the characters will be double-width;
  • e – y-axis resolution multiplier.

Now let’s see this in action with the following sketch:

Example 29.1

/*  Example 29.1 - uLCD-144 text demonstration
http://tronixstuff.com/tutorials > chapter 29  CC by-sa-nc  */
#include <displayshield4d.h> // necessary library
DisplayShield4d  lcd; // create an instance of the LCD
void setup()
{
Serial.begin(115200);  // LCD speed is very high
lcd.Init(); // wake up LCD
delay(20);
}
void loop()
{
lcd.Clear(); // clear LCD
delay(20);
lcd.setfontmode(OLED_FONT_TRANSPARENT);  // set font background type
delay(20);
for (int a=0; a<128; a+=8)
{
lcd.drawstringblock(0, a, 2 , lcd.RGB(255, 0, 0), 1, 1, "visit me");
delay(20);
}
delay(2000);
lcd.Clear();
for (int a=0; a<128; a+=16)
{
lcd.drawstringblock(0, a, 0, lcd.RGB(0, 255, 0), 2, 2, "0123456789");
delay(20);
}
delay(2000);
lcd.Clear();
delay(20);
for (int a=0; a<128; a+=32)
{
lcd.drawstringblock(0, a, 0, lcd.RGB(0, 0, 255), 4, 4, "Great");
delay(20);
}
delay(2000);
}

And a short video clip of the example in action:

As you can see the display update speed is much better than the LCD from the previous chapter. Although this example was short, don’t be afraid to try out your own parameters in the example sketch.

Next we will demonstrate the various graphics functions in the library. Creating graphics isn’t rocket science, it just takes some imagination (something I admit to lacking) and following the parameters for each function. Our first is

lcd.putpixel(x,y,lcd.RGB(r,g,b));

which places a pixel on the screen at location x,y of colour described using lcd.RGB(). Next we have

lcd.line(x1,y1,x2,y2,lcd.RGB(r,g,b));

which draws a line from x1, y1 to x2, y2 of colour rgb. One can also create rectangles and so on using

lcd.rectangle(x,y,l,h,z,lcd.RGB(r,g,b));

This will create a rectangle with the top-left point at x,y; width is l pixels, height is h pixels, and a new parameter z. If z is 0, the function will draw a solid shape, if z is 1, it will display only a wire-frame rectangle with a pixel width of one. Circles are created using

lcd.circle(x,y,r,z,lcd.RGB(r,g,b);

where x and y are the coordinates for the centre of the circle, r is the radius, and z is the solid/wireframe parameter. And finally – triangles:

lcd.triangle(x1,y1,x2,y2,x3,y3,z,lcd.RGB(r,g,b));

This will draw a triangle with the corners at the coordinate parameters; z again is the solid/wireframe parameter. However you need to order the corners in an anti-clockwise order. This will become evident in the example sketch below.

Example 29.2

In this example we run through the graphical functions described above. By following through the sketch you should gain an idea of how the graphical functions are used, in order to create your own displays.

/*  Example 29.2 - uLCD-144 graphic library demonstration
http://tronixstuff.com/tutorials > chapter 29  CC by-sa-nc  */
int a,b,c,d,e=0;
#include <displayshield4d.h> // necessary library
DisplayShield4d  lcd; // create an instance of the LCDvoid
setup()
{
randomSeed(analogRead(0));
Serial.begin(115200);  // LCD speed is very high
lcd.Init(); // wake up LCD
delay(50);
}
void loop()
{
lcd.Clear();
delay(50);
for (int z=0; z<2500; z++)
{
a=random(127);
b=random(127);
c=random(255);
d=random(255);
e=random(255);
lcd.putpixel(a,b,lcd.RGB(c,d,e));
delay(50);
}
delay(1000);
lcd.Clear();
delay(50);
for (int z=0; z<64; z++)
{
lcd.line(0,0,127,z*2,lcd.RGB(0,255,0));
delay(50);
}
for (int z=0; z<64; z++)
{
lcd.line(0,0,z*2,127,lcd.RGB(0,0,255));
delay(50);
}
delay(1000);
lcd.Clear();
delay(50);
for (int z=0; z<15; z++)
{
lcd.rectangle(z*10, z*10, 20, 20, 1, lcd.RGB(255,0,0));
delay(250);
lcd.rectangle(z*10, z*10, 20, 20, 0, lcd.RGB(0,0,255));
delay(250);
lcd.rectangle(z*10, z*10, 20, 20, 0, lcd.RGB(0,0,0));
delay(250);
}
delay(1000);
lcd.Clear();
delay(50);
for (int z=0; z<14; z++)
{
lcd.circle(63,63,z*3, 1, lcd.RGB(0,0,255));
delay(250);
lcd.circle(63,63,z*3, 0, lcd.RGB(0,255,0));
delay(250);
lcd.circle(63,63,z*3, 0, lcd.RGB(0,0,0));
delay(250);
}
delay(1000);
lcd.Clear();
delay(50);
for (int z=10; z>-0; --z)
{
lcd.triangle(127,127,64,z*10,0,127,1,lcd.RGB(0,255,0));
delay(250);
lcd.triangle(127,127,64,z*10,0,127,0,lcd.RGB(0,0,255));
delay(250);
lcd.triangle(127,127,64,z*10,0,127,0,lcd.RGB(0,0,0));
delay(250);
}
}

And here is the video of example 29.2 in action … brought to you by Mr Blurrycam:

So there you have it, another useful part and a very nice colour LCD to make use of.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our 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.

February 18, 2011 Posted by | arduino, education, LCD, learning electronics, microcontrollers | , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a Comment

The world’s smallest oscilloscope??

Hello readers

[Update 14/01/2013 - Now available locally in Australia]

Today we examine a tiny and fascinating piece of test equipment from Gabotronics – their XMEGA Xprotolab. Sure, that sounds like a lot – and it is. Yet the functionality of the Xprotolab is inversely proportional to its physical size. Try to imagine having an oscilloscope, arbitrary waveform generator, logic analyser and a spectrum analyser – including a display – in a package no larger than 25.4 x 40.6 mm (1″ x 1.6″) in size. Well imagine no more as here it is:

As described above, this tiny marvel of engineering has the following functions:

  • Two analogue oscilloscope channels with a maximum sampling rate of 2 million samples per second;
  • Analogue bandwidth of 320 kHz at 8-bits resolution;
  • Buffer size of 256 samples;
  • Fast fourier-transform;
  • Analog and external digital triggering;
  • Maximum input voltage of +/- 10V;
  • Automatic average and peak-to-peak measurements;
  • Logic analyser with eight channel maximum simultaneous monitoring;
  • Firmware is user upgradable;
  • Can also be used as a development board for the XMEGA microcontroller (extra items required);
  • When powered from a USB cable, the board can supply +/-5V and +3.3V into a solderless breadboard.

The OLED screen is very clear and precise, which considering the size of 0.96″ – very easy to read. One can also set the display mode to invert which changes the display to black on white, bringing back memories of the original Apple Macintosh:

Using the Xprotolab took a little getting used to, however after pressing menu buttons for a few minutes I had it worked out. The more sensible among you will no doubt read the instructions and menu map listed at the website. Having the dual voltmeter function is quite useful, it saved me having to mess about with a couple of multimeters when trying to debug some analogue circuits I’m currently working with.

The display can be as complex or as simple as you choose, for example when working with the oscilloscope you can disable one channel and shift the waveform so it occupies the centre of the screen. Or when working with the logic analyser, you can choose to only select the channels being monitored, instead of filling the screen with unused logic lines.

There are a couple of things to take care with. When inserting the Xprotolab into your breadboard, be careful not to put pressure on the OLED display when pushing down; when removing it from the breadboard, try and do so evenly with the help of an DIP IC puller.

Generally in my reviews there is a video clip of something happening. Unfortunately my camera just isn’t that good, so below is the demonstration clip from the manufacturer:

As you can see the Xprotolab would be quite useful for monitoring various signals whilst prototyping, as you can just drop it into a breadboard. Furthermore, if your required range is measurable the Xprotolab saves you having to look back-and-forth between a prototype and the display from a regular oscilloscope as well.

As the purchase price is relatively cheap compared against the time and effort of trying to make an OLED display board yourself, one could also plan to build an Xprotolab into a final design – considering a lot of measurement and display work is already done for you it could be a real time-saver. The Xprotolab can run from a 5V supply and only draws a maximum of 60 milliamps. Product support is quite extensive, including source code, schematics, videos, a user forum and more available from the product page.

In conclusion the Xprotolab is genuinely useful, inexpensive and ready to use out of the box. It would make a useful piece of test equipment for a beginner or seasoned professional, and also integrates well into custom projects when required.

Remember, if you have any questions about the Xprotolab,  please contact Gabotronics via their website.

Otherwise, have fun, stay safe, be good to each other – and make something! :)

[Note - the Xprotolab reviewed in this article was received from Gabotronics for review purposes]

February 13, 2011 Posted by | oscilloscope, part review, review, xmega, xprotolab | , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 9 Comments

Review – CD4047 Astable/Monostable Multivibrator

Hello readers!

Today we are going to examine an older but still highly useful integrated circuit – the 4047 Astable/Monostable multivibrator:

My reason for doing this is to demonstrate another way to create a square-wave output for digital circuits (astable mode) and also generate single pulses (monostable mode). Sometimes one can get carried away with using a microcontroller by default – and forget that there often can be simpler and much cheaper ways of doing things. And finally, the two can often work together to solve a problem.

What is a multivibrator? In electronics terms this means more than one vibrator. It creates an electrical signal that changes state on a regular basis (astable) or on demand (monostable). You may recall creating monostable and astable timers using the 555 timer described in an earlier article. One of the benefits of the 4047 is being able to do so as well, but with fewer external components. Here is the pinout diagram for a 4047 (from the Fairchild data sheet):

Note that there are three outputs, Q, Q and OSC out. Q is the normal output, Q is the inverse of Q – that is if Q is high, Q is low – at the same frequency. OSC output provides a signal that is very close to twice the frequency of Q. We will consider the other pins as we go along. In the following small video, we have LEDs connected to all three outputs – you can see how Q and Q alternate, and the increased frequency of OSC out:

That was an example of the astable mode.  The circuit used is shown below. The only drawback of using a 4047 is that you cannot alter the duty cycle of your astable output – it will always be 50% high and 50% low. The oscillator output is not guaranteed to have a 50% duty cycle, but comes close. The time period (and therefore the frequency) is determined by two components – R1 and the capacitor:

[Quick update - in the schematic below, also connect 4047 pin 14 to +5V]

The values for R2~R4 are 560 ohms, for the LEDs. R1 and the capacitor form an RC circuit, which controls the oscillation frequency. How can we calculate the frequency? The data sheet tells us that time (period of time the oscillator is ‘high’) is equal to 4.4 multiplied by the value of R1 and the capacitor. As the duty cycle is always 50%, we double this value, then divide the result into one. In other words:

And as the frequency from the OSC out pin is twice that of Q or Q, the formula for the OSC out frequency is:

However the most useful formula would allow you to work with the values of R and C to use for a desired frequency f:

When calculating your values, remember that you need to work with whole units, such as Farads and Ohms- not microfarads, mega-ohms, etc. This chart of SI prefixes may be useful for conversions.

The only thing to take note of is the tolerance of your resistor and capacitor. If you require a certain, exact frequency try to use some low-tolerance capacitors, or replace the resistor with a trimpot of a value just over your required resistor value. Then you can make adjustments and measure the result with a frequency counter. For example, when using a value of 0.1uF for C and 15 k ohm for R, the theoretical frequency is 151.51 Hz; however in practice this resulted with a frequency of 144.78 Hz.

Don’t forget that the duty cycle is not guaranteed to be 50% from the OSC out pin. This is shown in the following demonstration video. We measure the frequency from all three output pins, then measure the duty cycle from the same pins:

(The auto-ranging on that multimeter is somewhat annoying).

Now for some more more explanation about the 4047. You can activate the oscillations in two ways, via a high signal into pin 5 (pin 4 must then be low) or via a low signal into pin 4 (and pin 5 must be low). Setting pin 9 high will reset the oscillator, so Q is low and Q is high.

The monostable mode is also simple to create and activate. I have not made a video clip of monstable operation, as this would only comprise of staring at an LED. However, here is an example circuit with two buttons added, one to trigger the pulse (or start it), and another to reset the timer (cancel any pulse and start again):

[Quick update - in the schematic below, also connect 4047 pin 14 to +5V]

The following formula is used to calculate the duration of the pulse time:

Where time is in seconds, R is Ohms, and C is Farads. Once again, the OSC output pin also has a modified output – it’s time period will be 1.2RC.

To conclude, the 4047 offers a simple and cheap way to generate a 50% duty cycle  square wave or use as a monostable timer. The cost is low and the part is easy to source. As always, avoid the risk of counterfeit ICs and get yours from a reputable distributor. Living in Australia, mine came from element-14. Thanks to Fairchild Semiconductor for product information from their 4047 data sheet.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our 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.

February 11, 2011 Posted by | education, learning electronics, part review | , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 40 Comments

Tutorial: Arduino and Colour LCD

Learn how to use the colour LCD shield from Sparkfun in chapter twenty-eight of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Updated 19/02/2013

Although there are many colour LCDs on the market, I’ve chosen a relatively simple and popular model to examine in this tutorial – the Sparkfun Color LCD shield:

If you buy one note (shown above) that stacking headers aren’t supplied or fitted to the shield. If you get a header pack from Sparkfun or elsewhere – order PRT-10007 not PRT-11417 as the LCD shield doesn’t have the extra holes for R3 Arduino boards. However if you do have an Arduino R3 – relax … the shield works. While we’re on the subject of pins - this shield uses D3~D5 for the three buttons, and D8, 9, 11 and 13 for the LCD interface. The shield takes 5V and doesn’t require any external power for the backlight. The LCD unit is 128 x 128 pixels, with nine defined colours (red, green, blue, cyan, magenta, yellow, brown, orange, pink) as well as black and white.

So let’s get started. From a software perspective, the first thing to do is download and install the library for the LCD shield. Visit the library page here. Then download the .zip file, extract and copy the resulting folder into your ..\arduino-1.0.x\libraries folder. Then restart the Arduino IDE if it was already open.

At this point let’s check the shield is working before moving forward. Fit it to your Arduino – making sure the shield doesn’t make contact with the USB socket**. Then open the Arduino IDE and upload the TestPattern sketch found in the Examples folder. You should be presented with a nice test pattern as such:

It’s difficult to photograph the LCD – (some of them have very bright backlights), so the image may not be a true reflection of reality. Nevertheless this shield is easy to use and we will prove this in the following examples.

At the start of every sketch, you will need the following lines:

#include "ColorLCDShield.h"
LCDShield lcd;

as well as the following in void setup():

lcd.init(PHILIPS); 
lcd.contrast(63); // sets LCD contrast (value between 0~63)

With regards to lcd.init(), try it first without a parameter. If the screen doesn’t work, try PHILIPS or EPSON instead. There are two versions of the LCD shield floating about each with a different controller chip. The contrast parameter is subjective, however 63 looks good – but test for yourself. Now let’s move on to examine each function with a small example, then use the LCD shield in more complex applications.

The LCD can display 8 rows of 16 characters of text. The function to display text is:

lcd.setStr("text", y,x, foreground colour, background colour);

where x and y are the coordinates of the top left pixel of the first character in the string. Another necessary function is:

lcd.clear(colour);

Which clears the screen and sets the background colour to the parameter colour.  Please note – when referring to the X- and Y-axis in this article, they are relative to the LCD in the position shown below.

Now for an example – to recreate the following display:

… use the following sketch:

// Example 28.1
#include "ColorLCDShield.h"
LCDShield lcd;
void setup()
{
 // following two required for LCD
 lcd.init(PHILIPS); 
 lcd.contrast(63); // sets LCD contrast (value between 0~63)
}
void loop()
{
 lcd.clear(BLACK);
 lcd.setStr("ABCDefghiJKLMNOP", 0,2, WHITE, BLACK);
 lcd.setStr("0123456789012345", 15,2, WHITE, BLACK);
 lcd.setStr("ABCDefghiJKLMNOP", 30,2, WHITE, BLACK);
 lcd.setStr("0123456789012345", 45,2, WHITE, BLACK);
 lcd.setStr("ABCDefghiJKLMNOP", 60,2, WHITE, BLACK);
 lcd.setStr("0123456789012345", 75,2, WHITE, BLACK);
 lcd.setStr("ABCDefghiJKLMNOP", 90,2, WHITE, BLACK);
 lcd.setStr("0123456789012345", 105,2, WHITE, BLACK);
 do {} while (1>0);
}

In example 28.1 we used the function lcd.clear(), which unsurprisingly cleared the screen and set the background a certain colour. Let’s have a look at the various background colours in the following example. The lcd.clear()  function is helpful as it can set the entire screen area to a particular colour. As mentioned earlier, there are the predefined colours red, green, blue, cyan, magenta, yellow, brown, orange, pink, as well as black and white. Here they are in the following example (download):

// Example 28.2
int del = 1000;
#include "ColorLCDShield.h"
LCDShield lcd; void setup() { // following two required for LCD lcd.init(PHILIPS); lcd.contrast(63); // sets LCD contrast (value between 0~63) }
void loop()
{
 lcd.clear(WHITE);
 lcd.setStr("White", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(BLACK);
 lcd.setStr("Black", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(YELLOW);
 lcd.setStr("Yellow", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(PINK);
 lcd.setStr("Pink", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(MAGENTA);
 lcd.setStr("Magenta", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(CYAN);
 lcd.setStr("Cyan", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(BROWN);
 lcd.setStr("Brown", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(ORANGE);
 lcd.setStr("Orange", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(BLUE);
 lcd.setStr("Blue", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(RED);
 lcd.setStr("Red", 39,40, WHITE, BLACK);
 delay(del);
 lcd.clear(GREEN);
 lcd.setStr("Green", 39,40, WHITE, BLACK);
 delay(del);
}

And now to see it in action. The colours are more livid in real life, unfortunately the camera does not capture them so well.

Now that we have had some experience with the LCD library’s functions, we can move on to drawing some graphical objects. Recall that the screen has a resolution of 128 by 128 pixels. We have four functions to make use of this LCD real estate, so let’s see how they work. The first is:

lcd.setPixel(int colour, Y, X);

This functions places a pixel (one LCD dot) at location x, y with the colour of colour.

Note – in this (and all the functions that have a colour parameter) you can substitute the colour (e.g. BLACK) for a 12-bit RGB value representing the colour required. 

Next is:

lcd.setLine(x0, y0, x1, y1, COLOUR);

Which draws a line of colour COLOUR, from position x0, y0 to x1, y1. Our next function is:

lcd.setRect(x0, y0, x1, y1, fill, COLOUR);

This function draws an oblong or square of colour COLOUR with the top-left point at x0, y0 and the bottom right at x1, y1. Fill is set to 0 for an outline, and 1 for a filled oblong. It would be convenient for drawing bar graphs for data representation. And finally, we can also create circles, using:

lcd.setCircle(x, y, radius, COLOUR);

X and Y is the location for the centre of the circle, radius and COLOUR are self-explanatory. 

We will now use these graphical functions in the following demonstration sketch (download):

// Example 28.3
#include "ColorLCDShield.h"
LCDShield lcd;
int del = 1000;
int xx, yy = 0;
void setup()
{
 lcd.init(PHILIPS); 
 lcd.contrast(63); // sets LCD contrast (value between 0~63)
 lcd.clear(BLACK);
 randomSeed(analogRead(0));
}
void loop()
{
 lcd.setStr("Graphic Function", 40,3, WHITE, BLACK);
 lcd.setStr("Test Sketch", 55, 20, WHITE, BLACK); 
 delay(5000);
 lcd.clear(BLACK);
 lcd.setStr("lcd.setPixel", 40,20, WHITE, BLACK);
 delay(del);
 lcd.clear(BLACK);
 for (int a=0; a<500; a++)
 {
 xx=random(160);
 yy=random(160);
 lcd.setPixel(WHITE, yy, xx);
 delay(10);
 }
 delay(del);
 lcd.clear(BLACK);
 lcd.setStr("LCDDrawCircle", 40,10, WHITE, BLACK);
 delay(del);
 lcd.clear(BLACK); 
 for (int a=0; a<2; a++)
 {
 for (int b=1; b<6; b++)
 {
 xx=b*5;
 lcd.setCircle(32, 32, xx, WHITE);
 delay(200);
 lcd.setCircle(32, 32, xx, BLACK);
 delay(200);
 }
 }
 lcd.clear(BLACK); 
 for (int a=0; a<3; a++)
 {
 for (int b=1; b<12; b++)
 {
 xx=b*5;
 lcd.setCircle(32, 32, xx, WHITE);
 delay(100);
 }
 lcd.clear(BLACK);
 }
 lcd.clear(BLACK); 
 for (int a=0; a<3; a++)
 {
 for (int b=1; b<12; b++)
 {
 xx=b*5;
 lcd.setCircle(32, 32, xx, WHITE);
 delay(100);
 }
 lcd.clear(BLACK);
 }
 delay(del);
 lcd.clear(BLACK);
 lcd.setStr("LCDSetLine", 40,10, WHITE, BLACK);
 delay(del);
 lcd.clear(BLACK); 
 for (int a=0; a<160; a++)
 {
 xx=random(160);
 lcd.setLine(a, 1, xx, a, WHITE);
 delay(10);
 }
lcd.clear(BLACK);
 lcd.setStr("LCDSetRect", 40,10, WHITE, BLACK);
 delay(del);
 lcd.clear(BLACK); 
 for (int a=0; a<10; a++)
 {
 lcd.setRect(32,32,64,64,0,WHITE);
 delay(200);
 lcd.clear(BLACK);
 lcd.setRect(32,32,64,64,1,WHITE);
 delay(200);
 lcd.clear(BLACK); 
 }
 lcd.clear(BLACK); 
}

You can see Example 28.3  in the following video. (There’s a section in  the video showing semi-circles – however this isn’t possible with the new Arduino v1+ library).  For photographic reasons, I will stick with white on black for the colours.

So now you have an explanation of the functions to drive the screen – and only your imagination is holding you back.  ** Get an Eleven board – it has a microUSB socket so you don’t run the risk of rubbing against shields.

For another example of the colour LCD shield in use, check out my version of “Tic-tac-toe“.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our 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.

February 7, 2011 Posted by | arduino, education, LCD, LCD-09363, microcontrollers, tutorial | , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

February 2011 Competition

Hello readers

The February 2011 competition has now closed. Thank you to all those who entered, and the results have now been posted.

Time for another competition – and the best one yet! To enter, find the five questions that are spread across the articles published in tronixstuff.com in February. When you have answers to all five questions, email your answers to competition at tronixstuff dot com with “February″ in the subject line. Then in the first week of March, I will compile a list of people with the correct answers, and randomly select two winners. Now for the prizes – brought to you this month by the great people from Freetronics.

First Prize

One brand-new, hot off the pick-and-place FreetronicsEleven” 100% Arduino Uno-compatible board

The “Eleven” is just like an Arduino Uno – but better!
It is based on the existing Arduino Uno but with improvements and updates for ease of use, cost and getting started.
It’s 100% Arduino compatible. Also included in the package are a USB cable, and our Getting Started guide sheet.

As well as the standard Arduino Uno features found here, the Eleven has the following improvements and updates:

Prototyping area
For those projects where you don’t need the extra size or expense of a shield, the Eleven has its own standard prototyping area taking up a quarter of the board. Great for quick sensor and IC projects. There’s extra power pads underneath for neat connections.

LEDs visible on the edge
Wondered what your Arduino was doing? We’ve carefully placed a nice blue Power LED, plus colour coded RX, TX and D13 LEDs on the right edge of the board so you can see what’s going on.

Dual crystals
We’ve provided proper crystals for both the primary MCU and the communications MCU, rather than using a ceramic resonator.

Mini-USB Connector
No more short circuits of the large USB connector against your shields. Our standard Mini-USB connector is firmly mounted and we’ve included a cable too.

Overlay guide where you need it
When you’re soldering your project, it’s good to know what you’re connecting to! All of our boards and shields have a thorough pinout and guide printed on the bottom as well as the top, so when you’re soldering underneath there’s no need to flip the board over constantly.

Top spec MCU
Every Eleven has the higher specification ATmega328P Microcontroller.

D13 pin works for everything
The digital I/O pin 13 functionality has been fixed, the D13 indicator LED no longer loads up this pin when you use it as an input.

Mounting holes, power and X3 pads
We’ve included a fourth mounting hole in the bottom left, there’s no more wobbly board troubles if you’re fitting it to a case.
Helpful markings for the Power Jack size, polarity and voltage are right there on the board when you need them. Auto-power switching and self-resetting fuse protection are standard.
Really need to program the bootloader into an MCU? Not usually required, but we’ve included a DIP socket and the X3 programming pads for it.

It’s all in the same place
The power jack, headers and ICSP are all in exactly the same location as Arduino standard boards. The Eleven is perfectly compatible with all Arduino shields, projects and sketches.


What’s in the box?

  • Freetronics Eleven board
  • Mini-USB cable so you don’t need to purchase one separately!
  • Our carefully written Getting Started guide

Second Prize

One brand-new, FreetronicsKitTen” 100% Arduino Duemilanove-compatible board kit

As seen in the recent kit review, the lucky winner will enjoy making a great Arduino-compatible board that is easy and fun. More about the KitTen:

The KitTen is a simplified version of our TwentyTen (“Duemiladieci”) Arduino-compatible board, supplied as a kit using through-hole parts for easy assembly.

It may be easy to build, but it’s still full-featured and high-performance. If you compare it to typical Arduino-compatible kits you’ll see that it doesn’t scrimp on anything: in fact our design has more smoothing capacitors alone than the entire parts count of most other kits! It even includes a 3.3V regulator to allow it to use shields that require 3.3V, which is not something you see in typical kits.

The KitTen has the following features:

Prototyping area
For those projects where you don’t need the extra size or expense of a shield, the KitTen has its own standard prototyping area taking up a quarter of the board. Great for quick sensor and IC projects. There’s extra power pads underneath for neat connections.

LEDs visible on the edge
Wondered what your Arduino was doing? We’ve placed a blue Power LED and red D13 LED on the right edge of the board so you can see what’s going on even with a shield fitted on top.

Connector for FTDI USB cable
Use a commonly-available FTDI USB cable (not included) to upload sketches to your KitTen directly from the Arduino IDE.

Overlay guide where you need it
When you’re soldering your project, it’s good to know what you’re connecting to! All of our boards and shields have a thorough pinout and guide printed on the bottom as well as the top, so when you’re soldering underneath there’s no need to flip the board over constantly.

Top spec MCU
Every KitTen includes the higher specification ATmega328P Microcontroller, and we’ve pre-loaded it with the Arduino bootloader. Just plug it in, launch the Arduino IDE, and you’ll be running your own programs in no time.

D13 pin works for everything
The digital I/O pin 13 functionality has been fixed: the D13 indicator LED is isolated from the D13 pin using a MOSFET so that it no longer loads up this pin when you use it as an input.

Mounting holes and power pads
We’ve included a fourth mounting hole in the bottom left in the same location as the fourth hole on the Arduino Uno so there are no more wobbly board troubles if you’re fitting it to a case. Helpful markings for the power jack size, polarity and voltage are right there on the board when you need them.

5V and 3.3V voltage regulators
Many Arduino-compatible kits don’t provide both 5V and 3.3V voltage regulators, preventing you from using shields that require a 3.3V supply. We’ve included both 5V and 3.3V regulators to ensure the KitTen is compatible with all Arduino shields.

It’s all in the same place
The power jack, headers and ICSP are all in exactly the same location as Arduino standard boards. The KitTen is perfectly compatible with all Arduino Duemilanove shields, projects and sketches.


What’s in the box?

  • Gold-plated Freetronics KitTen PCB with overlay on both top and bottom.
  • A top-spec ATmega328P MCU pre-loaded with the Arduino bootloader.
  • All the required supporting parts.
  • The fully illustrated KitTen Assembly Guide.
  • Our Getting Started guide.

You will also need a 5V FTDI USB-to-Serial cable to upload sketches to your KitTen once it has been assembled. You only need one FTDI cable no matter how many KitTens you build.


So as you can see there is the opportunity to win some great prizes. As with any other competition, there needs to be some rules:

  • Prizes will be sent via regular Australia Post air mail;
  • Winners outside of Australia will be responsible for any taxes, fees or levies imposed by your local Governments (such as import levies, excise, VAT, etc.)
  • If you have won a previous competition you cannot enter;
  • If you know me in real life you cannot enter.
  • The Judge’s decision is final with regards to any dispute.
  • Entries will be accepted until 2359h GMT on 28th February

So have fun and keep checking into tronixstuff.com. Why not follow things on twitter, subscribe  for email updates or RSS using the links on the right-hand column, or join our 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.

Once again, thank you to our generous competition sponsor Freetronics!

Otherwise, have fun, stay safe, be good to each other – and make something!

February 5, 2011 Posted by | arduino, competition | , , , , , , , , , , , , , , , , , , , | Leave a Comment

Project – Simple RFID access system

In this tutorial you can make an RFID access system. It’s very simple and can be used with a wide variety of end-uses.

Updated 18/03/2013

The purpose of this project is to prototype a basic RFID access system. Although it is not that complicated, this article is my response to a kit reviewed in the Australian “Silicon Chip” (November 2010) electronics magazine. Their article describes the kit in detail – operation, schematic, use and installation. However the code for the microcontroller (PIC16F628A)  is not published due to the kit manufacturer holding copyright over the design. This is a shame, as many organisations have been quite successful selling open-source kits. So instead of moaning about it, I have created my own design that matches the operation of the original, instead using the ATmega328 MCU with Arduino bootloader. Consider this a basic framework that you can modify for your own access system, or the start of something more involved.

original article

There are pros and cons with the original vs. my version. The biggest pro is that you can buy the whole kit for around Au$40 including a nice PCB, solder it together, and it works. However if you want to do it yourself, you can modify it to no end, and have some fun learning and experimenting along the way. So let’s go!

The feature requirements are few. The system must be able to learn and remember up to eight RFID access tags/cards, etc – which must be able to be altered by a non-technical user. Upon reading a card, the system will activate a relay for a period of time (say 1 second) to allow operation of a door strike or electric lock. Finally, the RFID tag serial numbers are to be stored in an EEPROM in case of a power outage. When a tag is read, a matching LED (1~8) will show which tag was read. There are also two LEDs, called “Go” and “Stop” which show the activation status. The original kit has some more LEDs, which I have made superfluous by blinking existing LEDs.

This is a simple thing to make, and the transition from a solderless breadboard to strip board will be easy for those who decide to make a permanent example. But for now, you can follow with the prototype. First is the parts list:

  • Atmel ATmega328 with Arduino bootloader;
  • 16 MHz resonator (X1 in schematic);
  • ten LEDs of your choice;
  • two normally-open push buttons;
  • two 560 ohm resistors (all resistors 1/4 watt);
  • one 1k ohm resistor;
  • three 10k ohm resistors;
  • one BC548 transistor;
  • three 0.01 uF monolithic capacitors;
  • one 100 uF electrolytic capacitor;
  • one 1N4004 diode;
  • Microchip 24LC256 EEPROM;
  • 125 kHZ RFID module;
  • 125 kHz RFID tags/cards;
  • connecting wire;
  • large solderless breadboard;
  • LM7805 power regulator;
  • relay of your choice with 5V coil (example).

When selecting a relay, make sure it can handle the required load current and voltage – and that the coil current is less than 100mA.

If attempting to switch mains voltage/current – contact a licensed electrician. Your life is worth more than the money saved by not consulting an expert.

And here is the schematic:


Here is the prototype on the solderless breadboard. For demonstration purposes an LED has been substituted for the transistor/relay section of the circuit, the power regulator circuitry has not been shown, and there are superfluous 4.7k resistors on the I2C bus. To program the software (Arduino sketch) the easiest way is by inserting the target IC into an Arduino-compatible board, or via a 5V FTDI cable and a basic circuit as described here.

The Arduino sketch is also quite simple. The main loop calls the procedure readTags() to process any RFID tag read attempts, and then monitors button A – if pressed, the function learnTags() is called to allow memorisation of new RFID tags. Each tag serial number consists of 14 decimal numbers, and these are stored in the EEPROM sequentially. That is, the first tag’s serial number occupies memory positions 0~13, the second tag’s serial number occupies memory position 14~28, and so on. Two functions are used to read and write tag serial numbers to the EEPROM – readEEPROMtag() and writeEEPROMtag(). The EEPROM is controlled via the I2C bus. For a tutorial about Arduino, I2C bus and the EEPROM please read this article. For a tutorial about Arduino and RFID, please read this article. The rest of the sketch is pretty self-explanatory. Just follow it along and you can see how it works. You can download the sketch from here.

 
And finally, a quick video demonstration:

So there you have it. I hope you enjoyed reading about this small project and perhaps gained some use for it of your own or sparked some other ideas in your imagination that you can turn into reality.

In the meanwhile have fun and keep checking into tronixstuff.com. 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.

February 5, 2011 Posted by | hardware hacking, learning electronics, microcontrollers, projects, RDM630, RDM6300, rfid | , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 9 Comments

   

Follow

Get every new post delivered to your Inbox.

Join 3,843 other followers

%d bloggers like this: