Working[1]

39
Working of PWM Induction Motor Our Circuit is Devided In 5 part’s . Data receiving From PC serial Port. Pic MicroController 1. Opto-Isoloator 2. Triac 3. Pwm Theory 4. Pc Software (Just Basic) Pc Software & Code is attached seperatly. Data receiving From Seial Port RS-232 is simple, universal, well understood and supported but it has some serious shortcomings as a data interface. The standards to 256kbps or less and line lengths of 15M (50 ft) or less but today we see high speed ports on our home PC running very high speeds and with high quality cable maxim distance has increased greatly. The rule of thumb for the length a data cable depends on speed of the data, quality of the cable. Tutorial Electronic data communications between elements will generally fall into two broad categories: single-ended and differential. RS232 (single-ended) was introduced in 1962, and despite rumors for its early demise, has remained widely used through the industry. Independent channels are established for two-way (full-duplex) communications. The RS232 signals are represented by voltage levels with respect to a system common (power / logic ground). The "idle" state (MARK) has the signal level negative with respect to common, and the "active" state (SPACE) has the signal level positive with respect to common. RS232 has numerous handshaking lines (primarily used with modems), and also specifies a communications protocol. The RS-232 interface presupposes a common ground between the DTE and DCE. This is a reasonable assumption when a short cable connects the DTE to the DCE, but with longer lines and connections

Transcript of Working[1]

Page 1: Working[1]

Working of PWM Induction Motor

Our Circuit is Devided In 5 part’s .

Data receiving From PC serial Port.Pic MicroController1. Opto-Isoloator2. Triac3. Pwm Theory4. Pc Software (Just Basic)

Pc Software & Code is attached seperatly.

Data receiving From Seial Port

RS-232 is simple, universal, well understood and supported but it has some serious shortcomings as a data interface. The standards to 256kbps or less and line lengths of 15M (50 ft) or less but today we see high speed ports on our home PC running very high speeds and with high quality cable maxim distance has increased greatly. The rule of thumb for the length a data cable depends on speed of the data, quality of the cable.

Tutorial

Electronic data communications between elements will generally fall into two broad categories: single-ended and differential. RS232 (single-ended) was introduced in 1962, and despite rumors for its early demise, has remained widely used through the industry.

Independent channels are established for two-way (full-duplex) communications. The RS232 signals are represented by voltage levels with respect to a system common (power / logic ground). The "idle" state (MARK) has the signal level negative with respect to common, and the "active" state (SPACE) has the signal level positive with respect to common. RS232 has numerous handshaking lines (primarily used with modems), and also specifies a communications protocol.

The RS-232 interface presupposes a common ground between the DTE and DCE. This is a reasonable assumption when a short cable connects the DTE to the DCE, but with longer lines and connections between devices that may be on different electrical busses with different grounds, this may not be true.

Page 2: Working[1]

RS232 data is bi-polar.... +3 TO +12 volts indicates an "ON or 0-state (SPACE) condition" while A -3 to -12 volts indicates an "OFF" 1-state (MARK) condition.... Modern computer equipment ignores the negative level and accepts a zero voltage level as the "OFF" state. In fact, the "ON" state may be achieved with lesser positive potential. This means circuits powered by 5 VDC are capable of driving RS232 circuits directly, however, the overall range that the RS232 signal may be transmitted/received may be dramatically reduced.

The output signal level usually swings between +12V and -12V. The "dead area" between +3v and -3v is designed to absorb line noise. In the various RS-232-like definitions this dead area may vary. For instance, the definition for V.10 has a dead area from +0.3v to -0.3v. Many receivers designed for RS-232 are sensitive to differentials of 1v or less.

This can cause problems when using pin powered widgets - line drivers, converters, modems etc. These type of units need enough voltage & current to power them self's up. Typical URART (the RS-232 I/O chip) allows up to 50ma per output pin - so if the device needs 70ma to run we would need to use at least 2 pins for power. Some devices are very efficient and only require one pin (some times the Transmit or DTR pin) to be high - in the "SPACE" state while idle.

An RS-232 port can supply only limited power to another device. The number of output lines, the type of interface driver IC, and the state of the output lines are important considerations.

The types of driver ICs used in serial ports can be divided into three general categories:

Drivers which require plus (+) and minus (-) voltage power supplies such as the 1488 series of interface integrated circuits. (Most desktop and tower PCs use this type of driver.)

Low power drivers which require one +5 volt power supply. This type of driver has an internal charge pump for voltage conversion. (Many industrial microprocessor controls use this type of driver.)

Low voltage (3.3 v) and low power drivers which meet the EIA-562 Standard. (Used on notebooks and laptops.)

Data is transmitted and received on pins 2 and 3 respectively. Data  Set Ready (DSR) is an indication from the Data Set (i.e., the modem or DSU/CSU) that it is on. Similarly, DTR indicates to the Data Set that the DTE is on. Data Carrier Detect (DCD) indicates that a good carrier is being received from the remote modem.

Page 3: Working[1]

Pins 4 RTS (Request To Send - from the transmitting computer) and 5 CTS (Clear To Send - from the Data set) are used to control. In most Asynchronous situations, RTS and CTS are constantly on throughout the communication session. However where the DTE is connected to a multipoint line, RTS is used to turn carrier on the modem on and off. On a multipoint line, it's imperative that only one station is transmitting at a time (because they share the return phone pair). When a station wants to transmit, it raises RTS. The modem turns on carrier, typically waits a few milliseconds for carrier to stabilize, and then raises CTS. The DTE transmits when it sees CTS up. When the station has finished its transmission, it drops RTS and the modem drops CTS and carrier together.

