Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is...

14
Prototyping & Engineering Electronics Kits Basic Kit Guide odysseyboard.com

Transcript of Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is...

Page 1: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Prototyping & Engineering Electronics Kits

Basic Kit Guide

odysseyboard.com

Page 2: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Please refer to www.odysseyboard.com for a PDF updated version of this guide.

Guide version 1.0, February, 2018. Copyright © Odyssey Board, LLC

Page 3: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Disclaimer:

Odyssey Board equipment is recommended for ages 12 and up.

***Choking Hazard: The kit contains small parts. Do not allow kits to be used around small children.

Do not use kits in ways other than intended in this booklet.

Do not exceed 5 volts of power input.

Do not touch parts while spinning.

Be sure to orient parts correctly. Inappropriate arrangements can lead to excessive heat or fire.

Page 4: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Introduction to Arduino and Odyssey Board…….…Basic Kit Parts Inventory……………………….…….The Arduino IDE……………………………………...The Arduino Sketch………………………………….Digital vs. Analog Overview………………………...Circuits………………………………………………...Switch………………………………………………….Blink…………………………………………………....Programming Reference Chart…………………….Pulse Width Modulation……………………………..RGB…………………………………………………...Control ………………...……………………………..Potentiometer………………………………………..Serial Monitor………………………………………...Mapping……………………………………………….Photoresistor………………………………………….Temperature…………………………………………..Sound………………………………………………….

Contents1678

1011161827283743454951536167

Page

Page 5: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

What is Arduino?➢ Arduino is name brand for an open-

source physical computing platform for experimenting with electronics using a microcontroller. A microcontroller is a tiny computer that uses electrical circuits to carry out (execute) programs stored in its limited memory chip. It is can receive input from sensors and control outputs such as lights or motors.

➢ The programming code, called a sketch, is written to the Arduino Software IDE (Integrated Development Environment)

➢ The sketch is uploaded to the micro- controller using the USB cord.

➢ The USB cord also provides the power to the microcontroller.

What is in the Basic Kit Guide?In this guide you will find step by step instructions to assemble several systems using sensors and actuators. The coding syntax is explained in detail for each system to help you learn the basics of Arduino programming. A downloadable pdf of the most current version of this entire guide can be found on the odysseyboard.com website.

1

Some of the sketches are printed in the guide, but some are too lengthy. You can type the printed sketches into the IDE yourself or go to odysseyboard.com and click the Learn tab to find the downloadable code for each sketch which can be copied and pasted into the IDE from a Google document, or downloaded as an .ino file that opens directly to the IDE on your device.

Where can I find the code?

Page 6: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

How the Odyssey Board Kit Guide is Organized?

Different colored borders on pages contain specific types of information that will help you navigate the instruction booklet.

★ White or gray pages without borders explain background or pertinent information necessary to understand the circuits, components, and/or materials lists for each activity.

★ Green bordered pages are activity pages that indicate something for you to do or assemble and typically contain numbered step by step instructions.

★ Blue bordered pages contain additional activities and/or tasks to try on your own.

★ Gold bordered pages or sections contain information related to understanding the C++ coding syntax.

Note: The C++ coding syntax does not allow spaces between words. To make it easier to read, camelcase is used which capitalizes the first letter in each word following the first word. Ex: capitalzieTheFirstLetterOfWords

Information

Step by Step Instructions

Extra Activities

Code Explanation2

Page 7: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

The Odyssey Board Kits use the Keyestudio UNO.

The primary difference between the traditional Arduino and the Keyestudio board is the three additional rows of male header pins for each digital and analog pin. The traditional Arduino has three ground and two voltage pin options, which requires the use of a breadboard for most systems. The Keyestudio provides 25 ground pins, 21 5v pins, and a choice of male or female digital and analog signal pins. This allows the capacity to configure many systems without the need for a breadboard.

Traditional Arduino UNO Keyestudio UNO

3

Page 8: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Female Ground Pins Blue male pins D0-D13 and A0-A5 header pins are all ground pins.

5 volts

All red pins are marked V provide constant 5 volts.

Ground and Voltage Pin Configuration on the Keyestudio UNO.

Tip: You may find it helpful to mark the holes of the 3 female ground pins with a black sharpie.

