Now , I gonna make a smart circuit using an Arduino UNO .
For me , I was happy to know how the 7 segments work so , I decided to build a circuit using it .🤩
This tutorial helped me a lot to do my task .👉
_ Software
It is a free app for 3d design , electronics , and coding
_ Electric components
_Making Tools
Firstly , opened TinkerCAD and created new circuit .
Then brought the components needed ( Arduino UNO , 7 segment dispaly , 220 ohm resistor , buzzer , IR sensor , side switch , bush button ) .
After that started building my circuit as follows :
_ connect the Arduino with breadboard by wiring 5v pin of Arduino to the positive rail of the breadboard and GND to the negative rail
_ put my 7segment on the breadboard , then connect each pin with a resistor to avoid burning its' LEDs
_ After connecting resistors , wiring them with Arduino ( from pin 2 to pin 8 ) in order of letters ( from letter a to g) as shown in the 7 segment schematic.
_As I had 7 segment com cathode , connected it's com with the negative rail .
_ Then connected the Buzzer by connect it's positive leg to pin9 on Arduino and the negative with the negative rail .
_ Then connected the side switch by connecting it's middle pin to pin10 on Arduino then the left pin to the negative rail and the right to the positive .
_ Then , connecting IR sensor , VCC to the positive rail , GND to the negative and OUT to pin11 on Arduino .
_ Finally , connected the bush button , one leg on pin
After finishing building the circuit , went to the code to start building my code ,
The function we need is to display countdown from number 9 to 0 within 10 sec , so that each number appears within a second
And to do that I had to know which LEDs to light ( from a to g ) , and following it's schematic helping me doing that .
Going to the code blocks and as the 7 segment is an output component so ,
Going to the output blocks then drop and drag ( set pin n HIGH \ LOW) to control lighten the LEDs
9
4
8
3
7
2
6
1
5
0
To make it let second difference in time , going to control blocks then drop and drag ( wait n sec) *n = 1 * and put the block after each number block
Then collect all the blocks together
Now , we wanna control turning the circuit on and off so , we gonna use the switch to do that so , the switch will be an input component .
Here , we have two modes :
1_ Automatic mode , which depends on IR sensor to give an action .
2_ Manual mode , depends on switch to give an action .
Going to the input blocks and drop and drag (read digital pin n HIGH \ LOW )
Then go to math and choose the hexagonal shape to put the inputs in it and equal it to the read HIGH or LOW
And to combine the input and output together , 'll use IF & else from control blocks
Put the If condition in place above as we say : if you read digital pin n HIGH , set pin 1,2,31..... HIGH or LOW based on the number appeared .
Then in else , turn all the LDs off so , make all of them LOW .
inputs
math
control
math
Automatic mode
It based on the side switch , If the switch is high and the sensor sense moving object , it gives the actions .
Manual mode
It based on the bush button , If the switch is low and the button is high , it gives the actions .
After finishing the first output component , it's time to set the second 'buzzer''
we wanna making sound when it starts countdown and finish
Going to the output blocks and choose ( play speaker on pin n , with tone 60 , for 1 sec)
And put it in the beginning of the code and the end
I see that , it 'll be fine to make it wait 1 sec during the sound without displaying the 7 segment
It's time to test the circuit
Firstly , I brought the components needed ( Arduino UNO, it's cable , breadboard , male male wires , 7 segment , 7 220 ohm resistors , side switch , buzzer) .
Then started building the circuit as it is in tinkercad
Taking the code text copied , going to Arduino IDE and pasting it .
Verifying that the code is correct , then uploading it on the Arduino , remembering to connect it with it's cable .
IT is wonderful !
During building the code , Specifically the part related to programming the IR sensor , as I didn't know how to merge it's code with the 7 segment code .
AS every time I tried to merge them together , IR sensor doesn't worked .
To solve it : I tried to put a switch , that separates to modes , one is automatic and the other is manual as I explained in design\ preparation prosses section .
As required in the final project to make a smart device so , it will contain smart components , these components need to be programmed as we want to work , and that we learned in this week .
Using Arduino , for me was the first time to do it ,I admit that it was not an easy thing to do, but I am happy with my first step in this part .
We made this smart waving hand . 🤩
I enjoyed building it as it was the first time to mount smart objects in my projects 🥰