Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

lecture 1

The document provides an overview of various electrical components and concepts related to microcontrollers, specifically focusing on Arduino and its functionalities. It covers topics such as microcontroller systems, communication interfaces, input/output pins, and specific components like the 555 timer, voltage regulators, and sensors. Additionally, it explains how to utilize these components for tasks such as controlling motors and reading sensor data.

Uploaded by

roukff61736220
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

lecture 1

The document provides an overview of various electrical components and concepts related to microcontrollers, specifically focusing on Arduino and its functionalities. It covers topics such as microcontroller systems, communication interfaces, input/output pins, and specific components like the 555 timer, voltage regulators, and sensors. Additionally, it explains how to utilize these components for tasks such as controlling motors and reading sensor data.

Uploaded by

roukff61736220
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

INTERPLANETAR WORKSHOP 2024

ELECTRICAL SESSION-1

AHNAF RASHID OLEE

ID: 2006158

ELECTRICAL SUB TEAM


Contents:
Microcontroller and Arduino

555 Timer

TCRT5000 IR Sensor

7805 Voltage Regulator & Buck Converter

DS18B20 Temperature Sensor

BJT
What is Microcontroller?

A microcontroller is a small computer on a single integrated circuit


that is designed to control specific tasks within electronic systems.

For example, a car might have many microcontrollers that control


various individual systems within, such as the anti-lock braking
system, traction control, fuel injection or suspension control. All the
microcontrollers communicate with each other to inform the correct
actions.

Microcontrollers are widely used in embedded systems, such as


home appliances(microwave oven), automotive systems, medical
devices, and industrial control systems(Fire alarm),digital cameras,
and audio players.
THE MICROCONTROLLER SYSTEM
A system accepts at least one input,
performs some action on that input, and
produces one or more outputs.

Microcontroller vs Laptop

Microcontroller has a robust interrupt system which is important for external communications and real-time
applications.

An interrupt is an external or internal event/command that interrupts the normal processing of an event and
informs the microcontroller that a device needs its service. Upon receiving the interrupt signal, the
microcontroller stops its existing program and serves the external device request.
Microcontroller vs Arduino

Development boards are PCBs that contain a particular microcontroller IC and all of the supporting
external circuitry to make the microcontroller easier to use for quick development and prototyping.

Arduino is a Microcontroller Board which is designed to use the Microchip Technology ATmega328 8-bit
Microcontroller easily
The main function of the Arduino board is to control electronics through reading inputs &
changing it into outputs

Inputs Outputs
Inputs Outputs
Flash
Memory

Digital and
Analogue I/O
pins
Types of Arduino Microcontroller
Getting Started with Arduino:

❏ Physical ❏ Integrated ❏ Code/Sketch


Hardware Development
Environment
Layout of Arduino UNO Board
How to power up the Arduino UNO?

Power arduino from outside:

● The first and easy way is using the Type-B


USB Connector
● provide an unregulated supply in the range
of (7 - 12)V to VIN pin
● You can also supply the unregulated supply
through the 2.1mm DC Jack

Power a component from arduino:

A 3.3V (100 to 150mA),5V(500mA) pin are used as power output pins(to power sensors and modules)

There are several GND pins on the Arduino, any of which can be used to ground your circuit.
What Communication Interfaces are available on Arduino UNO?

Arduino UNO supports different types of communication interfaces.

● Serial: Digital IO pins 0 and 1 are used as Serial RX and TX pins to receive and transmit
serial data.
● I2C or I2C: A4 and A5 can be configured as SDA (A4) and SCL (A5) to support I2C or I 2C
● SPI:Digital IO Pins 10, 11 12 and 13 can be configured as SPI pins SS, MOSI, MISO and
SCK respectively.
What are the Input and Output Pins of Arduino UNO?

❏ 14 pins (D0 to D13) are true digital IO pins, which can be configured using digitalWrite()
and digitalRead() functions.

