Top Banner
Workbook | AS1.5 Develop an Electronics Outcome | 6Cr Year 11 Electronics This workbook focuses on Physics / Electronic concepts and breadboard interfacing techniques. It helps students when working towards the following Achievement Standards: AS1.5 Develop an Electronics Outcome (6 Credits) Interfacing Electronic Components Debugging Embedded Software code DC Circuit Theory Schools are free to Photocopy | 2018 © Craig Jefferies | 1
83

seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Apr 19, 2019

Download

Documents

vucong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Year 11ElectronicsThis workbook focuses on Physics / Electronic concepts and breadboard interfacing techniques. It helps students when working towards the following Achievement Standards: AS1.5 Develop an Electronics Outcome (6 Credits)

Interfacing Electronic Components Debugging Embedded Software code DC Circuit Theory

Schools are free to Photocopy | 2018 © Craig Jefferies | 1

Page 2: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

1 Microprocessors 5What is a Microprocessor 5Pinout Diagrams 5

2 Inputs, Processes & Outputs 6Inputs 6Processes 6Outputs 6

Input, Process, Output | Exercises 73 Development Boards 8

Breadboards 8The Development Board 8The ARDUINO 08m2 & Breadboard 8The Arduino Nano & Breadboard 8

4 Batteries | Voltage & Current 9Cells 9Circuit Symbol for Battery Cell 9

Batteries, Voltage & Current | Exercises 95 Resistors 11

Circuit Symbol for Resistor 11Resistance | Practical Exercises 11

6 Circuit | LED Interface 13LED Interface 13ARDUINO Code 13

Light Emitting Diode | Practical Exercises 137 Series Circuit Theory 14

A Series Circuit the Science way 14A Series Circuit the Electronics Way 14Current in a Series Circuit 14Voltage in a Series Circuit 14

Series Circuit | Exercises 158 LED Characteristics 16

Long Leg and Short Leg 16Greedy LEDs 16An 5mm LED Datasheet 16

LED | Exercises 179 Circuit | Buzzer 18

ARDUINO Code 18Piezo Buzzer | Practical Exercises 18

10 Circuit | DC Motor Interface 19Motor Interface 19

Schools are free to Photocopy | 2018 © Craig Jefferies | 2

Page 3: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

ARDUINO Code 1911 Transistor Switch 20

What is a transistor? 20What is a transistor switch? 20

Transistor | Exercises 2012 Circuit | Button 22

Button Interface 22ARDUINO Code 22What is a button 23The switch Interface 23

Button | Practical Exercises 2313 Resistive Sensors | LDR 24

Resistive Sensors | Practical Exercises 24Measure Resistance with a Multimeter 24

14 Circuit | Light Sensing interface 25ARDUINO Code 25

Light Sensing Interface | Exercises 2615 Circuit | Temperature Sensing Interface 28

ARDUINO Code 2816 Circuit | Moisture Sensing Interface 29

ARDUINO Code 2917 Making Decisions with Code 30

What does good code look like? 30What your code needs to include 30Why do we do this? 30

Making decisions with code 31ARDUINO Code 31

Conditional statements 32Check state of Digital Input pin 32Check value of variable 32

18 Project | Scared of the Dark 33

19 Project | Temperatures for Seed growth 35

20 Project | Fan Control 39

21 Voltage, Current, Resistance Review 41Resistance 41

Voltage, Current & Resistance | Exercises 4122 Voltage Divider 42

Its a series circuit! 42Let's look at an example: 42

Schools are free to Photocopy | 2018 © Craig Jefferies | 3

Page 4: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

23 Processing a voltage signal 44analogRead command 44Byte Variables 44Testing with the debug command 44

Processing a voltage signal | Exercises 4524 Ohm's Law 46

Example Calculation 46Ohm’s Law | Exercises 46

25 Circuit | Digital Temp Sensor 47ARDUINO Code 47

Dallas Temp Sensor DS18B20 | Practical Exercises 47Testing with the sertxd command 48

26 Components Review 49

27 Current Limiting Resistor 50Current Limiting Resistor | Exercises 51

28 Technical Report | AS1.5 52

Schools are free to Photocopy | 2018 © Craig Jefferies | 4

Page 5: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

1 MicroprocessorsWhat is a MicroprocessorThe Microprocessor is an integrated circuit that contains all the functions of a computer, however it is inside a single Integrated Circuit package and is way smaller

:It includes three things:1. Data and program storage 2. Input & Output control circuits 3. A central processing unit that

carries out simple maths on the data)

Pinout DiagramsPinout diagrams refer to a list of the Input and Output Pins of a Microprocessor. If tells us how many pins, what they are called and what the pins purpose or function is.

Below is the Pinout Diagram for the ARDUINO 08m2 Microprocessor

As you can see from the diagram, not every I/O pin is created equal. Operating Voltage for the ARDUINO 08m2 is between 2.3v - 5v

1. What 3 things does a microcontroller include?______________________________________________________________________________________________________________________________________________________________

2. Which pin on the 08m2 is an input pin only?_______________________________________________________________________________

3. What is the Maximum voltage you can supply a ARDUINO 08m2 Microprocessor?_______________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 5

Page 6: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

2 Inputs, Processes & OutputsThe diagram shows how inputs, processing and outputs work within a typical electronic system

InputsCircuits convert physical world inputs (like Touch, Light, Temperature, Moisture Level, Water Level, Movement) to electrical voltage signals which are processed by a microcontroller. These physical world inputs are sensed using electronic components.

Thermistor will sense temperature Light Dependant resistor (LDR) will