Ground Pins

3.3 volts

switch

Voltage Pins

4

Page 9: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use either the male or female analog signal pins.

Digital I/O pins are where you will connect most of your components called actuators that you want to do some kind of action. There are 14 digital pins marked D0-D13. You may use either the male or female digital signal pins.

Most yellow pins are I/O pins (Input/Output) that can send (write) or receive (read) signals and can be controlled with code.

Signal Pin Configuration on the Keyestudio UNO.

5

Page 10: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Odyssey Board Basic Kit Parts InventoryColors will vary.

Microcontroller

PotentiometerBlock

Socket Block Switch Block

Jumper Wires

TemperatureSensor Photoresistor Piezo Buzzer RGB LED LEDs 220 ohm resistors

Diffused Slow Change LED

Resistor Wires

Odyssey Board Base

9v battery adapter

DowelsWire Clips

10k ohm Voltage Divider Wire

Diffuser

Wire Spacers

6

Screwdriver - helps push snug wires out of socket blocks

Page 11: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

IDE stands for Integrated Development EnvironmentThe IDE must be installed on your device or you may sign up and use the web editor. Go to https://www.arduino.cc/en/Main/Software and follow the instructions to download the IDE to your device. NOTE: The instructions in this kit will show the downloaded IDE version.

If you plan to use the downloaded IDE, you can download it now but you will not use it until you do the Blink activity.

Once the code is written or pasted in the sketch section of the IDE, you may click the compiler to check for errors.

If there are no errors, click on the upload button to send the code to the Arduino. You can also just click Upload and the IDE will check for errors before uploading.

This is where the code is written or pasted.

Upload to the microcontroller.

Always unplug the power when you are changing your circuits.!

Compile (Check for errors)

What is the Arduino IDE?

Errors in code will show up in this section.

7

Page 12: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

//LED Blink Turns an LED on and off for one second.

int led1 = 7;//tells which pin is connected to the LED

void setup() {

pinMode(led1, OUTPUT);// sets up the pin as an output

}

void loop() {

digitalWrite(led1, HIGH);//turn LED on

delay(1000);// wait for 1000 milliseconds (one second)

digitalWrite(led1, LOW);//turn LED off

delay(1000);//wait one second

}

A program in the Arduino language is called a SKETCH.

A sketch has 4 main parts: The comments, declarations, setup, and loop functions.

The setup runs once to tell the Arduino how to set up the variables and pins you will be using.

The loop is where most of your program lives and is executed after the setup is complete. The Arduino will perform the commands in the loop program over and over until you unplug the power.

The declarations tell what variables will be used throughout the program. (Like a list of ingredients in a recipe.)

The comments are notes written by the programmer that follow //. The Arduino ignores the comments.

8

Page 13: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

int led1 = 7;

void setup () {

All the setup instruction must come between these two curly brackets. }

void loop () {

All the programming instructions (code) must come between these two curly brackets.

}

Important Points!!

The microcontroller only reads the declarations, setup, and loop functions.

The setup function tells the Arduino how to set up the pins.

The loop function is where the program runs over and over.

The declarations tell the microcontroller the names of components or variables that will be used and on which pins.

Only type void setup () ONE TIME.

Only type void loop () ONE TIME.

9

Page 14: Basic Kit Guide - storage.googleapis.com · The yellow analog signal pins are marked A0-A5. This is where you will connect most of your sensors and variable resistors. You may use

Overview of Digital vs. Analog Signals.

The UNO microcontroller uses two types of electronic signals, digital and analog. You will need to understand the difference as you work through the Odyssey Board circuit activities.

A digital signal has two, and only two states. It is either on or off and has no possible values in between. For example, most lights inside a room are either on or off. The yellow pins 0-13 on one side of the microcontroller are digital pins, which means they have only two states. They can either send (write) 0 volts or 5 volts, nothing in between.

Analog signals theoretically have an infinite number of possible values. For example, the light outside during an entire day can have nearly infinite values of light between the darkness at night and the brightest sunshine during the day. The microcontroller has analog pins A0 to A5 which can receive (read) analog inputs.

Working with digital and analog signals will be explained in greater detail later. You will even learn about 6 special digital pins that can allow you to trick a digital signal into acting like an analog signal.

10