0% found this document useful (0 votes)
17 views

1_Arduino Uno(2)

Uploaded by

thembelihle.mng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

1_Arduino Uno(2)

Uploaded by

thembelihle.mng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Arduino Uno

ATmega328
Created by: Dr. Daniel van Niekerk
Arduino Uno (ATmega328)
• Overview
̶ The Arduino Uno is a development board based on the ATmega328 microcontroller.
> It has 14 digital input/output pins (0 to 13).
> Six of the digital pins can be used as PWM outputs (3,5,6,9,10 & 11).
> It has six 10-bit resolution, analog to digital converter (ADC) inputs of A0 to A5.
> A 16 MHz crystal oscillator to drive microcontroller instruction execution.
> A universal serial bus (USB) type B jack connection.
> A 2.1 mm center-positive female DC power jack.
> An in-circuit serial programming (ICSP) header.
> A reset button to restart code execution of the microcontroller.
̶ The microcontroller on the Arduino Uno board can be powered by:
> Connecting it to a computer via a standard USB-A to USB-B type cable.
> Or connecting it to an AC-to-DC adapter via the onboard DC power jack (7 to 9V).
> Or connecting it to an unregulated external battery via the VIN pin (7 to 9V).
• Note
̶ An onboard ATmega8U2 programmed as a USB-to-serial converter is used to enable PC
programming of the ATmega328 and serial communication via USB cable connection.
̶ "Uno" means one in Italian, the name given to mark the release of Arduino 1.0.
Arduino Uno (ATmega328)
• Technical Specifications
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-9V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 can be used for PWM output)
̶ The 1 KB of EEPROM can be read and written using the EEPROM library.

PWM Output Pins 6 (8-bit resolution on pins 3, 5, 6, 9, 10 & 11)


Analog Input Pins 6 (10-bit resolution on pins A0 to A5 )
DC current for 5V per I/O Pin 40 mA
DC current for 3.3V per I/O Pin 50 mA
VCC & GND IC pins DC current 200mA
Flash Program Memory 32 KB (0.5 KB used by bootloader)
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16 MHz
Arduino Uno (ATmega328)
• Power Supply Options
̶ An Arduino Uno can be powered via the USB to PC connection or by connecting an
external power supply.
̶ External non-USB power can come either from an AC-to-DC adapter or a battery.
> The AC-to-DC adapter can be connected by plugging a 2.1 mm center-positive plug
into the Arduino Uno board's DC power jack.
> Or leads from a battery can be inserted in the GND and Vin pin headers of the
power pins connector strip of the Arduino Uno board.
̶ The Arduino Uno onboard circuitry selects the power source automatically, where the
external non-USB power will have the high priority.
̶ An Arduino Uno board can operate with a maximum external supply voltage in the
range of 6 to 20 volts.
̶ However, recommended external supply voltage range should be between 7 to 9 volts.
̶ If supplied with less than 7 volts, the regulated 5V pin may supply less than 5 volts and
the ATmega328 microcontroller may be unstable due to continually resetting.
̶ If supplied with more than 9 volts, the 5 volt regulator may overheat and damage the
Arduino Uno board when larger currents are supplied by the microcontroller.
̶ Also, each output pin can supply 40 mA, but the USB port can only provide a maximum
output current of 200 mA.
̶ When external non-USB power is connected, the onboard 5 volt regulator can only
provide an output maximum current of 1 A.
̶ Onboard 3.3 volt regulator can only provide a maximum output current of 150 mA.
Arduino Uno (ATmega328)
• The power pins are as follows:
̶ VIN pin: is connected to the input Arduino onboard 5 volt regulator, after a reverse
protection diode connected to the DC power jack.
̶ It can be used as an external power source, instead of the 5 volts from the USB
connection or other regulated 5 V power source connected to the 5V pin.
̶ External unregulated voltage (7 to 9 volts) can be supply through the VIN pin.
̶ If the supply voltage is via the DC power jack, the external unregulated voltage after the
reverse protection diode, can also be accessed via the VIN pin.

̶ 5V pin: is the regulated power supply used to power the microcontroller and other
components on the Arduino board.
̶ This can come either from VIN pin via the onboard 5 volt regulator or be supplied by
the USB connection or another external regulated 5 volt supply connected to 5V pin.