sense light levels Conductivity Probes sense

moisture Tilt switch will sense movement

ProcessesThe electrical signals sent to a microcontroller to be processed. A Microprocessor reads input, makes decisions are then turns output pins on or off.

OutputsOutputs include devices such as Lights LEDs, Motors, switches, speakers or buzzers to make sounds. Even sending data via Infrared or Radio Transmission (these are outputs)

Schools are free to Photocopy | 2018 © Craig Jefferies | 6

Page 7: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Input, Process, Output | Exercises1. Complete the Crossword

Across5. An electronic component that measures temperature6. An electronic component that senses Light levelDown1. An output device that makes sound2. A microprocessor does this after taking in an input signal3. An output device that rotates an axle4. An output device that creates light of various colours

2. List the inputs and outputs that could be used in the following plant watering electronic system (use your imagination) _____________________________________________

_____________________________________________

_____________________________________________

_____________________________________________

_____________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 7

Page 8: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

3 Development BoardsBreadboardsBreadboards are one of the most fundamental pieces neededwhen learning how to build circuits. We use a Solderless Breadboard to quickly and easily interfacing electronic components. Breadboards have many holes, each hole is connected to the many metal strips that are running underneath.

The Development BoardThis board for this course ares set up with:

A Microprocessor A Battery Pack (4.5v or 6v) A Download or Program cable

The Boards shown below have are coloured with Red and Black stripes to indicate Vcc (Positive, Red) and GND (Negative, Black)

The ARDUINO 08m2 & BreadboardThe ARDUINO 08m2 Microprocessor requires specific resistors to help connect the PC programming cable.

The Arduino Nano & BreadboardThe Arduino Nano uses a direct USB wire to both Power and Program the Microprocessor. The Nano has further features including a 5v voltage regulator, LEDs to indicate downloading.

Schools are free to Photocopy | 2018 © Craig Jefferies | 8

Page 9: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 9

Page 10: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

4 Batteries | Voltage & CurrentCellsA Cell in a single battery that stores chemical energy. converting this chemical energy into electrical energy for use in a circuit. When a battery is connected in a circuit drives a “direct current” flow around a circuit.

Circuit Symbol for Battery CellThe circuit symbol for a cell is a long and short line. Note the negative or ground terminal is the smaller.

VoltageVoltage is a measure of the amount of energy between two points in a circuit.

Voltage (V) measured in volts (v)

CurrentCurrent is a measure of how fast energy is flowing around a circuit.

Current (I) Measured in Ampere of Amps (A)

Battery PacksWe have a number of options for Power supplies ranging from 3v coin cells, to arrangements of 1.5v AA batteries.

Coin Cell3v

2x AA Battery Pack3v

3x AA Battery Pack4.5v

Batteries, Voltage & Current | Exercises1. Unscramble each of the words

Schools are free to Photocopy | 2018 © Craig Jefferies | 10

Page 11: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 11

Page 12: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

2. Complete the table below to review Voltage and Current ideas

Electricity Concept Unit of Measure Unit Symbol

Voltage ?? ??

Current ?? ??

3. Sketch the circuit symbol for 3 x AA Battery Cells joined together. What is the total voltage 3xAA battery will supply to a circuit?

4. State the voltage of an AA battery, including unit_______________________________________________________________________________

5. Research and find out the voltage of an AAA battery, including unit______________________________________________________________________________________________________________________________________________________________

6. Describe the difference between an AA and a AAA battery_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 12

Page 13: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

5 ResistorsA resistor is a component that resists the flow of electrical current in a circuit. Resistors convert electrical energy to heat

Resistance (R) Measured in Ohms (Ω)

Circuit Symbol for ResistorThe circuit symbol for a resistor is a rectangle.

We will use a few sizes of resistor. Small values 330Ω, 470Ω, Medium Values 1000Ω or 1kΩ, 10,000Ω or 10kΩ, Large Values: 1,000,000Ω or 1MΩ

Resistance | Practical Exercises1. Write your own definition for Resistance in one short sentence

_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

2. What is resistance measured in, Unit and Symbol_______________________________________________________________________________

3. In electronics we use k for kilo ohms when talking about resistor sizes. Complete the table to convert from Ohms to kilo ohms and back again

Value in ohms Value in kilo-ohms (kΩ)

?? 1kΩ

2000Ω ??

4700Ω ??

?? 12kΩ

Schools are free to Photocopy | 2018 © Craig Jefferies | 13

Page 14: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

4. Find the key words in the word searchAMPSBATTERYCELLCURRENTKILOMEGAMILLIOHMSVOLTAGEVOLTS

5. Crossword with key words and definitionsAcross4. means a thousandth or divide by 10006. the unit of measure for resistance7. converts chemical energy into electrical energy8. the flow of energy in a circuit

Down1. the unit of measure for Voltage2. The unit of measure for Resistance3. means 1000 or times by 10005. the energy a battery has8. a single battery

Schools are free to Photocopy | 2018 © Craig Jefferies | 14

Page 15: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

6 Circuit | LED InterfaceThe first circuit to construct is an output circuit using a LED and a resistor. We call this circuit an interface because is has two electronic components that work together to allow the circuit to function

LED InterfaceConstruct the LED interface circuit

5mm Light Emitting Diode (LED)

330 Ohm resistor.

ARDUINO Code

/* Blink */

int ledPin = 2;

void setup() pinMode(ledPin, OUTPUT);

void loop() digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); delay(1000);

Light Emitting Diode | Practical Exercises1. Listen to the Morse Code sound https://en.wikipedia.org/wiki/SOS It is a signal

