This document provides an overview of electronics and coding workshops conducted by Cassiopeia Ltd in 2016. It covers topics like robots, sensors, Arduino, breadboards, LEDs, buttons, displays, games, colors, sound, radio, communication and more. Circuit diagrams and code examples are provided for projects involving sensors, inputs, outputs and microcontrollers. The document serves as a reference guide for makers and coders learning electronics and programming.
9. Cassiopeia Ltd 2016
hit minus game
● connect the 2 LEDs and resistors
● connect the potentiometer
● connect the buzzer
● connect the button
● connect the 7 segment display
power from a USB powerbank
or
put your battery wires into the breadboard
10. Cassiopeia Ltd 2016
hit minus game
D4 means
digital pin 4 on Arduino
A0 means
analog input 0 on Arduino
GND is ground = 0V
16. Cassiopeia Ltd 2016
Speed of sound
Speed of sound =
343 meter per second (m/s)
through air
Speed of light =
300,000,000 m/s
1 million times faster than sound
17. Cassiopeia Ltd 2016
Ultrasound distance sensor
● send out ultrasound pulse 40,000 Hertz
● measure time it takes for reflection to arrive back (echo)
● calculate distance from this time measurement (speed of sound)
18. Cassiopeia Ltd 2016
OLED screen
each pixel = LED
128 x 64 pixels
fragile!
colour screen =
each pixel is 3 LEDs (RGB)
21. Cassiopeia Ltd 2016
potentiometer = variable resistor
create analog value: between 0 and 5V
3 legs:
0 and 5V on outside legs
variable voltage on middle leg
22. Cassiopeia Ltd 2016
joystick = 2 potentiometers
joystick is 2 potentiometers on 1 stick:
horizontal and vertical, x and y
2 variable voltages, VRx and VRy
25. Cassiopeia Ltd 2016
every object is a source of (mostly invisible) heat radiation
special camera
thermal imaging
26. Cassiopeia Ltd 2016
Infrared motion sensor (PIR)
● looking for infrared waves = heat
● needs a few seconds to ‘warm up’
● when it detects a change in infrared radiation > signal ON
32. Cassiopeia Ltd 2016
Radio module
nRF24 = 2.4GHz transceiver
T = transmit
R = receive
Crystal
Antenna
33. Cassiopeia Ltd 2016
Aviation navigation with Morse radio beacons
Radio towers at known locations send out Morse signals
Non-Directional Beacons (NDB) 190-1750 kHz
34. Cassiopeia Ltd 2016
Morse decoder with radio
Connect the 7 wires on the radio to the Arduino
Be careful to use 3.3V, not 5V!
R= receive
T = transmit
35. Cassiopeia Ltd 2016
Scratch for Arduino s4a.cat
control the Arduino from
Scratch
note: special program
needs to be uploaded to
the Arduino to make this
work
37. Cassiopeia Ltd 2016
Scratch for Arduino - traffic light
3x LED and resistor
red: D10
yellow: D11
green: D12
now try this:
38. Cassiopeia Ltd 2016
Scratch for Arduino - joystick plotter
POSITION = joystick:
5V, GND, A0, A1
PEN SIZE & COLOUR =
2x potentiometer:
5V, GND, middle: A2 and A3
CLEAR = button:
5V and D2
39. Cassiopeia Ltd 2016
Scratch for Arduino - joystick plotter
POSITION = joystick:
5V, GND, A0, A1
PEN SIZE & COLOUR =
2x potentiometer:
5V, GND, middle: A2 and A3
CLEAR = button:
5V and D2 with pull-down
resistor
40. Cassiopeia Ltd 2016
Scratch for Arduino - joystick position (analog input)
POSITION = joystick:
5V, GND, A0, A1
Arduino analog range (blue)
0 to 1023
Scratch screen range:
X = -250 to 250
Y = -200 to 200
Y
X
41. Cassiopeia Ltd 2016
Scratch for Arduino - analog ranges
Arduino analog signal: always 0 to 1023
Scratch screen:
X = -250 to 250 (analog / 2) - 250
Y = -200 to 200 (analog / 3) - 170
Pen colour: 0 to 200 analog / 5
Pen size: 0 to 255 analog / 4 (but divide by 20 otherwise too thick)
42. Cassiopeia Ltd 2016
Scratch for Arduino - digital input to Arduino (motion)
digital =
ON or OFF
1 or 0
true or false
PIR motion sensor on D2
5V and GND
LED with resistor on D10
43. Cassiopeia Ltd 2016
Scratch for Arduino - digital input to Arduino (button)
button for D3 and 5V
ON or OFF, true or false
connect D3 also to resistor to GND
otherwise we cannot be sure what
happens when button is not pressed
= PULL DOWN RESISTOR
44. Cassiopeia Ltd 2016
Scratch for Arduino - analog output on Arduino (LED)
digital = ON or OFF, 1 or 0
analog = a RANGE of values
LED with resistor on D9
for Arduino analog out = 0 to 255
0 = no power
255 = full power
45. Cassiopeia Ltd 2016
Scratch for Arduino - analog output on Arduino (servo)
analog = a RANGE of values
SERVO on D8 (orange)
5V (red) and GND (brown)
position from 0 to 180 degrees
46. Cassiopeia Ltd 2016
Scratch for Arduino - Monkey Catcher
● monkey is hiding
○ when motion detected, monkey appears on the screen
○ switch LED on
○ monkey says hello
■ change monkey’s colour with LDR sensor
■ change monkey’s size with potentiometer
■ push button to let the monkey go and hide again
○ monkey says bye
○ switch LED off
○ back to start
47. Cassiopeia Ltd 2016
S4A- Monkey Catcher
● PIR motion on D2
with 5V and GND
● button on D3 (with pull-down
resistor)
● LED + resistor on D10
● LDR + resistor on A0
● potentiometer on A1
start
loop
48. Cassiopeia Ltd 2016
Infrared LED and infrared detector
Infrared LED = emitter (white colour, L1) as with all LED’s, long leg = positive
Infrared detector (black colour, T1) ATTENTION: long leg goes to negative!
220Ω
10kΩ
5V
A0white
black
49. Cassiopeia Ltd 2016
Infrared detector = voltage divider
220Ω
10kΩ
5V
A0
5V
GND = 0V
0 to 5V analog input 0 to 1023
1023
0
white
black
50. Cassiopeia Ltd 2016
S4A - analog input to Arduino (IR emitter + detector)
0-5V signal between detector and resistor
to AO
220Ω
10kΩ
5V
A0
white
black
51. Cassiopeia Ltd 2016
S4A - analog input to Arduino (IR emitter + detector)
ball bounces around
when IR is blocked,
the ball stops and
drum is played
52. Cassiopeia Ltd 2016
S4A - analog input to Arduino (IR distance)
IR distance sensor
ball moves according to
IR reflection
53. Cassiopeia Ltd 2016
S4A - analog input to Arduino (IR distance game)
ball moves horizontally
according to IR reflection,
avoid the bee!
keep ball code
add sprite for bee
54. Cassiopeia Ltd 2016
S4A - pong game: overview
use potentiometer to control the
paddle position
ball bounces around
points increase with each hit
change the speed with a second
potentiometer
start again with button press
55. Cassiopeia Ltd 2016
S4A - pong game: step 1
connect potentiometer on breadboard:
outside legs to 5V and GND, middle to A0
check changing value
rename the sprite to ‘paddle’
paint a new costume for the paddle
57. Cassiopeia Ltd 2016
S4A - pong game: step 3
add a new sprite of arduino type
call it ball
change costume to a ball
write script for ball
move and bounce on edge
if touch paddle, bounce back
58. Cassiopeia Ltd 2016
S4A - pong game: step 4
edit stage: add red line
add check to ball script
add button on breadboard:
one side 5V
one side D2 and resistor to GND
59. Cassiopeia Ltd 2016
S4A - pong game: step 5
add variable ‘points’
to count the hits
set points=0 at start
add 1 point when hit
set points=0 when start again
60. Cassiopeia Ltd 2016
S4A - pong game: step 6
add a potentiometer to control the speed
outside legs to 5V and GND, inside A1
add variable ‘speed’
set speed to analog reading of A1
use this variable the ‘move’
speed can vary from 0 to 20:
A1 (0 to 1023) divided by 50
62. Cassiopeia Ltd 2016
Mobile phone technology
voice
sound wave
mic
electricity
SIM
radio wave
radio wave electricity
SIM speaker ear
sound wave
phone
phone
micSIM
63. Cassiopeia Ltd 2016
Arduino phone with SIM800 module
Insert SIM card correctly!
(contacts facing the board)
Green LED = network status
Red LED = call status
Press button to call number 1 or 2
Press any button to hang up
Press any button to pick up a call
72. Cassiopeia Ltd 2016
Sound waves: shape (= timbre)
Pure wave: SINE
Only 1 frequency
Other shapes make different sounds
Check http://onlinetonegenerator.com/
Only sine is a pure single frequency sound,
other shapes add frequencies
73. Cassiopeia Ltd 2016
Sound waves: shape
Pure wave: SINE
Only 1 frequency
Different instruments produce their own wave
shape, also human voices
Same basic note (frequency), but other
frequencies come up too
74. Cassiopeia Ltd 2016
Sound waves: shape and spectrum
Almost pure SINE wave:
1 strong frequency
Different instruments produce their own wave
shape
Same basic note (frequency), but other
frequencies come up too = ‘harmonics’
SPECTRUM shows us the frequencies
75. Cassiopeia Ltd 2016
Arduino SPECTRUM Analyser
Microphone with amplifier
RGB LED reacts to different
frequencies: colour depends
on dominant frequency
OLED shows the spectrum
with 6 bars: 400/800/1600/
3000/6000/12000 Hz
77. Cassiopeia Ltd 2016
Arduino wire loop game
Go from Start to Finish without touching the
wire while the time is counting..
The handle is connected to GND, and the wire
is connected to D7 as input.
Also 2 inputs for Start and Finish.
80. Cassiopeia Ltd 2016
DSL laser cutter: cutting and engraving
CO2 laser:
Infrared light = invisible!
CUTTING:
a line going through the
material
ENGRAVING:
an image/letters on the
surface
82. Cassiopeia Ltd 2016
Arduino servo insect - connections
Servo has 3 wires:
● 5V
● GND
● Signal (position)
Servo signals on D8 and D9
Large capacitor between 5V and GND
Potentiometer to A0: pace=time
Potentiometer to A1: span=max angle
83. Cassiopeia Ltd 2016
WIFI project: web server
Information is stored on
SERVERS:
● Websites
● Files such as music, video
We use the INTERNET to connect
to the servers
84. Cassiopeia Ltd 2016
WIFI project: web server
We connect to the INTERNET
over WIFI = wireless
(or by cable = ethernet)
We connect to a Wireless Router
or ACCESS POINT (hotspot)
The router is connected to the
internet via cables
INTERNET (ADSL, fiber optic..)
85. Cassiopeia Ltd 2016
WIFI project: web server
We create a WIFI ACCESS
POINT
We use a client (laptop, phone,
tablet) to connect to this WIFI
network
We visit webpages stored on the
server
http://esp
Local network only, not connected
to INTERNET
Our project =
WIFI access
point + server
INTERNET
87. Cassiopeia Ltd 2016
WIFI project:
RGB control
and DHT sensor
Arduino only used for power
supply (3.3V and 5V)
88. Cassiopeia Ltd 2016
Low power I/O Directly to pin: very low power
Pin + GND
5V power (5V + GND) and data pin(s)
Data pin = very low power
I/O
input/output
94. Cassiopeia Ltd 2016
Motor control with H bridge: L293D
Motor driver IC
2x H-bridge = 2 motors
2 pins for switches, 1 pin for power control
1 pin for external power
107. Cassiopeia Ltd 2016
Arduino gyro game
● tilt the sensor to move the ball
around
● do not touch the borders
● try to catch as many squares as
possible within 1 minute