Relay control demonstration in Proteus ISIS, Proteus ISIS, relay control, transistor driver circuit

How to Control Relay in Proteus ISIS

5.9M Views
40
700
60
25
60
PCBWay

Hello friends! Today, we will learn how to control a relay in Proteus ISIS. We will begin with a simple circuit that energizes a relay coil and switches a lamp, then add a transistor so a low-voltage logic signal can control the coil.

This follows naturally from our tutorials on DC motor control, stepper motor control and servo motor control. A relay is useful for switching a load on or off, but it is not the best choice for every motor-control task, particularly rapid speed control.

We will keep the demonstration at low DC voltage and use a lamp as the load. The original screenshots remain below, while the connection tables explain the base resistor, protection diode and supply relationships that you should include when building a complete driver circuit.

Relay control demonstration in Proteus ISIS, Proteus ISIS, relay control, transistor driver circuit
Figure: Relay control demonstration in Proteus ISIS.

Understand the Coil and Contacts First

An electromechanical relay contains a coil and a mechanically operated contact set. Current through the coil creates a magnetic field that moves the contacts. The coil circuit controls the switching action; the contacts complete or interrupt a separate load circuit.

A common single-pole changeover relay has three contact terminals: COM, NC and NO. COM is the moving contact. NC means normally closed, and NO means normally open. Here, normally refers to the coil being de-energized, not to the condition you expect most often in your application.

Contact behaviour of a changeover relay
Coil stateCOM to NCCOM to NO
De-energizedClosedOpen
EnergizedOpenClosed

For a lamp that should light when the coil energizes, connect the lamp circuit through COM and NO. Use COM and NC if you intentionally want the opposite behaviour. Neither contact terminal is automatically the coil's ground or supply pin.

The coil voltage and contact rating describe different limits. A relay with a 12 V coil does not require every switched load to operate at 12 V. However, the load voltage, current and load type must remain within the contact specifications. A simulation symbol alone does not establish those real-hardware ratings.

Select Components in Proteus ISIS

Create a new schematic and open the device picker. Search for a relay with a simulation model and a suitable contact arrangement. Add a DC source, a lamp and the wiring components needed for the first example. The available names depend on the installed Proteus libraries.

Components for the simple relay simulation, Proteus ISIS, relay control, transistor driver circuit
Figure: Components for the simple relay simulation.

Labcenter's Proteus simulation-model overview describes the distinction between available peripheral models and general component libraries. When selecting a device, check that it supports the intended simulation; a graphical symbol without the necessary model is not enough.

  • A changeover relay with a coil suitable for the chosen supply.
  • A 12 V DC source for the illustrative coil circuit.
  • A lamp configured for the chosen load supply.
  • A switch if you want to interrupt coil power manually.
  • Ground terminals and voltage or current probes.
  • An optional indicator LED with its own series resistor.

Open the component properties before wiring. Check the relay's coil parameters and the lamp's nominal voltage rather than relying on the label drawn beside the symbol. Give the power nets clear names, especially when the coil and load use separate supplies.

Build the Simple Relay Circuit

For the first experiment, connect the coil to its rated DC supply through a switch. Connect the positive load supply to COM, connect NO to one lamp terminal and return the other lamp terminal to the load supply's negative side. Add the reference connections needed by the simulator.

Original relay and lamp circuit before simulation, Proteus ISIS, relay control, transistor driver circuit
Figure: Original relay and lamp circuit before simulation.

When the coil receives enough current to operate, COM changes from NC to NO and completes the lamp circuit. When coil power is removed, the contact returns to its resting position. The original circuit demonstrated the energized condition by starting the simulation with power applied.

Energized relay switching the demonstration lamp, Proteus ISIS, relay control, transistor driver circuit
Figure: Energized relay switching the demonstration lamp.

An indicator connected across the supply only tells us that power is present. It does not prove that the relay has operated, that its contacts are healthy or that the load current is flowing. Observe the contact position and measure the lamp voltage as separate checks.

Add a Supply Indicator Correctly

If a red LED with an approximate 2 V forward drop is connected to a 12 V supply, a resistor is necessary. For a target current of 5 mA, R = (12 - 2)/0.005 = 2000 ohms. A 2.2-kilohm resistor gives approximately 4.5 mA with those assumptions.

The resistor dissipates approximately I2R = 0.045 W in that example. Choose a rating with suitable margin and check the actual LED characteristics. Do not copy an unprotected LED connection simply because a simulator displays an illuminated symbol.

Why a Microcontroller Needs a Relay Driver

A microcontroller output provides a logic signal with limited current capability. A relay coil may require a different voltage and considerably more current. Connecting a 12 V coil directly to a GPIO pin can exceed the pin's voltage or current limits.

A transistor lets the GPIO control a separate coil-current path. In a low-side NPN circuit, one coil terminal connects to the positive coil supply. The other connects to the transistor collector, and the emitter connects to ground. The GPIO drives the base through a resistor.

This arrangement does not boost a 5 V output into a 12 V supply. The 12 V supply already powers the coil; the transistor completes its return path. A 3.3 V controller can also operate an appropriately designed driver, but the resistor and transistor choices must be checked for that logic level.