̶ 3V3 pin: can supply 3.3 volts with a maximum output current of 150 mA, from another
on-board 3.3 volt regulator that is connected to the onboard 5 volt regulator output.

̶ GND pins: are connected to all the Arduino board common circuit grounds.
Arduino Uno (ATmega328)
• Microcontroller Port Pins
̶ Each of the 14 digital pins on the Uno can be used as an input or output that operate at
5 volts, using pinMode(), digitalWrite() and digitalRead() functions.
̶ All digital pins have an internal pull-up resistor disconnected by default, of 20-50 kΩ.
̶ Digital pins operate at 5 volts and each pin can provide or sink a maximum of 40 mA.
̶ In addition, some pins have the following specialized functions:
> Serial pins: 0 (RX) and 1 (TX), used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2, USB-to-TTL
serial chip.
> External Interrupt pins: 2 (interrupt 0) and 3 (interrupt 1), these pins can be
configured to trigger an interrupt on a low value, a change in value, a rising or falling
edge by using the attachInterrupt() function.
> PWM pins: 3, 5, 6, 9, 10 and 11, can provide 8-bit PWM output by making use of the
analogWrite() function.
> SPI pins: 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK), support the Serial Peripheral
Interface (SPI) communication by using the SPI library.
> LED pin: 13, a buffered built-in LED is connected to digital pin 13 and when the pin
output is set HIGH the LED is on and when the pin output is set LOW, it's off.
Arduino Uno (ATmega328)
̶ The Uno has 6 analog inputs labeled A0 through to A5 (or pin 14 to 19), each of which
provide 10-bit resolution that results in 1024 different values (0 to (2^10 - 1) = 1023).
̶ By default they measure from ground to 5 volts, all-though is it possible to change the
upper end of their range using the AREF pin and the analogReference() function.

̶ Additionally, some pins have specialized functionality:


> I2C pins: A4 (SDA) and A5 (SCL), supports Inter-Integrated Circuit (I2C) or Two-Wire
Interface (TWI) communication by using the Wire library.

̶ There are a couple of other pins on the board:


> AREF pin: is used to supply the reference voltage for upper end of the analog inputs
and is configured by using the analogReference() function.
> Reset pin: momentarily connecting this pin to ground (pulling it LOW) will reset the
Arduino microcontroller. It is typically used to add a reset button to Arduino shields
which block the main reset push-button on the Arduino board.

