Silicon Chip3-Channel Current Monitor With Data Logging - March 1999 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Time to save those old TV sets
  4. Feature: Dead Computer? Don't Throw It - Rat It! by Leo Simpson
  5. Feature: Getting Started With Linux; Pt.1 by Bob Dyball
  6. Project: Build A Digital Anemometer by Julian Edgar
  7. Serviceman's Log: Instant servicing; there's no such thing by The TV Serviceman
  8. Project: 3-Channel Current Monitor With Data Logging by Mark Roberts
  9. Back Issues
  10. Project: Simple DIY PIC Programmer by Michael Covington & Ross Tester
  11. Feature: Model R/C helicopters; Pt.3 by Bob Young
  12. Project: Easy-To-Build Audio Compressor by John Clarke
  13. Project: Low Distortion Audio Signal Generator; Pt.2 by John Clarke
  14. Product Showcase
  15. Vintage Radio: The Radiolette Model 31/32 by Rodney Champness
  16. Feature: Electric Lighting; Pt.12 by Julian Edgar
  17. Notes & Errata: Command Control Decoder
  18. Order Form
  19. Market Centre
  20. Advertising Index
  21. Book Store
  22. Outer Back Cover

This is only a preview of the March 1999 issue of Silicon Chip.

You can view 34 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.

Articles in this series:
  • Getting Started With Linux; Pt.1 (March 1999)
  • Getting Started With Linux; Pt.1 (March 1999)
  • Getting Started With Linux; Pt.2 (April 1999)
  • Getting Started With Linux; Pt.2 (April 1999)
  • Getting Started With Linux; Pt.3 (May 1999)
  • Getting Started With Linux; Pt.3 (May 1999)
  • Getting Started With Linux; Pt.4 (June 1999)
  • Getting Started With Linux; Pt.4 (June 1999)
Items relevant to "Simple DIY PIC Programmer":
  • DOS software for the Simple, Cheap DIY PIC Progammer (Free)
Articles in this series:
  • Radio Control (January 1999)
  • Radio Control (January 1999)
  • Radio Control (February 1999)
  • Radio Control (February 1999)
  • Model R/C helicopters; Pt.3 (March 1999)
  • Model R/C helicopters; Pt.3 (March 1999)
Items relevant to "Easy-To-Build Audio Compressor":
  • Audio Compressor PCB pattern (PDF download) [01303991] (Free)
Items relevant to "Low Distortion Audio Signal Generator; Pt.2":
  • Low Distortion Audio Signal Generator PCB patterns (PDF download) [01402991/2] (Free)
  • Low Distortion Audio Signal Generator panel artwork (PDF download) (Free)
Articles in this series:
  • Low Distortion Audio Signal Generator; Pt.1 (February 1999)
  • Low Distortion Audio Signal Generator; Pt.1 (February 1999)
  • Low Distortion Audio Signal Generator; Pt.2 (March 1999)
  • Low Distortion Audio Signal Generator; Pt.2 (March 1999)
Articles in this series:
  • Understanding Electric Lighting; Pt.1 (November 1997)
  • Understanding Electric Lighting; Pt.1 (November 1997)
  • Understanding Electric Lighting; Pt.2 (December 1997)
  • Understanding Electric Lighting; Pt.2 (December 1997)
  • Understanding Electric Lighting; Pt.3 (January 1998)
  • Understanding Electric Lighting; Pt.3 (January 1998)
  • Understanding Electric Lighting; Pt.4 (February 1998)
  • Understanding Electric Lighting; Pt.4 (February 1998)
  • Understanding Electric Lighting; Pt.5 (March 1998)
  • Understanding Electric Lighting; Pt.5 (March 1998)
  • Understanding Electric Lighting; Pt.6 (April 1998)
  • Understanding Electric Lighting; Pt.6 (April 1998)
  • Understanding Electric Lighting; Pt.7 (June 1998)
  • Understanding Electric Lighting; Pt.7 (June 1998)
  • Understanding Electric Lighting; Pt.8 (July 1998)
  • Understanding Electric Lighting; Pt.8 (July 1998)
  • Electric Lighting; Pt.9 (November 1998)
  • Electric Lighting; Pt.9 (November 1998)
  • Electric Lighting; Pt.10 (January 1999)
  • Electric Lighting; Pt.10 (January 1999)
  • Electric Lighting; Pt.11 (February 1999)
  • Electric Lighting; Pt.11 (February 1999)
  • Electric Lighting; Pt.12 (March 1999)
  • Electric Lighting; Pt.12 (March 1999)
  • Electric Lighting; Pt.13 (April 1999)
  • Electric Lighting; Pt.13 (April 1999)
  • Electric Lighting, Pt.14 (August 1999)
  • Electric Lighting, Pt.14 (August 1999)
  • Electric Lighting; Pt.15 (November 1999)
  • Electric Lighting; Pt.15 (November 1999)
  • Electric Lighting; Pt.16 (December 1999)
  • Electric Lighting; Pt.16 (December 1999)

