Page 1

Coding and Microcontrollers in Design Thinking

DIY Guidebook


Acknowledgements Susan Crichton, Director - Innovative Learning Centre Deb Carter, Research Project Coordinator - Innovative Learning Centre William Latta - Instructional Support Specialist - Innovative Learning Centre Maria Royston - Work Study Student - Innovative Learning Centre Innovative Learning Centre Advisory Board

Coding and Microcomputers in Design Thinking by Maria Royston, edited by William Latta, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. CC licensing information: http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_CA


Introduction Taking Making into the Schools is an immersive professional development approach. Designed for educators, this approach requires All participants to thoughtfully and fully engage in design thinking and creative problem finding. At the heart of the day is the maker ethos (love of making) which “values learning through direct experience and the intellectual and social benefits that accrue from creating something shareable� (Martinez & Stager, 2013). Making is a pedagogical orientation (Crichton & Carter, 2015) and a mind set (Dougherty, 2013) that integrates imagination and creativity with design thinking, problem solving, and even more importantly, problem finding. Using microcontrollers and coding in Making adds an additional element to the design thinking and creative problem finding process. The intent of this guidebook is to introduce you to the world of simple microprocessors and coding. The examples described throughout the guide will show how microcontrollers and coding can be easily incorporated into Design Thinking and Making activities for classrooms and schools. By teaching students how to deal imaginatively with the complexity of developing creative solutions for a variety of problems, they will be given the opportunity to explore their creativity and actually make something new and meaningful.

2


Table of Contents Introduction

2

Micro-controllers

3

Beginning to Code the Arduino

6

Electronics Basics

8

Breadboards

9

Voltage Current and Resistance

10

Resistors

11

Tools and Parts

15

Microcontroller & Simple Coding Projects

21

Project 1: The Happy Garden

21

Project 2: Password Please!

28

Project 3: Wind Power

33

Other Arduino DIY Projects

46

Preparing Your Microcontroller and Coding DIY Workshop

47

3


Microcontrollers

Microcontrollers are used in everything

amples of microcontrollers are the Arduino

from motor vehicles to home appliances.

UNO and the Lilypad Arduino.

Simply put, microcontrollers are tiny programmable computers. As a result, they can be easily incorporated into Maker ac-

Arduino is arguably the best option for a beginner interested in microcontrollers and

tivities.

DIY electronics. The Arduino’s key feature

User friendly microcontrollers have been

(IDE), a user friendly programming plat-

designed by companies like Arduino that

form. The Arduino User Community is

are integrated with digital and analog pin-

huge and has a very large coding database

outs, simplified programming methods,

with hundreds of examples.

is its Integrated Development Environment

voltage regulators and much more. Two ex-

4


Arduino microcontrollers are comparably

The operating voltage is important when

cheap (ranging from $12 - $60), simple to

designing circuits. It’s also useful to know

use, and run across multiple operating sys-

how many Digital pins and Analog Pins

tems.

each board has if you already know how

Arduino produces a variety of boards making it easy to find something project specific, such as a very small board with few

many components you need to connect to the board (and which type of pins they use).

pins or a flat wearable board with a built-in

PWM (Pulse Width Modulation) pins have

battery.

many uses, such as making an LED pul-

Microcontroller Specifications and Information It is important to know the voltage and current ratings of each device you use. The

sate. In the technical specifications outlined above, that there are 14 digital pins in total with 6 providing PWM. This means that there are 8 digital pins that are not PWM.

first step is knowing where to look. The Arduino Website (www.arduino.cc) lists the technical specifications for all of its products. For example, here are the specifications for the Arduino UNO.

5


Beginning to Code the Arduino Microcontroller (IDE)

Getting Started with Arduino

what you will see the first time you open

(www.arduino.cc/en/Guide/HomePage) pro-

the Arduino IDE program.

vides step-by-step installation help for Windows and MAC OS X. It also has links to some basic principles, libraries and more. Once you have the Arduino IDE installed on your computer, you can explore the Foundations of Arduino

The file will automatically be titled with the current date and a basic setup/loop is written. The first thing that needs to be done is to identify which board you’ve purchased and by selecting it under the Tools tab:

(www.arduino.cc/en/Tutorial/Foundations) and begin writing bit of code called a “Sketch”. The illustration above shows

6


Next, select the correct port (also under the Tools tab) for your Arduino. If you don’t know which port the Arduino is on, check the list of available ports, then unplug the Arduino and find which port has disappeared. Plug the Arduino back in and se-

The syntax and functionality of Arduino code is all explained in the language references section on the Arduino website. The comments in Blink describe what each section of code does. If there are no com-

lect that port.

ments or if we simply want to better under-

The Arduino IDE comes fully equipped