Clock signals (pins 15, 17, & 24) are only used for synchronous communications. The modem or DSU extracts the clock from the data stream and provides a steady clock signal to the DTE. Note that the transmit and receive clock signals do not have to be the same, or even at the same baud rate.

Note: Transmit and receive leads (2 or 3) can be reversed depending on the use of the equipment - DCE Data Communications Equipment or a DTE Data Terminal Equipment.

Glossary of Abbreviations etc.

CTS            Clear To Send [DCE --> DTE]DCD           Data Carrier Detected (Tone from a modem) [DCE --> DTE]DCE            Data Communications Equipment eg. modemDSR            Data Set Ready [DCE --> DTE]DSRS         Data Signal Rate Selector [DCE --> DTE] (Not commonly                         used)DTE            Data Terminal Equipment eg. computer, printerDTR            Data Terminal Ready [DTE --> DCE]FG              Frame Ground (screen or chassis)NC              No ConnectionRCk            Receiver (external) Clock inputRI                Ring Indicator (ringing tone detected)RTS            Request To Send [DTE --> DCE]RxD            Received Data [DCE --> DTE]SG              Signal GroundSCTS         Secondary Clear To Send [DCE --> DTE]SDCD        Secondary Data Carrier Detected (Tone from a modem)                          [DCE  --> DTE]SRTS         Secondary Request To Send [DTE --> DCE]SRxD         Secondary Received Data [DCE --> DTE]STxD         Secondary Transmitted Data [DTE --> DCE]TxD            Transmitted Data [DTE --> DCE]

Page 4: Working[1]

Is Your Interface a DTE or a DCE

One of the stickiest areas of confusion in datacom is over the terms "transmit" and "receive" as they pertain to DTE (data terminal equipment) and DCE (data communication equipment). In synchronous communication, this confusion is particularly acute, because more signals are involved. So why is it that you sometimes send data on TD, and other times you send data on RD? Is this just a cruel form of mental torture? Not really. The secret lies in adopting the proper perspective. In data-com, the proper perspective is always from the point of view of the DTE. When you sit at a PC, terminal or workstation (DTE) and transmit data to somewhere far away, you naturally do so on the TD (transmit data) line. When your modem or CSU/DSU (DCE) receives this incoming data, it receives the data on the TD line as well. Why? Because the only perspective that counts in data-com is the perspective of the DTE. It does not matter that the DCE thinks it is receiving data; the line is still called "TD". Conversely, when the modem or CSU/DSU receives data from the outside world and sends it to the DTE, it sends it on the RD line. Why? Because from the perspective of the DTE, the data is being received! So when wondering, "Is this line TD or RD? Is it TC or RC?" Ask yourself, "What would the DTE say?"

Find out by following these steps: The point of reference for all signals is the terminal (or PC).

1 ) Measure the DC voltages between (DB25) pins 2 & 7 and between pins 3 & 7. Be sure the black lead is connected to pin 7 (Signal Ground) and the red lead to whichever pin you are measuring.

2) If the voltage on pin 2 is more negative than -3 Volts, then it is a DTE, otherwise it should be near zero volts.

3) If the voltage on pin 3  is more negative than -3 Volts, then it is a DCE.

4) If both pins 2 & 3 have a voltage of at least 3 volts, then either you are measuring incorrectly, or your device is not a standard EIA-232 device. Call technical support.

5) In general, a DTE provides a voltage on TD, RTS, & DTR, whereas a DCE provides voltage on RD, CTS, DSR, & CD.

Page 5: Working[1]

X.21 interface on a DB 15 connector

 

also see X.21 write upalso see end of page for more info

General

Voltages: +/- 0.3Vdc

Speeds:Max. 100Kbps (X.26)

Max. 10Mbps (X.27)

 

The X.21 interface was recommended by the CCITT in 1976. It is defined as a digital signaling interface between customers (DTE) equipment and carrier's equipment (DCE). And thus primarily used for telecom equipment.

All signals are balanced. Meaning there is always a pair (+/-) for each signal, like used in RS422. The X.21 signals are the same as RS422, so please refer to RS422 for the exact details.

Pinning according to ISO 4903

Sub-D15 Male Sub-D15 Female

 

Pin Signal abbr. DTE DCE1 Shield   - -

Page 6: Working[1]

2 Transmit (A)   Out In

3 Control (A)   Out In

4 Receive (A)   In Out

5 Indication (A)   In Out

6 Signal Timing (A)   In Out

7 Unassigned

8 Ground   - -

9 Transmit (B)   Out In

10 Control (B)   Out In

11 Receive (B)   In Out

12 Indication (B)   In Out

13 Signal Timing (B)   In Out

14 Unassigned

15 Unassigned

Functional Description

As can be seen from the pinning specifications, the Signal Element Timing (clock) is provided by the DCE. This means that your provider (local telco office) is responsible for the correct clocking and that X.21 is a synchronous interface. Hardware handshaking is done by the Control and Indication lines. The Control is used by the DTE and the Indication is the DCE one.

Cross-Cable Pinning

X.21 Cross Cable

X.21 X.211 1

2 4

3 5

4 2

5 3

6 7

7 6

8 8

9 11

10 12

11 9

12 10

13 14

14 13

15  

Page 7: Working[1]

RS232D uses RJ45 type connectors (similar to telephone connectors) 

Pin No. Signal Description Abbr. DTE DCE1 DCE Ready, Ring Indicator DSR/RI

2 Received Line Signal Detector DCD

3 DTE Ready DTR

4 Signal Ground SG

5 Received Data RxD

6 Transmitted Data TxD

7 Clear To Send CTS

8 Request To Send RTS