for Help. Make the LED flash a morse code SOS. 3 short flashes, 3 long flashes and then 3 short flashes.

2. The human eye is unable to detect flashing LEDs when they flash two fast. Decrease the rate of flashing down to a small pause of around 50ms. Can you

Schools are free to Photocopy | 2018 © Craig Jefferies | 15

Page 16: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

detect the flash? If so, decrease the pause even further until you can no longer see the LED flash.

7 Series Circuit TheoryThe LED circuit we just created “6 Circuit | Light Emitting Diode” is an example of a Series circuit. The LED and Resistor are connected one after the other.

A Series Circuit the Science wayThe circuit diagram below shows a power supply connected in line with a 330 Ohm resistor and an LED. These components are in Series.

A Series Circuit the Electronics WayIn electronics, components such as the resistor and LED may be connected to a digital output pin of a microprocessor instead of a power supply. All the same ideas apply. .

Current in a Series CircuitAs there is only one path to follow, the current in a series circuit is the same everywhere. The current (I) through the resistor is the same as the current through the LED.

Voltage in a Series CircuitVoltage is divided among the components in a series circuit. For example, if the battery in the circuit opposite supplies or gives 3v to the circuit, then the 3v would be divided among the resistor and LED

ExampleA battery of Voltage: +6v is connected in a series circuit as shown opposite. The voltage loss across the resistor is: 4v

What is the Voltage across the LED?VBattery = V330R + VLED

VLED = VBattery - V330R

VLED = 6v - 4vVLED = 2 volts

Schools are free to Photocopy | 2018 © Craig Jefferies | 16

Page 17: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Series Circuit | Exercises

1. Check out the diagram opposite. It shows to resistors R1 and R2 in series. Calculate the voltage across the resistor R2. ( VTOTAL = V1 + V2 ) … Series Circuit ____________________________________________________________________________________________________________________________________________________________

2. Check out the diagram opposite. Calculate the voltage across the resistor R1. ( VTOTAL = V1 + V2 ) … Series Circuit _________________________________________________________________________________________________________________________________________________________

3. Find the missing Current (I1) in the series circuit. Include the unit.__________________________________________________________________________________________________

4. Calculate the unknown voltage (V330R) in the series circuit. Include the unit.___________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 17

Page 18: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

8 LED CharacteristicsAn LED stands for Light Emitting Diode. They are all around us; in our phones, in our torches and our TV’s. An LED converts electrical energy into light. LEDs require a lot less power to light compared to lamps or light bulbs. They don’t to get hot like lightbulbs do This makes them ideal for mobile devices and other low-power applications

Long Leg and Short LegLEDs, being diodes, will only allow current to flow in one direction. And when there’s no current-flow, there’s no light. The image below shows a 5mm LED.

Greedy LEDsIf you connect an LED directly to a current source it will try to dissipate as much energy as it’s allowed to draw, and, it will destroy itself. That’s why it’s important to limit the amount of current flowing across the LED with a small resistor.

An 5mm LED DatasheetAn LED Datasheet is a set of characteristics of a particular LED from the Manufacturer. The datasheet opposite gives minimum and maximum voltages across the LED for a current of 20mA.

Schools are free to Photocopy | 2018 © Craig Jefferies | 18

Page 19: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

LED | Exercises1. Sketch the circuit symbol for an LED

2. Study the LED datasheet. What is the maximum and minimum voltages we should supply the LED ______________________________________________________________________________________________________________________________________________________________

3. What do you think happens if we supply more current or voltage than the LEDs maximum?______________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 19

Page 20: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

9 Circuit | BuzzerConstruct the circuit using a Buzzer. Make sure that the buzzer is connected into a Digital Output pin such as pin 8

ARDUINO Code

/* Tone */int buzzerPin = 8; void setup() pinMode(buzzerPin, OUTPUT); void loop() tone(buzzerPin, 1000, 500); delay(500);

Piezo Buzzer | Practical Exercises1. Make a piezo buzzer produce a ascending series of notes. From a low note to

a high note.2. Find the lowest and highest notes that the piezo buzzer is able to produce.

List them:______________________________________________________________________________________________________________________________________________________________

3. The tone command has 3 parameters. What does each parameter mean? a. Pin______________________________________________________________________b. Frequency

________________________________________________________________c. Druation

_________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 20

Page 21: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 21

Page 22: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

10 Circuit | DC Motor InterfaceA DC Motor converts electrical energy into movement by rotating an axle. We call this circuit an interface because is has many electronic components that work together to allow the circuit to function

Motor InterfaceConstruct the Motor interface circuit

DC Motor 470 Ohm Resistor BC337 Transistor

This diagram opposite will help to figure out how to connect the components. If the motor does not spin, first check the batteries on your board, then try placing a diode across the motor like the diagram above.

ARDUINO Code

/* Motor */

int motorPin = 2;

void setup() pinMode(motorPin , OUTPUT);

void loop() digitalWrite(motorPin , HIGH); delay(2000); digitalWrite(motorPin , LOW); delay(2000);

Schools are free to Photocopy | 2018 © Craig Jefferies | 22

Page 23: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

11 Transistor SwitchMotors need heaps of oomph, around 80mA - 120mA of current. We cannot connect the motor directly to the Microprocessor output pin as the current from a digital pin is too small, it does not have enough oomph (only about 20-40mA of current from an output pin). To enable us to control the motor we need to make use of the supply voltage. The diagram opposite shows how to connect a BC337 transistor as a switch in a way that allows the Microprocessor to “switch” the motor on and off.

