Evaluation Board for the SA9904B Energy Metering IC sames PM9904BPD FEATURES + Designed to + + + + be used together with accompanying software as fully functional three phase trivector meter. Better than class 1 operation. On board power supply. Two on-board LED’s for active and reactive pulse output. 3 Phase 4 wire configuration. + + + + + On-board LCD display. On-board current transformers. Isolated connection to PC parallel port. Easy accessible test pins. Micro-controller plug-in support DESCRIPTION This application note describes the PM9904BPD evaluation board and together with the SA9904B data sheet provides a complete evaluation platform. The SA9904B is an accurate bidirectional power / energy measurement IC with serial (SPI) interface measuring active as well as reactive power / energy, RMS voltage and frequency. More detailed information specific to the of SA9904B can be found in its datasheet. The SA9904B forms the energy/power metering front-end of the module and connects to the SPI bus. Sharing the SPI bus is the SA8807A LCD driver which is capable of driving 96 segments on a 4 back plane LCD. The PM9904BPD evaluation board is configured and calibrated via the parallel port of a PC. The data interface between the evaluation board and the PC is fully isolated. The PM9904BPD module is designed for a three-phase fourwire applications, referenced to neutral. The mains voltages easily connect to module by way of a Molex connector (SK1). The 3 on-board current transformers measures the current in each phase. A simple capacitive power supply supplies the energy metering IC with power. The LM431 regulators are used to generate a 5 V supply voltage for the on-board optocouplers. Provision has been made to connect an external 5V power supply to drive the isolated opto-coupler. The PM9904BPD module can easily be connected to a microcontroller. The SAMES micro-controller board connects to the evaluation module by means of JP1 thereby creating a complete power meter without the PC interface. Physically the micro-controller board plugs into the evaluation module with its opto-coupler facing the mains connector (SK1). It shares the SPI bus with the SA8807A onboard LCD controller. JP4 PCVSS SK1 VDD GND Power Supply CT1 SK3 PCVDD LCD DISPLAY GND VSS VDD PCVSS PCVDD SA8807A Resistor Network JP2 JP1 CT2 Resistor Network SA9904A J12 F50 CT3 JP3 PCVSS Resistor Network Test Pins VDD VSS PCVSS Test Pins Figure 1: Block diagram SPEC-0448 (REV. 6) 1/22 19-06-02 sames PM9904BPD JUMPER SETTINGS Power supply jumpers with the PM9904BPD module the jumpers must be closed, and can be left closed in the case of the SAMES micro-controller board. This board is capable of driving the SPI bus in this state. Default Closed. The power supply jumpers are used to disconnect the onboard power supply, allowing the metering section of the circuit to be powered from an external power supply if required. Jumper J4 J5 J6 J7 Description Connects VDD to the metering circuitry. Default closed Connects VSS to the metering circuitry. Default closed GND connection point. An additional output from the module is made available to the parallel port of the PC. The output can be selected to be the SA9904B’s F50 output or it can be selected to be the modules push button output. Connection point between the power supply GND (N) and the SA9904 GND. Default closed Jumper Voltage selection jumpers J12 The following jumpers are used to select between 115V and 230V operation. When closed the series resistance in the voltage divider circuits to the voltage sense inputs are halved. Default Open. Jumper J1 230V 115V OPEN Closed J2 OPEN Closed J3 OPEN Closed Description PB (left connection) - Connects the push button output through a opto-coupler to pin 13 of the parallel port F50 (right connection) - Connects pin 7 of the SA9904 through a opto-coupler to pin 13 of the parallel port Parallel power supply jumper Jumper JP4 is used to select the power source for the optocoupler U7. Power can be taken from the PC’s parallel port or from an external 5 volt supply via SK3. Jumper Communication jumpers Jumpers J8 to J11 connect pull up resistors to the SPI inputs of the SA9904. The pull up resistors are required by the open drain outputs of the HCPL2631 opto-couplers. If a PC is used Right connection - Connects U7 to SK3. An external power supply can be connected to SK3 to power U7. SK3 N PH3 PH2 PH1 SK1 JP4 Description Left connection - Power for U7 is taken from the PC’s parallel port (pins 1, 14,16,17) sames PM9904AP JP2 JP4 Micro board J12 F50* JP1 JP3 PB J8 J9 J3 J2 J1 J10 J11 J7 J6 SK2 Push button GND J5 VSS J4 VDD *On some pcb’s this may be labled as PB / F150, however f50 and f150 is the same connection. Figure 2: Jumper positions http://www.sames.co.za 2/22 sames PM9904BPD CONNECTOR DESCRIPTION Jumper SK1 SK2 SETTING UP THE PM9904AP MODULE Figure 3 below shows a typical setup for the PM9904BPD evaluation module. The three phase voltages are connected directly to SK1 and each corresponding phase current is wired through the on-board CT’s. An external power supply can be connected to SK3 should the PC’s parallel port not be able to source enough current for the module's opto-couplers. Description Connects the three phase 4 wire supply to the module. Female BD25pin connects the evaluation board to the PC parallel port by a 1 to 1 cable. The module is isolated from the PC by the opto-couplers. SK3 5V supply to U7 opto coupler JP1 This header strip can be used for measuring the I/O pins of the SA9904B and SA8807. Note that this connector is on the same potential as the SA9904B. Provision is made for VDD and VSS so that a board with a micro controller can be easily fitted without any additional wiring. Signals available on this connector are: Figure 3 also shows the default jumper settings. The PM9904BPD evaluation module is setup by default for 3x 230V/80A operation. For 3x 115V operation jumpers J1, J2 and J3 need to be closed. Also capacitors C12, C13, and C14 values must be changed to 1uF / 150 VAC. When these hardware settings have been verified the user has the choice of using the micro-controller board or a PC to evaluate the SA9904B further. Please note when using the PC the micro-controller board should be unplugged to prevent a bus contention on the SPI bus, since the PC and microcontroller would be attempting to drive the bus simultaneously. Pin number Signal SA9904 (U1) SA8807 (U2) 1 VDD Pin 6 Pin 13 2 VSS Pin 14 Pin 26 3 F50 Pin 7 NC 4 SCK Pin 8 Pin 18 5 CS Pin 13 NC 6 MISO Pin 9 Pin 20 7 MOSI Pin 12 Pin 19 8 CE NC Pin 21 Micro-controller board Once the board has been plugged into the evaluation module no further action is required, just apply power. PC After removing the micro-controller board the evaluation board can connected to the PC’s parallel port using a 1 to 1 parallel cable (not supplied). Once the evaluation board has been connected to the PC and powered up, the supplied software can be launched. Refer to the next section for the software installation and setup details. MISO - Master In Slave Out MOSI - Master Out Slave In N Load PH1 PH2 PH3 SK1 5V CT3 CT2 CT1 JP4 J3 JP2 Supp Sel J12 PB/F150 JP1 SK2 SPI Port VSS J4 VDD OUT JP3 J10 J11 GND J5 J8 J9 To PC Parallel port J7 J6 Figure 3: PM9904AP setup and connection http://www.sames.co.za 3/22 J2 J1 sames PM9904BPD PM9904BPD EVALUATION SOFTWARE Getting the SA9904 to generate pulses proportional to the energy measured. Software for the SA9904AP module is supplied on one 3.5” 1.44MB floppy disk and is designed to communicate with the SA9904AP module via the PC’s parallel port. The supplied software is written for DOS. Additional Windows software will be posted to the SAMES web site for downloading when available. The source code, written in Turbo C, is also included. Figure 4 is a flow diagram showing how to generate pulses proportional to energy measured by the SA9904A. The speed of execution is not critical, although it will influence the resolution of the pulses that is generated. It is recommended that the flow diagram be implemented together with a timer interrupt used for the creep timing. The same flow diagram is applicable for the SA9604A, but reading of the register values should be synchronized with changes in bit D19 of its frequency register. File description The following files are included on the floppy disk: 9904mtr.c This file contains the source for the functions that read the SA9904 registers, store these values in integration registers, check for any overflow and generate the corresponding energy pulse for the PM9904BPD on-board LED’s. It makes provision to measure unbalanced energy per phase or sum the energy for each phase. The software does not make use of timers and relies on counting the software loops to generate reasonable delays for the LED outputs. Read Active Register Subtract previous value Check and fix register value wrapping pc_spi.c This file contains the source for all the SPI interface routines which are used to communicate between the PM9904BPD module and th e PC’s parallel port. Add to active energy integrator pc_lcd.c This file contains the source for all the functions relating to the SA8807 LCD driver IC, as well as other functions to switch on the LCD display icons. If integrator > threshold No Wait for next measurement cycle Do other functions on the meter Yes Subtract threshold from integrator 9904mtr.exe This is the executable file. Load creep timer Running the software The program is executed by running the 9904mtr.exe file with the following arguments: 9904mtr.exe 1 10 Generate pulse Figure 4: Pulse flow diagram The first parameter specifies the LPT port address to use where 1= 0x378 (LPT1) and 2 = 0x278 (LPT2). Threshold and pulse rates The second parameter is a loop delay. Larger values will slow down the SPI communication speed to the PM9904BPD module. The active and reactive registers on the SA9904B increment at a rate of 320 000 counts per second at rated metering conditions for a sine wave. A single count of the active register corresponds to an amount of energy expressed in Watt seconds (Ws). Energy per count is (Ws): Epc = Vnom x Imax / 320 000 http://www.sames.co.za 4/22 sames PM9904BPD where: Vnom is the mains voltage and correspond to 14µA in the voltage inputs of the SA9904B. Imax is the maximum mains current to be measured and correspond to 16µA on the current inputs of the SA9904B. The simplest way to implement the creep threshold is to relate it to the time between meter pulses. If the time between pulses is more than the limit, the energy accumulator is cleared. Pulse rate of meter at rated conditions (Hz): Rf = ( Vnom x Imax / 1000 ) x ( Mpr / 3600 ) The pulse rate required for a meter is usually expressed in pulses/kWh. A single pulse on the LED is mostly a fraction of a kWh and is converted to energy in Ws/pulse where: Vnom is the mains voltage and correspond to 14µA in the voltage inputs. Imax is the maximum mains current to be measured and correspond to 16µA on the current inputs of the device. Mpr is the meter pulse rate in pulses/kWh. Energy per LED pulse is (Ws/pulse): Epp energy = 1000 x 3600 / Mpr where: Epp is energy per LED pulse Mpr is the meter pulse rate or meter constant in pulses/kWh Creep threshold time (s): Ct = 1/(Cc / Imax) x Rf The threshold is calculated by dividing the energy represented by a LED pulse by the energy per register count. where: Cc is the specified creep current; energy below this value is discarded. Imax is the maximum mains current to be measured and correspond to 16µA on the current inputs of the device. Rf is the rated current frequency. Active energy threshold = Epp / Epc The threshold is thus the amount of energy to be measured (accumulated / integrated) by the meter before a LED pulse is generated. The flow diagram (figure 6) for the timer interrupt shows how the time between pulses is measured, if the time since the last pulse is more than the time measured, the integrator is reset and a new count down is started. Integrator Amplitude Pulse threshold Threshold value subtracted from integrator Start Timer Interrupt No Integrator zero Yes If LED On Decrement LED ON timer Pulse LED Yes Pulse Generated If LED ON Timer = 0 Reg 8 add to Integrator Reg 4 add to Integrator Reg 0 add to Integrator Switch LED off Figure 5: Implementation of an overflow integrator No Yes If creep timer > 0 Decrement creep timer Meter creep current For the SA9904B meter creep must be taken care of in software. From the explanation above on how to generate pulses, the meter must also be prevented from pulsing in cases where the energy measured is less than the creep threshold as per the meter specification. The creep current is defined as the limit for measured energy, any energy less than the creep threshold is discarded, and energy above the creep threshold is measured. Yes If creep timer = 0 Load creep timer No Exit Interrupt Reset integrator Figure 6: Interrupt flow diagram http://www.sames.co.za 5/22 sames PM9904BPD THE MICRO-CONTROLLER BOARD OVERVIEW Keys Four keys are provided of which one is connected to the microcontroller’s reset pin. The other three are available to implement an HMI (Human Machine Interface) in the firmware; they’re labelled Up/Down and Enter on the printed circuit board. This section describes the plug-in micro-controller board and should be read in conjunction with the evaluation software section, where basic metering software is described. The micro-controller’s software was developed according to this section. The board plugs into the evaluation module as described earlier in this application note. Rate outputs Two LEDs are provided for active and re-active energy respectively. These pulse outputs can be coupled to an optocoupler via JP3/4 providing an output for external usage. This output-pulse selection is accomplished with a jumper on JP3/4 as follows: + Jumper on board’s outside edge = a ctive + Jumper on board’s centre pins = re -active + Jumper on board’s inside edge = not used 1 Miscellaneous Connectors JP1 and JP2 are provided to ease debugging during code development, all relevant signals are available. J1 in conjunction with SK2 are the two plug-in points to the evaluation module, where SK2 is the SPI connector and J1 merely a stabilising holder. The micro-controller is programmed via SK1 using the controller’s ICSP (in circuit serial programming) capability, as described in the relevant MICROCHIP datasheet. If the intention is to program the board from MICROCHIP’s PICSTART-programmer a buffer needs to be inserted in the VDD line to boost the programmer’s output capability. An example of such a buffer is shown in Figure 8. Figure 7: Micro-controller board Hardware The schematic is presented in Figure 18. As can be seen the major elements are: + micro-controller, + eeprom, + keys, + rate LEDs / opto-isolated rate pulse output + and miscellaneous connectors. >5V 820K R1 Micro-controller A PIC 16F876-20/so is used to generate the rate pulses, in this application the micro uses a 20 MHz crystal (X1). This device has 8kB Flash ROM (program memory) and 368 Byte RAM (data memory). Detail information on the device can be obtained in the appropriate MICROCHIP datasheet. 100R R3 2N3906 EEPROM A 93C46 EEPROM provides storage for non-volatile data, such as calibration factors. This device has 1 kB space available or stated differently 128 x 8bit words. I/P 2N3819 O/P 1.2M R5 820K R2 0V Figure 8: Typical buffer circuit http://www.sames.co.za 6/22 sames PM9904BPD Firmware The micro-controller’s code was created according to the guidelines set out in the evaluation software section. It is presented as a kick-start to experimentation with the microcontroller module and as such shouldn’t be seen as the best (or only) possible implementation. The code was generated using Hi-Tech PIC C (v7.86PL4); the demo version on their www site (www.htsoft.com) is sufficient for experimentation. The program flow is presented in Figure 9. method of deciding what the predefined value should be is to measure the time between two pulses at the lowest permissible load current, this is then expressed i.t.o basic timer ticks. User Interface A simple interface has been implemented using two of the three available keys. The Enter Key toggles display of consumed kWh and kVARh units. The Down Key displays per phase voltage and frequency data, each press shows the next phase’s data. SPI Bit-banging SPI is used to aid portability to other micros, i.e. three port pins under direct software control creates SPI_CLOCK, MOSI and reads MISO. The SPI access of the SA9904B is divided into two tasks namely, fast and slow changing data. This is accomplished via an interrupt driven time-slicing architecture, with a basic timer tick of 10ms. Memory Usage ROM: 4070 words or 50% of the total capacity RAM: Bank0 Bank1 Bank2 Bank3 Rate LEDs / opto-outputs The 10ms pulse widths on these outputs are derived from the basic timer tick. Creep The creep algorithm is simply: - if the time between two successive pulses is greater than a predefined maximum, the respective energy accumulator is cleared. The simplest 86% 26% 83% --- or 50% of the total capacity Please refer to the readme. 1st file for any updated information not contained in this application note. The mentioned file is part of the source code that accompanies this module. /* Switch Power on */ START Setup Ctrler’s ports and interrupts init() Displays the start-up screens on LCD boot_scrn() Read voltage and frequency registers. Read energy registers User Interface isr() interrupt service routine: 10ms ticks ctrl fast & slow tasks ctrl pulsing of rate LEDs Manage interrupt on keypress process_a_data() process_r_data() END Figure 9: Program flow http://www.sames.co.za 7/22 /*Power off*/ sames PM9904BPD CIRCUIT DESCRIPTION ANALOG SECTION Voltage Divider The analog (metering) interface described in this section is designed for measuring 3 x 230V/80A with precision better than Class 1. Referring to figure 11 the connections for the voltage sense input for one phase is shown. The current into the A/D converter (IVP) is set 14µARMS at nominal mains voltage. This voltage sense input saturates at approximately 17µARMS. A nominal voltage current of 14µA allows for 20% over driving. Each phase voltage is divided down by a voltage divider to 14V. The current into the voltage sense input is set at 14µA via a 1MW resistor. The most important external components for the SA9904B integrated circuit are the current sense resistors, the voltage sense resistors and the bias setting resistor. The resistors used in the metering section are of the same type to minimize any temperature effects. The following equation is used to calculate the 14V voltage drop: RA = R22 + R23 + R24 +R25 RB = R8 || R13 Combining the two equations gives: (RA + RB) / 230V = RB / 14V A 24kW resistor is chosen for R13 and a 1MW resistor is used for R8. Substituting these values result in: RB = 23.44kW RA = RB x (230V / 14V - 1) RA = 361.6kW Bias Resistor Pin VREF (SA9904B pin 15) is connected to Vss via R7 which determines the on chip bias current. With R7=47kW optimum conditions are set. VREF does not require any additional circuitry. CT Termination Resistor The voltage drop across the CT termination resistors should be at least 16mV at rated current (Imax). The on-board CT's have low phase shifts and have a ratio of 1:2500. Each CT is terminated with a 2.7W resistor resulting in a voltage drop of 86.4mV across each resistor at rated conditions. Resistor values of R22, R24 are chosen to be 82kW and resistors R23 and R25 is chosen to be 120kW each. Current Sense Resistors Referring to figure 10 the resistors R1 and R2 define the current level into the SA9904B’s current sense inputs (phase one IIP1 and IIN1). The resistor values are selected for an input current of 16µA into the current inputs at rated conditions. The three voltage channels are identical so R14= R16 =R17 = R18 = R20 = R22 = R24 = 82kW and R15= R17 =R19 = R21 = R23 = R25 = 120kW The capacitors C3, C4 and C5 is used to compensate for phase shifts between the SA9904’s voltage sense inputs and current sense inputs. The on-board CT's were characterized and found to have a constant phase shift of 0.18 degrees. The value of the phase shift compensation capacitors were calculated as follows: C = 1 / ( 2 x p x Mains frequency x R5 x tan (Phase shift angle)) C = 1 / ( 2 x p x 50Hz x 1MW tan (0.18 degrees )) C = 1.013µF According to equation described in the Current Sense inputs section of the datasheet: R1 = R2 = (I / 16µA) x RSH / 2 = 80A /2500 / 16µA x 2.7W / 2 = 2.7kW where: I = Line current / CT Ratio The three current channels are identical so R1 = R2 = R3 = R4= R5 = R6. V1In R1 CT1 R26 2.7R V1 Out 2.7k R2 TZ76 GND J3 Pin 19 V1In R23 R24 R25 82k 120k 82k 120k C5 R13 1u 24k Pin 18 2.7k GND Figure 11: Mains voltage divider Figure 10: Current input configuration http://www.sames.co.za L1 R22 8/22 R8 1M Pin 17 sames PM9904BPD Power Supply Power Supply routing and de-coupling Referring to figure 15, capacitor C10 is charged through D2 during the positive half of the sine wave from the R29, C12 mains voltage dropper. Identical charging circuitry exists for the other two phases. During the negative sine wave, C11 is charged through diode D1. The unregulated voltage charged on C10 and C11 is limited to 47 V by means of zener diode D7. Resistors R32 and R33 act as current limiting resistors that feed the unregulated voltage to the positive and negative voltage regulators U3 and U4. The voltage regulators need a load capacitance of around 10µF (C8 and C9) to be in a stable operating region. C15 acts as a supply voltage storage capacitor. The 5V supply is de-coupled and routed directly to the power pins of the SA9904B by means of capacitor C15. Care was taken not to have current flowing in the node that connects the voltage reference resistor to VSS as it may introduce power supply noise on the voltage reference circuit. Jumpers J4, J5 and J7 allow the power supply to be completely disconnected form the metering section from the device. THE SA8807A LCD DRIVER Signal Routing The signal routing is done in such a manner that any signal coupling in to the measured signal will be a common mode noise signal and is subsequently rejected. Care should be taken that the signals to the SA9904B not be influenced by other sources such as electric fields from transformers etc. OVERVIEW PCB DESIGN The PM9904AP evaluation module represents a Class 1 meter and is designed to demonstrate the functionality and performance of the SA9904B metering integrated circuits. The SA9904B is mainly the analog front end of a meter. The SA9904B measures the energy, voltage and frequency which are made available to an external micro-controller, by way of JP1, or to a PC. When the meter ’s PCB is designed, it should be remembered that the SA9904B inputs are analog and special care need to be taken with the power supply and signal routing to the SA9904B. Protection The SA9904B should be protected from the measuring environment. This is achieved by using resistor dividers to scale all the SA9904B’s input signals. MOV's Z1, Z2, Z3 together with resistors R29, R30, R31 protect the power supply capacitors as well as the voltage sense inputs. The current setting resistors on the current sense inputs attenuates any common mode and asymmetrical transients. Component placement All the resistors on the SA9904B’s current sense inputs should be placed as close as possible to the SA9904B. This eliminates the possibility of any stray signals coupling into the input signals. Ground Plane The GND pin of the SA9904B is connected to the neutral phase, which is halfway between VDD and VSS. Note that supply bypass capacitors C1 and C2 are positioned as close as possible to the supply pins of the SA9904B, and is connected to a solid ground plane. Capacitor C6 is also positioned as close as possible to the supply pins of the SA9904B for proper supply bypassing. http://www.sames.co.za The SAMES SA8807A Liquid Crystal Display (LCD) driver is capable of driving up to 96 LCD segments and is designed for displays having 3 or 4 track multiplexed back planes. The SA8807A includes an on-chip oscillator and needs only a single external capacitor. Communication to the SA8807A is via the Serial Peripheral Interface (SPI) which is shared with the SA9904B. This LCD driver is ideal for any micro-controller based system requiring a liquid crystal display of up to 12 seven-segment digits. USING THE SA8807A Oscillator The SA8807A includes an on-chip oscillator that is controlled by a single external capacitor. Adjusting the capacitor value will change operating frequency of the SA8807A. The back plane multiplexing is a function of the SA8807A operating frequency. It is thus important to select the frequency high enough that the multiplexing of the display is not noticeable, but still within limits of the LCD display reaction time. f =7µF x 0.1Hz / C f = Required oscillator frequency f / 8 = back plane multiplex rate for a 4 back plane display SPI Interface The SA8807A shares the SPI interface with the SA9904B and connects directly to the opto-couplers on the PM9904BPD evaluation board. The CE signal enables the SPI interface for the display driver and the CS signal enables the SPI interface for the SA9904B. 9/22 sames PM9904BPD Commands To write to the device the following address is passed: 1 0 A5 A4 A3 A2 A1 A0 The demonstration software uses a buffer in memory on the PC to generate the complete display. The buffer is dumped to the LCD driver device in one go. The data passed to the driver IC is formatted with a starting address followed by the data for all segments. The first 8 bits is interpreted as address byte and the rest of the data is sequentially passed as data bytes. The address counter on the driver IC is incremented every 8 clocks. The procedure is repeated until all of the LCD memory is filled up. Data Data to the device is passed with MSB first D7 D6 D5 D4 D3 D2 D1 D0 Were D7 and D3 map to pin VR[3] of driver and COM4 of LCD Were D6 and D2 map to pin VR[2] of driver and COM3 of LCD Were D5 and D1 map to pin VR[1] of driver and COM2 of LCD Were D4 and D0 map to pin VR[0] of driver and COM1 of LCD See SA8807A datasheet for more information. Address The address of the data is set up in the following manner b g g c Cost b 4 e d c e d h DR-01255 Pin1 COM2 COM3 COM4 h » T4 f 1 Pin2 BACKPLANES Com » T3 f » Total COM1 a » T2 a » T1 Cosf » Pin32 » Pin35 » Pin36 Pin5 COLUMNS Figure 12: Mapping of a single character Address 5 4 3 2 1 0 30 7 32 5 33 4 34 3 35 2 36 1 COM1, 17 5f 5a 4f 4a 3f 3a 2f 2a 1f 1a Cosi T1 COM2, 18 5g 5b 4g 4b 3g 3b 2g 2b 1g 1b Total T2 COM3, 19 5e 5c 4e 4c 3e 3c 2e 2c 1e 1c Com T3 COM4, 20 5d 5h 4d 4h 3d 3h 2d 2h 1d 1h Cost T4 LCD Pin Table 1: LCD display memory map Address 11 10 23 LCD Pin 8 9 7 6 21 16 22 15 24 13 26 11 28 9 COM1, 17 Blank Blank k1 k2 % Error V 8f 8a 7f 7a 6f 6a COM2, 18 Blank Blank Hz W imp/KWh A 8g 8b 7g 7b 6g 6b COM3, 19 Blank Blank ~1 s Wh/imp r 8e 8c 7e 7c 6e 6c COM4, 20 T1, T2, T3, T4 Total ~2 h ~3 h 8d 8h 7d 7h 6d 6h Table 2: LCD display memory map (continued) http://www.sames.co.za 10/22 sames PM9904BPD THE LIQUID CRYSTAL DISPLAY 4-R1.0 Hz ~3 ~2 ~1 k1 kWrh kWsh 8h k2 Wh/imp 4.6 T1 2.8 Max. 1.1±0.1 DETAIL OF DIGIT (1 ~ 8) d . e 4.0° 0.25±0.05 0.5 0.8 . c b a 1 f 10.0±2.0 58.0 REAR GLASS 2.54±0.05 T2 . . . . REAR POLARIZER(Reflective) 60.0 ±0.8 12.3 T3 . . 4 g FRONT GLASS FRONT POLARIZER 1.5 . . 27.6 5.0 . . . 7 6 1.5 5 .2 3 2 .5 ± 0 .2 2 0 .6 ± 0 .6 16.8 . c b g 2.13 1.4 1.0 Max. 1.9 1.0 Max. DR-00902 t3 t1 t2 4.27 8.41 t4 4.3 7.18 T1Coso T2Total T3Com T4Cost . e 16.45 d a 1 f 3.4 1h . 4.6 1.6 3.5 0 .6 ± 0 .6 2 .5 ± 0 .2 2.54±0.05 3.1 17 x 2.54 = 43.18±0.1 7.8 4.0 2 0.65 T4 TOTAL . 8 . imp/kWh 1.95 2.4 %Error 8.3 8.41 1.0 2 3 . 0 ± 0 0. 7.5 8.0 Max. 4.5 7.5 14.0 Min. Viewing Area 4.5 Figure 13: All the Icons and Dimensions of LCD Pin 36 35 34 33 32 COM1 cosf 1f 2f 3f 4f 5f 6f 7f 8f %Error k1 COM2 Total 1g 2g 3g 4g 5g 6g 7g 8g imp/KWh Hz COM3 Com 1e 2e 3e 4e 5e 6e 7e 8e Wh/imp ~1 COM4 Cost 1d 2d 3d 4d 31 T1 30 5d 29 T2 28 6d 27 T3 26 7d 25 T4 24 8d 23 22 21 23 COM3 ~2 Total ~ 3 23 COM4 Table 3 : Mapping of display Pin 1 2 3 4 5 COM1 T1 1a 2a 3a 4a 5a 6a 7a COM2 T2 1b 2b 3b 4b 5b 6b COM3 T3 1c 2c 3c 4c 5c 6c COM4 T4 1h 2h 3h 6 4h 7 8 5h 9 10 6h 15 16 17 8a V k2 COM1 7b 8b A W 7c 8c r s h h 11 12 13 7h Table 4 : Mapping of display (continued) http://www.sames.co.za 11/22 14 8h 18 COM2 sames PM9904BPD SCHEMATIC V3 In C1 R15 82k R16 120k R18 PH2 B1 R19 82k R22 PH1 82k A1 R23 82k A4 120k U1 19 IIN1 GND IVP1 TZ76 18 IIP1 2.7k GND IVP2 R3 CT2 R13 16 GND R2 2 IIN2 IVP3 R8 C5 1u 20 1M R9 3 1M R10 1 F50 SCK CS DI DO IIP2 2.7k GND R5 CT3 C4 1u C3 1u 1M R4 TZ76 24k 17 2.7k R27 2.7R 5 7 8 13 12 9 JP1 F50 SCK CS MOSI MISO SCK CS DI DO IIN3 1 2 3 4 5 6 7 8 VDD SPI Port R6 TZ76 4 IIP3 OSC1 10 2.7k GND J7 C2 220n X1 3.5795MHz R7 V3 Out 15 VREF OSC2 11 GND 47k GND N 14 N Node VDD VSS F50 SCK CS MISO MOSI CE F50 2.7k R28 2.7R V1 Out R25 2.7k R26 2.7R V2 Out R12 24k A3 82k R1 CT1 B4 120k JUMPS2 J3 R24 120k R11 24k R21 B3 A2 V1In C4 120k JUMPS2 J2 R20 120k R17 C3 82k B2 V2 In JUMPS2 J1 C2 R14 PH3 VSS VSS VDD 6 C1 220n C6 1u VDD SA9904B VSS Figure 14 : Schematic diagram of metering section VP PH1 C12 R29 LL1 N PH2 1N4007 1N4007 470/1W 470/250VAC SK1 PH1 PH2 PH3 N D2 VD VDD + C10 47 Z1 4 3 2 1 D1 J4 VDD R32 + C8 470/25V D3 D4 1N4007 1N4007 10u U3 TL431 S10/275 C13 R30 47 Z2 J6 LL2 D7 47V 470/250VAC GND N MAINS + C11 N PH3 S10/275 C14 R31 LL3 47 Z3 N D5 1N4007 D6 R33 470/250VAC VN Figure 15: Schematic diagram of power supply http://www.sames.co.za 12/22 10u U4 TL431 1N4007 S10/275 + C9 470/25v 470/1W + C15 470 J5 VSS VS VSS R51 O2 4.7R R50 O3 4.7R R48 O4 4.7R R49 PC_OUT VDD PCVDD C16 100n C17 100n C18 100n VSS PCVSS 4.7R SK3 5V PCVSS 1 2 PC 5V VDD U5 R34 D6 1 VCC 13/22 Figure 16: Schematic diagram of Isolated interface 680R JUMPS2 J8 8 5V PCVDD PC_OUT MOSI JUMPS2 J9 R35 D5 4 680R SK2 1 14 2 15 3 16 4 17 5 18 6 19 7 20 8 21 9 22 10 23 11 24 12 25 13 O1 O2 VCC 680R D0 D3 VDD JUMPS2 J10 8 J11 3 D2 R37 D7 4 680R D4 GND R47 CS 5 JP2 I0 I1 I2 I3 I4 PCVSS VSS HCPL2631 PCVSS LED VDD 4.7k 6 D3 L2 CE JUMPS2 D1 O3 R43 4.7k 2 O4 R46 PCVSS LED 1k 7 I0 L1 SCK VSS U6 1 R42 1k 5 HCPL2631 R36 D4 GND D2 R45 4.7k 6 Supp Sel VDD 4.7k 3 JP4 R44 7 2 PC PM9904BPD http://www.sames.co.za O1 1 2 3 4 5 6 IN PCVSS D5 JP3 PCVDD D6 R41 D7 4.7k I3 I4 I2 PCVSS VCC I1 R38 1 4.7k 2 J12 PB/F50 3 6 5 PB1 GND VDD R39 4 680R HCPL2631 PCVSS MISO 680R 7 R40 I2 I1 U7 8 VSS D0 D1 D2 D3 D4 D5 D6 D7 O1 O2 O3 O4 PCVSS 1 2 3 4 5 6 7 8 9 10 11 12 13 OUT SW-PB F150 sames PM9904BPD http://www.sames.co.za VDD U2 25 VDD RES V1 CLK C7 39n 26 23 27 GND END M3 VSS SCK MOSI MISO CS_D 18 19 20 21 COM3 COM2 COM1 COM0 33 32 31 30 SCK MOSI MISO CE VR[3] VR[2] VR[1] VR[0] VS[23] VS[22] VS[21] VS[20] VS[19] VS[18] VS[17] VS[16] VS[15] VS[14] VS[13] VS[12] VS[11] VS[10] VS[9] VS[8] VS[7] VS[6] VS[5] VS[4] VS[3] VS[2] VS[1] VS[0] 17 16 15 14 11 10 9 8 7 6 5 4 3 2 1 43 42 41 40 39 38 37 36 35 LNC LP23 LP21 LP16 LP22 LP15 LP24 LP13 LP26 LP11 LP28 LP9 LP30 LP7 LP32 LP5 LP33 LP4 LP34 LP3 LP35 LP2 LP36 LP1 LCD1 LP1 LP2 LP3 LP4 LP5 LP7 LP9 LP11 LP13 LP15 LP16 COM0 COM1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 OEL-7678 14/22 Figure 17: Schematic diagram of LCD and Driver 13 22 28 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 LP36 LP35 LP34 LP33 LP32 LNC LP30 LNC LP28 LNC LP26 LNC LP24 LP23 LP22 LP21 COM2 COM3 HR-LCD SA8807AF sames sames PM9904BPD Figure 18: Silkscreen PCB layout http://www.sames.co.za 15/22 sames PM9904BPD PCB LAYOUT Figure 19: Top PCB layout Figure 20: Bottom PCB layout http://www.sames.co.za 16/22 sames PM9904BPD COMPONENT LIST (PM9904BPD BOARD) Items Part Type Designator Description 1 100n C16, C17, C18 Capacitor Monolithic Ceramic 2 10µ / 16V C8, C9 Capacitor Tantalum 1 1µ / 16V / No Polarity C3, C4, C5 Capacitor Electrolytic Radial 2 1µ / 63V C6 Capacitor Monolithic Ceramic 4 220n / 63V C1, C2 Capacitor Monolithic Ceramic 3 22n / 63V C7 Capacitor Monolithic Ceramic 5 470n / 250VAC C12, C13, C14 Capacitor Polyester 6 470µ / 16V C15 Capacitor Electrolytic Radial 5 470µ / 25V C10, C11 Capacitor Electrolytic Radial 6 Tz76 CT1, CT2, CT3 7 1N4007 D1, D2, D3, D4, D5, D6 Rectifier Diode 9 47V D7 Zener Diode 16 LED L1, L2 LED 3mm Diameter 17 SW-PB PB1 Micro switch 18 2.7k R1, R2, R3, R4, R5, R6 ¼ Watt, 1%, Metal Film Resistor 20 47k R7 ¼ Watt, 1%, Metal Film Resistor 20 1M R8, R9, R10 ¼ Watt, 1%, Metal Film Resistor 21 24k R11, R12, R13 ¼ Watt, 1%, Metal Film Resistor 22 4.7R R48, R49, R50, R51 ¼ Watt, 5%, Carbon Resistor 25 120k R15, R17, R19, R21, R23, R25 ¼ Watt, 1%, Metal Film Resistor 27 1k R42, R43 ¼ Watt, 5%, Carbon Resistor 26 2.7R R26, R27, R28 ¼ Watt, 1%, Metal Film Resistor 27 4.7k R40, R41, R44, R45, R46, R47 ¼ Watt, 5%, Carbon Resistor 29 470R / 1 Watt R32, R33 1 Watt, 1%, Wire Wound Resistor 30 47R / 2 Watt R29, R30, R31 2 Watt, 1%, Wire Wound Resistor 31 680R R34, R35, R36, R37, R38, R39 ¼ Watt, 5%, Carbon Resistor 33 82k R14, R16, R18, R20, R22, R24 ¼ Watt, 1%, Metal Film Resistor 35 MAINS Sk1 7 Pin Molex, Center square pin, Friction Lock 37 PC Sk2 Db25, PCB Mount, Female 36 PC 5V Sk3 2 Pin Molex, Center square pin, Friction Lock 37 TL431 U3, U4 TO -92 Package 38 HCPL2631 U5, U6, U7 DIP 8 Package 39 3.5795 MHz X1 Crystal 40 S10 / 275 Z1, Z2, Z3 Metal Oxide Varistor 41 SA9904B U1 20 Pin IC Socket, Tulip Type 43 SA8807AF U2 44 Pin PLCC IC Socket http://www.sames.co.za 17/22 PM9904BPD http://www.sames.co.za SK1 1 2 3 4 5 6 J1 MCLR VDD VSS RB3 RB6 RB7 N1 N2 N3 N4 N5 N6 N7 N8 8 7 6 5 4 3 2 1 ISP JP1 VSS Holder VSS C1 33p C2 33p X1 20 D1 1N4148 R2 RST 640R 1N4148 C4 100n VSS VDD 1k MCLR RA0 RA1 RA2 RA3 RA4 RA5 F50 RB1 RB2 RB3 RB4 9 1 2 3 4 5 6 7 21 22 23 24 25 Active 1k 10 11 12 13 14 15 16 17 18 26 27 28 R CS_D CS_A CS_M SCK MISO MOSI RC6 RC7 RB5 RB6 RB7 VDD SK2 C5 1u RST VSS VDD VSS F50 SCK CS_A MISO MOSI CS_D 1 2 3 4 5 6 7 8 SPI Port S1 UP S2 DOWN S3 ENTER S4 RESET VSS L2 VDD L OSC1/CLKIN OSC2/CLKOUT MCLR/VPP RC0/T1OSO/T1CKI RA0/AN0 RC1/T1OSI RA1/AN1 RC2/CCP1 RA2/AN2 RC3/SCK/SCL RA3/AN3/VREF RC4/SDI/SDA RA4/T0CKI RC5/SDO RA5/AN4/SS RC6 RB0/INT RC7 RB1 RB5 RB2 RB6 RB3 RB7 RB4 RA0 R4 RB7 RB6 RB5 RB4 RB3 RB2 RB1 F50 VDD VSS RC7 RC6 MOSI MISO 1 2 3 4 5 6 7 8 9 10 11 12 13 14 PIC16F876-20/SO L1 R3 JP2 MCLR RA0 RA1 RA2 RA3 RA4 RA5 VSS OSCI OSCO CS_D CS_A CS_M SCK U1 D2 VDD R1 33k VDD VSS VSS C3 100n OSCO OSCI 20MHz VDD 8 19 18/22 Figure 21: Micro-Controller Board Schematic 1 2 3 4 5 6 7 8 9 10 11 12 13 14 VSS RA1 Reactive U2 CS_M SCK MOSI MISO 1 2 3 4 CS SCK DI DO 93C46 VCC NC ORG VSS VDD 8 7 6 5 VSS VDD JP3 RA0 RA1 RA2 JP4 1 2 3 1 2 3 Q1 PNP R6 10k Out Select SK3 1 2 R5 VSS1k U3 4N35 Opto Out sames sames PM9904BPD MICRO-CONTROLLER BOARD sames R1 D1 C4 MCLR R2 RA0 RA0 D2 U1 RA4 PA9904B2 R6 RESET RB4 RB2 C1 VSS RB1 F50 OSCI VDD OSCO VSS CS_D RC7 CS_A CS_M C5 UP S1 DOWN S2 RC6 C2 R5 Active MOSI C3 U2 MISO ENTER Figure 22: Top PCB layout Figure 23: Bottom PCB layout http://www.sames.co.za Opto Out RB3 RA3 SCK S4 RB6 RB5 RA2 RA5 RB7 Q1 R3 PA9904B2 ISP 19/22 S3 R4 Reactive sames PM9904BPD sames R1 D1 C4 MCLR R2 ISP RA0 RA0 D2 U1 RB4 RB2 C1 VSS RB1 F50 OSCI VDD OSCO VSS CS_D RC7 CS_M C5 UP R5 S1 JP3/4 DOWN S2 RC6 C2 CS_A PA9904B2 R6 RESET R3 RA4 Active MOSI C3 U2 MISO ENTER S3 R4 Reactive Figure 24: Silkscreen PCB layout (Micro-controller board) http://www.sames.co.za Opto Out RB3 RA3 SCK S4 RB6 RB5 RA2 RA5 RB7 Q1 20/22 sames PM9904BPD COMPONENT LIST (Micro-controller board) Designator Part Type Footprint Description D1 1N4148 MELF-MINI-D Si signal diode D2 1N4148 MELF-MINI-D Si signal diode R5 1k 805 Resistor, 1% R4 1k 805 Resistor, 1% R3 1k 805 Resistor, 1% C5 1u 3528 Capacitor, tantalum/10V U3 4N35 DIP6 Opto-coupler, medium speed R6 10k 805 Resistor, 1% X1 20MHz XTAL3 Crystal R1 33k 805 Resistor, 1% C2 33p 805 Capacitor, ceramic C1 33p 805 Capacitor, ceramic U2 93C46 SO-8 e2prom, 1kB C3 100n 805 Capacitor, ceramic C4 100n 805 Capacitor, ceramic R2 100R....1kW 805 Resistor, 1% L1 Active LED3MM 3mm green S2 DOWN SW_PB_SMALL Micro switch, push to make S3 ENTER SW_PB_SMALL Micro switch, push to make JP4 HEADER 3 SIP3 3 pin SIP pins J1 Holder SIP8 8 pin SIP socket SK1 ISP SIP6 6 pin SIP pins JP1 L SIP14 14 pin SIP pins SK3 Opto Out 2PIN_MOLEX 2 Pin Molex, Centre square pin, Friction lock JP3 Out Select SIP3 3 pin SIP pins U1 PIC 16F876-20/SO SOL-28 Micro-controller Q1 PNP SOT-23 Any Si PNP, e.g. SMBT3906 JP2 R SIP14 14 pin SIP pins Micro switch, push to make S4 RESET SW_PB_SMALL L2 Reactive LED3MM 3mm red SK2 SPI Port SIP8 8 pin SIP socket S1 UP SW_PB_SMALL Micro switch, push to make http://www.sames.co.za 21/22 sames PM9607AP PM9904BPD DISCLAIMER: The information contained in this document is confidential and proprietary to South African Micro-Electronic Systems (Pty) Ltd ("SAMES") and may not be copied or disclosed to a third party, in whole or in part, without the express written consent of SAMES. The information contained herein is current as of the date of publication; however, delivery of this document shall not under any circumstances create any implication that the information contained herein is correct as of any time subsequent to such date. SAMES does not undertake to inform any recipient of this document of any changes in the information contained herein, and SAMES expressly reserves the right to make changes in such information, without notification, even if such changes would render information contained herein inaccurate or incomplete. SAMES makes no representation or warranty that any circuit designed by reference to the information contained herein, will function without errors and as intended by the designer. Any sales or technical questions may be posted to our e-mail address below: [email protected] For the latest updates on datasheets, please visit our web site: http://www.sames.co.za. SOUTH AFRICAN MICRO-ELECTRONIC SYSTEMS (PTY) LTD Tel: (012) 333-6021 Tel: Int +27 12 333-6021 Fax: (012) 333-8071 Fax: Int +27 12 333-8071 33 ELAND STREET KOEDOESPOORT INDUSTRIAL AREA PRETORIA REPUBLIC OF SOUTH AFRICA P O BOX 15888 33 ELAND STREET LYNN EAST 0039 REPUBLIC OF SOUTH AFRICA http://www.sames.co.za 22/22