This is a standard 9 to 25 pin cable layout for async data on a PC AT serial cable

 

Description Signal9-pin DTE

25-pin DCE

Source DTE or DCE

Carrier Detect CD 1 8 from Modem

Receive Data RD 2 3 from Modem

Transmit Data TD 3 2from Terminal/Computer

Page 8: Working[1]

Data Terminal Ready

DTR 4 20from   Terminal/Computer

Signal Ground SG 5 7 from Modem

Data Set Ready DSR 6 6 from Modem

Request to Send RTS 7 4from   Terminal/Computer

Clear to Send CTS 8 5 from Modem

Ring Indicator RI 9 22 from Modem

This a DTE port as on the back of a PC Com Port - EIA-574 RS-232/V.24 pin out on a DB-9 pin

used for Asynchronous Data

 

 

Page 9: Working[1]

25 pin D-shell connector RS232

commonly used for Async. data

PIN SIGNAL  DESCRIPTION

1   PGND Protective Ground2   TXD Transmit Data3   RXD Receive Data4   RTS RequestTo Send5   CTS Clear To Send6   DSR Data Set Ready7   SG Signal Ground8   CD Carrier Detect20  DTR Data Terminal Ready22  RI Ring Indicator

 

Page 10: Working[1]

Some applications require more pinsthan a simple async. configurations.

Pins used for Synchronous data 

jump to Other Connector pages

RS-232 Specs.SPECIFICATIONS RS232 RS423

Mode of Operation SINGLE-ENDED

SINGLE-ENDED

Total Number of Drivers and Receivers on One Line 1 DRIVER1 RECVR

1 DRIVER10 RECVR

Maximum Cable Length 50 FT. 4000 FT.

Maximum Data Rate 20kb/s 100kb/s

Page 11: Working[1]

Maximum Driver Output Voltage +/-25V +/-6V

Driver Output Signal Level (Loaded Min.) Loaded +/-5V to +/-15V

+/-3.6V

Driver Output Signal Level (Unloaded Max) Unloaded +/-25V +/-6V

Driver Load Impedance (Ohms) 3k to 7k >=450

Max. Driver Current in High Z State Power On N/A N/A

Max. Driver Current in High Z State Power Off +/-6mA @ +/-2v +/-100uA

Slew Rate (Max.) 30V/uS Adjustable

Receiver Input Voltage Range +/-15V +/-12V

Receiver Input Sensitivity +/-3V +/-200mV

Receiver Input Resistance (Ohms) 3k to 7k 4k min.

 

One byte of async data

Cabling considerations - you should use cabling made for RS-232 data but I have seen lo speed data go over 250' on 2 pair phone cable. Level 5 cable can also be used but for best distance use a low capacitance data grade cable.

The standard maxim length is 50' but if data is async you can increase that distance to as much as 500' with a good grade of cable. 

The RS-232 signal on a single cable is impossible to screen effectively for noise. By screening the entire cable we can reduce

Page 12: Working[1]

the influence of outside noise, but internally generated noise remains a problem. As the baud rate and line length increase, the effect of capacitance between the different lines introduces serious crosstalk (this especially true on synchronous data - because of the clock lines) until a point is reached where the data itself is unreadable. Signal Crosstalk can be reduced by using low capacitance cable and shielding each pair

Using a high grade cable (individually shield low capacitance pairs) the distance can be extended to 4000'

At higher frequencies a new problem comes to light. The high frequency component of the data signal is lost as the cable gets longer resulting in a   rounded, rather than square wave signal.

The maxim distance will depend on the speed and noise level around the cable run.

On longer runs a line driver is needed. This is a simple modem used to increase the maxim distance you can run RS-232 data.

Making sense of the specifications

Selecting data cable isn't difficult, but often gets lost in the shuffle of larger system issues. Care should be taken. however, because intermittent problems caused by marginal cable can be very difficult to troubleshoot.

Beyond the obvious traits such as number of conductors and wire gauge, cable specifications include a handful of less intuitive terms.

Characteristic Impedance (Ohms): A value based on the inherent conductance, resistance, capacitance and inductance of a cable that represents the impedance of an infinitely long cable. When the cable is out to any length and terminated with this Characteristic Impedance, measurements of the cable will be identical to values obtained from the infinite length cable. That is to say that the termination of the cable with this impedance gives the cable the appearance of being infinite length, allowing no reflections of the transmitted signal. If termination is required in a system, the termination impedance value should match the Characteristic Impedance of the cable.

Shunt Capacitance (pF/ft): The amount of equivalent capacitive load of the cable, typically listed in a per foot basis One of the factors limiting total cable length is the capacitive load. Systems with long lengths benefits from using low capacitance cable.

Propagation velocity (% of c): The speed at which an electrical signal travels in the cable. The value given typically must be multiplied by the speed of light (c) to obtain units of meters per second. For example, a cable that lists a propagation velocity of 78% gives a velocity of 0.78 X 300 X 106 - 234 X 106 meters per

Page 13: Working[1]

second.

Plenum cable

Plenum rated cable is fire resistant and less toxic when burning than non-plenum rated cable. Check building and fire codes for requirements. Plenum cable is generally more expensive due to the sheathing material used.

The  specification recommends 24AWG twisted pair cable with a shunt capacitance of 16 pF per foot and 100 ohm characteristic impedance. 

It can be difficult to qualify whether shielding is required in a particular system or not, until problems arise. We recommend erring on the safe side and using shielded cable. Shielded cable is only slightly more expensive than unshielded.