Build the NPN Transistor Relay Driver

Keep the relay and lamp from the first circuit, then add an NPN transistor, base resistor, base-to-emitter pull-down resistor and flyback diode. We will use a logic-state control in Proteus before introducing firmware. This keeps the driver test independent of a microcontroller program.

Components for the transistor controlled relay, Proteus ISIS, relay control, transistor driver circuit
Figure: Components for the transistor controlled relay.

Connections for the low-side relay driver
Part or nodeConnection
Relay coil positive terminalPositive coil supply
Relay coil negative terminalNPN collector
NPN emitterCoil-supply ground
Logic outputBase through a calculated series resistor
Base pull-downBase to emitter, for example 47 kilohms
Flyback diode cathodePositive coil supply
Flyback diode anodeCollector side of the coil
Controller groundDriver ground for this non-isolated input circuit

Original NPN relay driver circuit illustration, Proteus ISIS, relay control, transistor driver circuit
Figure: Original NPN relay driver circuit illustration.

The screenshot illustrates the original transistor-control concept. Use the complete connection table when recreating it, including protection and current-limiting parts that may not be represented clearly in an older drawing. Check the transistor's actual pinout; similarly named packages can place collector, base and emitter in different physical positions.

Estimate Coil Current

Suppose an illustrative 12 V relay coil has a DC resistance of 400 ohms. Its approximate steady current is I = V/R = 12/400 = 0.030 A, or 30 mA. Its steady coil power is approximately 12 × 0.030 = 0.36 W.

These values are a worked example, not specifications recovered from the screenshot. Use the selected relay's datasheet for a real design. The transistor's on-state voltage reduces the voltage across the coil slightly, and coil resistance changes with temperature.

Choose the Base Resistor

For an initial switching calculation, suppose we aim for a forced collector-to-base current ratio of 10. A 30 mA collector current then needs approximately 3 mA of base drive. With a 5 V output and an assumed 0.8 V base-emitter drop, RB = (5 - 0.8)/0.003 = 1400 ohms.

A 1.2-kilohm candidate gives about 3.5 mA before allowing for the pull-down path and output-voltage reduction. Check that the controller can provide that current while meeting its guaranteed HIGH voltage. Then verify saturation, dissipation and temperature limits against the specific transistor datasheet.

The onsemi PN2222A datasheet provides saturation measurements under stated collector and base current conditions. Those conditions matter more for a switch than assuming a typical small-signal current gain will always be available.

Protect the Driver With a Flyback Diode

A relay coil stores magnetic energy. When the transistor switches off, the coil current cannot change instantaneously. Without a controlled path, the coil can generate a voltage large enough to damage the transistor or disturb nearby electronics.

The diode across a DC coil is normally reverse-biased. Its cathode faces the positive supply and its anode faces the transistor collector. At turn-off, it provides a path for the remaining coil current. Reversing it would make it conduct strongly when the supply is applied.

The stored energy is E = 0.5LI2. For an illustrative inductance of 0.1 H and a current of 0.03 A, E = 0.000045 J, or 45 microjoules. The actual relay inductance and operating current determine the required protection, so check the diode's current, voltage and repetitive-energy suitability.

A simple diode also slows the decay of coil current and can lengthen relay release time. Applications requiring a faster release may use a different clamp arrangement, but the resulting transistor voltage and relay recommendations must be considered. Do not remove protection merely to make the contacts move faster.

Run the Logic-Controlled Simulation

Start with the logic input LOW. The transistor should be off, the coil should be de-energized and the lamp connected through NO should be off. The supply indicator may still glow because it measures supply presence rather than contact state.

Relay driver with logic input low, Proteus ISIS, relay control, transistor driver circuit
Figure: Relay driver with logic input low.

Change the logic input to HIGH. Base current should turn the transistor on, coil current should rise and the relay should connect COM to NO. The lamp should then receive its supply voltage and illuminate.

Relay driver with logic input high, Proteus ISIS, relay control, transistor driver circuit
Figure: Relay driver with logic input high.

Return the input to LOW and observe the release. Repeat this slowly so you can follow the sequence. Mechanical relays have operating and release times, so they should not be treated like ideal switches that follow arbitrarily fast logic transitions.

Measure More Than the Lamp State

  • Measure the coil voltage when the driver is on.
  • Measure the coil current and compare it with the expected operating range.
  • Check the collector voltage in both logic states.
  • Confirm that the load is wired through the intended contact.
  • Inspect the turn-off transient if the selected models support it.

A simplified relay model may not represent contact bounce, wear, arcing or every magnetic effect. Therefore, a clean simulation is useful evidence about the modelled circuit, but it does not replace datasheet checks and appropriate hardware testing.

Replace the Logic Input With a Microcontroller

After the driver works, replace the logic-state source with a GPIO output through the same base resistor. Keep a common reference between the controller and driver grounds. Never connect the 12 V coil node to the GPIO.

Configure the output so its initial state is defined. The pull-down resistor helps keep the transistor off while the GPIO is high impedance during reset, although the full startup behaviour depends on the selected controller and its boot process. Test power-up, reset and programming, not only the main loop.

