top of page
Writer's pictureSanskruti Ashtikar

Designing a Relay Control Circuit Using TinkerCAD

Updated: Nov 23

Relays are fundamental components in electronics, used to control high-voltage devices with low-voltage signals. This makes them indispensable in various applications, from home automation to industrial control systems. In this article, we will guide you through designing and simulating a basic relay control circuit using TinkerCAD, a powerful online platform for 3D design, electronics simulation, and coding.





Materials Needed:


  • Arduino Uno

  • 5V Relay Module

  • LED

  • 220-ohm Resistor

  • Push Button

  • Diode (1N4007)

  • NPN Transistor (2N2222)

  • Breadboard

  • Jumper Wires

  • External Power Supply (Optional)


Step 1: Understanding the Relay Control Circuit


A relay is essentially an electromechanical switch that allows a low-power signal, like the one from an Arduino, to control a high-power circuit. When the relay is activated, it uses an electromagnet to open or close a switch. In this project, we will control an LED using a relay, simulating the control of a larger load such as a motor or a light bulb.

The key components in this circuit include:

  • Relay Module: The relay module has three main terminals: COM (Common), NO (Normally Open), and NC (Normally Closed). The COM terminal is connected to the common input, while NO and NC determine whether the circuit is closed or open when the relay is activated or deactivated.

  • Transistor: An NPN transistor is used to amplify the Arduino's signal, allowing it to drive the relay coil.

  • Diode: A flyback diode protects the circuit from voltage spikes generated when the relay coil is de-energized.


Step 2: Setting Up the Components in TinkerCAD


  1. Arduino Uno: Start by placing the Arduino Uno on the TinkerCAD workspace. The Arduino will serve as the brain of the relay control circuit.

  2. Relay Module: Place the relay module on the breadboard. Connect the following pins:

    • VCC: Connect to the 5V pin on the Arduino.

    • GND: Connect to the GND pin on the Arduino.

    • IN: Connect to digital pin 7 on the Arduino (this pin will control the relay).

  3. Transistor (2N2222): Place the transistor on the breadboard. The transistor has three pins: the collector (C), base (B), and emitter (E).

    • Collector (C): Connect to one end of the relay coil.

    • Base (B): Connect to digital pin 7 of the Arduino through a 1k-ohm resistor.

    • Emitter (E): Connect to GND on the Arduino.

  4. Diode (1N4007): Place the diode across the relay coil terminals, with the cathode (marked end) connected to the VCC side of the coil and the anode to the collector of the transistor. This flyback diode prevents voltage spikes when the relay is turned off.

  5. LED and Resistor: To simulate controlling a load, place an LED on the breadboard. Connect the anode of the LED to the COM terminal of the relay and the cathode to GND through a 220-ohm resistor.

  6. Push Button: Add a push button to the circuit to manually control the relay. Connect one terminal to 5V and the other to digital pin 2 on the Arduino with a pull-down resistor (10k ohm) to GND.





Step 3: Writing the Arduino Code


With the hardware setup complete, the next step is to write the code that will control the relay. Below is a simple Arduino sketch that toggles the relay on and off based on the push button input.


int relayPin = 7;
int buttonPin = 2;
int buttonState = 0;
void setup() {
  pinMode(relayPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}
void loop() {
  buttonState = digitalRead(buttonPin);
  
  if (buttonState == HIGH) {
    digitalWrite(relayPin, HIGH); // Turn relay on
  } else {
    digitalWrite(relayPin, LOW); // Turn relay off
  }
}

Step 4: Simulating the Circuit in TinkerCAD


Now that your circuit and code are ready, it’s time to simulate the relay control circuit in TinkerCAD.

  1. Start the Simulation: Click the "Start Simulation" button. When the push button is pressed, the relay should activate, turning on the LED. Releasing the button should deactivate the relay and turn off the LED.

  2. Troubleshooting: If the LED does not turn on, double-check the connections, especially the transistor's orientation and the diode's placement. Ensure the push button is functioning correctly and that the Arduino code is properly uploaded.





Step 5: Practical Application and Testing


If you have access to physical components, you can build the circuit on a breadboard, following the same wiring instructions as in TinkerCAD. Upload the Arduino code to your Arduino Uno and test the relay circuit with a real load, such as a light bulb or motor, instead of the LED.

Ensure safety precautions when working with high-voltage components, such as using appropriate insulation and not exceeding the relay’s rated current and voltage.


Conclusion


Congratulations! You have successfully designed and simulated a relay control circuit using TinkerCAD. This project provides a foundation for understanding how relays work and how they can be used to control high-power devices with low-power signals. Relays are versatile components that can be integrated into a wide range of projects, from home automation systems to industrial controls.

By experimenting with different inputs (like sensors) and outputs (like motors or larger loads), you can extend this basic relay circuit to suit various applications. TinkerCAD offers a safe and convenient way to prototype and test your ideas before building them in the real world.


Happy tinkering!


Want us to guide you through your project or make the project for you ?







Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 





38 views0 comments

Related Posts

See All

Kommentare


bottom of page