̶ Note that an Arduino shield is defined as a hardware device that can be mounted over
the Arduino board to increase the capabilities of a given project. For example, Ethernet
shields can be used to connect the Arduino board to the Internet thereby making project
work easier. The pin position of the shields is similar to that of the Arduino board.
Arduino Uno (ATmega328)
• Communication
̶ The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino or other microcontrollers.
̶ The ATmega328 microcontroller provides Universal Asynchronous Receiver/Transmitter
(UART) that is Transistor-Transistor Logic (TTL) or 5 V, serial communication available on
digital receive pin 0 (RX) and transmit pin 1 (TX).
̶ An onboard ATmega8U2 microcontroller channels this serial communication over USB
and it appears as a virtual com port, to software on a computer.
̶ The ATmega8U2 microcontroller firmware uses standard USB COM drivers and
therefore, no external USB-to-serial device driver is required.
̶ The Arduino integrated development environment (IDE) software includes a serial
monitor to allow simple ASCII serial data to be sent to and from the Arduino board.
̶ Onboard RX and TX LEDs will flash when data is being transferred via the USB-to-serial
ATmega8U2 chip connection to a computer but not for external serial communication
directly connected on pins 0 (RX) and 1 (TX).
̶ A SoftwareSerial library allows serial communication on other Arduino Uno digital pins.
̶ The ATmega328 also supports I2C or TWI and SPI communication.
> The Arduino software includes a Wire library to simplify the use of I2C or TWI bus.
> The Arduino software includes a SPI library to simplify the use of SPI bus.
Arduino Uno (ATmega328)
• Programming
̶ The Arduino Uno board can be programmed directly through the downloaded Arduino
IDE software from the official Arduino website at “www.Arduino.cc”.
̶ In the IDE software, select “Arduino/Genuino Uno” from the “Tools > Board” menu.
̶ After connecting a USB cable between the Arduino Uno board and the PC, select the
automatically detected virtual com port from the “Tools > Port” menu.
̶ The ATmega328 microcontroller on Arduino Uno comes pre-burned with a bootloader
that allows uploading of new user program code to it, without the use of an external
hardware programmer.
̶ The bootloader can be bypass by programming the microcontroller through the ICSP
(In-Circuit Serial Programming) header by using an external (Arduino ISP or similar)
hardware programing device.
Arduino Uno (ATmega328)
• Automatic Software Reset
̶ A physical press of the reset button before an upload is not required because the
Arduino Uno can be reset by the Arduino IDE software running on a connected PC.
̶ One of the hardware flow control lines (DTR) of the ATmega8U2 is connected to the
reset line of the ATmega328 via a 100 nano-farad capacitor.
̶ When this line is asserted or pulled LOW, the reset line drops long enough to reset the
ATmega328 microcontroller chip.
̶ Using this capability, code can be uploaded simply by pressing the upload button on
the Arduino IDE software.
̶ This means that the bootloader can have a shorter timeout, as the lowering of DTR
control line can be well-coordinated with the start of the user code upload.
̶ If a sketch running on the board receives one-time configuration or other data when it
first starts, make sure that the software with which it communicates, waits a second
before sending this data, after opening the connection.
̶ The Arduino Uno board contains a trace that can be cut to disable the auto-reset.
̶ Pads on either side of the labeled “RESET-EN” trace under the Arduino Uno board, can
be soldered together again to re-enable auto-reset.
̶ The auto-reset can also be disable by connecting a 110 ohm resistor from the 5V pin to
the RESET pin.
Arduino Uno (ATmega328)
• USB Overcurrent Protection
̶ The Arduino Uno has a resettable poly-fuse that protects the computer's USB ports
from shorts and overcurrent.
̶ If more than 500 mA is sourced from the USB port, the fuse will automatically break the
connection until the short or overload is removed and time is allow for the fuse to cool
down in order to re-connect the USB port.
̶ Although most computers provide their own internal protection, the fuse provides an
extra layer of protection.
Arduino Uno (ATmega328)
Resettable poly-fuse
Power jack to externally USB connection for
power-up the Arduino programming and
UNO or use Vin pin Serial communication
(Max 200mA at 5V)
Max 1A from on board Reset Button
5V regulator.
DC current for 5V per
I/O Pin, 40 mA Max
DC current for 3.3V per SCL or 10bit A/D or I/O, A5
I/O Pin, 50 mA Max SDA or 10bit A/D or I/O, A4
AREF
DC Current VCC & GND GND
Pins: 200mA Pin13, I/O or SCK, built-in LED
5V Pin12, I/O or MISO
RESET Pin11, I/O or PWM or MOSI
3.3V
Pin10, I/O or PWM or SS
5V Pin9, I/O or PWM
GND
Pin8, I/O
GND
7 to 9V Max, Vin Pin7, I/O
Pin6, I/O or PWM
10bit A/D or I/O, A0 Pin5, I/O or PWM
10bit A/D or I/O, A1 Pin4, I/O
10bit A/D or I/O, A2 Pin3, I/O or Int1 or PWM
10bit A/D or I/O, A3 Pin2, I/O or Int0
SDA or 10bit A/D or I/O, A4 Pin1, I/O or TX
SCL or 10bit A/D or I/O, A5 Pin0, I/O or RX

32KB Flash, 2KB SRAM & 1KB EEPROM ICSP Header


Arduino Uno (ATmega328)
Arduino Uno (ATmega328)
Arduino Digital I/O, PWM Output and Analog Inputs
Digital Input States, pinMode(pin, INPUT) Digital Output States, pinMode(pin, OUTPUT)

5V 5V
digitalWrite(pin, HIGH)
Logic 1 state digitalRead(pin) == HIGH Minimum voltage 4.2V
state when HIGH
3V
Undefined state
1.5V
Logic 0 state digitalRead(pin) == LOW Maximum voltage 0.9V
state when LOW digitalWrite(pin, LOW)
0V 0V