check the reference section for each piece

with many examples! Let’s open the exam-

of code.

ple Blink under the 01.Basics example tab.

stand what a particular code does, we can

As an example, when the first bit of code used: pinMode() is looked up, we can see a description of what the code does and its given syntax, parameters, returns and even an example.

7


Electronic Basics My First Circuit

A circuit is a connection between a power

keep reading and check out Suppliers and

source and some load that allows current

Gathering Workshop Materials.

to flow. The simplest circuit would be between a battery (power source) and a resistor (load), but it wouldn’t be very interesting. Instead, consider the same circuit with the addition of an LED. Now we have

An LED

2xAA Battery

220Ω Resistor

Wire & Electrical Tape OR Breadboard

something simple that lights up. What do you need to do this at home? If you don’t have any of these components

8


Breadboards Breadboards have long vertical rails running down each side (left and right), and short horizontal rails in rows as shown below. The rows of the breadboard are labeled, starting at 1. The columns are typically labeled from A-J along the top of the

Looking back at the LED circuit, the same

board. The rows are connected from A-E

connection can be used making a bread-

and F-J. The vertical rails are commonly

board.

used as power rails, red for positive and blue for negative.

Don’t be confused by the change in orientation of the breadboard; the columns are still labeled from A-J and rows from 1-30.

There are a couple of problems with this circuit. The illustrated wires are completely Inserting one end of a wire in 1E and the other into 1F, allows for the two horizontal rows to be connected.

bare, meaning that if they cross the circuit could short out. The battery is also still connected to the wire with electrical tape. Special wire called jumper wires are commonly used when prototyping to make quick easy connections. Battery holders of various sizes can also be purchased that

As an example, the two connections

have wire leads on the ends allowing for di-

shown next, one with wires and the other

rect breadboard connections. The com-

on a breadboard are exactly the same.

pleted circuit may look a bit messy but is much safer and faster to build and change.

9


To convert the reservoir example to an elec-

Voltage Current and Resistance

tronics example, replace reservoir with a Now that the first circuit has been built, its

battery, and the tube with a resistor. A

time to learn how it works.

smaller tube would mean a larger resistor. Although resistors do not get bigger with

Voltage, current and resistance are directly

more resistance they are color coded by

related in what’s known as ohm’s Law.

their value. As the tube decreases a lower flow is created. If the smaller tube is half the size of the larger tube, the flow would 


be half as great.

Voltage is measured in Volts, Current in Amperes, and Resistance in Ohms. Voltage is the measure of potential in a system. Imagine a water reservoir that is above ground. Voltage can be thought of as the potential of a water reservoir above the ground (increasing potential with

If the flow in the first tube can be repre-

height).

sented by I, then the flow in the second can be 0.5I. If the voltage (reservoir) stays the same size V=V and the resistance in the first tube is R we can directly calculate the resistance of the second tube. First rearrange ohm’s Law: 


To visualize current and resistance think of the flow through the tube. As the size of the tube changes so does the flow of wa-

Next substitute the known values:

ter.


 The resistance has doubled, proving the theory.

10


What’s happens here? Using Ohm’s law

Resistors

again we can calculate the current of this Resistors will have 4, 5 or 6 bands of color.

circuit. (The voltage for a typical AA battery

To determine the value of your resistor use

is about 1.5V).

the chart below. The Tolerance and Temperature Coefficient values are important when precision is needed.

The value of the current is infinity! If the wire is attached in this way all of the current would drain out of the battery almost instantaneously. This is very dangerous and could even start a fire!

So, if the resistor had been ignored in the circuit the LED would have burned out The chart can be used to calculate the val-

very quickly depending on its internal resis-

ues of the resistors shown.

tance. Internal resistance is a small amount of built-in resistance to avoid damage. To be safe, do not rely on the internal resistance of components. 



 Now let’s look at the simple LED circuit. Why is a resistor needed? While you should never do this, imagine that a wire is connected directly from one anode of the battery to the other.

Different LEDs will have different forward voltage and current ratings. To determine what value of resistor is needed operate this LED we can see the forward voltage of the LED is 1.8-2.2V with a suggested current of 18mA. The original example used two AA batteries in series each of which provides 1.5V producing a total of 3V. So the batteries will provide enough voltage to operate the LED.

11


Series and Parallel Connections

Adding resistors in series adds their resistance.


A series connection is a connection between two components from the positive side of one component to the negative side of another. A parallel connection is the connection of the positive and negative sides of two components (positive to positive and negative to negative). Why use either of them?

Resistors in Parallel In contrast the following image shows the same resistors connected in parallel. Using two 220Ω resistors the new total resistance would be 440Ω: .

