Professional Documents
Culture Documents
Studio 1 – Introduction
Sensors
(e.g. sound, light, temperature etc.)
27
7A. On-campus workshop – The EZ JD Robot
• Watch introductory videos:
1. Watch Module Essential video 1 - JD Box Introduction
2. Watch Module Essential video 2 - Battery Care & Charging (till 2:40 only)
Arduino Uno + Voice Box Shield + WiFly Shield = WiFi Talking Stephen Hawking (TM)
7. Arduino Fundamentals
The Arduino Uno Board
• Main microcontroller:
• commonly uses ATMEGA AVRs (made by Atmel)
• Crystal resonator:
• controls how fast the microcontroller is running.
• Another microcontroller:
• to upload the program to the main
microcontroller, there is another microcontroller.
• lets you connect your USB cable to the Arduino
board and communicate via USB.
• lets you upload your programs onto the main
microcontroller.
• allows you to send messages back and forth
between your computer and your Arduino.
• extremely important for debugging.
7. Arduino Fundamentals
The Arduino Uno Board
• USB port:
• To power the board.
• Barrel jack
• To disconnect from PC and use own
power.
• Connect external 9V DC power source
• Voltage regulator
• Reduce the voltage to 5V
• Reset button
• To reboot Arduino program
Arduino Fundamentals
Arduino Uno Pin Configuration
Image Source: diyi0t.com
• Power pins:
• To power other circuitries with 5V or 3.3V
• Make sure whatever you power doesn’t
draw more than a few miliamperes.
• A few LEDs is fine; large motors, not.
• Vin:
• Input voltage pin of the Arduino board used to
provide input supply from an external power
source.
• 5V:
• Used as a regulated power supply voltage
• Used to give supply to the board as well as
onboard components.
• 3.3V:
• Used to provide a supply of 3.3V which is
generated from a voltage regulator on the
board
• GND:
• Used to ground the Arduino board.
Arduino Fundamentals
Arduino Uno Pin Image Source: diyi0t.com
Configuration
• Tx/Rx:
• Sending and receiving serial
data e.g., from GPS module,
Bluetooth module, Wi-Fi
module etc.
• Also known as UART pins.
• Used for communication
between the Arduino board and
a computer or other devices.
• TX0: transmit data
• RX0: receive data
Arduino Fundamentals
Arduino Uno Pin Image Source: diyi0t.com
Configuration
• Digital Pins (0 - 13):
• digital inputs and outputs
• normally pins receive 5v
as 1 and 0V as 0
• With most microcontroller
pins, you can configure a
third state i.e. set a
particular voltage to be
perceived as a 1 or 0 –
tristate logic
Arduino Fundamentals
Arduino Uno Pin Image Source: diyi0t.com
Configuration
• Tilde~ pins:
• Used to convert the digital
signal into an analog by
varying the width of the
Pulse.
• The pin numbers 3, 5, 6, 9,
10, and 11 are used as
PWM pins.
• Can be used to output pulse
width modulated square
waves.
Arduino Fundamentals
Arduino Uno Pin Image Source: diyi0t.com
Configuration
• Analog Pins (A0 – A5):
• Measure continuous
voltages from 0 – 5V.
7. Arduino Fundamentals
• The Arduino Program – Sketch
• The Arduino software is open-source
• An Arduino program is called a ‘sketch’.
• All sketches have
• A structure
• Values (variables and constants)
• Functions
7. Arduino Fundamentals
• The Arduino Program – Sketch
• The Arduino software is open-source
• An Arduino program is called a ‘sketch’.
• All sketches have
• A structure
• Consists of two main functions
1. Setup() function
• called when a sketch starts.
• used to initialize the variables, pin modes etc.
• only runs once, after each power up or reset of the Arduino board.
7. Arduino Fundamentals
• The Arduino Program – Sketch
• The Arduino software is open-source
• An Arduino program is called a ‘sketch’.
• All sketches have
• A structure
• Consists of two main functions
2. Loop() function
• loops consecutively, allowing your program to change and respond.
• used to actively control the Arduino board
7. Arduino Fundamentals
• A sample sketch
void setup() {
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(10, HIGH);
delay(1000);
digitalWrite(10, LOW);
delay(1000);
}
7. Arduino Fundamentals
• Tinkercad – a tool to simulate Arduino based circuits
• Free
• Online (https://www.tinkercad.com/)
• Before, this week’s workshop, create an account on
www.tinkercard.com
References
• https://www.ez-robot.com/Tutorials/Lesson/61?courseId=1
• https://www.arduino.cc/en/Tutorial/HomePage
• https://www.futurelearn.com/courses/physical-computing-raspberry-pi-python
• Chua, X.N. & Chew. E. (2015). The Next Wave of Learning with Humanoid Robot: Learning Innovation Design starts with "Hello
NAO". In T. Reiners, B.R. von Konsky, D. Gibson, V. Chang, L. Irving, & K. Clarke (Eds.), Globally connected, digitally enabled.
Proceedings Ascilite 2015 in Perth (pp. CP:52- CP:56).
49