Turn on two lamps connected to Arduino UNO using push buttons

Arduino UNO 05-12-23
188 0

Tutorial plan

1- The components necessary to control two lamps by push buttons through the Arduino UNO board

2- Mounting the Arduino UNO board with two lamps, two relays and two push buttons

3- Programming the Arduino UNO board to turn on two lamps using two push buttons

 

 

The components necessary to control two lamps by push buttons through the Arduino UNO board

To control the two lamps using  the Arduino UNO board, two relays and push buttons, you will need the following components:

1- Arduino UNO board:

Arduino Uno

The Arduino UNO board is a popular microcontroller board based on the ATmega328P microcontroller. It is one of the most commonly used Arduino boards and provides a versatile platform for creating interactive electronic projects.

The Arduino UNO board is suitable for beginners and experienced users alike, offering a flexible and accessible platform for prototyping and building various electronic projects, from simple LED blinking to complex robotics and home automation systems.

2- Two relays modules:

Two relays

You'll need two relays modules that are compatible with the Arduino UNO and can switch the high-voltage lamps. Ensure it's rated for the voltage and current required for your lamps.

3- Two lamps (220V):

The two lamps you want to control, which are rated for 220V.

4- Power Supply for the Lamp:

You'll need a power source for the lamps, typically a 220V AC power supply.

5- Wiring:

Various wires and cables for connecting the components in your circuit.

6- Push button:

push button

A push button, also known as a momentary switch or tactile switch, is a simple yet commonly used electromechanical component in electronics. It is designed to make or break an electrical connection temporarily when pressed or released.

7- Resistance

In the context of electronics and electrical circuits, a resistance refers to a passive two-terminal electrical component that restricts the flow of electric current. It is typically measured in ohms (Ω).

8- Breadboard:

Breadboard

A breadboard is a prototyping board that allows you to build circuits without soldering. It provides a convenient way to connect the components together.

9- Jumper Wires:

Jumper Wires

You'll need jumper wires to make connections between the Arduino UNO, the two lamps, two relays, two push buttons and breadboard.

Mounting the Arduino UNO board with two lamps, two relays and two push buttons

Once you have the necessary components, you can proceed with the following steps to control  the two lamps  with two push buttons:

1- Connect the first relay module to the first push button:

- Connect one leg of the push button to pin 4 of the Arduino.

- Connect another leg of the push button to the 5V pin of the Arduino.

- Place a 10k Ohm resistor between the third leg of the push button and the GND pin of the Arduino.

2- Connect the first relay to the Arduino UNO:

- Connect the relay's control pin (S) to pin 2 of Arduino UNO board.

- Connect the pin (+) of relay to pin 3.3V of Arduino UNO board.

- Connect the relay's ground pin (GND) to the Arduino UNO's GND.

3- Connect the first lamp and the power supply to the Relay:

- Connect one of the the power supply's wires to the relay's common (COM) terminal.

- Connect the wire of the lamp to the normally open (NO) terminal of the relay.

- Connect the neutral wire of the power supply directly to the neutral wire of the lamp.

4- Connect the seconf relay module to the second push button:

- Connect one leg of the push button to pin 5 of the Arduino.

- Connect another leg of the push button to the 5V pin of the Arduino.

- Place a 10k Ohm resistor between the third leg of the push button and the GND pin of the Arduino.

5- Connect the second relay to the Arduino UNO:

- Connect the relay's control pin (S) to pin 3 of Arduino UNO board.

- Connect the pin (+) of relay to pin 3.3V of Arduino UNO board.

- Connect the relay's ground pin (GND) to the Arduino UNO's GND.

6- Connect the second lamp and the power supply to the Relay:

- Connect one of the the power supply's wires to the relay's common (COM) terminal.

- Connect the wire of the lamp to the normally open (NO) terminal of the relay.

- Connect the neutral wire of the power supply directly to the neutral wire of the lamp.

Mounting the Arduino UNO board with two lamps, two relays and push buttonsMounting the Arduino UNO board with two lamps, two relays and push buttons

Programming the Arduino UNO board to turn on two lamps using the two push buttons

To program an Arduino Uno board to turn on two lamps using two relays and two push buttons, you'll need to write the Arduino code. Here's a sample code to get you started:

This code sets up the two push buttons to toggle the two relays state when pressed. When you press one of the buttons, it will turn the lamp on, and when you press it again, it will turn the lamp off.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info