Sometime batteries or resistors etc. need to be connected in parallel or series to increase or decrease a value based on what the circuit is. Since components require

To add the resistance in parallel we need

various voltages and currents to operate

to use a formula:

batteries and resistors are commonly placed in series when the exact value needed is not available. Remember back to the original circuit where two AA batteries were used in series. A single AA battery only produces 1.5V but the LED needed at least 2V to run, so by connecting the two batteries in series 3V was achieved at the output.

Resistors in Series Below is an image of a battery connected to an LED and two resistors in series.

The equation may look complicated but it can be used for all parallel connections of resistors. Using the previous value of 220Ω resistance, use the equation to find the new resistance, Using a calculator find that the new resistance is 110Ω. The resistance was actually lowered by 75% of the total resistance. Note that the resistance will not always be 25% of the total resistance, for example if a 200Ω and 300Ω resistor were put in parallel their combined parallel resistance would be 120Ω, not 125Ω.

12


Battery Combinations

Batteries in Parallel

To decide whether batteries should be

A parallel connection can be made to in-

used in series or parallel the meaning of

crease the capacity (run time) of a circuit

mAh needs to be understood. If a battery

without an increase in voltage. In the im-

is rated at 200mAh, it can provide 200mA

age below two AA batteries are connected

of current for one hour (h).

to the same circuit as before.

Batteries in Series A typical AA battery will produce approximately 1.5V with a capacity of 2000mAh. Connecting the batteries in series will double the output voltage while retaining the original capacity (2000mAh). In the example below a 220Ω resistor is in series with two batteries and an LED.

The combined voltage will stay the same as a single battery, 1.5V, but the capacity will double to 4000mAh. To find out how long this circuit will run the current has to be recalculated. The result will be about 6mA.

Using the combined voltage, 3V, the operating current can be calculated,

6mA is much too low to operate the LED, so the resistance will have to be changed.

The current will be about 13mA. If the LED

Remem-

ber an LED

is to run at 40mA we have to replace the

operates

at about

resistor,

40mA.

A resistor with a value of 75Ω will give the

37.5Ω will be needed for the LED to oper-

current needed. At 2000mAh with a current

ate properly. If the circuit is run with the

of 40mA the LED will burn for 50 hours.

new resistance the batteries will last for 100 hours

13


Series vs Parallel Summary Resistors in series increase resistance. Resistors in parallel decrease resistance. Batteries in series increase voltage. Batteries in parallel to increase capacity (mAh). Below is a summary table (including the formula for capacitors in series and parallel).

PICTORIAL DRAWING OF A SERIES CIRCUIT

14


Tools and Parts

It is always important to know what tools and parts are needed for a particular project. While some tools are not needed for every project, it is a good idea to have a basic toolkit that can be used regularly for these types of activities. While the tools and parts listed here will help complete the projects outlined in this document, they will be useful for future projects as well. Please see the last section of this guide for a suggested listing of tools and parts suppliers.

15


Tools Tool

Function

Breadboards are used for prototyping circuits. Breadboard

Soldering irons are used to create an electrical connection by melting solder between two electrically conductive surfaces. Soldering Iron

Solder is a metal alloy that comes in a leaded or unleaded form. Leaded solder melts at lower temperatures than unleaded solder. Solder

Flux is used when soldering to allow for the smooth flow of solder by oxidizing the metal compound. Flux Wick is used to remove solder from a joint. The wick is placed on top of the joint and heated with a soldering iron. Capillary action lifts the solder from the joint into the copper mesh of the wick. Wick

Third hands are used to hold components when soldering. Third Hand

Wire

Wire comes in various sizes. The typical gauge used for electrical purposes is 22AWG (American Wire Gauge). Wire may come with an insulating coat to prevent unwanted current flow between multiple wires.

16


Tools

Function

Wire strippers are used to remove insulation from the ends of wire before soldering. They also have small shears near the base to cut wire. Wire Strippers Jumper wires are primarily used when prototyping on a breadboard. Jumper wire exists as M/M, F/F, or M/F. M - Male (open wire end); F - Female (slot end) Jumper Wires Header pins are connected to components or boards to make connections more accessible. Header Pins

Prototyping Board

Crimping Tool

After a circuit has been tested on a breadboard, a prototype can be made using a prototype board. Circuit components are typically solder directly to the board, meaning that the components and board can not be reused. A crimping tool is used to attach pins (such as Molex female pins) to stripped ends of wire. It is unlikely one would need a crimping tool in the early stages of DYI discovery.

See Crimping Tool Molex Female Pins Alligator clips are wires with large clips attached to the ends. These are usually used to test connections. Alligator Clips

A multimeter is used to measure, current, resistance, etc. Multimeter

17


Components Component

