Monday, December 26, 2011

Welcome to “Silicon Chip” Magazine readers

Hello readers

Published in the January 2012 issue of “Silicon Chip” magazine is an eight page feature article by Jonathan Oxer introducing the Arduino system and how the hardware and software work together to allow anyone to turn their technological ideas into reality. If you have read Jon’s article and were directed here – thanks for visiting! We have much more content than just Arduino tutorials, however to get started with them please click here or select from one of the chapters listed in the “Arduino Tutorials” section on the right-hand side of this web page.  Our site is a work in progress and if you have any feedback or questions please email john at tronixstuff dot com, or visit our moderated Google Group.

Be sure to take advantage of the discount code on page seventeen made available by Little Bird Electronics - Australia’s largest Arduino and related electronics distributor; and also check out the range of Arduino-compatible equipment atFreetronics.

For those not familiar with the magazine, here is the cover for the January 2012 issue:

So what is “Silicon Chip” magazine all about? It is Australia’s window to the wide world of electronics, backed by a team of engineers and enthusiasts with decades of experience and knowledge. Each month you can read about in-house projects by the team and also submitted by readers – covering basic circuits right through to digital and computer systems, quality hi-fi and audio projects, news, reviews, readers’ letters, the humorous columns and a wide variety of kits to assemble. There is also a wide range of advertising from related businesses that helps you find new products and suppliers that you may not have known about.

Silicon Chip is the only Australian electronics magazine and one of the few left in the world with a broad appeal to the beginner and expert alike, and the projects described are always good value and not priced or designed out of most peoples’ reach. I unashamedly recommend you pick up a copy from the newsagent or take out a subscription if possible, it’s a great read and there’s always lots to learn and laugh about.

In the meanwhile, here’s the last question for our monthly competition:

Question: Who is the editor of “Silicon Chip” magazine?

Finally, that’s it for 2011. A big thank you to all of our readers for your visits, feedback, compliments, criticism, donations, and the crazy emails received through the year. And of course to all the great suppliers who help out with promotional considerations and sponsor our monthly competitions. Keeping this site together has been interesting, educational and a whole lot of fun, and I hope you think so too. There is a lot coming up for 2012 – so stay tuned via twitterGoogle+, or subscribe by email or RSS on the right-hand side of this page.

Have fun and Happy New Year :)

Thursday, December 22, 2011

Clock Kit Round-up – December 2011

Hello Readers

If there’s one thing that I really like it’s a good clock kit. Once constructed, they can be many things, including:

  • a point of differentiation from other items in the room;
  • a reminder of the past (nixie tubes!) or possible visions of the future;
  • the base of something to really annoy other people;
  • a constant reminder to get back to work;
  • a source of satisfaction from having made something yourself!

So just for fun I have attempted to find and list as many interesting and ‘out of the ordinary’ kits as possible, and ignored the simple or relatively mundane kits out there. If you are in the clock kit business and want a mention, let me know. So in no particular order, we have:

adafruit industries “ice tube” clock

Based around a vintage Soviet-era vacuum IV-18 type fluorescent display, the ice tube clock is a rare kit that includes a nice enclosure which keeps you safe from the high voltages as well as allowing the curious to observe your soldering skills. Ireviewed this kit almost a year ago and the clock is still working perfectly. Here is a video of the ice tube clock in action:

After some travelling meeting various people it seems that quite a few of us have an ice tube clock. There is something quite mesmerising about the display, perhaps helping to recall memories of our youth in the 1970s and 80s.

nootropic design Defusable Clock Kit

As recently reviewed, this kit allows you to build a simulated ‘countdown’ timer for a hypothetical explosive device that also doubles as a clock with an alarm. For example:

Whatever you do, don’t make a ‘fake bomb’ and leave it out in public! Only bad things could happen :)

ogilumen nixie tube kits

Not a clock kit as such, however they have made doing it yourself very easy with their power supply and IN-12A nixie board kits. We made one ourselves in a previous review, as shown below:

Alan Parekh’s Multimeter Clock Kit

This is certainly one from left field – using the analogue multimeters to display hours, minutes and seconds. See Alan describe his kit in this video:

Certainly something different and would look great on the wall of any electronics-themed area or would easily annoy those who dislike the status-quo of clock design.

akafugu VFD Modular Clock