Purchase a printed copy of this issue for $10.00.

You can use this easy-to-build card to monitor the current through three external loads or to monitor battery charg­ing currents. It plugs into the parallel port of your PC, is software controlled and can even automatically log sampled data to an Excel spreadsheet. By MARK ROBERTS T HIS IS A VERY versatile circuit. It accepts an external DC voltage input (up to 36V max.) which is then fed to three outputs via low-value current sensing resis­tors. It then individually monitors the currents through any external loads connected to the outputs and displays the results on a computer monitor. In use, the unit plugs into the parallel port of a PC via a DB25M connector and a DB25 male-to-female cable. An on-screen “virtual” instrument panel is used to control the card and dis­play the results – see Fig.1. This display is software generated, which means that you don’t have to buy expensive hardware items such as meters, cases, switches and knobs. As shown, the display is dominated 24  Silicon Chip by four meters – three to display the load currents and a fourth to display the external voltage input. Immediately below each current meter are two “Set Current Limit” buttons. These allow you to set individual current limits from 0-3A for each channel. Note, however, that the unit doesn’t act to limit the current as such; instead, it simply lights an indicator LED on the PC board if the current in a particular channel exceeds the set limit. A separate indicator LED is used for each channel. As well, there are Limit indicators on the control panel and these also light if the current limits are exceeded. This is shown on Fig.1, where the current in channel 3 (0.68A) has ex­ ceeded the set current limit of 0.67A. A bargraph to the left of each Limit indicator gives a quick visual indication of the current in each channel, while the meters themselves show both analog and digital readouts. By the way, there’s nothing to stop you from adding extra circuitry to the LED indicators on the PC board. The LED indica­ tor outputs on the DB25 socket go high (+5V) when the current limits are exceeded. These outputs could thus be used to drive logic circuits; eg, transistors and relays. These could be used to switch the external DC supply voltage or to disconnect the load, if the current rises above the set limit. The “Set Voltage” section on the panel has nothing to do with the external input voltage. Instead, the Fig.1: this is the on-screen virtual instrument panel generated by the software. It shows the applied external voltage plus the current flowing in each output channel. Note that the Limit indicator for channel 3 is lit here. That’s because the current in that channel has exceeded the set limit. down buttons are used to set an external voltage output on the board anywhere from 0-2V. Again, this particular output could be used to control external circuitry or to provide a variable voltage reference. Charging currents As an alternative to monitoring load currents, this unit can also be used to monitor charging currents. That’s because the current can flow through the output channels in either direction; ie, the three outputs can also be used as inputs. In practice, this means that you could connect a solar panel to one or more of the outputs and monitor the charging cur­rents into an external battery. The remaining feature of note on the main panel is the “Logging” function in the top lefthand corner. Clicking this brings up the dialog box shown in Fig.5, so that you can automat­ically log sampled data into an Excel spread­ s heet. You could use this to monitor the charging performance of a solar cell array, for example. The functions logged include the date, the time, the input voltage at the input (RS+) terminals and the current in each channel (ie, the current through each current sense amplifi­ er). There are four separate logging intervals for you to choose from: 10s, 1 minute, 10 minutes or 60 minutes. All you have to do is click the one you want. Main Features • Plugs into the parallel port of a PC. Software generates the onscreen instrument display. • Three current sensing channels (0-3A). • Instrument display has three ammeters plus a voltmeter to display the applied voltage. • Each current sense channel can be sampled and automatically logged to an Excel spreadsheet. • Logging interval can be set to 10 seconds, 1 minute, 10 minutes or 60 minutes. rent-Sense Amplifier”. In fact, three of these ICs are used in the design, one for each output channel. Fig.2 shows the basic internal circuitry of the MAX471. It contains a current sensing resistor (RSENSE), two amplifiers (A1 & A2), a couple of transistors and a comparator. Basically, the device is designed to accurately monitor current flow. In operation, the battery/load current flows from RS+ to RS- (or vice versa) via RSENSE. As a result, some current also flows through either RG1 and Q1 or through RG2 and Q2, depending on the current direction through the sensing resistor. Note that only Q1 or Q2 can be on at any one time. The two transistors are prevented from both turning on at the same time by additional internal circuitry (not shown on Fig.2 for the sake of clarity). Let’s assume initially that a load current flows from RS+ to RS- and that the OUT terminal (pin 8) is connected to ground via a resistor (ROUT). In that case, amplifier A1 supplies base current to Q1 which turns on. As a result, Q1 supplies current to the external resistor on pin 8 and this current (let’s call it IOUT) is proportional to the load current. Fig.2: this block diagram shows what’s inside the MAX471. It contains a current sensing resistor (RSENSE), two amplifiers (A1 & A2), a couple of transistors and a comparator. Only one transistor (either Q1 or Q2) can be on at any given time. The MAX471 To understand how the circuit works, we first need to look at one of its most important parts – the MAX471 “Precision, High-Side CurMARCH 1999  25 Fig.3: the final circuit uses six ICs. ICs2-4 are the current sense amplifiers, while IC5 performs A/D conversion of the analog data on its inputs. This data is then fed to the PC via the parallel port. IC6 provides the reference voltage for IC5. We can determine the value for IOUT using the following equation: IOUT = (ILOAD x RSENSE)/RG1. Similarly, the voltage across ROUT is given by the equation: VOUT = (RSENSE x ROUT x ILOAD)/RG. In practice, a value of 2kΩ for ROUT gives a value of 1V per amp of load current. The Sign output indicates the current’s direction and can be used to indicate whether a battery is charging or discharging, for example. This output is driven by a comparator which monitors the outputs of amplifiers A1 and A2. It is high for positive current flow from RS+ to RS- and low if the current flows in the opposite direction. How it works Now take a look at the circuit – see Fig.3. It uses six ICs, four LEDs and a handful of other parts, including a DB25M connector to interface to the PC’s parallel port. The three main ICs in the line-up 26  Silicon Chip are the MAX471s (IC2-IC4), which provide the three channels of current sensing. In addi­tion, there’s an MC145041 8-bit A/D converter (IC5), a MAX504 10-bit D/A converter (IC6) and a DS2401 silicon serial number. As shown on Fig.3, pins 2 & 3 of IC2-IC4 are all wired together and connected to the positive rail of the external power supply. Diode D1 is there to protect the circuit from reverse polarity protection. If the external supply is connected the wrong way around, D1 conducts heavily and blows the fuse inside the supply. Of course, this assumes that the external supply is fused at the output. If it isn’t, then you should add a 5A fuse in the positive supply line at the input of the Current Monitor. The “outputs” from the MAX471s (RS- & RS-1) appear at pins 6 & 7. These outputs are simply the other side of the internal current sense resistor, as shown in Fig.2. IC5 is used to sample and digitise the data applied to four of its address inputs (A0-A3). The data applied to A3 is derived from the paralleled RS+ inputs and reflects the applied input voltage. This voltage is fed to A3 of IC5 via a divider network consisting of resistors R6 & R7. The A0-A2 address lines independently sample the OUT pins of ICs 2-4 and this data is used to calculate the current through each device (ie, the individual load currents). In each case, a 2kΩ resistor is connected to the OUT pin so that we get 1V at the OUT terminal for each amp of load current. This voltage is then sampled via resistive dividers and fed to IC5. The signal on pin 17 (Address) of IC4 (applied from pin 7 of the parallel port) selects the input voltage to be converted. The EOC (end of conversion) output at pin 19 then goes low when conversion is completed and this signals the PC via pin 10 of the parallel port. The converted digital data is then clocked out from the DOUT pin (pin 16) and applied to pin 13 of the port, after which it is Parts List 1 PC board, 76 x 68mm 1 PC-mount DB25M connector 2 PC-mount 3-way screw terminal blocks 1 3-disc software package 1 PC stake Semiconductors 1 DS2401 silicon serial number (IC1) 3 MAX471 current sense amplifiers (IC2-IC4) 1 MC145041 8-bit A/D converter (IC5) 1 MAX504 10-bit D/A converter (IC6) 1 1N4001 diode (D1) 4 PC-mount miniature LEDs Capacitors 2 10µF 16VW PC-mount electrolytic 4 0.1µF monolithic Fig.4: install the parts on the PC board as shown here, taking care to ensure that all parts are correctly oriented. Note that the external supply should be fused; if it isn’t, connect it to the PC board via a 5A in-line fuse. the parallel port, while SCLK and CS-bar are the clock and chip select inputs respectively. The converted analog output voltage appears at pin 12 (VOUT) and can be varied from 0V to 2.048V. In addition, IC6 generates a fixed 2.048V reference voltage (REFOUT) and this is applied to pin 14 (V+REF) of IC5. Resistors (0.25W, 5%) 4 1MΩ (R7,R11-R13) 3 470kΩ (R8-R10) 1 100kΩ (R2-R4) 1 56kΩ (R6) 4 2.7kΩ (R5,R14,R15,R20) 3 2kΩ (R17-R19) 1 1kΩ (R16) 1 56Ω (R1) Silicon serial number processed by the software. The clock signal comes from pin 8 of the parallel port and is applied to pin 18 of IC4 (I/O-CK). Pin 6 of the parallel port controls the chip select (CS-bar) input of IC5. IC6 is a MAX504 10-bit digital-to analog (D/A) converter. The serial data generated by the software is fed into pin 2 (DIN) from pin 2 of IC1 is a Dallas Semiconductor DS2401 “Silicon Serial Number”. Its function is to confirm that the correct hardware is connected to the printer port. This is done to eliminate possible damage if you attempt to run the Current Monitor software and a printer or some other device (eg, a scanner) is connect to the parallel port. The DS2401 comes in a standard TO-92 package but only two of its pins (ie, Data and GND) are used. Each device comes with a unique registration number and this number is read by the soft­ware via pin 16 of the parallel port. If the number matches the number programmed into the software, the software functions normally. If the numbers don’t match or it cannot find the de­vice, the program won’t load. This means that the software supplied with each individual DS2401 is tailored to match that device. The same software will not work with other hardware because the code number will be different. Power for the circuit is derived directly from pin 9 of the parallel port which supplies a +5V rail. This means that no external power supply is required to run the circuit. Construction All the parts, including the DB25M connector, are installed on a PC board measuring 76 x 68mm. Fig.4 shows the assembly details. Begin the assembly by installing a Resistor Colour Codes  No.   4   3   1   1   4   3   1   1 Value 1MΩ 470kΩ 100kΩ 56kΩ 2.7kΩ 2kΩ 1kΩ 56Ω 4-Band Code (1%) brown black green brown yellow violet yellow brown brown black yellow brown green blue orange brown red violet red brown red black red brown brown black red brown green blue black brown 5-Band Code (1%) brown black black yellow brown yellow violet black orange brown brown black black orange brown green blue black red brown red violet black brown brown red black black brown brown brown black black brown brown green blue black gold brown MARCH 1999  27 Fig.5: clicking “Logging” on the virtual instrument panel brings up the Logging System dialog box shown at right. This lets you select the logging interval, after which you can automatically log to an Excel spreadsheet, as shown above. PC stake at the Analog Output position (near pin 1 of IC6), then install the 13 wire links. Note that one of these links (shown dotted) goes under the DB25M connector (SK1). The resistors and capacitors can go in next. Take care to ensure that the two 10µF electrolytics are installed with the correct polarity. Table 1 shows the resistor colour codes but it’s also a good idea to check the values using a digital multi­meter. The six ICs (including the DS2401) should now be installed. Note particularly that IC5 and IC6 face in opposite directions to each other. IC sockets were used on the prototype for the three MAX471 devices but these are not really necessary – just solder the devices directly to the PC board. Finally, complete the assembly by installing the DB25M connector, the insulated screw-terminal blocks, diode D1 and the LEDs. Make sure that the LEDs are correctly oriented – in each case, the anode lead is the longer of the two, while the LED lens is slightly offset towards the cathode. Go over your work and check the PC board carefully for mistakes before connecting the unit to a computer, 28  Silicon Chip ready for testing. You can either plug the unit directly into the parallel port or connect it via a DB25 maleto-female printer cable. The latter is certainly the most convenient, particularly when is comes to connecting external power supplies and loads. Installing the software The software comes on three floppy discs and runs under Windows 3.1x, Windows 95 and Windows NT. You install it by run­ning setup.exe on the first disc and then following a few onscreen instructions. In Windows 95, for example, you click Start, Run and then type A:\setup.exe in the space provided (assuming that the floppy disc is in the A: drive). The installer program creates the appropriate program group and installs a shortcut in the Start menu. In Windows 3.1x, you click File, Run and type A:\setup.exe. When you boot the software, it first opens a dialog box that lets you select between two printer ports (LPT1 and LPT2). LPT2 is the default but most users will have to select LPT1 since they will only have one parallel port on their comput­er. You then click OK to bring up the panel shown in Fig.1. Initially, the display will be off, since the Power is off. You turn the display (and the unit) on by clicking the Power button at bottom left. Check that the power LED (LED4) on the PC board lights when you do this. Don’t worry if one or more of the LEDs (including the Power LED) on the PC board lights while the computer boots up – everything should be normal after the Cur­ rent Monitor software is loaded. By the way, once you’ve selected a port, it can be saved as the default by clicking the Power button on and then off again (this rewrites the io.ini file). The software will now always boot with the new port as the default, unless you change it again. Clicking the power button to off also saves the three current limit settings and the analog voltage output setting, so that they are automatically reloaded the next time you run the software. Testing It’s now simply a matter of checking that everything works correctly. First, connect an external DC power supply to the Input and GND terminals (via Where To Buy Parts Parts for this design are available from Softmark, PO Box 1609, Hornsby, NSW 2077. Phone/fax (02) 9482 1565; email softmark<at>ar.com.au Hardware MAX471 precision, high-side current sense amplifier (price ea.) ........... $6 MAX504 10-bit D/A converter .............................................................. $10 MC145041 8-bit A/D converter ............................................................... $5 DB25M connector .................................................................................. $2 PC board .............................................................................................. $10 Full kit (hardware only, with three MAX471 ICs) .................................. $45 Optional parallel port card .................................................................... $15 Software Version 2.0 with logging ....................................................................... $30 Version 1.0 without logging .................................................................. $20 Payment by cheque or money order only. Please add $5 for postage. Note: the software associated with this design is copyright to Softmark. a suitable fuse – see above) and vary the supply between 0-30V. Check that the supply output is accurately shown on the voltmeter (lefthand side of the on-screen display), then set the supply to 5V. You can now simulate an external load by briefly connecting a 5.6Ω 5W resistor between O/P1 and GND. The meter for Current Output 1 should show a reading of about 1A. Don’t leave the resistor connected for more than a minute or so though, since it will be running at the limit of its t u b d e l i o s p o Sh ! E C I R P F L HA rating and will get very hot. Now do the same for the other two output channels; ie, connect the resistor between O/P2 and GND, then between O/P3 and GND. In each case, check that you get the correct current reading (1A) on the ammeter for that channel. If all is well, you can now check the current limit warning indicators. You do this simply by setting the current limits for each channel to a figure less than 1A, then briefly connecting the 5Ω resistor to each output in turn. In each case, the Limit indicator should light for the channel that’s being tested and should go out again when the resistor is removed or if the cur­rent limit is increased above 1A. In addition, the corresponding Limit LED should light on the PC board. The analog voltage output should also be checked. This is done by connect a voltmeter between the analog output and GND and clicking the Set Voltage buttons on the display. Check that the output can be varied between 0V and 2.048V. Data logging tests Finally, the logging feature should be checked out. To do this, first click “Logging” at the top left of the main window to bring up the dialog box shown in Fig.5, then select the “Logging Interval” and click the On/Off button. Excel should now automatically launch and log the sampled data at the selected time interval into the spreadsheet. To stop the logging process, click the On/Off button on the Logging System dialog box. The program will then instruct you to click the Save + Exit button, after which you can save the spreadsheet to a file and directory of your choosing. The Logging System dialog box is then closed by clicking the “Back To Main SC Form” button. 14 Model Railway Projects THE PROJECTS: LED Flasher; Railpower Walkaround Throttle; SteamSound Simulator; Diesel Sound Generator; Fluorescent Light Simulator; IR Remote Controlled Throttle; Track Tester; Single Chip Sound Recorder; Three Simple Projects (Train Controller, Traffic Lights Simulator & Points Controller); Level Crossing Detector; Sound & Lights For Level Crossings; Diesel Sound Simulator. Our stocks of this book are now limited. All we have left are newsagents’ returns which means that they may be slightly shop-soiled or have minor cover blemishes. SPECIAL CLEARANCE PRICE: $3.95 + $3 P&P (Aust. & NZ) This book will not be reprinted Order by phoning (02) 9979 5644 & quoting your credit card number; or fax the details to (02) 9979 6503; or mail your order with cheque or credit card details to Silicon Chip Publications, PO Box 139, Collaroy, NSW 2097. MARCH 1999  29