Analog to digital converter, analogRead(pin) PWM output states, analogWrite(pin, value)


5V 1023 Analog pins are: A0, A1, Generates continuous square wave with a specified
4.995V 1022 A2, A3, A4 & A5 Duty Cycle value of: 0 (always off) to 255 (always on)
4.990V 1021
10-bit ADC maps 0V to 5V PWM frequency is 490Hz for pins 3, 9, 10, 11 and
into integer values of 0 to 980Hz for pins 5 & 6.
(2^10-1) = 1023
T = 1/f = 1/490Hz = 2.04ms Therefore:
ADC resolution steps are:
5V/1023 = 4.88mV analogWrite(3, 100) has
9.76mV 2 a Duty Cycle of 800us
4.88mV 1 analogRead(pin)
Duty Cycle Resolution is: 2.04ms/255 = 8us
0V 0
Arduino Uno (ATmega328)
• Flowcharts
̶ Flowcharts are used to design software programs, so that the flow of the program is
logical and sequential.
̶ Flowcharts are also used to document a software program.
̶ Flowcharts make it easy to interpret programs and also makes it easier to modify the
program with minimal effort.
̶ A flowchart is successfully design when it can be understood by a non-programmer.
Arduino Uno (ATmega328)
• Frequently used Flowchart Symbols

Terminal > Indicates starting or ending point of a program or predefined process.

Input or
output > Used for any input or output operation.

Predefined
process
> Used to invoke a subroutine or function which is normally used as a
predefined process.

Process > Any type of arithmetic or procedural operation.

Decision > Used to ask a question in a program with either two or three outcomes.

A Connector > Allows flowcharts to be drawn without criss-crossed flow lines.


Example: Flowcharts
START START

A
READ READ
TEST TEST
SCORE SCORE

LAST NO LAST NO
SCORE? SCORE? A

YES YES

COMPUTE COMPUTE
AVERAGE AVERAGE

DISPLAY DISPLAY
AVERAGE AVERAGE

END END
Arduino Uno (ATmega328)
• Advantages of Flowcharts
̶ Standard symbols are used for flow-charting, resulting in flowcharts being widely
recognised.
̶ Flowcharts can be understood and interpreted by someone without a programming
background.
̶ Flowcharts can be used to divide the entire project into sub-tasks or functions.
̶ The flowchart can be examined to measure the overall programing progress.
̶ Flowcharts show the sequence of operations and can therefore, be used to aid in
locating the source of logical errors.
̶ There are many aids available to create flowcharts, like programing templates and
automated drawing packages.
Arduino Uno (ATmega328)
• Disadvantages of Flowcharting
̶ Flowcharts can be difficult to design, draw, or change except for simple programs.
̶ There is no easy way to debug or test a flowchart.
̶ Flowcharts tend to become cluttered because designers find it difficult to provide only
the amount of detail needed to make the flowchart useful.
̶ Flowcharts show only the program organisation and they do not show the organisation
of the data or the structure of the input/outputs.
̶ Flowcharts do not help with hardware or timing problems or give any indication as to
where any of these problems might occur.
̶ Flowcharts can become unstructured because line arrows backtracking and looping all
over the chart result in difficult to understand flowchart designs.
Arduino Uno (ATmega328)
Start
• Software Development Steps
Problem
̶ Problem Definition. Definition
̶ Program Design (Flowcharting).
̶ Coding (writing code & compiling). Program
Design
̶ Debugging (using simulator).
̶ Testing (run program in MCU). Coding

̶ Documentation. Assembly Yes


̶ Maintenance Errors ?
No
> (alterations or adaptions). Debugging

Logical Yes
Errors ?
No
Testing

Functional Yes
Errors ?

No
Documentation

Maintenance

End
ADC Converter Calculations
• ADC_VREF = 5V or 3.3V EXTERNAL or 1.1V (INTERNAL)

• MAX_ADCRESULT = 210 − 1 = 1023 (for 10 bit ADC)


MAX_ADCVOLTAGE ADC_V
• ADC_VSTEP = MAX_ADCRESULT
= MAX_ADC REF
RESULT

ADCVOLTAGE
• ∴ ADCRESULT = ADC_VSTEP