The team at akafugu have created a modular baseboard/shield kit which holds a shield containing four IV-17 alphanumeric nixie tubes to create your own clock or display system:

Unlike some of the other nixie tube kits the firmware has been made public and can be modified at will. In the future different display shields will be available to extend the use of the kit.

tubeclock.com kits

This site has two kits available, one using either four or six Soviet-era IN-12 type nixie tubes:

… and another kit using the Soviet-era IN-14 nixie tubes:

You have to hand it to the former Soviet Union – they knew how to over-produce nixie tubes. One rare example where we can benefit from a command economy!

evil mad science clocks

The certainly not evil people have two clock kits, the first being the Bulbdial Clock Kit:

This uses a unique ring of LEDs around the circumference of the clock face to create shadows to mark the time. It is also available in a range of housing and face styles. Their other kit of interest is the Alpha Clock Five:

The photo of this clock doesn’t do it justice – the alphanumeric displays are 2.3″ tall, making this one huge clock. It also makes use of a Chronodot real-time clock board, which contains a temperature-controlled oscillator  which helps give it an accuracy of +-/ 2 minutes per year. Furthermore you can modify this easily using an FTDI cable and the Arduino IDE with some extra software. Would be great for model railways (or even a real railway station) or those insanely conscious about the time.

Question: Which Soviet leader allegedly banged his shoe in the United Nations?

Kabtronics Clock Kits

This organisation has several clock kits which span a range of technology from the later part of the twentieth century. These guys can only be true clock enthusiasts! Starting with the 1950s, they have their Nixie-Transistor Clock:


Look – no integrated circuits, leaving the kit true to the era. If you need to hide from someone for a weekend, building this would be a good start. Next we move onto the 1960s and the Transistor Clock:

The 1960s brought with it LEDs so they are now used in this kit, however the logic is still all analogue electronics. However next we can move to the 1970s, and finally save some board space with the TTL Clock:

This would still be fun to assemble but somewhat less punishing for those who don’t enjoy solder fumes that much. However you still have a nice kit and something to be proud of. Finally, the last in the line is the 1980s-themed Surface-Mount Technology Clock:

So here we have a microcontroller, SMT components, and a typical reduction in board size. Their range is an excellent way of demonstrating the advances in technology over the years.

The GPS FLW Display Clock

Wow – this clock makes use of huge Burroughs B7971 15-segment nixie tube displays and a GPS receiver to make a huge, old-style/new-tech clock. Check out the demonstration video:

This thing is amazing. And it is actually cheaper to buy a fully-assembled version (huh). The same organisation also offers another GPS-controlled clock using IN-18 nixie tubes:

Again, it isn’t inexpensive – however the true nixie tube enthusiasts will love it. This clock would look great next to a post-modern vintage hifi tube amplifier. Moving forward to something completely different now, we have the:

adafruit industries monochron®

Almost the polar opposite of the nixie-tube clocks, the monochron uses an ATmega328 microcontroller and a 128 x 64 LCD module to create some interesting clock effects. For example:

Many people have created a variety of displays, including space invaders and the pong game simulation. The clock also includes the laser-cut acrylic housing which provides a useful and solid base for the clock.

Spikenzie Labs Solder : Time™ watch kit

Technically this is a watch kit, however I don’t think that many people would want to walk around wearing one – but it could be used in more permanent or fixed locations. Correct me if I’m wrong people. However in its defence it is a very well designed kit that is easy to solder and produces a nice clock:

It uses a separate real-time controller IC to stay accurate, and the design However this would be a great suggestion as a gift for a younger person to help them become interesting in electronics and other related topics. The asm firmware is also available for you to modify using Microchip MPLAB software if that takes your fancy.

Velleman Kits

The Velleman company has a range of somewhat uninspiring clock kits, starting with the Scrolling/Rolling LED Clock:

… the 2¼” 7-Segment Digital Clock:

This clock includes the housing and also accepts an optional temperature sensor, and therefore can display this as well. There is also the aptly-named – Digital LED Clock:

It tells the time and would be useful in a 1980s-era idea of the future movie set. The final velleman clock kit is the Jumbo Single-Digit Clock:

In all fairness this one looks quite interesting – the LED display is 57mm tall and the time is display one digit at a time. It is powered by a PIC16F630 however the firmware is proprietary to velleman.