Description

Resistors are an essential part of any electrical circuit. Resistors limit the electrical current through the circuit with the relationship of ohms law: V = IR (Voltage = Current X Resistance). Resistors

Capacitors are used to temporarily store charge in a system. This process is useful to smooth power in a circuit, etc. Capacitors Diodes are semiconductors that limit current flow to one direction. An ideal diode will allow current to pass through completely one way while not allowing it to pass back through the component. Diodes Transistors typically have three pins: Base; Emitter; Collector. While there are a variety of transistors, NPN transistors are the most common and are the ones used in this guide. Transistors LEDs (Light Emitting Diodes) are directional semiconductors that release energy as photons. LED’s have an anode (+) and cathode (-). When the right amount of voltage is applied to the anode, the LED lights up. LEDs

Integrated Circuit Chips

Motors

Integrated circuit chips are capable of being programmed to perform logic operations.

A variety of motors exist for dyi circuitry projects. The most common, the DC brushed motor, works using electromagnetism with coils and magnets. There are multiple methods of motor control. For example, simple transitors are used for speed control while H-Bridges are capable of reversing the direction of the motor.

18


Component

Description

A potentiometer is a basic input device. Turning the knob changes the resistance of the film inside, resulting in a change in voltage reading. Potentiometers

There are many types of switches. A switch can either be on, allowing current to flow, or off, creating an open circuit. Switches

Buttons have a value of 1 when pressed or 0 when not pressed. They are commonly used as controls in DIY projects. Buttons

Joysticks are extremely useful for controlling robots and changing the speed of servos/motors. Joysticks 1 X4 or 3 X4 keypads use separate buttons with a common ground. Each button connects to a digital pin which allows them to serve separate functions. Keypads

The hygrometer is a device used to detect moisture. Specifically, the tines are designed for use in soil to detect how wet or dry the soil is. Hygrometers

The soil sensor is similar to the hygrometer, but requires fewer components to operate. Moisture Sensor

19


Component

MicroServos

Description A servo is a combination of a motor and gears in some type of encasement. A servo can be continuous providing a complete rotation of the axis or have a specific degree of freedom (typically 180o).

A soft potentiometer is similar to a regular potentiometer, but will change resistance by detecting pressure changes across its surface. Soft Potentiometers

Temperature Sensors

Temperature sensors use a diode to precisely amplify the change in voltage across the base. The emitter is used to determine the temperature.

There are many ways of creating buzzers. The piezo buzzer uses a transistor circuit to apply varying voltage to a disk that flexes and creates sound. Buzzers Lithium Polymer (Lipo) batteries are very small (and thin) for their capacity and can be recharged for continued use in embedded systems and DIY projects. Lipo Batteries

Photoresistors are resistors specifically sensitive to light. They change resistance when more or less light is applied. Photoresistors

USB to Micro USB Cable

The USB to Micro USB cable is used to hook up the Arduino microprocessor to your computer for programming purposed.

20


Microprocessor & Simple Coding Projects Project 1 The Happy Garden

Stop wondering if you watered the plants this morning! The Happy Garden Hygrometer will always let you know how much moisture is being retained in the plants soil. Now you can base your watering schedule on when the hygrometer indicates that it is needed. Note: Please refer to the “Preparing the Workshop� section of this guide for a complete listing of suppliers for these components, tools, and optional equipment.

21


Components and Tools Circuitry Components Needed

Quantity

Arduino Pro Mini

1

Hygrometer Sensor

1

LED

1 Red 2 Yellow 2 Green

220â„Ś Resister

1

Battery and Battery Holder

2 AA Batteries 1 Battery Holder

Jumper Wires (male pins on each end)

13

Breadboard

1

USB to Micro USB Cable

1

Tools (Optional)

Quantity

Wire

1 roll

Solder

1 roll

Soldering Iron & Stand

1

Prototyping Board

1

Wire Strippers

1 pair

22


Step by Step 1. Start with the Arduino Pro Mini and the Breadboard. Plug the Arduino Pro Mini into the breadboard with Digital Pin 9 into H1 and Digital Pin 10 into D1.

2. Now connect the LEDs. 1. Push the Red LED the pins into J14 and J15. Take a jumper wire and push one end into I7 and the other into I14. 2. Push one of the Yellow LED’s pins into J17 and J18. Push the other Yellow LED’s pins into J26 and J27. Take one jumper wire and push one end into I5 and the other end into I17. Take another jumper wire and push one end into B1 and the other end into I26. 3. Push one of the Green LED’s pins into J20 and J21. Push the other Green LED’s pins into J23 and J25. Take one jumper wires and push one end into I1 and the other end into I20. Take the other jumper wire and push one end into I4 and the other end into I26. 4. Using 5 more jumper wires, push the ends into H15 and H18; G18 and G21; F21 and F24; H24 and H27; and finally I27 and the Blue Negative (-) column, row 36.