What is a transistor?The transistor is kind of like a water tap. The base pin is like a handle you might turn to allow more or less electrons to flow from emitter to collector. Transistors are three-terminal devices. The pins are labeled:

collector (C), base (B), and emitter (E).

What is a transistor switch?We use a transistor is to control the flow of current to another part of the circuit – using it as an electric switch. A normal switch would require a human hand turn it on or off, but a transistor switch is controlled by the voltage at the base pin. A microcontroller output pin, like those on a ARDUINO or Arduino, can be programmed to go high or low, essentially switching a transistor on or off

Transistor | Exercises1. Sketch the circuit symbol for a Motor

2. Sketch Motor Symbol

3. What happen if you swap the motor wires around the other way?__________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 23

Page 24: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 24

Page 25: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

4. Sketch the circuit symbol for a Transistor

5. Why does a motor not work when connect directly into the digital output pins of the Microcontroller?______________________________________________________________________________________________________________________________________________________________

6. What needs to happen for the transistor to work like a switch? (current to flow from collector to emitter)__________________________________________________________________________________________________________________________________________________________

7. Sketch the entire transistor switch interface (all components need to make the Motor go)

Schools are free to Photocopy | 2018 © Craig Jefferies | 25

Page 26: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

12 Circuit | ButtonWe call this button circuit an interface because is has two electronic components that work together to allow the circuit to function

Button InterfaceConstruct the Button interface circuit.

Tact Switch (make sure it's plugged in with legs spread lengthways on the breadboard

10K Ohm resistor

Which way round does the tact switch go?When pressed, a tact switch wll connect from point 1 to point 4 or from point 3 to point 2

/* Button */

const int buttonPin = 2; const int ledPin = 13;

int buttonState = 0;

void setup() pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT);

void loop() buttonState = digitalRead(buttonPin); if (buttonState == HIGH) digitalWrite(ledPin, HIGH); else digitalWrite(ledPin, LOW);

Schools are free to Photocopy | 2018 © Craig Jefferies | 26

Page 27: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 27

Page 28: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

13 Button InterfaceWhat is a buttonA button is a switch, it is a used to interrupts the flow of current in a circuit. Switches are devices that are either completely on “closed” or completely off “open”.

The switch InterfaceThe switch interface uses a 10K resistor to pull the input pin of the Microprocessor to ground (A pull-down resistor). This means the digital input pin “feels” ground or zero or LOW. Only when the switch is pressed, does a connection get made to the positive rail, allowing the digital input pin to “feel” high.

Button | Practical Exercises1. Sketch the circuit symbol for a closed button interface

2. What is the purpose of the pull-down resistor?____________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 28

Page 29: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

13 Resistive Sensors | LDRA Light Dependant Resistor or LDR is a light-sensitive, variable resistors. It changes resistance depending on the amount of light falling on the sensor.

In pitch-black conditions, the LDRs resistance will be in the megaohm’s (1.0MΩ+) range. Shining a bright light on the sensor can drop the resistance to near-zero, but usually the resistance of the LDR falls between 8-20kΩ in normal lighting conditions.

Resistive Sensors | Practical ExercisesMeasure Resistance with a Multimeter

1. We can Grab a multimeter, switch the dial to the Ohms symbol like the image opposite and use the probes to measure the resistance of the LDR in various light levels.

Light Level Resistance Value

Dark

Low Light

Classroom Light

Phone Torch Light

Schools are free to Photocopy | 2018 © Craig Jefferies | 29

Page 30: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

14 Circuit | Light Sensing interfaceThis circuit is an interface because is has two electronic components that work together to allow the circuit to function.

We can use the Light dependant resistors properties to help sense light levels. Construct the following circuit on a breadboard.

LDR 10K Resistor Jumper Wire to Microprocessor

ARDUINO Code

/* light sensor */

int ldrPin = A0; // select the input pin for the LDRint ldrValue = 0; // variable to store the value coming from the sensor

void setup() Serial.begin(9600);

void loop() ldrValue = analogRead(ldrPin); // read the value from the sensor: Serial.println(ldrValue );

Schools are free to Photocopy | 2018 © Craig Jefferies | 30

Page 31: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Light Sensing Interface | Exercises1. Refer to your debug screen. On the number line below, place in your

analogRead values for Darkness, Room-Lighting and Intense Light.

light level Intense Light Classroom Lightening Darkness

0 ----------------------------------------------------------------------------------------------------------------- 255

analogRead value

?? ___________________

?? __________________

?? ___________________

2. Sketch LDR Symbol

3. Sketch the Light Sensing interface. This is the combination of an LDR and 10K resistor. Label all components plus supply voltage and 0 volt rails

Schools are free to Photocopy | 2018 © Craig Jefferies | 31

Page 32: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

4. Complete the word find with the key words

ANALOGUEDARKNESSLIGHTMULTIMETEROHMSRESISTORSENSORVARIABLE

5. Complete the CrosswordAcross1. the approximate resistance of an LDR in Pitch Black conditions2. A resistor whose resistance varies with light

Down1. A device used to measure Resistance, Voltage, and Current

Schools are free to Photocopy | 2018 © Craig Jefferies | 32

Page 33: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

15 Circuit | Temperature Sensing InterfaceThis circuit is an interface because is has two electronic components that work together to allow the circuit to function. A NTC Thermistor is a temperature-sensitive, variable resistors. It changes resistance depending on the amount of heat applied to the sensor. The resistance of NTC Thermistor will decrease as the temperature increases.

Construct the following circuit on a breadboard.

100k NTC Thermistor into C.2 10K Resistor Jumper Wire to Microprocessor

/* thermistor */