❏ All these Digital IO pins are capable of sourcing or sinking 20mA of current (max 40mA ).
An additional feature of the Digital IO pins is the availability of internal pull-up resistor

❏ There are also 6 Analog Input Pins (A0 to A5)that provide a 10-bit resolution ADC feature,
which can be read using analogRead() function.(can be configured as Digital IO pins, if
required.)

❏ Digital IO pins 3, 5, 6, 9, 10 and 11 are capable of producing 8-bit PWM Signals. (use
analogWrite() function for this)
How to know whether the sensor or the electronic component works on Digital or Analog Signals?

The datasheet provides information about whether it operates on digital or analog signals. Certain sensors have the
capability to function with either digital or analog signals so it depends on how the user intends to utilize the sensor.

The Pushbutton is an example of a Digital Component whereas The Potentiometer is an example of an Analog
Component.

the next step involves determining whether the electronic component functions as an output,or as an input

Let us now talk about Digital Output and Digital Input separately!
A) Digital Output:
Example: Turning an LED on and off.
digitalWrite(pin,value) takes two arguments,

digitalWrite() does not return anything


B) Digital Input:
Example: Pressing and releasing the pushbutton

We use the function digitalRead(pin) when reading the value from a specified digital pin, either HIGH or LOW .
This function takes one parameter: pin: Arduino pin number
This function returns:HIGH or LOW
IDE

Serial monitor?

there are built-in libraries that provide basic functionality. In addition, it’s possible to
import other libraries and expand the Arduino board capabilities and features.
analogRead()
analogWrite()
digitalWrite()

Serial.begin(9600) ?? digitalRead()
analogRead()

Reads the value from the specified analog pin. Arduino boards contain a multichannel, 10-bit

analog to digital converter. This means that it will map input voltages between 0 and the

operating voltage(5V or 3.3V) and return values between 0 and 1023.

This function takes one parameter: pin

The input range can be changed using analogReference()

Formula: Digital value = ( Input value / Reference voltage) * Resolution

If the Analog input is 2.8 Volts, the digital value for 10-bit resolution can be calculated as follows.
Digital value = ( 2.8 / 5 ) * 1023 = 573 (Approximately)
Digital pin can only give 0,5 V output .So how we can control motor
speed or led brightness with it??

Pulse Width Modulation


❖ A technique for getting analog results from digital devices such as microcontrollers

❖ The duration of "on time" is called the pulse width. To get varying analog values, you can
change pulse width

❖ analogWrite(pin,value) takes two arguments,


❖ value is on a scale of 0 - 255, such that analogWrite(255) requests a 100% duty cycle
(always on), and analogWrite(127) is a 50% duty cycle (on half the time)
In the graph, the
green lines represent
a regular time
period(2 milliseconds)

Duty Cyc Value=(100*Duty Cyc Percet)×255

For a 25% duty cycle:

Duty Cycle
Value=(25*100)×255=0.25×255=63.75

Since the analogWrite() function


accepts integer values, so round 63.75 to
the nearest integer, which is 64.
To control the speed of the motor,we have to adjust the voltage and current supplied to it.

One way is that at constant supply voltage, you might want to put a potentiometer in series with the motor to adjust
the current .The power across the resistor will just be converted into wasted heat.

Another alternative and probably the most popular among speed control methods is the pulse width modulation.If
you supply a DC motor with a 9V source and a switch but you constantly press the switch between On and Off
reduces the average voltage supply as seen by the motor thus reducing its speed.

A 90% duty cycle of the 1hz signal frequency consists of a pulse width(signal HIGH state) equal to 0.9
seconds and a signal LOW state equal to 0.1 second.
555 timer

You can just think of it as a black box with 8 pins and with the help of
external components like resistors and capacitors, it can function as
a timer, pulse generator, and oscillator depending on the values of
the externally connected components.

-It operates from + 5 Volts to + 18 Volts ,Sinking or sourcing 200 mA


