Silicon Chip4-Way Event / Race / Anything Timer - February 2002 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Electronic braking in cars: is it a good idea?
  4. Feature: Electronic Braking Control In Cars by Julian Edgar
  5. Feature: Steel Mini Mills: A Recycling Success Story by Bob Young
  6. Project: 10-Channel IR Remote Control Receiver by John Clarke
  7. Project: A 2.4GHz High-Power Audio-Video Link by Ross Tester
  8. Order Form
  9. Project: Assemble Your Own 2-Way Tower Speakers by Leo Simpson
  10. Project: Touch And/Or Remote-Controlled Light Dimmer; Pt.2 by John Clarke
  11. Project: 4-Way Event / Race / Anything Timer by Ross Tester
  12. Product Showcase
  13. Feature: Look Ma - No Keyboard by Greg Swain
  14. Vintage Radio: The Diason P.P. 32/6 DC receiver by Rodney Champness
  15. Weblink
  16. Book Store
  17. Back Issues
  18. Notes & Errata
  19. Market Centre
  20. Advertising Index
  21. Outer Back Cover

This is only a preview of the February 2002 issue of Silicon Chip.

You can view 30 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "10-Channel IR Remote Control Receiver":
  • PIC16F84(A)-04/P programmed for the 10-Channel IR Remote Control Receiver [10-RMOTE.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the 10-Channel IR Remote Control Receiver [10-RMOTE.HEX] (Software, Free)
  • 10-Channel IR Remote Control Receiver PCB pattern (PDF download) [15111011] (Free)
  • Panel artwork for the 10-Channel IR Remote Control Receiver (PDF download) (Free)
Items relevant to "Touch And/Or Remote-Controlled Light Dimmer; Pt.2":
  • PIC16F84A-20(I)/P programmed for the Touch and/or Remote-Controlled Light Dimmer [DIMMER.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Touch and/or Remote-Controlled Light Dimmer [DIMMER.HEX] (Software, Free)
  • Touch and/or Remote-Controlled Light Dimmer PCB patterns (PDF download) [10101021/2] (Free)
Articles in this series:
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.1 (January 2002)
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.1 (January 2002)
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.2 (February 2002)
  • Touch And/Or Remote-Controlled Light Dimmer; Pt.2 (February 2002)

Purchase a printed copy of this issue for $10.00.

A couple of months ago (December 2001), we introduced you to the “PIC FUN” concept by Adelaide company, eLabtronics. Now, as promised, we’re going to put PIC FUN to work by turning it into a 4-way timer. 4-Way Event/Race/ Anything Timer W HAT’S A 4-WAY TIMER? It’s a device capable of digitally timing up to four different or related events at once. Slot cars on a race track, for example; or the first four sprinters in a race; the reaction times of four people of various states of sobriety (don’t laugh – it’s quite a legitimate test!); school physics experiments. And so on. By the way, we’re not suggesting those last two be combined! It’s accurate to 1/100th of a second so it is quite a useful device in its own right. And it counts up to 99.99 seconds – more than 1.5 minutes – so again it is very useful. There are many more examples of where timers could be used – perhaps right now you’re thinking of a pet project which lends itself perfectly. Starting and stopping the timer is very easy using the Reset switch and the four pushbutton switches (S1-S4) situated on the lid of the box. But to make switching the timer on and off even more convenient, you can also use (prebuilt) infrared light beam relays for each of the four inputs. Whenever the light beam is cut, the counter stops. As versatile as this system is, though, there will be places where you need different types of inputs. With just a tiny bit of ingenuity, these switches or light beam relays could be replaced with a whole host of electronic and/or mechanical “inputs” to make the unit do exactly what you want to do. What sort of ingenuity? Perhaps it could be a pressure pad in a “gate” through which runners have to pass. Perhaps it could be as simple (and cheap!) as an external pushbutton switch. The switches are normally open so you can parallel them to your heart’s content! You get the picture, we’re sure. All that is required to trigger the software is a 5V positive-going pulse. Software Software? We hadn’t mentioned that yet! Of course, much of the software resides in the PIC microcontroller – it does the vast majority of the “housekeeping” of the unit. But there is other software which comes on a CD-ROM and allows the PICFUN2 Timer to be By ROSS TESTER 66  Silicon Chip www.siliconchip.com.au used in conjunction with your PC, recording and saving information from the various timer inputs. We’ll look at this much more closely in a moment. Extra hardware In the meantime let’s get back to the PICFUN2 Timer itself. We don’t propose to go over the PICFUN2 PC board and its operation again – we covered that in the December issue. This time, we’ll concentrate on what you have to do to build PICFUN2 Timer. From the basic PICFUN2 board described in December, the following has been added: (a) PORTA has extra terminal blocks and resistors for external connection. This allows all five ports of PORTA to be accessed for external wiring. (b) Five switches have been added to connect to PORTA. This allows direct access to the ports for testing and other functions such as reset/start or possible menu selections on the LCD. (c) Five connectors have been added to PORTA. This allows exter­nal devices to be connected to the PORTA pins via a sturdy con­nector. The power pins (+5V and 0V) are provided for external sensor power. (d) A 7805 5V regulator allows extra loads on the power supply, such as external sensors on the connectors, while maintaining a stable 5V supply. (e) A clock crystal: for accurate 1/100s timing, a clock crystal with a frequency which is divisible by a base 2 number to 100Hz is critical. (f) An 16 x 2 line alphanumeric LCD display. A standard LCD module is connected to seven lines of PORTB. The eighth port (with the seventh port) is used for programming and/or PC communica­tions. (g) A box has been used to mount the parts – it all fits neatly into a standard size box. Inside the box Most of the real estate in the box is taken by the PICFUN2 board. It is in fact a little simpler than the earlier PICFUN2 project because the output devices are mostly removed. They’re replaced by an LCD (liquid crystal display) module which mounts on the lid of the box. Also on the lid are the four pushbutton switches previously mentioned and a master (reset) switch. Four 4-pin sockets (for the infrared www.siliconchip.com.au Fig.1: the circuit is based on the basic PICFUN2 kit described in the December 2001 issue but includes extra switches, connectors, a crystal (for accurate timing), a 5V regulator and an LCD to display the timing results. February 2002  67 beam relays or other start/stop devices) are mounted on the back panel of the box while on the front is a DC power socket, a 9-pin “D” socket (for connection to your PC), a slider switch (toggles between program­ ming and 68  Silicon Chip reading modes) and another 4-pin socket which can be used to “cascade” another PICFUN2 counter (or more). Power, by the way, is provided by a 12V DC plugpack, which is supplied with the PICFUN Timer kit. Construction Most of the components which go on the PC board for this project are resistors – and most of these are one of www.siliconchip.com.au Fig.2: follow this diagram to assemble the PC board and complete the wiring of the 4-Way Event Timer. Note that the LCD module is modified by adding a trimpot and a 220Ω 1W resistor, as shown in the detail below. This close-up view of the rear of the LCD module shows how the 220Ω 1W resistor, the multi-turn trimpot and the ribbon cable are installed. These parts can all be secured to the back of the module using hot-melt glue. two values – 12 x 390Ω and 11 x 10kΩ ohms. Solder these resistors in first, followed by the only other resistor on the board, a 10Ω unit. There are five capacitors. One 22pF capacitor (in the timing circuit) and www.siliconchip.com.au one 0.1µF actually solder to the back of the board while the remainder, all associated with the power supply, are in normal positions on the top side. The semiconductor complement (ignoring the microcontroller for a moment) is four diodes, one transistor and the 5V regulator. Make sure all the polarised components go in the right way around. Solder in the crystal and the PC board mounting terminal blocks (1 x 3-way and 2 x 2-way which interlock to form 1 x 7-way). Finally, solder in the header pin socket (used to connect to the LCD) and the 18-pin PIC socket. Don’t put the PIC in just yet – leave it until the board has been checked out. There is one above-board link (insulated thin hookup wire) from the regulator to the header pin socket for which no real provision is made. It solders directly to the output pin of the regulator (righthand most pin looking at the front) and solders to an empty pad immediately alongside the header pin socket. Similarly, a connection must be made from the same point to a 4-pin connector (CON3) mounted on the rear panel. The 9-pin D connector solders directly to the PC board and pokes through a hole in the front panel, while the DC socket and the program/ run switch both connect via suitable lengths of hookup wire to their respective positions. The wires on the switch, in particular, need only be very short as they connect to the PC board immediately underneath. The switch itself is held on the front panel by Araldite, hot-melt or other suitable glue. Before we move on to the LCD module, there are a fair number of interconnections to be made between the PC-mounted terminals, the 4-pin sockets and the pushbutton switches. These are made with suitable lengths of fine hookup wire – follow the wiring diagram exactly and you shouldn’t get into too much difficulty. The LCD module There are some modifications necessary to the module. A 220Ω 1W resistor needs to be glued to the back of the board to allow it to run from 12V. Also a multi-turn trimpot is glued onto the board, as is a length of ribbon cable which connects the module to PICFUN2 (see photograph and the detail diagram in Fig.2). This terminates in a header pin plug at the PICFUN2 end but each wire must be soldered to its appropriate position at the LCD module end. Follow the diagram exactly – some pads on the module are not soldered at all while one wire must cross over its partn­ers to go to the right place. The multi-turn trimpot we mentioned before is connected to two of the same pads as the ribbon cable and to one other pad by short lengths of hookup wire. This pot varies the contrast of the LCD which also affects the viewing angle. When you’ve finished soldering the wires in place, secure the trimpot and the ribbon cable to the board with Araldite or hot melt glue. And then February 2002  69 That means the timer is ready to rock and roll. All you have to do to start it is hit the “reset” button and you’ll see the counter start, counting up in 1/100 seconds. Hit any of the four stop buttons and the display should halt (even though the counter is still running) with the exact time you pressed the button and the button itself nominated: “39.84 seconds – Stop4” Press any of the other buttons and a similar message ap­pears – the time of stopping and the button identified. The infrared sensors You don’t have to worry about building the infrared trans­mitter/receivers, as they are supplied already built and tested. All you have to do is plug them into the appropriate 4-pin socket. You can use one, two, three or four of these units, depend­ing on your application. Two are supplied with the kit. The transmitter and receiver must be aligned with each other so that they operate, and the beam must be where it will be cut by the person or thing you are timing. Press the alignment switch on the Receiver Unit and adjust the angle of the units to get the maximum intensity on the red LED. The units are now aligned. Release the switch and the sensor is now ready to use. Reprogramming the PIC This is the view inside the completed timer. The PIC chip is supplied pre-programmed so the unit should work first time if everything is correct. similarly glue the LCD module into its place inside the case lid so the display can be seen through the cutout. is, so let’s see if it works (after checking your wiring, of course). Put in the PIC! The PIC chip is supplied pre-programmed so the unit should work first time if everything is correct. Because there are pushbutton “Start” switches and a similar “Reset” switch mounted on the case, you don’t have to plug the remote triggering infrared devices in to check it out. And that’s pretty important, because we haven’t yet mentioned the remote triggering infrared devices! Plug your 12V DC plugpack in and you should be rewarded with a message that says “00.00 seconds”. The final thing to do, once you’ve checked and double-checked your component placement and wiring, is to carefully insert the PIC chip into its socket. Make sure the notch on one end of the PIC lines up with the notch on the end of the socket – and also make sure that all pins of the PIC go into the socket, not bent underneath or splayed out (it’s easy to do, trust us!). The construction side of the project is now completed. You can use it as it 70  Silicon Chip Testing While the PIC comes pre-programm­ ed, provision is made (via the D9 connector and the run/program switch JP1) to reprogram the chip at a later time if you manage to erase it (pretty difficult to do accidentally!) or if you are particularly clever and write your own code to make it do even more things. It’s also possible that eLab­tron­ ics will also have updated software available (check out their web­site at www.labtron.com.au). The original eTIMER.hex file is provided on the CD supplied with the kit, just in case. LCD software The LCD software is an assembler, or “ASM” file, which will compile and run directly on the PICFUN2 without modification. One of the features of this software is that the structure enables the user to keep a list of messages which can be easily called within the main program. Similarly, www.siliconchip.com.au the command set is listed and can also be easily called up. PC interface software We mentioned earlier that the PICFUN Timer can be also used in conjunction with your PC. In fact, in this mode, its capabili­ties are significantly extended. Just some of the applications available are as a counter, a timer or even a quiz game timer which keeps scores. Before you start, make sure your display properties setting in Windows is set to SMALL FONTS (otherwise the window may not fit the screen properly). To set up the system for “Interface-To-PC”, run setup from the CD. Plug the 9-pin female-to-female cable into the serial (COM) port on your PC but not yet into the PICFUN Timer socket. Make a note of the COM port you are using. Also beware of using male-to-female cables with gender changers. These may not always be “straight through” connections which this project requires. Once setup is completed go to your Windows Start menu, click on program and click on eTimer. The welcome window shown should appear. Click on the Welcome button, select the COM port you are using and then click on OK. The default program which will load is the Quiz Game but you can change to the Infrared Timer or Counter by clicking on the OPTIONS menu and selecting the appropriate icon. If the interface software is running properly, unplug everything from the PICFUN Timer (including power) and slide the programming switch up, towards the top of the box. Plug in the cable from your PC (it should still be connected to the PC) and then plug in power. Hold down the RESET button while sliding the programming switch DOWN towards the bottom of the unit. The message “PC Interface” should now appear on the LCD display and your PICFUN Timer is now ready to run in the Interface-To-PC mode. In all three modes of operation, you can enter the “play­ers” names into your PC according to which button numbers they are holding. You can add or subtract their points, plot the results on a graph and even save the www.siliconchip.com.au The run/program switch (JP1) is mounted on the rear panel to allow you to reprogram or update the PIC microcontroller at any time. Here’s the welcome screen (left) that you’ll see when you load the CD-ROM, along with the port selection screen (on the right). records in an Excel file. After all the player’s names have been entered, press the START button. (In the Infrared Timer mode, the start can be made with a start sensor; eg, the start of a slot car race). The timer will start counting. When a player switch is press­ ed (or a race sensor triggered), the time counted for that player will stop while others will continue counting until SC their switch/sensor is closed. Where To Buy A Kit The PICFUN Timer is available from eLabtronics, 12-20 Gilles St, Adelaide, SA 5000. Phone (08) 8231 5966. Website www.labtron.com.au Prices are as follows: eTIMER Kit (includes PICFUN2 Kit, LCD Kit, extra parts, plugpack and software) ..................................................................$138.00 Built & tested eTIMER with two sets of IR sensors ........................$198.00 Extra set of IR sensors (built & tested receiver & transmit­ter) ..........$48.00 LCD Kit (ready to plug in, with ribbon cable and software).............. $46.00 February 2002  71