• AND: ADCVOLTAGE = ADCRESULT × ADC_VSTEP

• IF: MAX_SENSOR VOLTAGE < ADC_VREF


ADC_V
• THEN: AMPGAIN = MAX_SENSORREF (for best resolution by using full ADC range)
VOLTAGE

• AND: ADCVOLTAGE = SENSOR VOLTAGE × AMPGAIN


MAX_SENSORREADING
• ∴ ADC_SF = MAX_ADCRESULT
(where: SF is the Scale Factor)

• THEN: SENSOR READING = ADCRESULT × ADC_SF


SENSORREADING SENSOR ADC ADC
• NOTE: MAX_SENSORREADING
VOLTAGE
= MAX_SENSOR VOLTAGE
= MAX_ADC RESULT
= MAX_ADC
VOLTAGE VOLTAGE RESULT
ADC Converter Calculation Example
• A wind driven propeller connected to a DC motor shaft, can deliver an output voltage of
between 0 and 1.5 V. This voltage range represents wind speeds between 0 and 120 km/h.
The output of this wind speed sensor is amplified for best resolution and connected to the
10-bit ADC, pin A2. The Arduino ADC internal reference voltage of 5 volts is selected.

̶ Calculate the gain of the amplifier to ensure best resolution by making use of the full
ADC voltage measurement range.
𝐌𝐀𝐗_𝐀𝐃𝐂𝐕𝐎𝐋𝐓𝐀𝐆𝐄 𝐀𝐃𝐂_𝐕𝐑𝐄𝐅 𝟓𝐕
> 𝐀𝐌𝐏𝐆𝐀𝐈𝐍 𝐀𝐯 = 𝐌𝐀𝐗_𝐒𝐄𝐍𝐒𝐎𝐑 =
𝐌𝐀𝐗_𝐒𝐄𝐍𝐒𝐎𝐑
=
𝟏.𝟓 𝐕
= 𝟑. 𝟑𝟑𝟑
𝐕𝐎𝐋𝐓𝐀𝐆𝐄 𝐕𝐎𝐋𝐓𝐀𝐆𝐄

̶ Calculate the voltage step of the A/D converter for each ADC bit result.
𝐀𝐃𝐂_𝐕𝐑𝐄𝐅 𝟓𝐕 𝟓𝐕
> 𝐀𝐃𝐂_𝐕𝐒𝐓𝐄𝐏 = 𝐌𝐀𝐗_𝐀𝐃𝐂 =
𝟐𝟏𝟎 −𝟏
=
𝟏𝟎𝟐𝟑
= 𝟒. 𝟖𝟖𝟕 𝐦𝐕/𝐛𝐢𝐭
𝐑𝐄𝐒𝐔𝐋𝐓

̶ When the sensor is reading 65 km/h, determine the sensor output voltage and the
expected ADC result.
𝟔𝟓 𝐤𝐦/𝐡 𝐒𝐄𝐍𝐒𝐎𝐑 𝐕𝐎𝐋𝐓𝐀𝐆𝐄 𝟔𝟓 𝐤𝐦/𝐡 ×𝟏.𝟓 𝐕
> 𝟏𝟐𝟎 𝐤𝐦/𝐡
=
𝟏.𝟓 𝐕
→ ∴ 𝐒𝐄𝐍𝐒𝐎𝐑 𝐕𝐎𝐋𝐓𝐀𝐆𝐄 =
𝟏𝟐𝟎 𝐤𝐦/𝐡
= 𝟎. 𝟖𝟏𝟑 𝐕

> 𝐀𝐃𝐂𝐕𝐎𝐋𝐓𝐀𝐆𝐄 = 𝐒𝐄𝐍𝐒𝐎𝐑 𝐕𝐎𝐋𝐓𝐀𝐆𝐄 × 𝐀𝐌𝐏𝐆𝐀𝐈𝐍 = 𝟎. 𝟖𝟏𝟑 𝐕 × 𝟑. 𝟑𝟑𝟑 = 𝟐. 𝟕𝟏 𝐕