of load current.

The duty cycle of the timer is adjustable.

Two modes of operation of the 555 timer are Monostable Mode,Astable mode

For now we will discuss only Astable Mode to control the speed of the motor through pulse width
modulation.
Since the duration of output being HIGH or LOW is dependent on the charging and discharging times of the capacitor,
we can control the duty cycle of the output pulse.

TON = 0.693 * (R1 + R2) * C TOFF = 0.693 * R2 x C Period T = TON + TOFF = 0.693 * (R1 +2*R2) * C

Duty Cycle = (THIGH / T) * 100

Hence, if we replace R2 with a Potentiometer, we can control the charging and discharging tines of the capacitor and
essentially the duty cycle of the PWM Signal.
7805 Voltage Regulator:

❏ Voltage sources in a circuit may have fluctuations resulting in not providing fixed voltage therefore A
voltage regulator IC maintains the output voltage at a constant value.

❏ Here “78” means that it is a positive voltage regulator and “05” means that it provides 5V as output.

❏ The output current of this IC can go up to 1.5A.


❏ If we apply maximum input voltage 25 VDC and the maximum input current are 1500mA then the power loss is 30
Watt.
❏ This power loss converts into heat so we required a heatsink for heat dissipating from
Typical Application Circuit of the 7805 IC:

❏ Input capacitor deals with input inductance problem

❏ Output capacitor adds to the stability of the circuit


● Linear voltage converter heats up a lot to dissipate extra current,
● It switches off after heating up, and switches back on again.

So what’s the alternative?

Buck converter

❏ The fixed dc input signal is changed into another dc signal at the output which is of lower
value.
❏ The efficient power conversion in bulk converter extends battery life and reduces the heat
produced.
Applications:

Many sensors ,motors used in rovers operate at lower voltages (3.3V or 5V) than the main
battery (12V or 24V).

Power loses in the buck converter is divided into 3 main sections


1- Inductor loss (Pl)
2- Semiconductor/Mosfet loss (P fet)
3- Other loses ( like PCB copper trace loss, driver loss)
High efficiency is critical in mobile applications like rovers to maximize battery life and
reduce heat generation.
7805 regulators have 20% to 40% efficiency and buck converters have efficiency is 88%-92%.
DS18B20 Temperature Sensor

Ground : Connect to the ground of the circuit

Vcc : Powers the Sensor to 3.3V or 5V

Data : This pin gives output the temperature value


Circuit diagram:

This sensor use one wire communication protocol which only needs one digital pin to communicate with
the microcontroller.To keep the data transfer stable, you’ll also need to connect the 4.7k pull-up resistor
between the signal and power pins (Note: internal pull-ups on the arduino do not work here).
What is Pull Up Resistor?
A microcontroller in any embedded system utilizes I/O signals to communicate with the external devices.

In a 5V digital circuit, an input voltage between 2 to 5V is considered high, while a voltage between 0 to
0.8V is considered low.But, due to any reason, if the available voltage at an input pin is between 0.9 to 1.9
V, the circuit will confuse to select a high or low logic state.To avoid this floating condition, pull-up and pull-
down resistors are used.

A pull-up resistor is connected between the supply voltage and an input pin. This setup ensures the input
voltage is stable when the switch is off.

How to solve the


problem?
The rule of thumb when
choosing a pull-up resistor is to
choose a resistance value that
is at least 10 times smaller than
the input impedance (or the
internal resistance) of the pin.
A mechanical switch physically opens or closes a
circuit by moving contacts.

But can we make it automated??

Transistor as Switch:

The Arduino’s IO pins are able to source or sink up to 40mA of current per IO pin.

Because the IO pins of the Arduino are not designed to deliver high-current to drive loads like motors or power LEDs.
Instead, we use the digital output signal from the Arduino IO pins to trigger a transistor (that works as an electronic
switch) to turn ON or OFF the high-current load device (e.g. Motor).