There are many cables available meeting the recommendations of RS-422 and RS-485, made specifically for that application. Another choice is the same cable commonly used in the Twisted pair Ethernet cabling. This cable, commonly referred to as Category 5 cable, is defined by the ElA/TIA/ANSI 568 specification The extremely high volume of Category 5 cable used makes it widely available and very inexpensive, often less than half the price of specialty RS422/485 cabling. The cable has a maximum capacitance of 17 pF/ft (14.5 pF typical) and characteristic impedance of 100 ohms.

Category 5 cable is available as shielded twisted pair (STP) as well as unshielded twisted pair (UTP) and generally exceeds the recommendations  making it an excellent choice for RS232 systems.

RS232 - V.24/V.28 - IS2110 - X.20 bis (for Async) - X.21 bis (for Sync)

General

In this document the term RS232 will be used when refered to this serial interface. The description of RS232 is an EIA/TIA norm and is identical to CCITT V.24/V.28, X.20bis/X.21bis and ISO IS2110. The only difference is that CCITT has split the interface into its electrical description (V.28) and a mechanical part (V.24) or Asynchronous (X.20 bis) and Synchronous (X.21 bis) where the EIA/TIA describes everything under RS232.

As said before RS232 is a serial interface. It can be found in many different applications where the most common ones are modems and Personal Computers. All pinning specifications are writen for the DTE side.

Page 14: Working[1]

All DTE-DCE cables are straight through meaning the pins are connected one on one. DTE-DTE and DCE-DCE cables are cross cables. To make a destiction between all different types of cables we have to use a naming convention.DTE - DCE: Straight CableDTE - DTE: Null-Modem CableDCE - DCE: Tail Circuit Cable

Interface Mechanical

RS232 can be found on different connectors. There are special specifications for this. The CCITT only defines a Sub-D 25 pins version where the EIA/TIA has two versions RS232C and RS232D which are resp. on a Sub-D25 and a RJ45. Next to this IBM has added a Sub-D 9 version which is found an almost all Personal Computers and is described in TIA 457.

Male Female

Pinnings

 RS232-C DescriptionCircuitEIA

CircuitCCITT

RJ45 TIA 457

1 Shield Ground AA      

7 Signal Ground AB 102 4 5

2 Transmitted Data BA 103 6 3

3 Received Data BB 104 5 2

4 Request To Send CA 105 8 7

5 Clear To Send CB 106 7 8

6 DCE Ready CC 107 1 6

20 DTE Ready CD 108.2 3 4

22 Ring Indicator CE 125 1 9

8 Received Line Signal Detector CF 109 2 1