int thermistorPin = A0; // select the input pin for the LDRint thermistorValue = 0; // variable to store the value coming from the sensor

void setup() Serial.begin(9600);

void loop() thermistorValue = analogRead(thermistorPin ); // read the value from the sensor: Serial.println(thermistorValue );

1. What happens to the analogRead value when you heat the Thermistor _______________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 33

Page 34: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

16 Circuit | Moisture Sensing InterfaceThis circuit is an interface because is has two electronic components that work together to allow the circuit to function.

Water is able to act as a conductor. The more water in soil the lower the soils resistance (resistance gets lower with an increase in moisture content) .We can use probes to help construct a circuit that responds to moisture levels.

Construct the following circuit on a breadboard. Two Jumper Wires as Probes 10K Resistor Jumper Wire to Microprocessor

/* conductivity*/

int conductivityPin = A0; // select the input pin for the LDRint conductivityValue = 0; // variable to store the value coming from the sensor

void setup() Serial.begin(9600);

void loop() conductivityValue = analogRead(conductivityPin ); // read the value from the sensor: Serial.println(conductivityValue );

Schools are free to Photocopy | 2018 © Craig Jefferies | 34

Page 35: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

17 Making Decisions with CodeWhat does good code look like?It's time we had a look at the code we are using to take in input, processes the input and control output devices. The image below shows the code we used for the Light sensing circuit.

What your code needs to includeIt is important that the code your write includes: Meaningful file name, Program Title, Code comments, Indentation, Variable assignment using symbols.

Why do we do this?This make your code easier to understand, easier to read by other people and easier to debug (fix syntax errors and logic errors)

1. When writing code, what should you include?____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

2. What is variable assignment?________________________________________________________________________________________________________________________________________________________

3. What are code comments?________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 35

Page 36: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Making decisions with codeMaking decisions with code involves three things:

1. Taking in and storing input 2. Processing the stored input3. Turning on an output device

Below is example code that takes in and stores analogue input, processes the stored input then turns on an output device

ARDUINO Code

'Read Light Levels.bas

'assign all constants and variablesetup: symbol LDR = C.4 ‘ assign the LDR to analogue pin C.4 symbol LED= C.2 ‘ assign the LED to digital pin C.2

' main loopdo analogRead LDR,b1 ‘ read the voltage signal on the LDR pin

if b1 < 20 then ‘ if light value below 20 - flash LED for 50ms high LED pause 50 low LED else ‘ else light value above 20 - flash LED for 1 sec high LED pause 1000 low LED endif loop

4. In the code above, what input is being taken in? (Light or Temp)________________________________________________________________________________________________________________________________________________________

5. What 3 things does making a decision with code involve?____________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 36

Page 37: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

One of the most important parts of this code is below. It takes in a voltage signal as input from a specific input pin and store it in memoryTaking in and storing input Processing the stored input, Turning on

an output device

Conditional statementsA conditional statement is an if else command, and is used to make a decision. If condition is TRUE)then do something, else condition must have been FALSE so do something else

if “condition” then // do somethingelse // do something elseend if

Example show using a conditional statement on Digital and Analogue inputsCheck state of Digital Input pinsymbol BUTTON= pinC.3

if BUTTON = 1 then ‘ do somethingelse ‘ do something elseendif

6. Does BUTTON = 1 refer to the switch open or switch closed?____________________________________________________________________

Check value of variablesymbol LDR=C.4analogRead LDR, b1

if b1 > 100 then ‘ do somethingelse ‘ do something elseendif

7. What happens if the statement if b1 < 100 evaluates to FALSE?____________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 37

Page 38: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

18 Project | Scared of the DarkDevelop an electronics system that is able to sense nighttime and turn on some form of light

1. Construct the LDR input interface. sketch and label the LDR analogue input interface

2. Calibrate your LDR analogRead values to light levels. Use a calibration table to record your light levels and analogRead values.

Light Levels analogRead values

Pitch-Black ??

Darkness ??

Low Light ??

Med Light (Room Lightning)

??

Sunlight ??

Intense Light ??

3. Construct an output interface that will provide some form of light. sketch and label the input interface

Schools are free to Photocopy | 2018 © Craig Jefferies | 38

Page 39: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 39

Page 40: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

4. Write software code that takes in and stores input, makes a decision and turns on an output device. Debug your code (fix syntax errors logical errors)

5. Test your software program to make sure it turns on a light in night time light conditions Use a testing table to record your light levels and light source response.

Light Levels Did the light turn on?

Pitch-Black ??

Darkness ??

Low Light ??

Med Light (Room Lightning)

??

Sunlight ??

Intense Light ??

6. Modify your Programming Code so that it includes: Meaningful file name, I/O pins assigned meaningful names using symbols, Program Description,code comments, Code indentation. Either Copy in your program code or glue in a photograph.

Schools are free to Photocopy | 2018 © Craig Jefferies | 40

Page 41: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

19 Project | Temperatures for Seed growthWhat is the optimum temperature for seed growth? Temperature has a big effect on Seed Growth? Germination increases in higher temperatures – up to a point. Some plant seeds, including cool season vegetables like lettuce and broccoli germinate best in temperatures between 13 to 21 C.https://www.gardeningknowhow.com/plant-problems/environmental/temperature-on-plants.htmDevelop an electronics system that is able to indicate to a gardner when the soil is within 13-21 C

1. Construct the NTC Thermistor analogue input interface. sketch and label the input interface

2. Calibrate your NTC Thermistor analogRead values to temperature levels. Use a calibration table to record your temp levels and analogRead values.