Nocrotec Nixie Clocks

This company has a range of kits using nixie tubes and numitrons (low voltage incadescent displays in tubes). One particularly lovely kit is their IN-8 Blue Dream kit:

The blue glow at the base of the nixie tubes is due to an LED mounted at the bottom of the tube. Another aesthetically-pleasing kit is their Little Blue Something nixie clock. Check out their demonstration video:

nixiekits.eu

More IN-12 nixie clocks from Germany, the first being the Manuela_HRYou can buy the kit without an enclosure, or choose from the ‘office’ style:

… or this funky number:

You can specify it with RGB LEDs which colour-cycle to provide the effect shown above. For those not too keen you can also buy the kits pre-assembled. Their other kit is the Sven:

It is available with IN-8 or IN-14 nixie tubes. The design quality of the enclosure is outstanding, a lot of effort has been made to produce a complete kit that “won’t look like a kit” when completed.

Minty Time

This is a small binary clock kit that fits in an Altoids tin:

This is a nice little kit as it is inexpensive, easy to make and very well documented. You could also mount this in a variety of flat surfaces, limited only by your imagination.

The Chronulator

Here we find a unique design that uses analogue panel meters in a similar method to the multimeter clock detailed previously. Here is an example of the completed kit:

The kit contains the electronics and meters (or you can delete the meters for a discount if you already have some) however the housing is up to you. Furthermore, this kit has some of the best instructions (.pdf) I have ever seen. They are a credit to the organisation. Our final clock kit is the …

Denkimono

This is another clock kit in the style of ‘suspicious bomb timer’-looking – and it pulls this off quite well. Consider the following video demonstration:

As well as a normal clock it can function as an alarm, stopwatch, countdown timer and lap counter. The instructions (.pdf) are well written and easy to follow. Furthermore the Denkimono is also well priced for the kit and delivery.

Hopefully this catalogue of clock kits was of interest to you. If you have found some other kits to add to the list, or wish to disagree or generally comment about this article please do so via the comment section below. This article was not sponsored in any way.

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.

Wednesday, December 21, 2011

Review – nootropic design defusable clock kit

Hello Readers

In this review we examine an interesting, fun and possibly a prankster’s delight – the “Defusable Clock Kit” fromnootropic design. The purpose of this kit is to construct a clock that counts down in a similar method to “movie-style” bombs, and it has terminals to connect four wires to the board. When the countdown timer is beeping away, you need to choose which wire to cut otherwise the “bomb” (alarm) goes off.

Furthermore, it also functions as a normal clock with an alarm, so you can use it daily normal activities. And finally it is based on the Arduino system which allows the kit to be reprogrammed at a later date. Now let’s move forward by examining kit construction.

Packaging

The kit arrives in a re-sealable antistatic pouch that can be reused without any effort:

Assembly

Detailed instructions can be found on the product website. The kit has a very clear and well-detailed silk screen on the PCB:

All the parts required are included, as well as an IC socket for the microcontroller:

However it looks like someone in the kitting department was in a hurry, things like this are pretty inexcusable – but recoverable:

Nothing that can’t be fixed carefully with some needle-nose pliers, nevertheless it was somewhat inconvenient. Some beginners may not have the patience or finesse to fix this themselves, and end up with a useless microcontroller. Moving forward, the first parts to solder in are the resistors:

… then to the other lower-profile components:

… and the rest:

Which leaves us with the final product:

The clock is designed around simple Arduino-compatible circuitry, so if you wish to alter the firware for the clock or upload your own sketch, you will need to fit the six-way header pins (in order to connect a USB-FTDI cable). As the pins are horizontal and tend to fall over, it’s easier to solder the first pin from the top of the PCB to hold it in place:

… then turn the PCB over and solder the rest.

Operation

Power is supplied via the DC socket on the PCB, and converted to 5V with a typical 7805 regulator. Therefore your input voltage can range between normal levels of 9~12VDC. Once the power is connected you can set the time for the clock and alarm for normal use. However if you feel like some sweat-inducing excitement, connect four wires each between the terminal blocks at the top of the PCB. Then press the red button to start the ten-second countdown. You can also increase or decrease the countdown time.