// Conceptual Arduino output control for a verified driver circuit.
const byte relayControl = 6;
void setup() {
  digitalWrite(relayControl, LOW);
  pinMode(relayControl, OUTPUT);
}
void loop() {
  digitalWrite(relayControl, HIGH);
  delay(2000);
  digitalWrite(relayControl, LOW);
  delay(2000);
}

The two-second intervals make the switching visible. They are not a recommended continuous duty cycle for every relay or load. For an actual application, replace this demonstration loop with the required control conditions and respect the relay's electrical and mechanical life specifications.

Using a ULN2003A for Several Relays

A driver array can reduce the number of discrete parts when several coils need control. The TI ULN2003A contains seven Darlington channels and common-cathode clamp diodes. Its outputs sink current; they do not supply coil power.

For the usual positive-supply coil arrangement, connect COM to the positive coil supply so the internal clamp diodes have the intended return path. Connect the driver ground correctly and check the voltage drop and total package dissipation. A per-channel headline current rating does not mean every channel can carry that current simultaneously under all conditions.

Our relay interfacing with ULN2003 tutorial continues this topic. You can also compare the control source with the 555 timer relay-control example.

Troubleshooting and Design Review

Relay simulation problems to check
ProblemPossible cause
Coil does not energizeWrong supply, insufficient current, reversed transistor or missing ground reference
Relay moves but lamp stays offOpen load circuit, wrong contact or incorrect lamp supply
Lamp is on in the resting stateLoad connected through NC rather than NO
Transistor remains partly onFloating base, incorrect input level or inadequate circuit definition
Supply is effectively shortedFlyback diode reversed or wiring bypassing the load
Simulation reports no modelSelected part is unsuitable for the requested simulation

Do not assume a relay is ideal for PWM motor-speed control. Mechanical contacts are comparatively slow and wear with switching. A transistor, MOSFET or motor-driver circuit is usually the relevant starting point for rapid electronic switching, while relays can be useful for suitably rated occasional connection changes.

Keep the coil circuit and contact circuit separate in your reasoning. The contacts provide isolation only within the relay's specified construction and the surrounding layout. Sharing grounds elsewhere can remove system-level isolation even though the relay itself has isolated contacts.

Check Contact Loading and Supply Behaviour

The lamp circuit deserves its own review. An incandescent lamp can draw more current at switch-on than after its filament warms up. A motor can draw a large starting or stalled current. Consequently, choosing contacts only from the steady running current may underestimate the stress they experience.

Check the manufacturer's rating for the actual load type and voltage. A contact rating specified for a resistive AC load should not automatically be reused for an inductive DC load. In the simulation, distinguish the lamp's nominal power from the relay coil's power; these are supplied through different paths even if you use one common DC source.

A weak supply can also produce repeated operation and release, sometimes heard as chatter. When the coil energizes, its current causes the supply voltage to fall; the relay releases, the voltage recovers and the sequence repeats. Measure the supply at the driver while it switches instead of checking only its unloaded voltage.

For a controller-driven circuit, consider the return-current path as well. Coil current flowing through a poor shared ground connection can disturb the controller's reference. Short, appropriate power wiring and local supply decoupling help prevent that problem. These physical effects may be absent from an ideal schematic simulation unless they are deliberately modelled.

Finally, record the relay's pull-in and release requirements. A coil that remains energized at a reduced voltage may still fail to pull in from rest at that voltage. Test the transition from a fully released state rather than assuming that holding performance proves reliable startup.

Frequently Asked Questions

Does a 12 V relay need a 12 V logic signal?

No. Its coil needs an appropriate supply, while a correctly designed driver can accept a lower-voltage control signal. The logic source does not directly power the coil.

Can I omit the base resistor?

No. The resistor limits current into the base-emitter junction and protects the driving output. Calculate a suitable value for the selected transistor, coil and controller.

Why is the diode connected backwards across the coil?

It must remain off while normal coil voltage is applied. Its orientation allows it to conduct the continuing coil current after the transistor switches off.

Why does the relay click without switching my lamp?

A click suggests mechanical movement, but the load circuit may still be open. Check COM, NO, the load supply and the lamp return independently.

Does this tutorial demonstrate mains wiring?

No. The examples use low-voltage DC supplies. Switching higher-energy loads requires a separate design with appropriate ratings, protection, layout and installation requirements.


Comments

6

Join the conversation

1 reply
Reply3

I have built all your circuits and they work well. The led goes on as expected and the lamp lights when the circuit is activated. The part that really drives me nuts is when the relay is activated and the lamp is on , the internal part of the relay does not active, even though the lamp is glowing. I have had this problem with all the relay circuits in proteus. The internal part of the relay ( the wiper arm) does not move. Any ideas

Reply5

Really like your tutorials! Need to try out some of your Proteus add-ons. I was wondering if you know how to make a 4PDT Relay for Proteus? I've tried taking the 2PDT Relay and modifying that but I get error messages when I try to use it. Can you make this part? Thanks for any help.