Temperature Levels analogRead values

12oC ??

13oC ??

14oC ??

Schools are free to Photocopy | 2018 © Craig Jefferies | 41

Page 42: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

... ??

20oC ??

21oC ??

22oC ??

Schools are free to Photocopy | 2018 © Craig Jefferies | 42

Page 43: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

3. Construct an output interface that will provide some form of warning indicator. Sketch and label the input interface.

4. Write software code that takes in input, makes a decision and turns on an output device. Debug your code (fix syntax errors logical errors)

5. Test your software program to make sure it turns on a warning indicator in temperature conditions that are to cold or to hot. Use a testing table to record your light levels and light source response.

Temperature Levels

Did the warning indicator function as expected?

Below 13oC ??

13oC ??

Above 13oC ??

... ??

Below 21oC ??

21oC ??

Above 21oC ??

Schools are free to Photocopy | 2018 © Craig Jefferies | 43

Page 44: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

6. Modify your Programming Code so that it includes: Meaningful file name, I/O pins assigned meaningful names using symbols, Program Description,code comments, Code indentation. Either Copy in your program code or glue in a photograph.

Schools are free to Photocopy | 2018 © Craig Jefferies | 44

Page 45: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

20 Project | Fan ControlDesktop Fans are useful to help cool down areas by creating airflow. Your task is to construct a Fan that turns on when the Temperature measured by an NTC Thermistor increases above 21oC.

7. Construct the NTC Thermistor analogue input interface. sketch and label the input interface.

8. Calibrate your NTC Thermistor analogRead values to temperature levels. Use a calibration table to record your temp levels and analogRead values.

Temperature Levels analogRead values

Cold ??

Perfect Temp (21 oC) ??

Hot ??

9. Construct an DC Motor output interface that will provide some form of airflow sketch and label the input interface.

Schools are free to Photocopy | 2018 © Craig Jefferies | 45

Page 46: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 46

Page 47: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

10.Write software code that takes in input, makes a decision and turns on an output device. Debug your code (fix syntax errors logical errors)

11.Test your software program to make sure it turns on a warning indicator in temperature conditions that are to cold or to hot. Use a testing table to record your light levels and light source response.

Temperature Levels

Did the Fan function as expected?

Cold ??

Perfect Temp ??

Hot ??

12.Modify your Programming Code so that it includes: Meaningful file name, I/O pins assigned meaningful names using symbols, Program Description,code comments, Code indentation. Either Copy in your program code or glue in a photograph.

Schools are free to Photocopy | 2018 © Craig Jefferies | 47

Page 48: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

21 Voltage, Current, Resistance ReviewVoltageVoltage is a measure of the amount of energy between two points in a circuit. Voltage (V) measured in volts (v)

CurrentCurrent is a measure of how fast energy is flowing around a circuit. Current (I) Measured in Ampere of Amps (A)

1 milli-Amp (1mA) → 1 / 1000 = 0.001 Amp

100 milli-Amp (100mA). → 100 / 1000 = 0.1 Amp

ResistanceResistance is a measure of the resistance to the flow of charge. All wires and components have some resistance. In the process of resisting the flow of charge heat will be produced. Resistance R is measured in Ohms ( Ω ). We commonly use the following resistor values in this course

330 Ω, 470 Ω 1KΩ (1000Ω), 10K (10,000Ω)

Voltage, Current & Resistance | Exercises1. What is the unit for Current?

_____________________________________________________________________________________________

2. Convert the following values to Ampere 10mA : ___________________________________ ( divide by 1000 ) 25mA : ___________________________________ ( divide by 1000 ) 110mA : ___________________________________ ( divide by 1000 )

3. What is the unit for resistance?_____________________________________________________________________________________________

4. What are common resistor values we use this course?________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 48

Page 49: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

_______

5. What is produced in the process of resisting the flow of charge?_____________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 49

Page 50: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

22 Voltage DividerA voltage divider is the name given to two resistor in series, used for the purpose of dividing up the voltage from a power source. The diagram opposite shows a light Sensing interface with an LDR and a fixed resistor in series.

Its a series circuit!1. The LDR and fixed resistor are in

Series2. In a series circuit the source

voltage is divided among the resistors.VBattery = VLDR + VR

3. The bigger the resistance of the LDR (such as in Pitch black) the higher the voltage across the LDR.

Let's look at an example:Do you remember this statement a few pages back in the book? “In pitch-black conditions, the LDRs resistance will be in the megaohm’s (1.0MΩ+) range. Shining a bright light on the sensor can drop the resistance to near-zero, but usually the resistance of the LDR falls between 8-20kΩ in normal lighting conditions”. The diagrams below show a Light sensor interface in Pitch Black and in Intense Lighting conditions.

Light Sensor interface values in Pitch Black

The

LDR in Pitch black has a resistance of 1M Ohm. Thats really big. It uses up most of the voltage from the source due to the being so much bigger than the fixed 10K Ohm resistor.

Light Sensor interface values in Intense light

The

LDR has a resistance of 1K Ohms in Intense Light. Much smaller. It uses a very small amount of voltage from the source due to the being so much smaller than the fixed 10K Ohm resistor.

Microprocessor can read the voltage signal from the LDRThe microprocessor is able to read the voltage signal from the LDR, converting it to

Schools are free to Photocopy | 2018 © Craig Jefferies | 50

Page 51: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

an integer value. The bigger the voltage signal from the LDR, the bigger the integer value recorded. This is called Analogue to Digital Conversion. A ARDUINO using a command called analogRead for this.

Schools are free to Photocopy | 2018 © Craig Jefferies | 51