23


3.

Now the Hygrometer can be attached to the breadboard. As shown below, place the pins of the hygrometer circuit board into I30, I31, I32, and I 33. Attach a jumper wire to B9 and G30; attach another jumper wire from B11 to G31; attach the last jumper wire from B5 and G34.

4. Use the USB to Micro USB cable to connect the Arduino Pro Mini into your computer, so that the coding needed to operate the Hygrometer can be written and uploaded to the arduino. 5. Begin by testing the Hygrometer to ensure it is producing the correct values. To do this, 6 lines of code are needed. Open the Arduino IDE program and type the following simple code into a new sketch. The code for this sketch actually contains more than 6 lines. Remember that lines with // are just notes explaining what the code is doing.

24


6. Verify and upload the code and then click on the Serial Monitor button (Magnifying Glass Icon), located in the top right hand corner of the window. 7. Using a piece of paper towel and a cup of water you can imitate dry, moist, and wet conditions. 1. First, with the Hygrometer sitting in the open air, record the value written to the serial monitor. This will be your “danger” or too dry value. 2. Now, wet the paper towel with some of the water and wrap it around the Hygrometer. The value should change and this will be your “ideal” value needed for the next section of code. 3. Finally, dip the Hygrometer directly into the cup of water. The resulting value will be the “overwatered” value. 4. Hint: You can do a bit of research for plants with specific moisture requirements to find out what the ideal conditions are and modify the code accordingly. 8. Now that the Hygrometer has been tested, the LED pins need to be defined and conditional statements added for each state of moisture level in the soil.

25


9. In this step begin the serial connection and define the LEDs as outputs.

10. Finally, define the loop and if statements. You can set up as many conditions as you like. For this example there are 5 conditions: Dry; Nearing Dry; Moist; Nearing Wet; Wet. This is where the values recorded in step 7 will be used. The conditions will read as follows: Reading

LEDs Used

Dry = “Danger”

Red LED

“Danger” > Nearing Dry > “Ideal”

1st Green + 1st Yellow LED

Moist = “Ideal”

1st and 2nd Green LED

“Ideal” > Nearing Wet > “Overwatered”

2nd Green + 2nd Yellow LED

Wet = “Overwatered”

Yellow LED

11. In code this will look a little different. Review the complete code structure for the “Happy Garden” and change as needed.

26


27


Project 2 Password Please!

Need a secure entrance for your tree house or a secret storage container? Look no further. Using the 3 X 4 Matrix keypad, an Arduino Pro Mini, a servo, and some LEDs, you can set up a fool proof keypad entry system.

Note: Please refer to the “Preparing the Workshop� section of this guide for a complete listing of suppliers for these components, tools, and optional equipment.

28


Circuitry Components Needed

Quantity

Arduino Pro Mini

1

3 X 4 Keypad

1

LED

1 Red 1 Green

220â„Ś Resister

1

Battery and Battery Holder

2 AA Batteries 1 Battery Holder

Jumper Wires (male pins on each end)

11

Breadboard

1

USB to Micro USB Cable

1

Tools (Optional)

Quantity

Wire

1 roll

Solder

1 roll

Soldering Iron & Stand

1

Prototyping Board

1

Servo

1

29


Step by Step 1. Start with the Arduino Pro Mini and the Breadboard. Plug the Arduino Pro Mini into the breadboard with Digital Pin 9 into H1 and Digital Pin 10 into D1.

2. Now connect the LEDs 1. Place the red LED pins in J14 and J15. Take a jumper wire and push one end into I7 and the other into I14. 2. Place the green LED pins in J19 and J20. Take a jumper wire and push one end into I5 and the other into I19. 3. Take the 220â„Ś Resister and push one end into I9 and the other end into Row 9 on the Blue Negative (-) column. 4. Using a jumper wire, push one end into I15 and the other end into Blue Negative (-) column, row 16. Take another jumper wire and push one end into I20 and the other end into Blue Negative (-) column, row 21.

30


3. Attach the 3 X 4 Matrix keypad pins to H23 - H29. Attach jumper wires from: 1. G23 to C4 2. G24 to C3 3. G25 to C2 4. G26 to C1 5. G27 to I1 6. G28 to I2 7. G29 to I3 4. Plug the Arduino Pro Mini into your computer using the USB to Mini USB cable. 5. Use the following sketch to display which key is being pressed.

31


