1 of 98

1

Parallax Inventing Kit Series

Young inventors can add real electronics to their creations.

One-day whirlwind introduction for teachers

2 of 98

2

Products

Inventions

Electronics Common to Both Products and Inventions

Processor

Indicators

Sensors

Actuators

Displays

3 of 98

3

Indicators

Sensors

Actuator

Display

Processor

Lights

Speaker

Servo

7 Segment�

Angle

Press

Light

Tilt

4 of 98

4

For Circuits

Capacitors

Jumper wires

Resistors

Connectors

Battery holder

Power

Jack

Breadboard

USB cable

Quick reference�card

Also in Your Kit

3-Pin �Header

5 of 98

5

Processor and Programming Language

6 of 98

6

Activity: Hardware Setup

After this activity, your system should resemble the one shown here.

We’ll want to make sure the labeling is right-side-up and readable on both the blue FLiP module and white prototyping “breadboard”.

7 of 98

7

(2) Make sure the text is right-side up!

(4) Make sure FLiP’s P15 pin is in the breadboard’s d30 socket.

(1) Place your breadboard and FLiP on the table.

(5) Press down firmly with both thumbs so that FLiP pins sink all the way in.

Breadboard

FLiP

(3) Make sure all the pins are in holes in the d and h columns

Insert Propeller FLiP into Breadboard

8 of 98

8

(1) Connect the USB cable’s A end to your Laptop

(2) Connect the USB cable’s micro-B end to the Propeller FLiP Module

Connect FLiP to laptop with USB cable

9 of 98

9

Activity: Get Ready to Program

This activity will walk you through those steps for a project named Light On.

At the beginning of a programming session:

  • Run and minimize the BlocklyProp Client/Launcher
  • Open a Chrome Browser and go to solo.parallax.com
  • Start or open a project

10 of 98

10

Run the BlocklyProp Client/Launcher

If you have not already downloaded and installed the BlocklyProp Client/Launcher, go to this address and get started.

http://blockly.parallax.com/blockly/public/clientdownload

11 of 98

11

BlocklyProp Client/Launcher - Connect and Minimize

Windows/Mac: Click Connect

All OS: Minimize

12 of 98

12

Create a Project

solo.parallax.com

Light On project

See next slide for step-by-step clip

13 of 98

13

Create a Project

Click New Project.

Enter the project name, set the board type to Propeller FLiP..., and optionally, add a description.

Click Continue to get to the Blockly Editor

14 of 98

14

Activity: System Test

See next slide for step-by-step clip

15 of 98

15

Program: Light On

Click the Pin states category

Click the Make PIN 0 high block to place it on the canvas

Set the PIN dropdown to 26

Click Save and confirm the filename

Click the green Load & Run (Save code in EEPROM) button

16 of 98

16

Programs for processors in inventions typically do six key tasks:

  1. Communicate
  2. Remember
  3. Calculate
  4. Decide
  5. Repeat
  6. Count

Activity: BlocklyProp Basics

17 of 98

17

3 Programs

Step-by-step clip on next slide

Remember

Calculate

Communicate

18 of 98

18

Programs:

Communicate Remember Calculate

Step-by-step clip

As you watch, make a note of how a new variable is created, and then it becomes an option in any existing variable dropdown.

19 of 98

19

Programs

Step-by-step clip on next slide

Decide, Repeat, Count

20 of 98

20

Program:

Decide, Repeat, Count

Step-by-step clip

As you watch, make a note of how to click the if block’s configure gear to make it an if...else block.

21 of 98

21

Program

Step-by-step clip on next slide

Password for Liftoff

22 of 98

22

Program:

Password for Liftoff

Step-by-step clip

Comparing text uses a block that’s different from the one you used for comparing numbers..

23 of 98

23

Click Home for:

  • New Project
  • Open Project

Load & Run is almost always better than Run Once.

If program doesn’t load, check the Connection & Status.

Click Save frequently!

The Menu Button is also called the “Hamburger Menu”.

Try the Code/Block View Toggle to go between Block and C code.

BlocklyProp Editor

24 of 98

24

Activity: Prototyping Area

This activity will guide you through making your setup like this picture.

ALWAYS DISCONNECT:

  • USB
  • Battery pack

...before adding or making changes to wiring or circuits.�REMEMBER: Reconnect USB before loading a program

After connecting USB, ALWAYS CHECK:

  • 5-9V light green
  • Fault light off

Disconnect USB/Batteries immediately if no 5-9V or fault light is on.

25 of 98

25