Page 52: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Voltage Divider | Exercises1. A voltage divider is made up of how many resistors

_____________________________________________________________________________________________

2. Is a voltage divider a combination of resistors in series or in parallel?__________________________________________________________________________________________________________________________________________________________________________________________

3. Does an LDR have a large or small resistance in Pitch Black lightning _____________________________________________________________________________________________

4. In the diagram opposite

a. What is the source voltage____________________________________

b. Which resistor will have the largest voltage across it? The 1M Ohm or the 10K Ohm______________________________________________________________________________________________________________

5. What does a Microprocessor convert a voltage signal to when using Analogue to Digital conversion?__________________________________________________________________________________________________________________________________________________________________________________________

6. A student has drawn a circuit diagram of a voltage divider that uses an LDR to measure light levels. Place in the following labels in there correct placed on the circuit diagram.

RLED

R2

Vout

Schools are free to Photocopy | 2018 © Craig Jefferies | 52

Page 53: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

23 Processing a voltage signalMicroprocessors are great at processing a voltage signal, like those from a Light Dependant resistor. It can do this using a technical called analogue to digital conversion.

analogRead commandanalogRead means read analogue to digital conversion and is a method of converting a physical voltage into a digital value. The analogRead command will read a voltage signal and convert it to a value of between 0-255 from the microcontroller input pins. (assuming is stores values using 8-Bit binary)

analogRead C.4, b1

Byte VariablesEvery microprocessor has a certain number of general purpose variables to store data temporarily while the program is running. The basic unit of storage is the byte. Variables are containers that can hold data. We can use these byte variables to hold integer data types.

let b0 = 100 let b1 = 0 let b2 = 255

But there are limitations. A byte variable can only hold a number between 0-255.

Testing with the debug commandDebug command sends information from the ARDUINO back to the ARDUINO Programming Editor displaying the current state of the byte variables. ARDUINO > DEBUG (F6)

debug b1

This is useful with testing and debugging code. But it does slow the operation of your program down.

The diagram opposite show the ARDUINO debug screen.

analogRead 4, b1 debug b1

Schools are free to Photocopy | 2018 © Craig Jefferies | 53

Page 54: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Schools are free to Photocopy | 2018 © Craig Jefferies | 54

Page 55: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Processing a voltage signal | Exercises1. What does adc stand for?

__________________________________________________________________________________________________________________________________________________________

2. The analogRead command takes two parameters, what are they? __________________________________________________________________________________________________________________________________________________________

3. A ARDUINO byte variable can hold values from 0 to what?_____________________________________________________________________________

4. What does the DEBUG command do?_____________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 55

Page 56: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

24 Ohm's LawOhm's Law deals with the relationship between voltage, current and resistance in a circuit. This relationship states that The voltage across a resistor is proportional to the current through it. We end up with a little equation that links these ideasVoltage (V) = Current (I) x Resistance (R)V = I x R

Example CalculationAn alarm clock draws 0.5 A of current when connected to a 120 volt circuit. Calculate its resistance.Known are

Current I = 0.5A Voltage V = 120v

How to solve the equationR = V / IR = 120 / 0.5R = 240 Ohms

Ohm’s Law | Exercises1. A DC Motor uses a 3 x AA batteries (4.5v). What is the resistance of the DC

motor if it draws a current of 0.1A?_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

2. A circuit contains a 3 volt cell battery and a LED with a resistance of 60 ohms. Calculate the current._______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 56

Page 57: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

25 Circuit | Digital Temp SensorThe DS18B20 is a sealed digital temperature probe lets you precisely measure temperatures in wet environments with a simple 1-Wire interface. Only one wire (and ground) needs to be connected from ARDUINO

Notice a 4K7 (4,700 Ohm) resistor connected from the 1-Wire pin to Vcc

Construct the following circuit on a breadboard.

ARDUINO Code

'Read Moisture Levels.bas

'assign all constants and variablesetup: symbol TEMP= C.2 ‘ assign the DS18B20 probes to Digital pin C.2

' main loopdo readtemp TEMP, b1 ‘ read the signal on the TEMP pin debug ‘ send all readings to a PC screenloop

Dallas Temp Sensor DS18B20 | Practical ExercisesThe readtemp,PIN,BYTE_VARIABLE command will typically store values between 0-255. So how does it output negative temperature values?

1. Using some ice, attempt to generate negative values on the DS18B20 temperature probe and record the output to the serial terminal.

2. How could you use software code to output negative values to the serial terminal using the - sign

Schools are free to Photocopy | 2018 © Craig Jefferies | 57

Page 58: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

26 Components ReviewBelow are some specifications for typical low voltage DC components used.

Motor SpecificationsThe motor has a normal operating voltage range of 3.0 to 5.0V DC and with no load spins at a speed of 6600 RPM (drawing about 110mA).

1. What is the maximum recommended voltage of the motor?_____________________________________________________________________________

2. How much current does the motor draw with no load?_____________________________________________________________________________

Piezo Speaker SpecificationsEach speaker requires an operating voltage of 3.5-5V with a current of 55mA max. These speakers also have a typical sound output of 95 dBA and a coil resistance of 42 ohms.

3. What is the maximum recommended voltage of the Piezo Speaker?____________________________________________________________________________

4. How much current does the speaker draw?_____________________________________________________________________________

Here are the recommendations for a typical 5mm LED

5. What is the recommended Voltage for the 5mm LED?_____________________________________________________________________________

6. What is the recommended Current for the 5mm LED?_____________________________________________________________________________

7. What is likely to happen if your LED circuit is above or below these recommended specifications?__________________________________________________________________________________________________________________________________________________________