6. Upload the code to the arduino and open the serial monitor (magnifying glass) in the top right hand corner of the Arduino IDE window. Push all of the buttons on the keypad and make sure they are showing up correctly. If not, you can change the order of the numbers in the sketch until they are correct. 7. Once the numbers are correct you can begin coding the conditional statements for a specific “secret” combination. The following code written by Stefan at musicdriver.com. You can change the secretCode to be any combination you wish. Any numbers pushed before entering the secretCode will not prevent the “lock” from opening, to lock the system simply press the # or * key on the keypad.

32


Project 3 Wind Power

Ever wanted to impress party guests with your own DIY bling? How you can. This pinwheel is controlled with a Lilypad Arduino and with the touch of a button, you can turn it on or off. With this project, you can design your own code to change the speed and create unique patterns for the pinwheel.

Note: Please refer to the “Preparing the Workshop” section of this guide for a complete listing of suppliers for these components, tools, and optional equipment.

33


Circuitry Components Needed

Quantity

Lilypad Arduino

1

Motor

1

Pinwheel (can be bought at a Dollar Store)

1

Coin Cell Battery + Holder or Lithium Ion Battery

1

Micro USB to USB Cable

1

Lilypad Button

1

220Ω Resister 10Ω Resister

1 1

Transistor

1

Diode

1

Jumper Wires (male pins on each end)

2

USB to Mini USB Cable

1

Tools

Quantity

FTDI Cable

1

Alligator Clip Leads

10

Wire

1 roll

Solder

1 roll

Soldering Iron & Stand

1

Small Prototyping Board

1

Snaps

30

1/16” Hole Punch

1

Conductive Sewing Thread

1 roll

Sewing Needle

1

34


Step By Step This project will can be completed in two ways. In the first way, the motorized pinwheel can be prototyped using a breadboard. In the second way, an actual wearable pinwheel can be constructed. The first step is to create the motor control circuit on the breadboard. Place a resistor between pins H6 and H10, place an NPN transistor between pins J9-J11, and finally place a diode between pins I11 and I16.

1. Using the alligator clip jumper wires make the following connections from the breadboard to the Lilypad Arduino. 1. Connect one jumper wire from the leg of the transistor (H6 on the breadboard) to Digital Tab 9 on the Lilypad Arduino. 2. Connect one end of the next jumper wire to I9 on the breadboard, using a male to male jumper wire to facilitate the connection. Connect the other end of the jumper wire to the Negative (-) Tab on the Lilypad. 3. Using the next jumper wire connect the leg of the diode in I11 of the breadboard to one pin of the motor. Note: the pin you connect this to will determine the direction that the motor will spin. 4. Connect the next jumper wire to the other leg of the diode (i16 on the breadboard) and the other end to the remaining pin on the motor.

35


5. Using another male to male jumper wire, make the last connection from the alligator clip attached to the motor to the Positive (+) Tab on the Lilypad.

2. Attach the Lilypad Arduino to your computer using the USB to Mini USB cable. Type the following lines of code into a new sketch and save it as “Motor�

36


3. Upload the code to the arduino and open the serial monitor (magnifying glass) in the top right hand corner of the Arduino IDE window. Practice changing the speed of the motor by following the instructions on the serial monitor. 4.

Now the Lilypad Button needs to be attached to the Lilypad Arduino. Using three more jumper wires with alligator clips make the following connections. 1. Connect the end of one jumper wire to the Lilypad Button (+) and the other end to the Positive (+) on the Lilypad Arduino. (Note: There will now be two clips attached to this tab). 2. Connect the next jumper wire to the Lilypad Button (-) and the other end to Digital Tab 3 on the Lilypad Arduino. 3. Finally using the last jumper wire, connect one end onto the resistor. Attache the other end of the resistor to the (-) side of the button. You can use the clip that is already attached to this tab to hold the resistor in place. Connect the other end of the jumper cable to the (-) tab of the Lilypad Arduino. Note: The earlier connections on the motor do not change.

37


5. The button can now be tested using the following “PinWheel� code.

38


The Wearable PinWheel

The following are the instructions to make the wearable version of this project. While this version is optional, it still provides all the functionality of the device made in the previous set of steps. The DIY holder for this project is a plastic card holder. The button is placed on the front so the motor can be turned on and o easily. A piece of card stock is used so that the Arduino can be detached from the rest of the project. Snaps and wires are used to attach most of the components to the card stock.

39


Step by Step 1. We will begin by using the small piece of proto-board to condense the motor controller to make it easy to attach to the card stock. Place the components on the proto-board as shown below.

2. Spread out the legs of the components to make things easier to look at and to show the connections. Looking at the back of the proto-board, connect the top leg of the resistor to the center leg of the transistor. Next, connect the top leg of the transistor to the negative side of the diode.

3. Next, bend the extending pins into makeshift loops and solder the two connections made in the previous step.