Inside the Breadboard

26 of 98

26

The Breadboard

(Test Yourself)

Two or more wires in the same row of 5 are connected.

Two or more wires in the same column by a colored stripe are connected

You can use a jumper to connect rows of 5 to each other, or even to a given column with a stripe.

27 of 98

27

Set up Easy �Access to GND

  • Disconnect USB.
  • Use black wires.
  • Verify that the FLiP GND connection is on row 22
  • Right breadboard: j-22 to socket in rightmost BLUE column
  • Connect sockets in BLUE columns as shown along the top
  • Double check your connections!

28 of 98

28

System Check

  • Reconnect USB
  • Be ready to disconnect USB if anything does not match the signs of life shown here.
    • P26 on (only if Light On running)
    • 5-9 V light on
    • Fault light off
  • Reconnect USB and check for signs of life.
  • If any don’t match, disconnect USB immediately and look for wiring mistakes.
  • If all 3 indicators match the picture, continue to the next step.

on?

29 of 98

29

  • Disconnect USB.
  • Use red wires.
  • Right breadboard: j-19 to a socket by the RED column
  • Connect sockets in RED columns as shown along the top
  • Double check your connections!

Set up Easy �Access to 3.3 V

30 of 98

30

System Check (again)

  • Reconnect USB
  • Be ready to disconnect USB if anything does not match the signs of life shown here.
    • P26 on (only if Light On running)
    • 5-9 V light on
    • Fault light off
  • Reconnect USB and check for signs of life.
  • If any don’t match, disconnect USB immediately and look for wiring mistakes.
  • If all 3 indicators match the picture, continue to the next step.

on?

31 of 98

31

Build and test an LED indicator light

Write BlocklyProp programs to control its on/off behavior

Activity: Build Your Own Light

32 of 98

32

