Electronic Project 24: Light and Sound display characteristics of an SR Flip-flop using LED & Buzzer with arduino uno

in utopian-io •  7 years ago  (edited)

What Will I Learn?

At the end of this tutorial:

♦ The readers will be able to create a circuit that will display the function of an SR flip-flop

♦ The readers will be able to know how the circuit works.

♦ Learn to apply the circuit in making electronic projects that needs the function of an SR Flip-flop

Introduction

In this tutorial, we are about to learn and display the characteristics of an SR Flip-flop using LED lights and a buzzer.
So what is RS flip-flop?

RS Flip-flop is commonly used flip-flop also known as Set-Reset flip-flop. It has two inputs, S & R, S is to set the flip-flop and R is to reset the flip-flop. It has two outputs that is complement of one another.

You can read more here

Requirements

Electronic Components

♦ Arduino Uno

♦ Pushbutton

♦ Resistor

♦ Buzzer

♦Transistor

♦ LED

♦ Breadboard

♦ Connecting wires

Software

♦ Fritzing application

Difficulty

♦ Advance

Tutorial Contents

Using the fritzing software, we will create our circuit diagram, arduino codes and prototype using the breadboard

Part I. Schematic Diagram

So first let us construct our circuit diagram.

image.png

Select the electronic components needed for the circuit in the fritzing library. We need 1 arduino uno, 1 pushbutton, 7 resistors, 2 leds, 1 2 buzzers and 2 transistors.

image.png

Arrange the components before constructing the circuit.
In arranging the components, place all the components for the input side (left side) of the arduino and the components for the output side (right side).

In this tutorial the input components will be the pushbutton and a resistor. The rest of the components are for the output side.

image.png

Now let us construct our circuit diagram. So at input side of our microcontroller is the pushbutton connected in series with a resistor. The pushbutton must be connected to a voltage source. So we will connect it to the 5V output from the arduino and the resistor directed to the ground.

image.png

At the output side of our microcontroller, we need two pins for our LED lights. I will use pin 12 & 13 as our output pin. So we connect an amplifier circuit at the two inputs to amplify the signal before connecting to the two LED.

image.png

Then the amplified output at the collector terminal of the transistor will be connected to the LED lights. This amplified signal can drive the two LEDs. We can put or connect a resistor before connecting the led to minimize the current flow through the led to avoid damaging the led.

image.png

Then for our buzzer, we connect it in parallel with the resistor and led connection. We connect it in series so that same voltage source supplied to the buzzer.

image.png

Here is our final circuit diagram.

image.png

When the pushbutton is press, the microcontroller will give an output as SET or 1 at pin 12. When it is not pressed, the output is Reset or otherwise 0 at pin 13.

A signal will flow at the input, then the pin 12 is high, so there is an output signal fed to the amplifier circuit. Then the amplified signal at the collector terminal will make the led and buzzer to operate.

image.png

As you can see in the figure below, two outputs, that is complement with each other. When q = 1, then the other output will be 0.

image.png

The output signal at the collector will flow through the led making it to give lights then also the buzzer will give a sound relative to the input value at the pushbutton.

image.png

Part II. Code

Now let us do programming of our Arduino uno.
Click on code to start.

image.png

The pushbutton serve as the two inputs (S & R) of the microcontroller.We declare the input and output pins for our microcontroller. Pin 2 is the input pin and pin 12 & 13 as the output pin.

int buttonPin = 2;
int res1Pin = 12;
int res2Pin = 13;

image.png

Our two inputs (S & R) will depends on the pushbutton activity. If it is pressed it will give “1” value and if not “0”. So we declare first the initial value of the pushbutton.

int buttonValue = 0;

image.png

Now we will set up our loop.

void setup(){
pinMode(buttonPin, INPUT); //set input pin 2
pinMode(res1, OUTPUT);     //set output pin 12
pinMode(res2, OUTPUT);     //set output pin 13
}

image.png

Now we will create a looping to our microcontroller.

void loop(){
if (digitalRead(buttonPin)==LOW){  //when pushbutton is not pressed (S =0)
digitalWrite(res1, HIGH);   //give an output at pin 12
digitalWrite(res2, LOW);   //no output at pin 13
} 
else {
digitalWrite(res1, LOW);  //if not, pin 12 has no output
digitalWrite(res2, HIGH); //while pin 13 will have an output
}
}

image.png

Here are our arduino codes.

int buttonPin = 2; 
int res1Pin = 12; 
int res2Pin = 13; 
int buttonValue = 0; 
void setup(){ 
pinMode(buttonPin, INPUT); 
pinMode(res1, OUTPUT); 
pinMode(res2, OUTPUT); 
} 
void loop(){ 
if (digitalRead(buttonPin)==LOW){  
digitalWrite(res1, HIGH);   
digitalWrite(res2, LOW);   
} 
else { 
digitalWrite(res1, LOW);  
digitalWrite(res2, HIGH); 
} 
} 

Part III. Breadboard

Click on the breadboard.

image.png

Arrange each component in the breadboard before connecting.

image.png

Now connect each component if you don’t know how to connect using breadboard just read my previous tutorial about how to construct a circuit in the breadboard

image.png

Application

The readers can create their own SR flip-flop display.
Like the example below.

link source

Curriculum

Here are my other tutorials for electronic projects.

ELECTRONIC PROJECTS

Tutorial 1

Tutorial 2

Tutorial 3

Tutorial 4

Tutorial 5

Tutorial 6

Tutorial 7

Tutorial 8

Tutorial 9

Tutorial 10

Tutorial 11

Tutorial 12

Tutorial 13

Tutorial 14

Tutorial 15

Tutorial 16

Tutorial 17

Tutorial 18

Tutorial 19

Tutorial 20

Tutorial 21

Tutorial 22



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thanks @creon

Hey @rfece143 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x