Bionic Arduino Class2
Bionic Arduino Class2
Random Behavior
RGB LEDs
Color mixing
A variable resistor
TX sending to PC
RX receiving from PC
The function
Serial.available()
makes reading strings
easier
The readSerialString()
function at right takes a
character string and sticks
available serial data into it
Pay no attention to the pointer symbol (*)
Must be careful about calling readSerialString() too often or youll read partial strings
Piezoelectrics
piezo
buzzer
Piezo leads are very thin. The breadboard holes grab them better than the header sockets, which is
why the jumper leads are used.
Or you can jam a jumper wire in the holes to hold in the piezo leads.
Play a Melody
SoundSerial
Play the piezo beeper
with the Serial Monitor
Type multiple letters
from cdefgabC to
make melodies
This sketch is in the handout,
Notice the problem with this sketch?
Di!erent notes play for di!erent amounts of time.
50 cycles of low C isnt the same amount of time as 50 cycles of high B
Making it Quieter
Easiest way: add a resistor
(brown,
black,
orange)
Arduino
board
pin 7
gnd
+
piezo
buzzer
10k
Arduino
board
pin 7
gnd
+
piezo
buzzer
Like most things in electronics, if you want less of something, add a resistor.
A better value would probably be 1k, but we dont have that on hand.
This may not seem important now, but wait for the next project.
Play a Stored Melody
PlayMelody
Plays a melody stored
in the Arduino
Could be battery-powered, play
melody on button trigger, control
playback speed with photocell, etc.
Melody denition is sort of like the old cell ringtone style
Melody playing logic is a little hard to follow, since it is timing critical.
Make a Theremin
ooo-weee-ooooo
The original spooky
sound machine
Works by measuring your
bodys electric eld
Leon Theremin
No touching needed!
Well use light in lieu of RF
As heard on Star Trek, Beach Boys, horror movies, Mars Attacks!, and bad New Age songs.
Works sorta like those touch switches, but no touching here.
That is, your body becomes a variable capacitor.
Light Theremin
Theremin
Move hand over
photocell to
change pitch
Play with val processing & cycles count
to alter sensitivity, pitch and timbre
Okay so maybe it sounds more like a bad video game than a spooky movie
The glitchy sound is cause because of the time it takes to read the sensor
There are ways around such stu!, but requires more complex programming using timers &
interrupts
The sound can get annoying quick
Other Serial Devices
to Wi-Fi to Ethernet
to graphic LCD
to 8-servo controller
Lantronix Wi-Port and Lantronix Xport http://lantronix.com/
Seetron Serial Graphic display and Mini SSC http://www.seetron.com/slcds.htm http://www.seetron.com/ssc.htm
Serial Examples
to Roomba
Youve already seen this. :)
http://hackingroomba.com/
Going Further
Piezo buzzers
Serial communications
RGB LEDS
Computer-controlled accent
lighting (a wash of color
against the walls)
Ambient Orb doesnt connect to computer though. Uses the pager network.
Ambient Devices: http://www.ambientdevices.com/
Tod E. Kurt
tod@todbot.com
END Class 2
http://todbot.com/blog/bionicarduino/
Feel free to email me if you have any questions.