Your chances of defusing it in time can be quite low – by cutting one wire you can defuse it, by cutting two other wires nothing will happen and the clock keeps ticking – and by cutting the final wire… well, it’s all over. The wires are randomly chosen each time so you can’t predict which will be the correct wire. (Unless you change the firmware). Now let’s see the clock in action:

At this juncture it would be appropriate to warn the users of this kit not to … well, misuse the clock. To be honest I’m surprised such a kit originated from the US in the first place, but then again it never hurts to have a sense of humour. But seriously, to the untrained eye or casual security guard – this kit will look pretty damn real. So no making any mock explosive models with Play-Doh or metal cylinders and leaving them on the train or bus or under someone’s toilet seat. Then again, that would be good for a laugh – so please keep it at home, not in the railway station.

Question – Who played alongside with Mel Gibson in the “Lethal Weapon” movies?

Further expansion

As mentioned earlier this kit is Arduino (Duemilanove) compatible, you can upload new sketches using a 5V FTDI cable or swapping the microcontroller over in another Arduino-style board. You have four LEDs, a 4-digit 7-segment LED module, a buzzer, and four digital I/O pins via the terminal block on the top-right of the PCB which could control external devices. Furthermore you can download and examine the clock sketch to modify or deconstruct it to determine the operation.

Conclusion

Apart from the laughs and possible mayhem you could cause with this, the kit is easy to assemble and works as described. It would make a great present to get someone interested in electronics, or help them with soldering practice. Furthermore it is certainly unique, and would be fun at parties and other events.

This kit and many other electronic goodies are available from Little Bird Electronics. High-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.

 

Tuesday, December 13, 2011

Review – Akafugu TWI 7-Segment Display

Hello Readers

Today we review a product from a new company based in Japan – akafugu. From their website:

Akafugu Corporation is a small electronics company that operates out of Tokyo, Japan. We specialize in fun and easy to use electronic gadgets. Our goal is to provide products that not only make prototyping faster and easier, but are also perfect for incorporation in finalized products.

And with this in mind we examine their TWI 7-segment display board. It consists of a four digit, seven-segment LED module driven by an Atmel ATtiny microcontroller – and has an I2C (or called TWI for “two-wire interface”) interface. By using I2C you only need power, GND, SDA and CLK lines – which saves on I/O and physical space.

Packaging

The display arrives appropriately packaged in reusable bags, and the main board is sealed in an anti-static pouch:

Assembly

The display board arrives partly-assembled. The MCU is presoldered to the board, so all we need to solder are the external connections on each side of the board, and the LED module. It is quite small and of an excellent quality:

The reason for having the power and data lines on both side is that you can then daisy-chain the displays. Speaking of which, the review unit arrived with a common-anode white LED module (data sheet.pdf) – however you can also order it in red or blue. Although they are not included, I soldered in a line of socket pins to allow for changing the LED module later on:

The final product is neat and compact, the view from the rear:

Note the ISP header pin sockets which allow low-level programming of the ATtiny4313 MCU. And the front:

akafugu also sell an optional housing stand, manufactured from transparent acrylic, which turns the display module into a nice little desk stand model:

Using the display module

Now to put the display to use. As it is controlled via I2C/TWI a variety of microcontroller platforms will be able to use the display. For our examples we will be using an Arduino-compatible board. Before moving forward you need to download and install the Arduino library which is available (as well as an avr-gcc library) on Github. Note that the example sketches in the Arduino library are for IDE v1.0.

As the module uses its own microcontroller, you can change the I2C bus address with a simple sketch (which is provided with the library). This is a great idea, which removes any chance of clashing with other bus devices, and allows more modules to be on the same bus. The default address is 0X12h.

When using the module, the following lines need to be in your sketch:

#include #include <TWIDisplay.h> #define SLAVE_ADDR 0x12 TWIDisplay disp(0x12);
void setup() { Wire.begin(); disp.setRotateMode(); disp.clear(); disp.setBrightness(255); }

You can change the brightness mid-sketch using disp.setBrightness() with a parameter between zero and 255. To display an integer, use:

  disp.writeInt(8888); // displays '8888'

To turn on or off the decimal points, use:

  disp.setDot(x,boolean); // where x is the digit (0~3 from left to right) and boolean is true for on, false for off

To clear the display, use:

 disp.clear();

