Incorporating Computer Control into Student Project Work using a PIC Microcontroller

41
The ICT in Schools’ Initiative of the Department of Education and Science Incorporating Computer Control into Student Project Work using a PIC Microcontroller

description

Incorporating Computer Control into Student Project Work using a PIC Microcontroller. Building the PIC Control Board. CONTENTS Printed Circuit Boards (PCBs) Required PIC Board Components Populating the PIC Control Board Soldering Technique Testing Troubleshooting Hardware. - PowerPoint PPT Presentation

Transcript of Incorporating Computer Control into Student Project Work using a PIC Microcontroller

Page 1: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Incorporating Computer Control into Student

Project Work using a PIC Microcontroller

Page 2: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Building the PIC Control Board

Page 3: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

CONTENTS1. Printed Circuit Boards (PCBs)2. Required PIC Board Components3. Populating the PIC Control Board4. Soldering Technique5. Testing 6. Troubleshooting Hardware

Page 4: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

1. Printed Circuit Boards (PCBs)

Page 5: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

A printed circuit board also known as a PCB is a way of manufacturing electronic circuits. A PCB is made from insulating plastic with copper

tracks connecting the holes where components are placed.

They are designed specially for each circuit and make construction very easy.

Courtesy of www.technologystudent.com

Page 6: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

PC Graphics Card

PCBs are frequently used as a ‘Black Box’ technology in that they are replaced completely in the event of a malfunction rather than attempting to isolate the specific component that is causing the problem.

Page 7: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

2. Required PIC Board Components

Page 8: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Item No PIC Board Code Description No. Required per Board

SURFACE MOUNTED

1 R1,R4,R5,R7,R8 10K Resistor 5

2 R3,R6 4K7 Resistor 2

3 R15, R16 2K2 Resistor 2

4 R2 22K Resistor 1

5 R9,R10,R11,R12,R13,R14 330R Resistor 6

6 D1,D3,D10,D11 Diode 1N4001 50V 4

7 D2 Diode 1N4148 50V 1

8 IC2 18 pin low profile DILIC socket 1

9 IC1&IC4 7805 5V voltage regulator 2

10 C1&C4 Capacitor 100nF Polyester 2

11 C2&C3 Capacitor 220uF Electrolytic 2

12 Q1&Q2 BC337-40 npn transistor 2

13 TB1-TB6 2 way 16A PCB terminal block 6

14 CN1 2.1mm PCB DC Power Socket 1

FLYING LEADS

15 SW1 Miniature SPST momentary push switch 2

16 CN2 3.5mm stereo USB socket 1

17 Cable 10 way ribbon cable - rainbow 0.2 m

Page 9: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Item No PIC Board Code Description No. Required per Board

OUTPUTS

18 D4&D7 5mm Red LED 2

19 D5&D8 5mm Green LED 2

20 D6&D9 5mm Yellow LED 2

21 N/A LED Spacer mount 6

22 N/A 3v 8000 rpm motor 1

23 N/A Miniature enclosed speaker 1

INPUTS

24 N/A NORPS12 LDR 1

25 N/A NTC Thermistor 20K 1

26 N/A 43mm lever solder microswitch 2

MICROCHIP

28 IC2 GENIE E18 IC 1

29 N/A GENIE USB Plug & Play cable 1

MISC

30 N/A Flexible propellor 1

31 N/A Battery Clip PP3 End Entry 200mm 1

32 N/A 4 x AA Short Battery Holder 1

33 N/A EI suppression capacitor 1

Page 10: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Details of component suppliers for the PCB we are using are available in the Excel file:

Student PIC Project Board Components.xls

Page 11: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Details of the PCB we are using are available in the Excel file: Student PIC Project Board Components.xls

Page 12: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

3. Populating the PIC Control Board

Page 13: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

PCB Population Method

1.Start with the smaller components e.g. resistors and diodes.

2.Move on to larger components like the IC socket.

3.Finish surface mount with the tall components i.e. capacitors and

transistors.

4.Complete the population by connecting the components on flying

leads; power socket, USB and reset switch.

5.Do not connect the chip until the board has been tested for

power connection.

Page 14: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Start now with the smaller components e.g. resistors and diodes.

Populate Order PIC Board Code Description Identification

1 R1,R4,R5,R7,R8 10K Resistor Brown, Black, Orange (Gold)

2 R3,R6 4K7 Resistor Yellow, Violet, Red (Gold)

3 R15, R16 2K2 Resistor Red, Red, Red (Gold)

4 R2 22K Resistor Red, Red, Orange (Gold)

5 R9,R10,R11,R12,R13,R14 330R Resistor Orange, Orange,

Brown (Gold)

6 D1,D3,D10,D11 Diode 1N4001 Ensure correct polarity

7 D2 Diode 1N4148 Ensure correct polarity

Ensure correct alignment of diodes

Page 15: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Move on to larger components like the IC socket.

Keep notch to the LHS

Page 16: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Insert taller components; capacitors (C1-C4) , transistors (Q1&Q2), voltage regulators (IC1&IC4) and terminal blocks (TB1 – TB4).

C2 C3

C1

C4

Q1 Q2

TB3 TB6