40


4. Using the hole punch, make some holes in the piece of card stock to attach the components to. The button will be located on the bottom left corner of the card stock.

5. To attach the snaps, make four holes in a close circle. The snaps allow you to disconnect the motor and Lilypad from the rest of the project. Attach the snaps using the conductive thread and wind it around the snap itself as well as the connection that you are making.

6. Start by sewing on the snap to connect the resistor to the Negative (-) tab on the Arduino.

41


7. Make the connection from the button to the Positive (+) tab and the digital tab 3 on the Arduino. After sewing the connections, use a small amount of fabric glue to secure the ends of the conductive thread.

8. Now the connections to the motor controller can be made. To measure out the space needed for the holes of the motor controller, place it on the card stock and put a small pencil dot in the center of each loop you created in step 3. Use the hole punch to create holes where the pencil dots are located. To make the connection between the snap and the motor controller, twist the ends of some wire into loops and then sew the loops (using the conductive threat) to the backs of the female snaps. Thread the wires through the holes that were just made before sewing the snaps onto the card stock.

42


9. To make the last connection, attach the emitter of the transistor to the (-) tab. Solder the wire overlapping itself after looping it through the conductive thread.

10. Wrap a few wire connections around the tabs on the LilyPad (+, -, 3 and 9) and measure the distance from them to the snaps on the card stock. On the (+) tab, sew on a male snap connector that will be used with the female snap connector that was previously attached to the wire in step 8.

43


11. To complete the circuitry, attack the rest of the female snaps to the remaining wires and connect them to the male snaps located on the card stock. 12. To attach the pinwheel to the stem of the motor, take a portion of the wooden pinwheel base and glue it to an unused part of a servo motor. Construct a cardboard mount to stabilize the motor and make it easier to attach snaps to the positive and negative terminals of the motor. Attach wires from the motor and wrap them around the male snaps. Use epoxy glue to ensure that everything securely into place, creating a snapable pinwheel.

44


13. The polarity of the motor does not matter. Attaching the power to the negative side simply reverses the direction that the pinwheel will spin. This is another good reason for the snap design. If it does not spin the way that you wanted, simply unsnap it and turn it around.

14. Finally, attach the battery by connecting it to the motor. 15. Enjoy your newly created Bling!!

45


Try These Tutorials to Further Your Skills with Arduino DIT

Reverse Geocache Box

Turn Signal Biking Jacket

http://arduiniana.org/projects/the-reverse-geocache-puzzle/

http://www.instructables.com/id/turn-signalbiking-jacket/

Automatic Cat Laser

http://www.instructables.com/id/CatBot-Automated-Cat-Laser/

46


Preparing Your Coding and Microprocessor DIY Workshop

The following detailed list outlines various tools and components useful for the projects mentioned in this guide and other projects that come to mind. Specific notes are included on why these tools and components are important. Products marked with an asterisk (*) are considered to be essential or “bare minimum�. Links to suggested suppliers are also included for these tools and components.

47


Tool Soldering Station

Solder

Solder Vacuum

Workbench Power Supply Station

Product

Notes

Hakko Soldering Station

Quality soldering station. Best for a permanent workbench. Consider this iron if you have some experience with DIY electronics and are looking for a reliable station for your workspace

Handheld Soldering Iron Soldering Iron Stand

Good for cheap startup if keep costs down is important. The soldering iron stand is important to prevent accidental fires or burns.

Solder Stand with Solder Roll Holder

This is a mid-level choice for a soldering station. The Solder Roll Holder helps to keep your roll of solder neat and tidy.

Third Hand

This device is an alternative to the soldering stand and includes extremely helpful clips to hold your work which you solder.

Leaded Solder

Leaded solder is dangerous when inhaled, but with proper ventilation the effects can be avoided. A full description and comparison of solder types can be found at: https:// learn.sparkfun.com/tutorials/how-to-solder---through-holesoldering/what-is-solder

Unleaded Solder

See above

Solder Vacuum

Solder vacuums are used to remove solder in an area it is undesired.

Solder Wick

Solder wick is placed on top of unwanted solder and heated to absorb it, removing it from the joint.

3CH 24V 2A Adjustable Power Supply

This power supply allows multiple users as it has 3output channels.

Note: A power supply is not necessary for most Arduino related projects. The Arduino can powered through the USB port on your computer while the coding is being uploaded to the microprocessor. A small battery pack can be used for stand-alone purposes.

48


Tool Pliers

Product

Notes

Needle Nose Pliers

Useful for bending component leads, placing parts for soldering, picking up sensitive components and more.

3 Piece Pliers Set

Though a bit more expensive, having a set of three pliers with different noses can be very useful.

