1
Parallax Inventing Kit Series
Young inventors can add real electronics to their creations.
One-day whirlwind introduction for teachers
2
Products
Inventions
Electronics Common to Both Products and Inventions
Processor
Indicators
Sensors
Actuators
Displays
3
Indicators
Sensors
Actuator
Display
Processor
Lights
Speaker
Servo
7 Segment�
Angle
Press
Light
Tilt
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
Processor and Programming Language
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
(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
(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
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:
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.
11
BlocklyProp Client/Launcher - Connect and Minimize
Windows/Mac: Click Connect
All OS: Minimize
12
Create a Project
solo.parallax.com
Light On project
See next slide for step-by-step clip
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
Activity: System Test
See next slide for step-by-step clip
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
Programs for processors in inventions typically do six key tasks:
Activity: BlocklyProp Basics
17
3 Programs
Step-by-step clip on next slide
Remember
Calculate
Communicate
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
Programs
Step-by-step clip on next slide
Decide, Repeat, Count
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
Program
Step-by-step clip on next slide
Password for Liftoff
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
Click Home for:
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
Activity: Prototyping Area
This activity will guide you through making your setup like this picture.
ALWAYS DISCONNECT:
...before adding or making changes to wiring or circuits.�REMEMBER: Reconnect USB before loading a program
After connecting USB, ALWAYS CHECK:
Disconnect USB/Batteries immediately if no 5-9V or fault light is on.
25
Inside the Breadboard
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
Set up Easy �Access to GND
28
System Check
on?
29
Set up Easy �Access to 3.3 V
30
System Check (again)
on?
31
Build and test an LED indicator light
Write BlocklyProp programs to control its on/off behavior
Activity: Build Your Own Light
32
New Part: LED
33
Build your light circuit�Connect LED
34
New Part: Resistor
35
Build Your Light Circuit
Connect resistor & test
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
Change your light circuit -
connect to P2
38
Program: Blink
See next slide for step-by-step clip
The clip on the next slide will walk you through:
39
Program:
Blink
step-by-step clip
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:
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
How it Works: Blink Code
Units of pause (ms) are milliseconds.
One ms is one-one-thousandth of a second
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
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
New Part: Piezospeaker
Plug the piezospeaker into the breadboard
45
Circuit: Speaker
Connect wires to complete the circuit:
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
Program
Beep!
Step-by-step
clip
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
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
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
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
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:
53
Pushbutton �Circuit�Parts
54
Pushbutton Sensor �Circuit
IMPORTANT: Make sure to orient the pushbutton with legs sticking out of the case to the left and right.
55
Test Button State (after loading & running next program)
56
Program: Check Pushbutton P11
See next slide for step-by-step clip
57
Program: Check Pushbutton P11
Step-by-step Clip
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
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
App: Pushbutton Controlled Light
See next slide for step-by-step clip
Light on while button pressed and held
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
App: Pushbutton Controlled Blink
See next slide for step-by-step clip
Light blinks while button pressed and held
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
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
New Part:
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
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
Circuit: Add Turn Angle Sensor
Parts
(1) Potentiometer
Schematic
Note
B terminal to d-22, W terminal to f-21
0.01
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
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
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
Program: Give RC Time Result to Variable
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
Circuit: Temporarily Replace Angle Sensor with Light Sensor
Parts
(1) Phototransistor
Schematic
Note
C pin to f-21, E pin to d-22
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
App: Angle to Tone
This app will control tone with adjustments to angle knob.
Schematic
0.01
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
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
App: Button Angle to Tone
Control tone with adjustments to angle knob, but only while you hold down the pushbutton!
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
81
Program:
Button Angle to Tone
Step-by-step clip
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
Parts: Battery Supply
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
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
Servo and Circuit Parts
A standard servo turns to and holds positions. Applications:
Your program will send the servo a rapid high/low pattern with timed highs to control its position.
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:
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:
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
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
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
App: Angle Sensor Servo Control
This app monitors the angle sensor, and updates the servo’s relative to the angle sensor measurement.
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.)
Activity:
Multicore - Each Task at Its Own Pace
Program:
Multicore - Terminal Independent Blink Rates
Notes:
Import project using Append to add code from another project
Program: Multicore - Terminal Independent Blink Rates
Step-by-step clip
Curriculum
95
In-progress after two pilot programs
Example of curricula for other Parallax Line:
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
Questions/Answers & Resources
Emails: education@parallax.com� support@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
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)