Build cool stuff with arduino for sci camp 16 dec13
Upcoming SlideShare
Loading in...5
×
 

Build cool stuff with arduino for sci camp 16 dec13

on

  • 430 views

Slides for Arduino workshop for Science Camp 2013

Slides for Arduino workshop for Science Camp 2013

Statistics

Views

Total Views
430
Slideshare-icon Views on SlideShare
429
Embed Views
1

Actions

Likes
0
Downloads
6
Comments
0

1 Embed 1

http://www.supercoolbooks.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Build cool stuff with arduino for sci camp 16 dec13 Build cool stuff with arduino for sci camp 16 dec13 Presentation Transcript

    • Build cool stuff with Arduino William Hooi Wendell Wong Centre for Research & Applied Learning in Sciences Science Centre Singapore Introductory Workshop 13 Dec 2013 facebook.com/CRADLEsci
    • What are microcontrollers? • • • • Really small computers With limited hardware resources Programmable Can be used to do anything imaginable
    • Doing good for humanity Fukushima nuclear disaster DIY radiation detector built by Tokyo Hackerspace, connected live to the Internet
    • Arduino as an Interative Device
    • Terminology • Pins – A leg on a microcontroller with some specific function (e.g. Power pin, ground pin, digital input pin, analog output pin) Digital pins Arduino has 13 digital pins that can be used as input or output Arduino has 6 analog pins that can only be used as input Analog pins
    • Using the breadboard Horizontal tracks for power vertical tracks for components
    • Connecting circuit
    • Program structure Arduino use a language similar to C++ void setup( ) { } void loop( ) { }
    • Where to start Determine your input Output device: Determine your output and device Input device: Choose a device Lightdependent resistor (LDR) Light emitting diode (LED) Piezo buzzer
    • Reading from serial monitor Verify Upload Serial monitor
    • Activity 1: Blink an LED longer leg 330
    • Activity 1: Blink an LED Assign pin 13 as LED pin Assign LED pin as output Turn LED pin on Wait for 0.5s Turn Led pin off Wait for 0.5s
    • Recap pinMode (pin number, OUTPUT/INPUT); digitalWrite(pin number, HIGH/LOW); delay(milliseconds);
    • Activity 2: ..and beep a buzzer Piezo buzzer 330
    • Activity 2: ..and beep a buzzer Assign pin 8 as tone pin Play a tone on tone pin with 200 Hz and 250ms Play a tone on tone pin with 600 Hz and 250ms
    • Use arrays for longer tunes
    • Challenge Build a circuit and write the Arduino sketch that will enable you to blink 4 LEDs intermittently & play a musical tone
    • Controlling RGB
    • Activity 4: Light sensing adafruit.com
    • Activity 4: Display light reading – Serial
    • Controlling servo motor
    • Activity 5: Controlling servo motor GND pin 0 +5V
    • Control servo with trimmer pot #include <Servo.h>
    • Recap #include <Servo.h> Servo myservo; myservo.attach (pin number); myservo.write (angle);
    • Reading from serial monitor #include <Servo.h> create a servo object called ‘myservo’ Start serial comm at 9600bps Assign servo to servo pin 9 Read analog pin 0, pass value to potLevel Convert range to 180 divisions Display something on serial monitor Tell servo to rotate
    • Replace pot with light sensor 10k
    • 10k
    • Ideas for projects
    • Thank you facebook.com/CRADLEsci