You can even display strings of text. Not every character can be displayed, however most can and the effect of scrolling looks good. For some example code:

char message[] = "This is a long message "; for (int i = 0; i < strlen(message); i++) { disp.print(message[i]); delay(250);

Now to put the display to work! Using this IDE v1.0 demonstration sketch (download), we have created the following display:

For the curious, the current drawn with all segments on at full brightness is just over  33 milliamps:

Conclusion

When you need to display some numerical or other fitting data with a greater clarity than an LCD, or just love LEDs then you could do very well with this display. The designers have made a quality board and backed it up with documentation and (unlike many much larger, more prominent companies) a mature library to ensure it works first time. Furthermore the use of the I2C/TWI bus removes the problem of wasting digital output pins on your MCU – and the ability to change the bus address is perfect. So give akafugu a go and you will not be disappointed. The display and other goodies are available directly from akafugu.jp

Disclaimer – The parts reviewed in this article are a promotional consideration made available by akafugu.

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.

Monday, December 12, 2011

Project – Ultrasonic Combination Switch

Hello Readers

Time for a follow-up to the Single Button Combination Lock by creating another oddball type of switch/lock. To activate this switch we make use of a Parallax Ping))) Ultrasonic sensor, an Arduino-style board and some other hardware – to make a device that receives a four-number code which is made up of the distance between a hand and the sensor. If Arduino and ultrasonic sensors are new to you, please read this tutorial before moving on.

The required hardware for this project is minimal and shown below – a Freetronics Arduino-compatible board, thePing))) sensor, and for display purposes we have an I2C-interface LCD module:

The combination for our ‘lock’ will consist of four integers. Each integer is the distance measured between the sensor and the user’s hand (etc.). For example, a combination may be 20, 15, 20, 15. So for the switch to be activated the user must place their hand 20cm away, then 15, then 20, then 15cm away. Our switch will have a delay between each measurement which can be modified in the sketch.

To keep things simple the overlord of the switch must insert the PIN into the switch sketch. Therefore we need a way to take measurements to generate a PIN. We do this with the following sketch, it simply displays the distance on the LCD (download sketch):