Schools are free to Photocopy | 2018 © Craig Jefferies | 58

Page 59: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

27 Current Limiting ResistorLimiting current into an LED is very important. there is a specification for diodes called the forward voltage (usually between 1.5-4V for LEDs). You must reach the characteristic forward voltage to turn 'on' the diode or LED, but as you exceed the characteristic forward voltage, the LED's resistance quickly drops off. Therefore, the LED will begin to draw a bunch of current and in some cases, burn out. A common calculation needed in a circuit is to figure out the size of a series resistor needed to protect an LED from burn out

5mm LED specifications

Max Voltage = 2v Max Current = 20mA

So if we are using a 4.5 volt Supply, then the voltage across R1 needs to be 2.5v

4.5 - 2 = 2.5 volts

Using Ohm's Law to calculate the Resistance R

R = V / I R = 2.5v / 0.02AR = 125 Ohms

Schools are free to Photocopy | 2018 © Craig Jefferies | 59

Page 60: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Current Limiting Resistor | Exercises1. What is the purpose of the a resistor in series with an LED?

__________________________________________________________________________________________________________________________________________________________

2. A student is attempting to connect an LED straight onto a 9v supply.. Calculate the size of the series resistor needed to protect the LED from blowing!________________________________________________________________________________________________________________________________________________________________________________________________________________________________

3. Check out the diagram opposite. A Resistor is placed in series with the 5mm LED. Describe the purpose of the 330 Ohm resistor?___________________________________________________________________________________________________________________________________________________

4. Explain the effect of swapping the 330 Ohm resistor with a larger 1K Ohm resistor. Do this be researching and writing about the effect on the voltage across the LED with a large 10K resistor, the voltage across each component and the overall effect on the LED_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Vocab list: voltage, shared, current, increases, decreases, same, brighter, dimmer, Schools are free to Photocopy | 2018 © Craig Jefferies | 60

Page 61: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

through, across

Schools are free to Photocopy | 2018 © Craig Jefferies | 61

Page 62: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

28 Technical Report | AS1.5Achievement Standard 1.5 requires students to develop and test an electronics outcome and shows that they understand the purpose and function of components and interfaces.

To be continued …

Schools are free to Photocopy | 2018 © Craig Jefferies | 62

Page 63: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

29 Workbook AnswersMicroprocessors1. Data and program storage, Input & Output control circuits, A central processing unit2. Pin 33. Around 5vInputs, Processes & Outputs1. Crossword includes these words: Thermistor, LDR, Buzzer, Decision, Motor, LED2. Moisture Sensor or Temp sensor, On/Off Valve for waterBatteries | Voltage & Current1, Voltage, volt, current, amp, cell, negative, positive2. Voltage (V) measured in volt (v), Current (I) measured in Ampere (A)4. 1.5v5. 1.5v6. AAA battery is smaller, contains less chemicals, does not last as longResistors2. Ohms (Ω)3. 1000Ω - 1kΩ, 2000Ω - 2kΩ, 4700Ω - 4.7kΩ, 12,000Ω - 12kΩ5. Crossword includes these words: milli, ohm, battery, current, volt, ohm, kilo, voltage, cellSeries Circuit1. 2.0v2. 2.5v3. 25mA4. 2.7vLED Characteristics2. From 1.8v Up to 3.2v3. LED may overheat and burn outTransistor Switch3. Motor spins in the reverse direction5. Digital output pin cannot supply enough current6. Voltage applied to base pin

Light Sensing Interface1. Intense Light - Low analogRead value like 0-10, Darkness high analogRead value like 200-255, 5 Crossword include: megaohm, LDR, multimeterTemperature Sensing Interface1. Thermistor resistance decreases, so analogRead value will also decreaseMake decision with code1. File name, title, code comments, indentation, variable assignment2. Giving a variable a meaningful name to reuse in the program3. Descriptions of what the code is doing4. LDR so Light 5. Take in and store input, process input and turn on output device6. Closed7. Code will ‘do something elseVoltage, Current, Resistance Review1. Amp2. 0.01A, 0.025A, 0.110A3. Ohm4. 330, 470, 1K, 10K, 4K7, 10K5. HeatVoltage Divider1. 22. Series3. Large4a. 5V4b. 1M, 1Mega Ohm resistor5. An integer between 0-255Processing a voltage signal1. Analogue to Digital Conversion2. Input Pin and Variable3. 2554. Sends data to the PCOhms Law

Schools are free to Photocopy | 2018 © Craig Jefferies | 63

Page 64: seniorsecondary.tki.org.nzseniorsecondary.tki.org.nz/content/download/3890/31397/file/Prog 6... · Web viewseniorsecondary.tki.org.nz

Workbook | AS1.5 Develop an Electronics Outcome | 6Cr

Button Interface2. Pull the digital input in to LOW

1. R=V/I = 4.5/.1 = 45 Ohms2. I=V/R = 3/60=0.05 Amps

Component review1. 5.0v2. 110mA3. 5v4. 55mA5. Between 1.8v and 2.2v6. 20mA7. Overheat and burn outCurrent Limiting Resistor1. To reduce the current to the LED and to reduce to voltage across the LED2. 9v - 1.8v = 7.2v | R=V/I = 7.2/0.02 = 360 Ohms3. To reduce the current to the LED and to reduce to voltage across the LED4. The larger 1K Ohm resistor will reduce the current to a very small value and reduce the voltage across the LED to a value below that needed to make the LED glow

Schools are free to Photocopy | 2018 © Craig Jefferies | 64