We just need to set (bias) the transistor properly to work as a switch (ON/OFF).
Transistors are three terminal active devices made from different semiconductor materials that can act as
either an insulator or a conductor by the application of a small signal voltage.

There are two basic types of bipolar transistor construction, PNP and NPN, which basically describes the
physical arrangement of the P-type and N-type semiconductor materials

The Bipolar Transistor basic construction consists of two PN-junctions producing three connecting
terminals (Emitter ( E ), Base ( B ) and Collector ( C )
Then bipolar transistors have the ability to operate within three different regions:
Transistor Switching ON (Saturation Region):
❏ In this region, the BJT operates as a closed switch, allowing a large current to flow from the collector to the
emitter (IC).The base-emitter & base-collector junctions are forward-biased.
❏ We apply the Vin voltage to the transistor’s base pin using any IO pin of our microcontroller (Arduino), this
base voltage will push a small current (IB) through the base of the transistor causing it to go into saturation
region (the transistor becomes like a closed switch).
❏ Consequently, the Vout will be equal to the VCEsat of the transistor (around 0.2v) which is nearly zero. Now,
the load RL (can be a motor, LED, or whatever) will have a voltage difference across its terminals. Device will
turn ON.
Transistor Switching OFF (Cut-OFF Region)
❖In this region, the BJT acts as an open switch, preventing any significant current flow from the collector to the
emitter. The base-emitter & base-collector junctions are reverse-biased.
❖ We drive the Vin voltage to the transistor’s base pin to LOW (0v) using any IO pin of our microcontroller
(Arduino), causing it to go into the cut-off region (the transistor will not conduct and becomes like an open
switch).
❖ Consequently, the Vout will be equal to the VCC which is the supply voltage of your circuit. Now, the load RL
will have no voltage difference across its terminals, and no current will flow through it because the circuit is
opened. device will turn OFF.
TCRT5000 IR Sensor

❏ The TCRT5000 Infrared sensor mainly includes an IR Tx (transmitter,irled) & and IR Rx


(receiver,phototransistor).
❏ Once the voltage supply is provided to the IR Tx unit then it immediately transmits & emits IR signals. when
signals crash through an object, then the IR receiver gets the signals.

Pin Configuration:

● Anode: This is a positive pin of the infrared transmitter IR Tx


● Cathode: This is a negative pin of the infrared transmitter IR Tx
● Collector: This is the collector terminal of the IR receiver
● Emitter: This is the emitter terminal of the IR receiver
Working mechanism of tcrt5000 ir sensor

❖ The IR LED continuously emits infrared light.

❖ When an object is placed in front of the sensor, the IR light reflects off the object and is detected by the
phototransistor.
❖ The phototransistor conducts, pulling the sensor pin to LOW but why???

❖ A phototransistor is similar to a regular transistor but with its base exposed to light. In a phototransistor,
light hitting the base region generates electron-hole pairs, which effectively acts as the base current in
a regular transistor.
❖ In this state, the collector of the phototransistor is connected to the emitter (GND) through the
conducting phototransistor.
❖ The current flows through the phototransistor to GND, pulling the voltage at the collector (and the
Arduino input pin) down to 0V.
References:
https://www.circuitbasics.com/introduction-to-microcontrolleres/
https://lastminuteengineers.com/ds18b20-arduino-tutorial/
https://www.electrosoftcloud.com/en/arduino-pull-up-pull-down-resistors/
https://www.electronicshub.org/arduino-uno-pinout/
https://www.instructables.com/Transistors-With-Arduino-BJT-BC547-TIP120/
https://electronicscoach.com/buck-converter.html
https://randomnerdtutorials.com/555-timer-ic-tutorial/
https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/
https://www.circuito.io/blog/arduino-uno-pinout/
https://besomi.com/signals-from-arduino-analog-vs-digital-pins/

You might also like