23 Data Signal Rate Select(DTE/DCE Source>

CH/CI 111/112    

24 Transmit Signal Element Timing(DTE Source)

DA 113    

15 Transmitter Signal Element Timing(DCE Source)

DB 114    

17 Receiver Signal Element Timing(DCE Source)

DD 115    

18 Local Loopback / Quality Detector LL 141    

Page 15: Working[1]

21 Remote Loopback RL/CG 140/110    

14 Secondary Transmitted Data SBA 118    

16 Secondary Received Data SBB 119    

19 Secondary Request To Send SCA 120    

13 Secondary Clear To Send SCB 121    

12 Secondary Received Line Signal Detector/Data signal Rate Select (DCE Source)

SCF/CI 122/112    

25 Test Mode TM 142    

9 Reserved for Testing        

10 Reserved for Testing        

11 Unassigned        

Interface Electrical

All signals are measured in reference to a common ground, which is called the signal ground (AB). A positive voltage between 3 and 15 Vdc represents a logical 0 and a negative voltage between 3 and 15 Vdc represents a logical 1.This switching between positive and negative is called bipolar. The zero state is not defined in RS232 and is considered a fault condition (this happens when a device is turned off).According to the above a maximum distance of 50 ft or 15 m. can be reached at a maximum speed of 20k bps. This is according to the official specifications, the distance can be exceeded with the use of Line Drivers.

Functional description

Description Circuit Function

Shield Ground AA Also known as protective ground. This is the chassis ground connection between DTE and DCE.

Signal Ground AB The reference ground between a DTE and a DCE. Has the value 0 Vdc.

Transmitted Data BA Data send by the DTE.

Received Data BB Data received by the DTE.

Request To Send CA Originated by the DTE to initiate transmission by the DCE.

Clear To Send CBSend by the DCE as a reply on the RTS after a delay in ms, which gives the DCEs enough time to energize their circuits and synchronize on basic modulation patterns.

DCE Ready CCKnown as DSR. Originated by the DCE indicating that it is basically operating (power on, and in functional mode).

DTE Ready CDKnown as DTR. Originated by the DTE to instruct the DCE to setup a connection. Actually it means that the DTE is up and running and ready to communicate.

Ring Indicator CEA signal from the DCE to the DTE that there is an incomming call (telephone is ringing). Only used on switched circuit connections.

Received Line Signal Detector

CF Known as DCD. A signal send from DCE to its DTE to indicate that it has received a basic carrier signal

Page 16: Working[1]

from a (remote) DCE.

Data Signal Rate Select(DTE/DCE Source>

CH/CIA control signal that can be used to change the transmission speed.

Transmit Signal Element Timing(DTE Source)

DATiming signals used by the DTE for transmission, where the clock is originated by the DTE and the DCE is the slave.

Transmitter Signal Element Timing(DCE Source)

DB Timing signals used by the DTE for transmission.

Receiver Signal Element Timing(DCE Source)

DD Timing signals used by the DTE when receiving data.

Local Loopback / Quality Detector

LL  

Remote Loopback RL/CG Originated by the DCE that changes state when the analog signal received from the (remote) DCE becomes marginal.

Test Mode TM  

Reserved for Testing

   

The secondary signals are used on some DCE's. Those units have the possibility to transmit and/or receive on a secondary channel. Those secondary channels are mostly of a lower speed than the normal ones and are mainly used for administrative functions.

Cable pinningHere are some cable pinning that might be useful. Not all applications are covered, it is just a help:

Straight DB25 Cable DB25 Null- modem or cross over cable (Async)

DB25 Tail- circuit or cross over cable cable (Sync)

DB25 to DB9 DTE

- DCE cablePin Pin

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 8

9 9

10 10

11 11

12 12

13 13

14 14

15 15

16 16

17 17

18 18

Pin Pin

1 1

2 3

3 2

4 5

5 4

6, 8 20

7 7

20 6, 8

</DB9 Null- modem or

cross over cable

1,6 4

2 3

3 2

4 1,6

5 5

7 8

8 7

Pin Pin

1 1

2 3

3 2

4 8

6 20

7 7

8 4

17 24

20 6

24 17

Pin Pin

  1

3 2

2 3

7 4

8 5

6 6

5 7

1 8

4 20

9 22

 

Page 17: Working[1]

19 19

20 20

21 21

22 22

23 23

24 24

25 25

 

This cable should be used for DTE to DCE (for instance computer to modem) connections with hardware handshaking.

(To Computer).

(To Modem).

9 PIN D-SUB FEMALE to the Computer25 PIN D-SUB MALE to the Modem

  Female Male Dir

Shield   1  

Transmit Data 3 2

Receive Data 2 3

Request to Send 7 4

Clear to Send 8 5

Data Set Ready 6 6

System Ground 5 7  

Carrier Detect 1 8

Data Terminal Ready 4 20

Ring Indicator 9 22

Nullmodem (25-25) Cable

Use this cable between two DTE devices (for instance two computers).

(To Computer 1).

(To Computer 2).

Page 18: Working[1]

25 PIN D-SUB FEMALE to Computer 1.25 PIN D-SUB FEMALE to Computer 2.

  D-Sub 1 D-Sub 2  

Recieve Data 3 2 Transmit Data

Transmit Data 2 3 Receive Data

Data Terminal Ready 20 6+8 Data Set Ready + Carrier Detect

System Ground 7 7 System Ground

Data Set Ready + Carrier Detect 6+8 20 Data Terminal Ready

Request to Send 4 5 Clear to Send

Clear to Send 5 4 Request to Send

Note: DSR & CD are jumpered to fool the programs to think that their online.

RS232 (25 pin) Tail Circuit Cable

Null Modem cable diagrams Nullmodem (9p to 9p) Nullmodem (9p to 25p)

Nullmodem (25p to 25p)

Cross Pinned cables for Async data.

 

Pin out for local Async Data transfer

Page 19: Working[1]

Thyristors, triacs, diacs

There are several thyristors displayed on 6.1. Triacs look the same, while diacs look like small power rectifying diodes. Their

symbols, and pin-out is found in

Page 20: Working[1]

A thyristor is an improved diode. Besides anode (A) and cathode (k) it has another lead which is commonly described as a gate (G), as found on picture 6.2a. The same way a diode does, a thyristor conducts current when the anode is positive compared to the cathode, but only if the voltage on the gate is positive and sufficient current is flowing into the gate to turn on the device. When a thyristor starts conducting current into the gate is of no importance and thyristor can only be switched off by removing the current between anode and cathode. For example, see figure 6.3. If S1 is closed, the thyristor will not conduct, and the globe will not light. If S2 is closed for a very short time, the globe will illuminate. To turn off the globe, S1 must be opened. Thyristors are marked in some circuits as SCR, which is an acronym for Silicon Controlled Rectifier.A triac is very similar to a thyristor, with the difference that it can conduct in both directions. It has three electrodes, called anode 1 (A1), anode 2 (A2), and gate (G). It is used for regulation of alternating current circuits. Devices such as hand drills or globes can be controlled with a triac.

Thyristors and triacs are marked alphanumerically, KT430, for example. Low power thyristors and triacs are packed in same housings as transistors, but high power devices have a completely different housing. These are shown in figure 6.1. Pin-outs of some common thyristors and triacs are shown in 6.2 a and b.Diacs (6.2c), or two-way diodes as they are often referred to, are used together with thyristors and triacs. Their main property is that their resistance is very large until voltage on their ends exceeds some predefined value. When the voltage is under this value, a diac responds as a large value resistor, and when voltage rises it acts as a low value resistor.

Page 21: Working[1]

Practical examples

Picture 6.5 detects when light is present in a room.  With no light, the photo-transistor does not conduct. When light is present, the photo-transistor conducts and the bell is activated. Turning off the light will not stop the alarm. The alarm is turned off via S1.

Fig. 6.5: Alarm device using a thyristor and a photo-transistor

Page 22: Working[1]

A circuit to flash a globe is shown in figure 6.6  This circuit flashes a 40w globe several times per second. Mains voltage is regulated using the 1N4004 diode. The 220u capacitor charges and its voltage rises. When this voltage reaches the design-voltage of the the diac (20v), the capacitor discharges through the diac and into the triac. This switches the triac on and lights the bulb for a very short period of time, after a period of time (set by the 100k pot), the capacitor is charged again, and the whole cycle repeats. The 1k trim pot sets the current level which is needed to trigger the triac.

Fig. 6.6: Flasher

A circuit to control the brightness of a globe or the speed of a motor is shown in figure 6.7

Fig. 6.7: Light bulb intensity or motor speed controller

Page 23: Working[1]

If the main use for this circuit is to control the brightness of a light bulb, RS and CS are not necessary.

Triacs and Diacs

The Triac

Figure 1. Triac Circuit Symbol

The triac is similar in operation to two thyristors connected in reverse parallel but using a common gate connection. This gives the triac the ability to be triggered into conduction while having a voltage of either polarity across it. In fact it acts rather like a "full wave" thyristor. Either positive or negative gate pulses may be used. The circuit symbol for the triac is shown in Figure 1.

Triacs are mainly used in power control to give full wave control. This enables the voltage to be controlled between zero and full power. With simple "half wave" thyristor circuits the controlled voltage may only be varied between zero and half power as the thyristor only conducts during one half cycle. The triac provides a wider range of control in AC circuits without the need for additional components, e.g. bridge rectifiers or a second thyristor, needed to achieve full wave control with thyristors. The triggering of the triac is also simpler than that required by thyristors in AC circuits, and can normally be achieved using a simple DIAC circuit. A simplified triac control circuit is shown in Figure 2. The operation will be explained after introducing the Diac.

Figure 2. Simplified AC Power Control Circuit using a Triac

Page 24: Working[1]

The Diac

This is a bi-directional trigger diode used mainly in firing Triacs and Thyristors in AC control circuits. Its circuit symbol (shown in figure 3a) is similar to that of a Triac, but without the gate terminal, in fact it is a simpler device and consists of a PNP structure (like a transistor without a base) and acts basically as two diodes connected cathode to cathode as shown in figure 3b.

Figure 3. The Diac Circuit symbol and an equivalent diagram using diodes.

The DIAC is designed to have a particular break over voltage, typically about 30 volts, and when a voltage less than this is applied in either polarity, the device remains in a high resistance state with only a small leakage current flowing.

Once the break over voltage is reached however, in either polarity, the device exhibits a negative resistance as can be seen from the characteristic curve in Figure 4.

Figure 4. Typical Diac Characteristics.

When the voltage across the diac exceeds about 30 volts (a typical break-over voltage) current flows and an increase in current is accompanied by a drop in the voltage across the Diac. Normally, Ohm's law states that an increase in current through a component causes an increase in voltage across that component; however the opposite effect is happening here, therefore the Diac exhibits negative resistance at break-over.

Page 25: Working[1]

In the simple power control circuit in Figure 2 the Diac is used to trigger a Triac by the "Phase Control" method. The AC mains waveform is phase shifted by the RC circuit so that a reduced amplitude, phase delayed version of the mains waveform appears across C. As this wave reaches the break over voltage of the Diac, it conducts and discharges C into the gate of the Triac, so triggering the Triac into conduction. The Triac then conducts for the remainder of the mains half cycle, and when the mains voltage passes through zero it turns off. Some time into the next (negative) half cycle, the voltage on C reaches break over voltage in the other polarity and the Diac again conducts, providing an appropriate trigger pulse to turn on the Triac.

By making R a variable value, the amount of phase delay of the waveform across C can be varied, allowing the time during each half cycle at which the Triac fires to be controlled. In this way, the amount of power delivered to the load can be varied.

Note that in practical control circuits using Thyristors, Triacs and Diacs, large voltages are switched very rapidly. This can give rise to serious RF interference, and steps must be taken in circuit design to minimise this. Also as Mains is present in the circuit there must be some form of safe isolation between the low voltage control components (e.g. the Diac and phase shift circuits) and the mains "live" components, e.g. the Triac and load. This can easily be achieved by "Opto-coupling" the low voltage control circuit to the high voltage power control (Triac or SCR) part of the circuit.

Figure 5. The Opto Triac

The materials used in the manufacture of Triacs and SCRs, like any semiconductor device, are light sensitive. Their conduction is changed by the presence of light; that's why they are normally packaged in little chunks of black plastic. However, if an LED is included within the package, it can turn on the high voltage device output in response to a very small input current through the LED. This is the principle used in Opto-Triacs and Opto-SCRs, which are readily available in integrated circuit (IC) form and do not need very complex circuitry to make them work. Simply provide a small pulse at the right time and the power is switched on. The main advantage of these optically activated devices is the excellent insulation between the low power and high power circuits, (typically several thousand volts). This provides safe isolation between the low voltage input and high voltage output.

Page 26: Working[1]

Testing Thyristors, Triacs and Diacs.

Resistance tests on these devices are of limited use; SCRs and Triacs often operate at mains voltage and when they fail the results can be dramatic. At least the violent blowing of a fuse will be the usual result of a short circuit. Such a fault can be confirmed by measuring the resistance between the two main current carrying terminals of a SCR or Triac. A short circuit in both directions means a faulty component. It is quite possible however, for these devices to be faulty and not show any fault symptoms on an ohmmeter test. They may seem OK at the low voltages used in such meters, but still fail under mains voltage conditions.

The normal method of testing would be the checking of voltages and waveforms if the circuit was operating, or substitution of a suspect part when damage (e.g. blown fuses) is apparent. In many cases these components will be designated "safety critical components" and must only be replaced using manufacturers recommended methods and components. It is common for manufacturers to supply complete "service kits" of several semiconductor devices and possibly other associated components, all of which must be replaced, since the failure of one power control device can easily damage other components in a way that is not always obvious at the time of repair.

Pwm Theory

PWM Inverter

Pulse Width Modulation or PWM technology is used in Inverters to give a steady output voltage of 230 or 110 V AC irrespective of the load. The Inverters based on the PWM technology are more superior to the conventional inverters. The use of MOSFETs in the output stage and the PWM technology makes these inverters ideal for all types of loads. In addition to the pulse width modulation, the PWM Inverters have additional circuits for protection and voltage control.

The quality of the output wave form (230 / 110 volt AC) from the inverter determines its efficiency. The quality of the inverter output wave form is expressed using Fourier analysis data to calculate the ‘Total Harmonic Distortion’ (THD). THD is the square root of the sum of the squares of the harmonic voltage divided by the fundamental voltage.

THD = √ V2 2 + V3 2 + V4 2…………. Vn 2 / V1Based on the output waveforms, there are three types of Inverters. These are Sine wave, Modified Sine wave or Quasi sine wave and Square wave inverters.

Sine waveAlternating current has continuously varying voltage, which swings from positive to negative. This has an advantage in power transmission over long distance. Power from the Grid is carefully regulated to get a pure sine wave and also the sine wave radiate

Page 27: Working[1]

the least amount of radio power during long distance transmission. But it is expensive to generate sine wave in an inverter. Its quality is excellent and almost all electrical and electronic appliances work well in sine wave inverter.

Sine Wave

The sine wave is the AC waveform we get from the domestic lines and from the generator. The major advantage of sine wave inverter is that all of the house hold appliances are designed to operate in sine wave AC. Another advantage is that the sine wave is a form of soft temporal rise voltage and it lacks harmonic oscillations which can cause unwanted counter forces on engines, interference on radio equipments and surge current on condensers.

Modified Sine wave or Quasi Sine wave

Modified sine wave is designed to simulate a sine wave since the generation of sine wave is expensive. This waveform consists of a Flat Plateau of positive voltage, dropping abruptly to zero for a short period, then dropping again to a flat plateau of negative voltage. It then go back to zero again and returning to positive. This short pause at zero volts gives more power to 50 Hz fundamental frequency of AC than the simple square wave.

Inverters providing modified sine wave can adequately power most house hold appliances. It is more economical but may present certain problems with appliances like microwave ovens, laser printers, digital clocks and some music systems. 99% of appliances

Page 28: Working[1]

run happily in modified sine wave. Instruments using SCR (Silicon Controlled Rectifier) in the power supply section behave badly with modified sine wave. The SCR will consider the sharp corners of the sine wave as trashes and shut off the instrument. Many of the Laser printers behave like this and fail to work in inverters and UPS providing modified sine wave power. Most variable speed fans buzz when used in modified sine wave inverters.

Square wave

This is the simplest form of output wave available in the cheapest form of inverters. They can run simple appliances without problems but not much else.Square wave voltage can be easily generated using a simple oscillator. With the help of a transformer, the generated square wave voltage can be transformed into a value of 230 volt AC

or higher.

Advantage of Pulse Width Modulation

In a standard Inverter without the PWM technology, the output voltage changes according to the power consumption of the load. The PWM technology corrects the output voltage according to the value of the load by changing the Width of the switching frequency in the oscillator section. As a result of this, the AC voltage from the Inverter changes depending on the width of the switching pulse. To achieve this effect, the PWM Inverter has a PWM controller IC which takes a part of output through a feedback loop. The PWM controller in the Inverter will makes corrections in the pulse width of the switching pulse based on the feedback voltage. This will cancel the changes in the output voltage and the Inverter will give a steady output voltage irrespective of the load characteristics.

PWM Inverter Block Diagram

Page 29: Working[1]

How it Works?

To design an Inverter, many power circuit topologies and voltage control methods are used. The most important aspect of the Inverter technology is the output waveform. To filter the waveform (Square wave, quasi sine wave or Sine wave) capacitors and inductors are used. Low pass filters, are used to reduce the harmonic components. Resonant filter can be used if the Inverter has a fixed output frequency. If the inverter has adjustable output frequency, the filter must be tuned to a level above the maximum fundamental frequency. Feedback rectifiers are used to bleed the peak inductive load current when the switch turns off.

As per the Fourier analysis, a square wave contains odd harmonics like third, fifth, seventh etc only if it is anti-symmetrical about 180 degree point. If the waveform has steps of certain width and heights, the additional harmonics will be cancelled. If a Zero voltage step is introduced between the positive and negative parts of the square wave, the harmonics that are divisible by three can be eliminated. The width of the pulse should be 1/3 of the period for each positive and negative steps and 1/6 of the period for each of the Zero voltage steps. This leaves on the fifth, seventh, eleventh, thirteenth harmonics etc.The Pulse Width Modulation technology is meant for changing the characteristics of the square wave. The switching pulses are Modulating, and regulating before supplied to the load. When the Inverter requires no voltage control, fixed pulse width can be used.

Multiple Pulse Width Modulation (MPWM) Technology

In Multiple Pulse width technology, waveforms that contain a number of narrow pulses are used. The frequency of these narrow pulses is called Switching or Carrier frequency. The MPWM technology is used in Inverters driving variable frequency motor control systems. This

Page 30: Working[1]

allows wide range of output voltages and frequency adjustments. More over the MPWM technology overall improves the quality of the waveform.

PWM Inverter Characteristics

In order to increase the efficiency of the PWM inverter, the electronic circuit is highly sophisticated with battery charge sensor, AC mains sensor, Soft start facility, output control etc. The PWM controller circuit uses PWM IC KA 3225 or LM 494 .These ICs have internal circuits for the entire operation of the pulse width modulation. The Oscillator circuit to generate the switching frequency is also incorporated in the IC. Output driver section uses Transistors or Driver IC to drive the output according to the switching frequency. Output section uses an array of Switching MOSFETs to drive the primary of the stepping transformer. Output voltage is available in the secondary of the stepping transformer.

Working With the PWM Object

BEFORE READING THIS GUIDE . . .

All code used in this tutorial is written in nqBASIC, using the free nqBASIC IDE.  If you are new to nqBASIC, look for documentation, tutorials, and examples at www.nqBASIC.com.  Before using this tutorial, you should already know how to create a project, where to write your source code, how to compile the code, and how to download it to your NanoCore12 module.

PURPOSE

If you want to use your NanoCore12 module to control the speed of a motor, vary the brightness of a light, or generate a variable voltage, the PWM object can do the job very well! The Pulse Width Modulator (PWM),  built into NanoCore12, is a hardware subsystem that is controlled by the nqBASIC PWM object.

Objectives of this guide:

1. Introduce the concept of pulse width modulation2. Discuss some uses and applications for a pulse width modulator

3. Identify the pulse width modulators (channels) in NanoCore12

4. Demonstrate how to derive the values needed for the PWM Registers

5. Provide an example program demonstrating the PWM

6. Analyze the program source code

WHAT IS PULSE WIDTH MODULATION?

Pulse Width Modulation is the process of controlling (modulating) the pulse width (duty cycle) of a logic level signal. Duty cycle is the percentage of one cycle that a logic level signal is high. A cycle is defined as the smallest part of the waveform that repeats.

Page 31: Working[1]

Figure 1 shows a logic level waveform with period T. During the period, the signal is low for 50% of the period and high for the remaining 50% of the period. We say that the signal has a duty cycle of 50%, and this waveform is often referred to as a "square wave". 

FIGURE1 

Figure 2 shows three independent logic level waveforms with duty cycles of 70%, 80%, and 100% respectively. In this case the duty cycle of the waveform is increasing.

FIGURE 2

Page 32: Working[1]

 

WHAT IS A PULSE WIDTH MODULATOR USED FOR?

A pulse width modulator is a device that can be programmed to vary a logic level waveform’s duty cycle. The duty cycle produced can be used to control the amount of voltage or current applied to a load.

Consider FIGURE 3. The pulse width modulator generates a signal whose duty cycle controls the power delivered to a motor, M. 

FIGURE 3

If the duty cycle produced by the PWM is 0%, then transistor Q1 is turned off. Therefore, no power is delivered to the motor M.

Table 1 shows what happens to the power delivered to the motor as the duty cycle increases.

TABLE1

Page 33: Working[1]

In general, the power delivered to a load is proportional to the duty cycle applied to the circuit.  As a result, the PWM can be used for varying light intensity, motor speed, and average voltage.

THE PWM CHANNELS IN NANOCORE12

In NanoCore12, a PWM is referred to as a channel. For example, a NanoCore12 that can generate four simultaneous PWM waveforms is said to have four PWM channels (or PWMs).

NanoCore12DX, Figure 4, has five PWMs.

FIGURE 4

Each channel can be individually programmed to produce a signal with its own duty cycle without affecting the operation of neighboring PWM channels.

DERIVING THE PULSE WIDTH MODULATED SIGNAL

The pulse width modulated signal, produced by a PWM channel, is derived from the microcontroller’s bus clock. This is accomplished by programming a series of registers with values that scale the bus clock down to the desired pulse width modulated frequency.

NOTE FOR ADVANCED USERS: By default, nqBASIC uses the phased-locked loop (PLL) feature of the microcontroller to boost the bus clock to 24 MHz.  If you use the System PLL object to change the bus clock, it will affect the PWM subsystem.

CALCULATING PWM SETTINGS FOR 8-BIT MODE

Each PWM channel has four programmable PWM variables used to reduce the bus clock to the desired pulse width modulated frequency. These variables are:

BUS CLOCK DIV SCALED DIV

PeriodValue

Page 34: Working[1]

A few things to keep in mind:  you want to have the largest period value possible, as this produces the most accurate PWM duty cyle. Hence, you should use BUS CLOCK DIV and SCALED DIV to divide down the clock so as to end up with the best possible range for the period. The following example calculations are based on this approach, of trying to maximize DutyCycleValue.

The overall formula is this:PWM Frequency = Bus Clock /BUS CLOCK DIV / (2*SCALED DIV ) /PeriodValue

The possible division factors for are 1, 2, 4, 8, 16, 32, 64, 128 which in turn are associated with constant keywords in nqBASIC, shown below:

BUS CLOCK DIV           Value TIMER_DIV_1     divide by 1TIMER_DIV_2     divide by 2TIMER_DIV_4     divide by 4TIMER_DIV_8     divide by 8TIMER_DIV_16    divide by 16TIMER_DIV_32    divide by 32TIMER_DIV_64    divide by 64TIMER_DIV_128   divide by 128

                 TABLE 2

The possible values for SCALED DIV are 0 to 255.  So, using a value of 50 would further divide the bus clock by 100, for example.PeriodValue is the maximum value your DutyCycleValue can be.  That's why, the larger it is, the more discrete pulse-widths you'll be able to generate. The maximum value is 255, and this is the final divisor for the PWM object.

EXAMPLE

PROBLEM:It is desired to generate a pulse-width modulated signal with a frequency of 10Hz and a duty cycle of 50%.

Determine the PWM constants values:

BUS CLOCK DIV SCALED DIV

PeriodValue

SOLUTION: We need to reduce the 24MHz Bus Clock of NanoCore12 to 10Hz by programming the PWM registers with the correct values.

STEP 1:  PERIODVALUELet PeriodValue=250Bus clock / Period Value = 24MHz/(250) = 96kHZThe value 250 was selected to give us a nice round figure which can be further reduced by BUS CLOCK DIV and SCALED DIV.

STEP 2: BUS CLOCK DIV =  TIMER_DIV_32(96kHz)/ (32) =  3kHz

Page 35: Working[1]

3Khz can be easily reduced to 10 Hz by dividing by 300.

STEP 3: SCALED DIV = 1503kHz / (2*150) =10 Hz