Fundamentals of Arduino- is a 05 days consecutive program and training session and this slide is for the 2nd day of those 05 days. The session took place on 29th December 2020. This is very much designed for school and college-going students-who are interested in Arduino, Robotics, and other 4th Industrial Revolution-peripherals.
In this session, Basic of Arduino Coding, Introduction to Proteus, Simulation using Proteus was discussed.
The event was organized by EMK Center and the trainer was Mr. Redwan Ferdous.
08448380779 Call Girls In Friends Colony Women Seeking Men
Fundamentals of Arduino: Day-02
1. Fundamentals of Arduino
Day 02of 05
29th December 2020
Redwan Ferdous
Electrical Engineer| Tech Enthusiast| Robotics | Automobile| Data Science |
Tech-Entrepreneur & Investor |
redwan.contact@gmail.com | ferdousr@emk.com.bd
https://sites.google.com/view/redwanferdous
2. Today’s Agenda
• Intro to Arduino Coding
• Introduction to Proteus Design Suite (version: 08)
• Working with some simulation of Arduino based projects at Proteus
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
2
9. Arduino Simulation using
Proteus (v:08)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
9
10. Proteus Design Suite
• The Proteus Design Suite is a proprietary software tool suite used
primarily for electronic design automation. The software is used
mainly by electronic design engineers and technicians to create
schematics and electronic prints for manufacturing printed circuit
boards (PCB). [wiki]
• Initially released on 1988
• Current Stable Release 8.10
• EDA (electronic design automation) software
• File Extension for created simulation: .pdsprj
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
10
11. Proteus Design Suite
• Proteus owes its name to a Greek god of the sea (Proteus), who took
care of Neptune's crowd and gave responses; he was renowned for
being able to transform himself, assuming different shapes.
• There is a full-fledged ‘Programing Language’ named, ‘Proteus’.
It stands for: PROcessor for TExt Easy to Use.
Wiki- https://en.wikipedia.org/wiki/Proteus_(programming_language)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
11
12. Proteus Design Suite
• Features:
• Schematic Capture
• Microcontroller Simulation
• Printed Circuit Board (PCB) [upto 16 copper layer]
• 3D Modeling / Verification
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
12
13. Installing Proteus (version:08) in your
machine
• Download from the following link and follow the instruction to install
the software properly in your machine.
https://drive.google.com/uc?id=0B7Kl58TCjALjcDdSOFZJa0hLT1k&expo
rt=download
• For instruction is written in Spanish language, please translate using
Google Translator and follow accordingly.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
13
14. Check if the software is running perfectly..
• If Proteus (version 08) is
being installed perfectly
according to the
instruction, the landing
page will be seemed
as following:
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
14
15. Getting Started with Proteus Software
• Exploring the different keys and options of using the software:
• Ribbon Tools (horizontal)
• Pick up components
• Libraries
• Terminals and other tools in vertical ribbon
• Import Missing Library [Later On]
• PCB
• Blinking an LED
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
15
16. But your Arduino Library should be missing..
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 16
17. Download the ‘Arduino’ Library for Proteus
• Download the following 02 files from the link:
https://drive.google.com/drive/folders/1ys9MC4hRXEcLYEcA7DJhCO8w
feWeqWpX?usp=sharing
• There are 02 types of files: .IDX and .LIB
• (.LIB) is for the libraries
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
17
18. Now Projects…
• Today we will make total 04 projects
• Project-01: 7 Segment Display
• Project-02: Driving Motor with Motor Driver IC
• Project-03: Message Transmission using Tx-Rx Module
• Project-04: Using Temperature sensor (LM35)
• First 02 projects will be described in details, with electronics.
The last 02 will be shown only execution- to show the
methods. Basic PCB drawing will also be shown
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
18
19. Project-01: Running 7-Segment Display
• Problem Statement:
We will take a 7-Segment Display (Common Anode/ Common Cathode) and
display 0-9 on that display in a cyclic order, continuously.
• 7- Segment Display
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 19
20. Project-01: Running 7-Segment Display (cont.)
• Components:
• Arduino Uno (Rev-3) x01
• 7-Segment Display (CC/CA) x01
• Resistor (01k) x01
• Power Source (PWR and GND)
• Component lists for commercial production is called BOM (Bills of
Materials)
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 20
21. Project-01: Running 7-Segment Display (cont.)
• First, let’s see the LED Basics:
• A single LED consists of two terminals, an anode and a cathode. The
anode is the positive terminal and
the cathode is the negative terminal:
• To power the LED, you connect the cathode to
ground and the anode to the voltage supply.
The LED can be turned on or off by
switching power at the anode or the cathode.
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 21
22. Project-01: Running 7-Segment Display (cont.)
• With the LED’s anode connected to a digital pin,
the cathode is connected to ground:
• Note: All LEDs need a current limiting resistor
placed on either the anode side or cathode side
to prevent the LED from burning out. The resistor
value will determine how bright the LED shines.
1K ohms is a good place to start, but you can
calculate the ideal value with an
LED resistor calculator.
[Link: https://ohmslawcalculator.com/led-resistor-calculator]
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 22
23. Project-01: Running 7-Segment Display (cont.)
To light up an LED with the anode connected
to a digital pin, you set the digital pin to HIGH:
void setup()
{
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
}
void loop()
{
}
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
23
24. Project-01: Running 7-Segment Display (cont.)
• How 7-Segment Display works?
Seven segment displays consist of 7 LEDs,
called segments, arranged in the shape of an “8”.
Most 7-segment displays actually have
8 segments, with a dot on the right side of the
digit that serves as a decimal point.
Each segment is named with a letter A to G,
and DP for the decimal point:
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
24
25. Project-01: Running 7-Segment Display (cont.)
• Each segment on the display can be
controlled individually, just like a regular LED.
• There are two types of 7-segment displays
– common cathode and common anode.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
25
26. Project-01: Running 7-Segment Display (cont.)
• Difference between Common Cathode & Common Anode 7-Segment
Display
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 26
27. Project-01: Running 7-Segment Display (cont.)
• How to Tell If You Have a Common Anode or Common Cathode
Display
- To determine if a display is common anode or common cathode, you
can probe the pins with a test circuit constructed like this:
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 27
28. Project-01: Running 7-Segment Display (cont.)
• How to Tell If You Have a Common Anode or Common Cathode
Display
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 28
Connect the ground (black) wire to any pin of the display. Then insert the positive (red) wire into each one of
the other pins. If no segments light up, move the ground wire over to another pin and repeat the process.
Do this until at least one segment lights up.
When the first segment lights up, leave the ground wire where it is, and connect the positive wire to each
one of the other pins again. If a different segment lights up with each different pin, you have a common
cathode display. The pin that’s connected to the ground wire is one of the common pins. There should be
two of these.
If two different pins light up the same segment, you have a common anode display. The pin that’s connected
to the positive wire is one of the common pins. Now if you connect the ground wire to each one of the other
pins, you should see that a different segment lights up with each different pin.
29. Project-01: Running 7-Segment Display (cont.)
• How to Determine the Pinout for Your Display
Draw a diagram showing the pins on your display. With the common
pin connected to the ground wire (common cathode) or positive wire
(common anode), probe each pin with the other wire. When a segment
lights up, write down the segment name (A-G, or DP) next to the
corresponding pin on your diagram.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
29
30. Project-01: Running 7-Segment Display (cont.)
• Resistors:
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 30
31. Project-01: Running 7-Segment Display (cont.)
• Resistors: I recommend to visit the following site to know the brief
about different types of resistors and its variants
https://www.electricaltechnology.org/2015/01/resistor-types-resistors-
fixed-variable-linear-non-linear.html
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 31
32. Project-01: Running 7-Segment Display (cont.)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
32
We are using
Common Cathode:
Final Circuit Diagram will look like this
33. Project-01: Running 7-Segment Display (cont.)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
33
TruthTable
34. Project-01: Running 7-Segment Display
(Coding)
• Copy the Code to Arduino IDE and Make Hex File.
• Our working Code is bit lengthy, because it has used the basic LED-
Driving Logic.
• We Can Also Use a special library, and thus we can make our 50+ line
code to only 10 lines!!
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
34
35. Project-01: Running 7-Segment Display
(Coding)
• Download the SevSeg.h library from this link:
https://drive.google.com/file/d/1Fw4OJb5L5qLANli_cD4yJNmFWH2gF
Qev/view?usp=sharing
• Then write the following Code:
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
35
36. Project-01: Running 7-Segment Display (Coding)
#include "SevSeg.h"
SevSeg sevseg;
void setup(){
byte numDigits = 1;
byte digitPins[] = {};
byte segmentPins[] = {6, 5, 2, 3, 4, 7, 8, 9};
bool resistorsOnSegments = true;
byte hardwareConfig = COMMON_CATHODE;
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments);
sevseg.setBrightness(90);
}
void loop(){
sevseg.setNumber(4);
sevseg.refreshDisplay();
}
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
36
37. Project-01: Running 7-Segment Display (cont.)
29-Dec-20 All the contents collected from internet, is mentioned with sources at the bottom slide 37
• So, the procedure is- building the circuit as showing.
• Then write the code at your Arduino IDE and make the Hex File- as
shown
• Upload the Code at simulated Arduino at Proteus
• Hit Run
• If any error occurs, debug.
• If not, Congratulations!
Follow the same procedure for next 03 projects also.
38. Project-02: Driving Motor with Motor Driver
• Problem Statement:
Running a DC Motor using a Motor Driver IC based on Arduino
• Why Motor Driver IC?
• Arduino is not sufficient to drive the DC motor directly as the motor consumes
more current. Arduino can source 40mA (max) from its GPIOs and a DC motor
requires up to 200 - 300 mA. So, current amplification between the Arduino and
the DC motor is required. That is where the L293D IC H-bridge driver comes in.
• The main advantage of using an H-bridge is you only have to change the current
direction to move the motor forward or backward rather than changing voltage
polarity.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
38
39. 29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
39
Project-02: Driving Motor with Motor Driver(cont.)
40. Project-02: Driving Motor with Motor Driver(cont.)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
40
It requires two Vcc’s: 5V (Vcc1) for its internal driver operation and
12V (Vcc2) for the motor. The L293D can drive two motors at a time
and for each motor, it has two input pins (A) and two output pins (Y).
At one input pin, we have to pass a HIGH digital signal and
at other a LOW signal. These signals will then be amplified and
given to the motor. Basically what we have done is,
we have just applied a positive signal on one pin of the motor and
LOW signal to another pin of the motor.
This will tend to move the motor continuously in a particular direction
at maximum speed. But for assigning speed,
we will source PWM pulses from Arduino to enable the L293D’s pin.
41. • Components:
• Arduino Uno (Rev-3) x01
• DC Motor -5volt /12volt x01
• Motor Driver IC (L293d) x01
• Power Source (PWR and GND)
• Special Note on L293d: This IC can set up motors with a voltage between
5V to 36V and a current of up to 600 mA. However, it can withstand a
current up to 1200 mA in 100 microsecond and non-repetitive. The
frequency of this IC is 5 kHz.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
41
Project-02: Driving Motor with Motor Driver(cont.)
42. • Let’s build the circuit:
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
42
Project-02: Driving Motor with Motor Driver(cont.)
43. • Now, the code..
int val =255;
void setup() {
// put your setup code here, to run once:
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
analogWrite(9,val);
analogWrite(10,0);
delay(10);
}
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
43
Project-02: Driving Motor with Motor Driver(cont.)
44. • Let’s check PWM signal variance in this motor driving simulation:
• Add Oscilloscope and DIY. (Task-2)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
44
Project-02: Driving Motor with Motor Driver(cont.)
45. • If you want to run the simulation using L298 motor driver IC, instead
of L293d, you can follow this tutorial:
https://projectiot123.com/2019/03/25/l298-motor-driver-simulation-
in-proteus/
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
45
Project-02: Driving Motor with Motor Driver(cont.)
46. Project-03: Message Transmission using Tx-Rx
Module
• Problem Statement:
• We want to transmit a preset data/message from RF
(433MHz) transmitter module to another RF receiver
module.
• For this, you will need to install the library of RF Transmitter and Receiver (Rx-Tx),
which is basically a mimicry of a very popular, common 433MHz RF Tx-Rx.
https://drive.google.com/file/d/0B7Kl58TCjALjRER0WFAtMDQwNDA/view
-Download from here and put the ‘.lib’ file to ‘Library’ Folder and ‘MDF’ file to
‘Models’ Folder and start the Proteus Software.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
46
47. Project-03: Message Transmission using Tx-Rx
Module
• Components:
• Arduino Uno (Rev-3) x01
• Modulo Rx Module x01
• Modulo Tx Module x01
• Power Source (PWR and GND)
• Virtual Terminal/ Serial Monitor Terminal
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
47
48. Project-03: Message Transmission using Tx-Rx
Module
• Circuit Diagram:
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
48
49. Project-03: Message Transmission using Tx-Rx
Module
• Code: easy one!!!
• After that. Load the hex file and run the code.
• Congratulations!
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
49
50. Project-04: Using Temperature sensor (LM35)
• Problem Statement:
We want to measure temperature of a controlled /covered
environment with a easy, cheap temperature sensor (LM35).
• Read the datasheet of LM35 to know more technical specification
about it. ‘How to read a datasheet’- is a very important research pre-
requisite.
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
50
51. Project-04: Using Temperature sensor (LM35)
• Components:
• Arduino Uno (Rev-3) x01
• LM35 x01
• Power Source (PWR and GND)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
51
52. Project-04: Using Temperature sensor (LM35)
• Circuit Diagram:
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
52
53. Project-04: Using Temperature sensor (LM35)
Code:
int val;
int tempPin=1;
void setup() { Serial.begin(9600); }
void loop() {
val= analogRead(tempPin);
float mv= (val/1024.0)*5000;
float cel=mv/10;
Serial.print ("Temperature = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
}
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
53
54. Project-04: Using Temperature sensor (LM35)
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
54
55. Project-04: Using Temperature sensor (LM35)
Congratulations!
You have completed all 04 simulations using Proteus and Arduino!!
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
55
56. Some Other Projects: Ultrasonic Sensor
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
56
57. Some Other Projects: Xbee Communication
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
57
58. Some Other Projects: Water Sensor Simulation
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
58
59. Troubleshooting Circuit Design in Proteus
• First: Follow their Manual
https://drive.google.com/file/d/1MkWjGOABsnsFJUrqjUK0i3H10mSo-
7Kb/view?usp=sharing
• Google
• Youtube
• Forums
• Redwan at Google Classroom!
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
59
60. Anything you want me to tell?
Thank You
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
60
61. Bibliography
• https://maker.pro/arduino/projects/how-to-simulate-arduino-projects-using-proteus
• https://www.electricaltechnology.org/2015/01/resistor-types-resistors-fixed-variable-linear-non-linear.html
• https://electronics.stackexchange.com/questions/191336/how-to-unhide-hidden-pins-in-proteus
• https://en.wikipedia.org/wiki/Proteus_Design_Suite
• https://www.theengineeringprojects.com/2015/09/interfacing-lm35-arduino-proteus-isis.html
• https://circuitdigest.com/microcontroller-projects/7-segment-display-interfacing-with-arduino
• https://www.electronicslovers.com/2017/09/interfacing-of-seven-segment-display-with-arduino-in-
proteus.html
• https://www.circuitbasics.com/arduino-7-segment-display-tutorial/
• https://www.youtube.com/watch?v=N63BYtw7bOg
• https://www.youtube.com/watch?v=ES-Noqlej9c
• https://www.youtube.com/watch?v=eDkIXWBkdqI
• https://www.theengineeringprojects.com/2015/09/interfacing-lm35-arduino-proteus-isis.html
29-Dec-20
All the contents collected from internet, is mentioned with
sources at the bottom slide
61