// Ultrasonic combination lock - distance display // John Boxall - December 2011 // tronixstuff.wordpress.com/projects | CC by-sa-nc
#include "Wire.h" #include "LiquidCrystal_I2C.h" // for I2C bus LCD module http://bit.ly/eNf7jM LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
int signal=8;
void setup() { pinMode(signal, OUTPUT); lcd.init(); // initialize the lcd lcd.backlight(); // turn on LCD backlight }
int getDistance() // returns distance from Ping))) sensor in cm { int distance; unsigned long pulseduration=0; // get the raw measurement data from Ping))) // set pin as output so we can send a pulse pinMode(signal, OUTPUT); // set output to LOW digitalWrite(signal, LOW); delayMicroseconds(5); // now send the 5uS pulse out to activate Ping))) digitalWrite(signal, HIGH); delayMicroseconds(5); digitalWrite(signal, LOW); // now we need to change the digital pin // to input to read the incoming pulse pinMode(signal, INPUT); // finally, measure the length of the incoming pulse pulseduration=pulseIn(signal, HIGH); // divide the pulse length by half pulseduration=pulseduration/2; // now convert to centimetres. We're metric here people... distance = int(pulseduration/29); return distance; }
void loop() { lcd.print(getDistance()); lcd.println(" cm "); delay(500); lcd.clear(); }

And here is a demonstration of the sketch in action:

Now for the switch itself. For our example the process of “unlocking” will be started by the user placing their hand at a distance of 10cm or less in front of the sensor. Doing so will trigger the function checkPIN(), where the display prompts the user for four “numbers” which are returned by placing their hand a certain distance away from the sensor four times, with a delay between each reading which is set by the variable adel. The values of the user’s distances are stored in the array attempt[4].

Question - What is an ultrasonic sound? 

Once the four readings have been taken, they are compared against the values in the array PIN[]. Some tolerance has been built into the checking process, where the value entered can vary +/- a certain distance. This tolerance distance is stored in the variable t in this function. Each of the user’s entries are compared and the tolerance taken into account. If each entry is successful, one is added to the variable accept. If all entries are correct, accept will equal four – at which point the sketch will either “unlock” or display “*** DENIED ***” on the LCD.

Again, this is an example and you can modify the display or checking procedure yourself. Moving forward, here is our lock sketch (download):

// Ultrasonic combination lock // John Boxall - December 2011 // tronixstuff.wordpress.com/projects | CC by-sa-nc
int pin[]={ 20, 15, 20, 25}; // this is the "PIN" distances in cm
#include "Wire.h" #include "LiquidCrystal_I2C.h" // for I2C bus LCD module http://bit.ly/eNf7jM LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
int signal=8; // digital pin for Ping))) signal
void setup() { pinMode(signal, OUTPUT); lcd.init(); // initialize the lcd lcd.backlight(); // turn on LCD backlight Serial.begin(9600); // for debug }
int getDistance() // returns distance from Ping))) sensor in cm { int distance; unsigned long pulseduration=0; // get the raw measurement data from Ping))) // set pin as output so we can send a pulse pinMode(signal, OUTPUT); // set output to LOW digitalWrite(signal, LOW); delayMicroseconds(5); // now send the 5uS pulse out to activate Ping))) digitalWrite(signal, HIGH); delayMicroseconds(5); digitalWrite(signal, LOW); // now we need to change the digital pin // to input to read the incoming pulse pinMode(signal, INPUT); // finally, measure the length of the incoming pulse pulseduration=pulseIn(signal, HIGH); // divide the pulse length by half pulseduration=pulseduration/2; // now convert to centimetres. We're metric here people... distance = int(pulseduration/29); return distance; }
void checkPIN() { int attempt[4]; // stores user's attempt values int accept=0; // used for checking resulting user entry int t=5; // +/- tolerance int adel=1500; // delay between movement attempts lcd.setCursor(0,0); lcd.print("Get ready... "); delay(adel); // delay before first distance measurement lcd.setCursor(0,0); lcd.print(" Position One "); lcd.setCursor(0,1); lcd.print(">>>>____________"); attempt[0]=getDistance(); delay(adel); lcd.setCursor(0,0); lcd.print(" Position Two "); lcd.setCursor(0,1); lcd.print(">>>>>>>>________"); attempt[1]=getDistance(); delay(adel); lcd.setCursor(0,0); lcd.print("Position Three "); lcd.setCursor(0,1); lcd.print(">>>>>>>>>>>>____"); attempt[2]=getDistance(); delay(adel); lcd.setCursor(0,0); lcd.print(" Position Four "); lcd.setCursor(0,1); lcd.print(">>>>>>>>>>>>>>>>"); attempt[3]=getDistance(); delay(adel); lcd.clear(); lcd.print("Checking ... "); // for visual effect more than anything delay(2000); lcd.clear();  // display user entry on serial monitor for debugging for (int z=0; z<4; z++) { Serial.println(attempt[z]); } Serial.println("------"); delay(2000);   // now compare against preset values // allow a +/- tolerance (tolerance in integer 't')  if (attempt[0]>=(pin[0]-t) && attempt[0]<=(pin[0]+t)) { accept++; } if (attempt[1]>=(pin[0]-t) && attempt[1]<=(pin[0]+t)) { accept++; } if (attempt[2]>=(pin[0]-t) && attempt[2]<=(pin[0]+t)) { accept++; } if (attempt[3]>=(pin[0]-t) && attempt[3]<=(pin[0]+t)) { accept++; }
if (accept==4) { // correct entry lcd.setCursor(0,0); lcd.print(" ** Accepted ** "); // here you would enter code to run when the switch was successfully activated delay(2000); } else if (accept!=4) { // incorrect entry lcd.setCursor(0,0); lcd.print(" *** DENIED *** "); // here you would enter code to run when the switch was unsuccessfully activated delay(2000); } }
void loop() { if (getDistance()<10) { lcd.clear(); checkPIN(); } lcd.setCursor(0,0); lcd.print(" ** Ready ** "); }

To finish the switch, a housing of some sort is required. adafruit industries sell a housing which has mounts for an Arduino-form board and 16×2 LCD which is convenient, so we use it for the finished example as shown below:

And for the final demonstration of the switch in action. Note that the delays between actions have been added for visual effect – you can always change them to suit yourself:

So there you have it – the base example for a different type of combination switch. I hope someone out there found this interesting or slightly useful :)

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.