> 𝐀𝐃𝐂𝐑𝐄𝐒𝐔𝐋𝐓 = 𝐀𝐃𝐂 𝐕𝐎𝐋𝐓𝐀𝐆𝐄
𝐀𝐃𝐂_𝐕
=
𝟐.𝟕𝟏 𝐕
𝟒.𝟖𝟖𝟕 𝐦𝐕/𝐛𝐢𝐭
= 𝟓𝟓𝟒
𝐒𝐓𝐄𝐏
ADC Converter Calculation Example
̶ Calculate the scale factor to multiply the ADC result with, in order to determine the
actual wind speed in km/h.
𝐌𝐀𝐗_𝐒𝐄𝐍𝐒𝐎𝐑 𝐑𝐄𝐀𝐃𝐈𝐍𝐆 𝟏𝟐𝟎 𝐤𝐦Τ𝐡
> 𝐀𝐃𝐂𝐒𝐅 = 𝐌𝐀𝐗_𝐀𝐃𝐂𝐑𝐄𝐒𝐔𝐋𝐓
=
(𝟐𝟏𝟎 −𝟏)
= 𝟎. 𝟏𝟏𝟕 𝐤𝐦Τ𝐡 /𝐛𝐢𝐭

̶ What is the input ADC voltage, if the ADC result is 850?


> 𝐀𝐃𝐂𝐕𝐎𝐋𝐓𝐀𝐆𝐄 = 𝐀𝐃𝐂𝐑𝐄𝐒𝐔𝐋𝐓 × 𝐀𝐃𝐂_𝐕𝐒𝐓𝐄𝐏 = (𝟖𝟓𝟎 × 𝟒. 𝟖𝟖𝟕 𝐦𝐕Τ𝐛𝐢𝐭) = 𝟒. 𝟏𝟓𝟒 𝐕
̶ If no amplifier was connected between the sensor and the ADC, what would have been
the decimal ADC result, if the wind speed was at 100 km/h?

> 𝟏𝟎𝟎 𝐤𝐦/𝐡


𝟏𝟐𝟎 𝐤𝐦/𝐡
=
𝐒𝐄𝐍𝐒𝐎𝐑 𝐕𝐎𝐋𝐓𝐀𝐆𝐄
𝟏.𝟓 𝐕
→ ∴ 𝐒𝐄𝐍𝐒𝐎𝐑 𝐕𝐎𝐋𝐓𝐀𝐆𝐄 =
𝟏𝟎𝟎 𝐤𝐦/𝐡 ×𝟏.𝟓 𝐕
𝟏𝟐𝟎 𝐤𝐦/𝐡
= 𝟏. 𝟐𝟓 𝐕

> 𝐁𝐮𝐭 → 𝐀𝐃𝐂𝐕𝐎𝐋𝐓𝐀𝐆𝐄 = 𝐒𝐄𝐍𝐒𝐎𝐑 𝐕𝐎𝐋𝐓𝐀𝐆𝐄 → 𝐰𝐢𝐭𝐡𝐨𝐮𝐭 𝐚𝐦𝐩𝐥𝐢𝐟𝐢𝐞𝐫

> ∴ 𝐀𝐃𝐂𝐑𝐄𝐒𝐔𝐋𝐓 = 𝐀𝐃𝐂𝐕𝐎𝐋𝐓𝐀𝐆𝐄


𝐀𝐃𝐂_𝐕
=
𝟏.𝟐𝟓𝐕
𝟒.𝟖𝟖𝟕 𝐦𝐯/𝐛𝐢𝐭
= 𝟐𝟓𝟔
𝐒𝐓𝐄𝐏
Exercise
1. Describe how many digital input/output, PWM output and analog input pins does the
Arduino Uno board microcontroller provide?
2. Elaborate on how the microcontroller on the Arduino Uno board, can be powered?
3. State the maximum and the recommend external supply voltage range that the Arduino
Uno board can handle, including why the recommended range is preferred?
4. State the maximum current that can be providing by each 5V input/output pin, USB port
and onboard 5V regulator?
5. Identify which functions allow digital pins to be used as inputs or outputs and describe
the associated internal pull-ups?
6. State which Arduino Uno pins provide external interrupts and what the configurable
interrupt trigger states are that can be set by which function?
7. Discuss how is it possible to program the ATmega328 on the Arduino Uno aboard without
using a separate in-circuit serial programming device?
8. Explain why is a physical press of the on board reset button is not required when
unloading code to the Arduino Uno?
9. Explain how the Arduino Uno board protects the computer connected USB port from a
short or overload?
10. Sketch scales to indicate the possible Arduino Uno digital input and output pins states,
including the associated function used to set these states.
Exercise
11. Sketch a scale indicating the Arduino Uno analog to digital resolution steps for an input
voltage range of 0 to 5V, including the associated faction to start a conversion on which
Arduino pins.
12. Use a sketch to describe the Arduino Uno PWM duty cycle setting range and resolution
including output frequency options on which pins and the function use to start PWM?
13. Explain what flowcharts are used for?
14. Discus how flowcharts help a programmer and when is it considered a successful
designed?
15. Sketch and describe the purpose of each of the following standard flowchart symbols:

• Process symbol
• Pre-defined process symbol
• Input/output symbol
• Decision symbol

16. List six advantages of using flowcharts.


17. List six disadvantages of using flowcharts.
18. Sketch a flowchart demonstrating each of the steps involved in the software development
process.
19. List all the steps involved in firmware or software development process.
Exercise
20. A distance measurement sensor with amplification is connected to the 10-bit Arduino
ADC, A0 pin. The distance sensor can measure in the range of 0 – 10 m and it’s
corresponding output voltage range is 0 – 3.3V. The Arduino ADC internal reference of 5 V
has been selected.
20.1 Calculate the voltage gain of the amplifier to ensure best resolution by using the full
ADC range.
20.2 Calculate the voltage step of the A/D converter for each ADC bit result.
20.3 When the sensor is reading of 4.5 m, determine the sensor output voltage and the
expected ADC result.
20.4 Calculate the scale factor to multiply the ADC result with, in order to determine the
actual distance in meters.
21. A water flow sensor outputs 150 mV for every litre/s of water flow measurement. The
operating range of the flow sensor is 0 to 20 litre/s. It is connected to the 10-bit Arduino
ADC pin A3, via an amplifier. The Arduino internal ADC reference of 5 V has been selected.
21.1 Calculate the voltage gain of the amplifier to ensure best resolution by using the full
ADC range.
21.2 Calculate the voltage step of the A/D converter for each ADC bit result.
21.3 When the sensor is reading of 12 liter/s, determine the sensor output voltage and the
expected ADC result.
21.4 Calculate the scale factor to multiply the ADC result with, in order to determine the
actual water flow in liter/s.
Exercise
22. A pressure sensor with a non-inverting amplifier is connected to the 10-bit Arduino, A0
pin. The pressure sensor can measure in a range of 0 - 12 bar and its corresponding output
voltage range is 0 – 4 V. The Arduino ADC internal reference of 5 V has been selected.
22.1 Sketch a circuit diagram, clearly showing the amplifier connected to the sensor and
Arduino with the required resistors.
22.2 Calculate the voltage gain of the amplifier to ensure best resolution by using the full
ADC range.
22.3 Design the amplifier circuit, if the selected feedback resistor is 1 KΩ
22.4 When the sensor is reading of 8.55 bar, determine the sensor output voltage and the
expected ADC result.
22.5 Calculate the scale factor to multiply the ADC result with, in order to determine the
actual pressure in bars.
Exercise
23. A sensing resistor with the value of 0.01 Ω must be used to sense the DC current in a
circuit as shown in figure 1. The required sensing current range is from 0 to 50 A. The
Arduino internal ADC reference has been set to the built in reference of 1.1 V.

12V +9V +5V


Circuit 5V Or
Vin 5V
MCP601 A0 pin
Rsens
0.01Ω Arduino
GND
Ri Rf
Figure1

23.1 Calculate the voltage gain of the amplifier to ensure best resolution by using the full
ADC range.
23.2 Design the amplifier circuit, if the selected feedback resistor is 1.2 KΩ.
23.3 Calculate the voltage step of the A/D converter for each ADC bit result.
23.4 When the current through the sensing resistor is 23 A, determine the sensor output
voltage and the expected ADC result.
23.5 Calculate the scale factor to multiply the ADC result with, in order to determine the
actual current flow through the sensing resistor in amps.

You might also like