New Part: LED

  • An LED is like a one-way valve for electric current.
  • If you plug it in backward, it won’t let current through (and won't emit light either)
  • That’s why it’s important to know your + and - terminals
  • This image is from the card in your kit
  • The longer pin is + (anode)
  • The shorter pin is - (cathode)
  • The cathode pin is also closest to the flat spot on the edge of the LED’s plastic case

33 of 98

33

Build your light circuit�Connect LED

  • Disconnect USB
  • Connect the shorter ( - ) anode pin to a socket in the vertical blue column
  • Connect the longer ( + ) cathode pin to b-9 socket

34 of 98

34

New Part: Resistor

  • A resistor “resists” the flow of electric current
  • Resistors with larger values resist current more strongly
  • The color bands indicate the resistors value
  • Each band’s color corresponds to a number.
  • The left two bands are two digits in the resistor’s value.
  • The 3rd band is the number of zeros to append value digits
  • The last band is the % tolerance
  • LEDs are polar, resistors are not

35 of 98

35

Build Your Light Circuit

Connect resistor & test

  • Get a 220 Ω (red-red-brown) resistor
  • Connect one end to d-9 on the left breadboard.
  • Connect the other end to a socket in the RED power column.
  • Reconnect USB.
  • System Check.
  • Verify that the LED light is ON.

36 of 98

36

Current: Flow of electrons through a circuit. Yes, current flows from + to - even though the electrons flow from - to +.

Voltage: Electrical pressure from battery + to - that results in current when a circuit is complete.

Resistance: The part of a circuit that slows the flow of current in a complete circuit.

How it Works: Electricity & Circuits

37 of 98

37

Change your light circuit -

connect to P2

  • Disconnect USB
  • Disconnect resistor lead that’s in the RED power socket.
  • Connect to a-13 on the right breadboard.
  • Reconnect USB.
  • System Check.
  • The LED circuit you just built will not emit light until you program it to do so...

38 of 98

38

Program: Blink

See next slide for step-by-step clip

The clip on the next slide will walk you through:

  • Changing the project name from Light On to Blink
  • Finding, placing, configuring and connecting the blocks
  • Saving your work
  • Loading the program into the Flip with the Load & Run button.

39 of 98

39

Program:

Blink

step-by-step clip

40 of 98

40

How it Works: Circuit

P0...P31 are I/O pins.

I/O stands for input/output.

make PIN 2 high/low sets P2 to output.

As an output:

  • make PIN 2 high connects 3.3 V to the circuit (light on).
  • make PIN 2 low connects GND (0 V) to the circuit (light off).

The P26...P31 pins have white markings that to indicate special functions in the FLiP module. For more info, get the product doc from the Downloads & Documentation dropdown at �parallax.com/product/32123

You can press the tiny RESET button under top edge to restart the last (Load & Run) program from the beginning.

41 of 98

41

How it Works: Blink Code

  • Enter the repeat forever block’s container
  • Make PIN 2 high (light on)
  • Pause 200 ms
  • Make PIN 2 low (light off)
  • Pause 200 ms
  • Go back to the first block in the repeat forever containter
  • Make PIN 2 high
  • Pause 1000 ms
  • Make PIN 2 low
  • Go back...

Units of pause (ms) are milliseconds.

One ms is one-one-thousandth of a second

42 of 98

42

Tips

See how the color of each block matches the tab next to its block category?

Where to Find blocks

Right-click a block and select Help

Help with Blocks

BlocklyProp block reference

BlocklyProp Tutorials & Projects

43 of 98

43

Activity: Device Tones and Beeps

A series of high/low signals to a light can be too rapid for the eye to detect with.

What do you think what would happen if when a speaker is connected to it instead?

This is another example where the I/O pin is used as an output.

Notes:

Volume not adjustable

High pitched tones may be less audible with age

44 of 98

44

New Part: Piezospeaker

Plug the piezospeaker into the breadboard

  • ( + ) pin into f-15
  • ( - ) pin terminal into e-15.

45 of 98

45

Circuit: Speaker

Connect wires to complete the circuit:

  • P4 to Piezospeaker’s ( + ) pin
    • In picture: left breadboard i-15 to right breadboard a-15
  • Piezospeaker ( - ) pin to GND
    • In picture: left breadboard b15 to leftmost blue column

46 of 98

46

Program: Beep!

See next slide for step-by-step clip

The frequency block is in the Audio/Frequency Out category.

The Terminal print text block is in the Communicate category

When you run the program, a the Terminal will cover your page. Click Close to get back.

47 of 98

47

Program

Beep!

Step-by-step

clip

48 of 98

48

The Terminal print text blocks show messages of what frequency tone is playing

Each tone lasts a second since its duration (ms) is 1000

There is also a 1000 ms pause between each tone, so they are separated by 1 second.

How it Works: Code

49 of 98

49

How it works

A piezoelectric element is flat with no voltage, but bends when voltage is applied.

High/low signals like the blinking light, but at hundreds or thousands of reps per second cause it to vibrate, much like a string in a musical instrument.

Hertz (Hz) is a repetition per second.

Kilohertz (kHz) is thousands of reps per second

50 of 98

50

Musical Notes

Note x 2 is note in higher octave. Note / 2 is note in lower octave.

Example: C6 = 1046.5, C6 x 2 = 2093.0 = C7

51 of 98

51

Sound Effects

Down routine playse plays 600 tones: 4000 Hz, 3995 Hz, 3990 Hz … 1010 Hz, 1005 Hz, 1000 Hz.

repeat item… is in the control block category

item is the name of a variable

A variable can store a value

Repeat item from 4000 thru 1000 by -5 changes the value of item to 4000, then 3995, then 3990, and so on down to 1000.

The repeat block runs any blocks in its container for each value of item.

See how item is also in the frequency block’s frequency (Hz)

input?

52 of 98

52

Activity: Sense Presses with a Pushbutton

The I in I/O pin stands for Input.

As an input, an I/O pin can sense a high or low signal in a circuit.

As an input, the I/O pin has no effect on the circuit. The circuit will behave the same regardless of whether it is connected to the I/O pin

In this activity:

  • Detect if a button is pressed by sensing high/low signals in a circuit
  • Use that info to decide whether or not to blink a light?

53 of 98

53

Pushbutton �Circuit�Parts

54 of 98

54

Pushbutton Sensor �Circuit

IMPORTANT: Make sure to orient the pushbutton with legs sticking out of the case to the left and right.

55 of 98

55

Test Button State (after loading & running next program)

56 of 98

56

Program: Check Pushbutton P11

See next slide for step-by-step clip

57 of 98

57

Program: Check Pushbutton P11

Step-by-step Clip

58 of 98

58

Inside the Pushbutton

Since 1 and 4 are the same piece of wire, all of row 24 is a common connection. Same with 26.

Not pressed: P11 senses 0 V (GND) through the 10k resistor.

Pressed: P11 senses 3.3 V through the pushbutton.

59 of 98

59

How it Works

Pin input:

The circuit is not affected by the I/O pin in any way

The pin senses: � 0 V as 0� 3.3 V as 1

Check PIN 11 sends that 1/0 value to the Terminal print number block’s input

60 of 98

60

App: Pushbutton Controlled Light

See next slide for step-by-step clip

Light on while button pressed and held

61 of 98

61

Program: Pushbutton Controlled Light

Step-by-step clip

Note how the if block’s settings gear is clicked

Also note the steps for changing the shape of the if block to an if...else… block

62 of 98

62

App: Pushbutton Controlled Blink

See next slide for step-by-step clip

Light blinks while button pressed and held

63 of 98

63

Program: Pushbutton Controlled Blink

Step-by-step clip

Note how the if...else block turns the light on or off, and is followed by the other light blinking blocks (pause, low, pause again).

64 of 98

64

Activity: Sensors to Measure Light, Angle, and More

Pushbuttons only have two states: pressed / not pressed.

Other sensors measure how much (light, rotation, etc.)

Those “how much” input values can be used in microcontroller apps to control output values, like speaker tone, blink rate, and more...

65 of 98

65

New Part:

  • A capacitor is like a tiny rechargeable battery for circuits
  • A capacitor has “capacity” to store electric charge
  • Measured in farads (F)
  • The ones we are using are measured in fractions of millionths of farads or microfarads (µF)
  • The one marked 104 has 10 times the capacity of the on marked 103
  • For nerds: �The 103 marking is 10 and add 3 zeros for 10,000. That’s the number of picofarads or trillionths of a farad. �10x103 x 1x10-12 = 0.01 x 10-6 = 0.01 µF

66 of 98

66

Build Charge/Discharge Circuit

Parts

(1) Resistor 220 Ω (red-red-brown)

(1) Capacitor 0.01 µF (103)

(1) Jumper wire (black)

Schematic

0.01

67 of 98

67

New Part: Turn Angle Sensor (Potentiometer)

The knob adjusts the point of wiper contact on the resistive element over about 270°.

Less counterclockwise, less resistance W to B

More counterclockwise, more resistance W to B

68 of 98

68

Circuit: Add Turn Angle Sensor

Parts

(1) Potentiometer

Schematic

Note

B terminal to d-22, W terminal to f-21

0.01

69 of 98

69

Test Angle Sensor

Twist gently to find limits.

Record (relative) angle values for the counterclockwise and clockwise limits.

See next slide for step-by-step clip

70 of 98

70

Program:

Test Angle Sensor

Step-by-step clip

See how the New variable button is used to create the angle variable?

When you create the angle variable, it appears in the list.

71 of 98

71

How it works

The make PIN high block supplies the circuit with 3.3 V.

Thinking of our capacitor like a battery, the pause (ms) 1 block gives our capacitor enough time to charge.

The RC time block changes P9 to input. As far as the circuit is concerned, 3.3 V disappeared.

The RC time block measures how long it takes the capacitor to drain to about half its voltage. (Depends on W-B resistance)

The angle variable gets the result.

72 of 98

72

Program: Give RC Time Result to Variable

73 of 98

73

New Part: Light Sensor (Phototransistor)

The phototransistor has three terminals:

Collector (C) longer pin

Base (B) light input through top

Emitter (E) shorter pin and flat spot on plastic case.

Light controls the amount of current the phototransistor conducts into C and out E.

74 of 98

74

Circuit: Temporarily Replace Angle Sensor with Light Sensor

Parts

(1) Phototransistor

Schematic

Note

C pin to f-21, E pin to d-22

75 of 98

75

Test Light Sensor

Try pointing the light collecting face at different light sources.

Also cast shade over it.

Your shade values will probably be smaller.

Click the angle dropdown in the angle = block, and select Rename variable. Change it to light. Also change the angle = in the Terminal print text block.

76 of 98

76

App: Angle to Tone

This app will control tone with adjustments to angle knob.

Schematic

0.01

77 of 98

77

Program: Angle to Tone

See next slide for step-by-step clip

IMPORTANT

If you experiment with short tones and pauses, make sure to: right-click Terminal print and Disable it

78 of 98

78

Program: Angle to Tone

Step-by-step clip

When you add a variable, the block that reports its value is added to the block list.

The block that assigns values to variables only shows one variable. You have to use the dropdown to get the other variable name.

79 of 98

79

App: Button Angle to Tone

Control tone with adjustments to angle knob, but only while you hold down the pushbutton!

80 of 98

80

80

Program: Button Angle to Tone

See next slide for step-by-step clip

IMPORTANT

If you experiment with short tones and pauses, make sure to: right-click Terminal print and Disable it

81 of 98

81

81

Program:

Button Angle to Tone

Step-by-step clip

82 of 98

82

Activity: Motion Control with a Servo

A hobby servo turns to and holds certain angles.

The Parallax Standard Servo has a 180° range of motion.

Servo angle blocks make the FLiP tell the servo what angle to turn to and hold.

Values from sensors can be used to decide what angle to make the servo hold.

83 of 98

83

Parts: Battery Supply

84 of 98

84

Connect Battery Power Circuit

Insert the barrel jack into the breadboard.

The pin sticking out of the back of the jack should be in e-3

The pin in the middle of the barrel jack goes in e-1.

The pin on the side of the barrel jack goes in c2.

Black wire: b-1 to socket by blue stripe in power strip.

Red wire: b-3 to b-22.

85 of 98

85

Test Battery Power

Check after each step to make sure the indicators are okay (5-9 V on, fault light off). If the fault light comes on or the PWR light turns off, disconnect battery/USB immediately.

86 of 98

86

Servo and Circuit Parts

A standard servo turns to and holds positions. Applications:

  • Remote controlled airplanes, cars, etc.
  • Theater props
  • Moving Halloween decorations

Your program will send the servo a rapid high/low pattern with timed highs to control its position.

87 of 98

87

Circuit: Servo Connections

Red wire: c-3 to f-6.

Black wire: i-5 to socket by blue stripe in power strip.

3-pin header: h-5, h-6, & h-7

10 kΩ resistor: b-11 to f-7

Important:

  • Double check your work.
  • Repeat the USB + battery power test (5-9V on, Fault off)

88 of 98

Connect the Servo

88

Disconnect battery power and USB.

Make sure the cable’s colored wires from top to bottom are black, red, white.

Double check:

  • Black in h-5
  • Red in h-6
  • White h-7

As you reconnect battery and USB power, be ready to disconnect if the 5-9 light goes out or the fault light turns on.

89 of 98

89

Servo Angle Control

Servo PIN...set angle… blocks make the servo turn its 4-point star shaped horn to (and hold) certain angles. To get it just like the picture, you might have to test, then remove the screw that holds the horn to the output shaft. Pull off the output shaft, adjust, then push back on and re-tighten screw.

90 of 98

90

Servo Angle Control

The Servo blocks are in the servo block category.

At each angle, the servo turns to and holds that angle. That’s 2 seconds in each position for this program.

If you try to gently twist the horn away from a given angle, it will firmly resist.

After 2 seconds at 180°, the servo PIN disable block stops sending control signals to the servo. At that point, you will be able to gently turn it away from 180°.

91 of 98

91

App: Angle Sensor Servo Control

This app monitors the angle sensor, and updates the servo’s relative to the angle sensor measurement.

92 of 98

92

Code: Angle Sensor Servo Control

If your min and max angle_in values were different from 0 and 66, update the map block’s input range accordingly. (This was the test from slide 62.)

93 of 98

Activity:

Multicore - Each Task at Its Own Pace

Program:

Multicore - Terminal Independent Blink Rates

94 of 98

Notes:

Import project using Append to add code from another project

Program: Multicore - Terminal Independent Blink Rates

Step-by-step clip

95 of 98

Curriculum

95

In-progress after two pilot programs

  • Tim (at course)
  • Jennifer (CA)

Example of curricula for other Parallax Line:

  • learn.parallax.com/educators
    • learn.parallax.com/educators/resource/activitybot-resources

96 of 98

Extra Activities

96

If you prefer to multitask at courses like this, here’s some extra material to work on from learn.parallax.com/tutorials/language/blocklyprop

There are also some extra examples in the Code - Extras folder

97 of 98

97

Questions/Answers & Resources

Emails: education@parallax.comsupport@parallax.com

Store: www.parallax.com �Check the Downloads & Docs and Additional Resources sections for any given product.

Education Resources: learn.parallax.com

Parallax Inc.

599 Menlo Drive, Ste 100

Rocklin, CA 95765

www.parallax.com

learn.parallax.com

Main: (916) 624-8333

facebook.com/groups/blockly

facebook.com/ParallaxInc

youtube.com/parallaxinc

instagram.com/parallaxinc

pinterest.com/parallaxinc/

linkedin.com/company/parallax/

twitter.com/parallaxinc

98 of 98

98

Intern Projects

Lock Box �(Base + Security Kits)

Music Box �(Base + Mechanical Kits)

Bullseye Game �(Base Kit)

FlossBot �(Base + 2 standard servos)

Cat Feeder �(Base Kit)

Lock Box �(Base + Security Kits)