Note: Pliers that are spring loaded are easier to work with than those that aren’t.

Heat Gun

Heaterizer

This heat gun is small and heats quickly. Useful for heatshrink, melting solder, and other general heating needs.

Wire Strippers

Wire Strippers

Wire strippers are used to remove some of the inductive shielding from hookup wire. These also possess small sheers near the base, perfect for cutting wire when needed.

Wire

Hook-up Wire Spool Set

This set contains 6 spools of 25ft wire in all the colors. The wire is solid core.

Hook-up Stranded Wire

Stranded wire is useful if the wire may be under stress or bending. Also useful for solder joints where wrapping the wire is ideal. (Eg. around small pins)

Heat Shrink

Heat Shrink Kit

A sample kit can contain up to 100 pieces each 10cm long. Each piece can be cut into several pieces depending on which joints need to be covered.

Cutters

Super Scissors

These scissors are like regular scissors except super heavy duty and include serrated shears near the base. Primary uses include cutting apart salvaged PCB, large gauge wire.

Flush Cutters

Extremely useful for cutting in a tight area, such as removing extra bits of wire after soldering, trimming header pins, and more. A definite must-have for any workshop.

49


Tool Storage

Product

Notes

30 Drawer Cabinet 21 Component Storage Box 60 Drawer Plastic Parts Cabinet Compartment boxes and cabinets are useful for storing small components. Tool storage can be anything from buckets to large cabinet drawers depending on the tool and how much space one has. Any storage method is acceptable, so long as you keep organized don’t worry about buying expensive shelving/drawers.

Multimeter

Breadboards

Connectors

Mastercraft Digital Multimeter

Available at Canadian Tire

LCD Digital Multimeter

A cheap reliable multimeter

Full Size Breadboard

Very useful for large circuits, OP amps, arrays, etc.

Mini Breadboard

Ideal for minimalistic projects using full components

Prototyping Breadboards 10-pack

Used for creating and testing various electrical circuits.

65 pack jumper wires

Used for breadboard connections

Alligator Connectors

Useful for testing connections and prototyping with the Lilypad Arduino

If money is tight, jumper wires can be made from regular hookup wire. The main benefit of jumper wires is the sturdy “plug” style of the hard wire end

Passive Components

TH Ceramic Capacitors (180 pc)

180 through hole capacitor kit

Joe Knows Capacitor Kit

645 through hole capacitor kit

Joe Knows Semiconductor Kit

2320 through hole semiconductors

SMD Resistor/Capacitor Assortment

2475 surface mount resistor and capacitor set. These components are used when soldering to PCB.

Through hole capacitors and resistors are the type you will be using with a prototyping or bread board. 50


Suppliers Supplier

Pros

Cons

DX.Com www.dx.com

Large selection. Often has special deals. Very cheap. Typically free international shipping.

Product information is limited. Schematics are not included. Quality can occasionally be poor. Occasionally long shipping times.

eBay.com www.ebay.com

Can be a cheap alternative for electrical components. Provides seller “Top Rated Seller� icon that gives you a strong indication that the product can be trusted and customer reviews and number of products sold can give you a good idea of what to expect.

Long shipping times from China. Fast times from USA but much more expensive. Extra shipping charges are sometimes applied upon entering the country, especially from the US, or on large orders.

Sparkfun.com www.sparkfun.com

Reliable. Provides lots of product information and fast shipping times. Customer support is very good.

Expensive in comparison to DX.com and eBay.com

Digikey.com www.digikey.com

Great option for intensive DIY seekers. Schematic and product information included. Fast shipping time. Canadian company (buying local helps everyone!). Great options for kits, very useful when starting a personal (or classroom) workshop.

If one or more of your items is on backorder they may send multiple packages and charge extra shipping each time. Typically more expensive than DX.com or eBay.com.

Hobbyking.com Hobbyking carries a large variety of parts www.hobbyking.com for RC enthusiasts with minimal DIY components.

Often extra shipping charges upon arrival, particularly on large packages. Regular shipping can take a long time, up to a month or longer. If the product you want is not in stock, find something else.

Allied Electronics Comparable to Digikey with very fast US company. Micro-controllers are more ca-en.alliedelec.com shipping times, many product options and expensive and have less variety in stock extensive product information. Trustworthy compared to Sparkfun. supplier. 51


© lii


Innovative Learning Centre innovativelearningcentre.ca 1137 Alumni Avenue Faculty of Education University of British Columbia Okanagan ViV 1V7

Type to enter text

liii

Coding and Microcontrollers in Design Thinking  

DIY Guidebook This guidebook will introduce you to the world of simple microprocessors and coding. The examples described throughout the g...

Read more
Read more
Similar to
Popular now
Just for you