TB1 TB2

TB4 TB5

IC1 IC4

Page 17: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Insert power socket CN1 and connect the PP3 battery clip as shown. This allows the board be powered from either the PSU

or 4 x 1.5V AA batteries.

CN1: 2.1mm PCB DC Power Socket

PP3 Battery Clip

NOTE: The red PP3 cable could be connected through a SPST switch to create a master on/off control

Page 18: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

If the project under construction requires the use of a 9V external PSU then it is recommended to use an external power socket such as the

one shown above. These can be fitted into 3mm acrylic sheet.

2.1mm Power Socket

Page 19: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Complete the population by connecting the components on flying leads; beginning with the reset switch SW1 as shown. It is possible to use 2 cables to connect the reset switch to the PCB by using 2 loops on the board. However, the holes maybe too small to allow this.

SW1 – Reset Switch

Page 20: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

For use in a project it will be necessary to mount the USB socket on a flying lead as shown. The black and red cables may be connected in

the holes A and B if desired, as they are linked by copper trace.

A

B

CN2: USB 3.5 mm Stereo Socket

Page 21: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

LED outputs may be connected to outputs Q2 to Q7 using flying leads so that they can be fitted into a project where necessary.

Solderless LED holders are available from some suppliers fitted with 200mm leads that retain the LED using a patented clamping device.

Q2 Q3 Q4

Q5 Q6Q7

Page 22: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

It is cheaper to connect LEDs by soldering ordinary cable.

Plastic LED leg spacers shown are available from some suppliers.

They are very useful for ensuring that students do not short out the LED legs.

Page 23: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Q0 Q1

On the student project board at the position for outputs Q0 and Q1 there are terminal blocks so that outputs such as bulbs and motors can be attached. These outputs require a larger current than is available directly from the PIC.

To overcome this a transistor is used with its base attached to the PIC. The small current from the PIC is used to switch on the transistor allowing a large current to enter the collector. This makes it possible to use outputs like bulbs and motors.

Page 24: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

For the purposes of this course we will use a small speaker in output Q0 and a motor in output Q1 as shown above.

Q1Q0

NOTE: Some DC motors can cause the PIC to malfunction due to electromagnetic interference or ‘noise’.

To counteract this, fit a 220nF capacitor directly across the motor connections or use a solar type motor.

Page 25: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

We are using the following inputs:

D0/A0: NTC Thermistor 20K

D1/A1: NORPS12 LDR

D6: Micro-switch D7: Push Switch PTM

NOTE: The 20K thermistor is being used instead of a digital temperature sensor that is difficult to source and expensive. Another terminal block may also be added to allow easier connection.

Page 26: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

4. Soldering Technique

Page 27: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Good soldering is necessary to ensure proper functioning of the PCB. If possible, always use a temperature controlled soldering iron.

Click on the screen to activate a short video clip on soldering technique courtesy of Youtube.

Page 28: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Common soldering mistakes....

Too much solder

Page 29: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Too little solder

Page 30: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Unless joints with too little solder are corrected they can eventually crack causing intermittent connection problems.

These can be very difficult to diagnose.

Page 31: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

‘Cold’ soldered joint – caused by incorrect technique

Page 32: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Course participants are encouraged to practice their

soldering technique if necessary before

commencing.

Page 33: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

4. Testing

Page 34: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Your completed PIC board should be tested to establish correct power supply is present on the board and at the IC (5V) before inserting the chip. NOTE: Never solder the board with

the IC inserted.

Do not insert IC until power supply has been tested

Page 35: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Otherwise, you are ready to insert the IC and begin using the GENIE Design Studio software.

0V

+5 V

PIN 1

PIN 18

When you measure across pins 5 and 14 in the IC holder you should read approx 5V.

If not then refer to the slides on Troubleshooting Hardware.

Page 36: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

4. Troubleshooting Hardware

Page 37: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

If you do not read approx 5V across pins 5 and 14 on your IC then follow these steps:

1.Check your power source is working properly i.e. Check your

batteries or your PSU.

2.Carry out a visual check of components to ensure:

a. Components are inserted in the correct location e.g.

resistors and diodes.

b. Components are inserted with correct polarity i.e.

diodes, electrolytic capacitors, transistors.

c. Components on flying leads are connected properly,

particularly the external power socket if used.

Page 38: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

If you still have not identified a problem then continue with the following checks:

6-9V 5V0V

Check whether there is supply voltage (6 or 9V depending on batteries or PSU) and whether the voltage regulator has reduced this to 5V for use with the PIC as shown.

Page 39: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

If the problem still persists then it is probably due to a physical malfunction such as a poorly soldered joint or a break or crack in the copper trace. To identify this type of problem:

1.Carry out a visual check of all soldered joints and copper traces

using a suitable magnifying glass.

2.Check continuity between each component using the multimeter.

3.Re-solder any joints that appear like those shown in slides 28 to

31.

Page 40: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

Student PIC Project Board Inputs & Outputs

Page 41: Incorporating Computer Control into Student Project Work using a PIC Microcontroller

The ICT in Schools’ Initiative of the Department of Education and Science

For further information on any of these topics please refer to:

www.t4.ie