CONSTRUCTION GUIDE IR Alarm. Robobox. Level I

Similar documents
CONSTRUCTION GUIDE Robotic Arm. Robobox. Level II

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

Programming 2 Servos. Learn to connect and write code to control two servos.

Coding with Arduino to operate the prosthetic arm

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

Arduino Sensor Beginners Guide

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink

Lab 2: Blinkie Lab. Objectives. Materials. Theory

Lesson 3: Arduino. Goals

Arduino Lesson 1. Blink. Created by Simon Monk

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

Lecture 6. Interfacing Digital and Analog Devices to Arduino. Intro to Arduino

Rodni What will yours be?

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1

FABO ACADEMY X ELECTRONIC DESIGN

INA169 Breakout Board Hookup Guide

CONSTRUCTION GUIDE Capacitor, Transistor & Motorbike. Robobox. Level VII

Arduino Workshop 01. AD32600 Physical Computing Prof. Fabian Winkler Fall 2014

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

Workshop 9: First steps in electronics

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

CONSTRUCTION GUIDE Light Robot. Robobox. Level VI

Arduino: Sensors for Fun and Non Profit

Computational Crafting with Arduino. Christopher Michaud Marist School ECEP Programs, Georgia Tech

TWEAK THE ARDUINO LOGO

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

Arduino Setup & Flexing the ExBow

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

Disclaimer. Arduino Hands-On 2 CS5968 / ART4455 9/1/10. ! Many of these slides are mine. ! But, some are stolen from various places on the web

THE INPUTS ON THE ARDUINO READ VOLTAGE. ALL INPUTS NEED TO BE THOUGHT OF IN TERMS OF VOLTAGE DIFFERENTIALS.

Lab 2.4 Arduinos, Resistors, and Circuits

.:Twisting:..:Potentiometers:.

Basics before Migtrating to Arduino

isys-4004 GUI interface - V2.1 Power up Initialize Peripheral Start Measurement YES LED flashes red Object available LED blinking

The µbotino Microcontroller Board

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Arduino An Introduction

A servo is an electric motor that takes in a pulse width modulated signal that controls direction and speed. A servo has three leads:

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

smraza Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)...

The Robot Builder's Shield for Arduino

PLAN DE FORMACIÓN EN LENGUAS EXTRANJERAS IN-57 Technology for ESO: Contents and Strategies

Analog Feedback Servos

Pulse Width Modulation and

Workshops Elisava Introduction to programming and electronics (Scratch & Arduino)

Experiment 1: Robot Moves in 3ft squared makes sound and

PIR Motion Detector Experiment. In today s crime infested society, security systems have become a much more

Controlling Your Robot

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

CPSC 226 Lab Four Spring 2018

INTRODUCTION to MICRO-CONTROLLERS

La Malinette is an open source project by Reso-nance Numérique Programming Interactivity Kit

100UF CAPACITOR POTENTIOMETER SERVO MOTOR MOTOR ARM. MALE HEADER PIN (3 pins) INGREDIENTS

Application Note. Communication between arduino and IMU Software capturing the data

Adafruit 16-Channel Servo Driver with Arduino

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE (

Welcome to Arduino Day 2016

Servo Sweep. Learn to make a regular Servo move in a sweeping motion.

Application Note AN 157: Arduino UART Interface to TelAire T6613 CO2 Sensor

Setup Download the Arduino library (link) for Processing and the Lab 12 sketches (link).

Experiment 1 Identification of Components and Breadboard Realization

Lecture 4: Basic Electronics. Lecture 4 Brief Introduction to Electronics and the Arduino

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

Exercise 2-2. Four-Wire Transmitter (Optional) EXERCISE OBJECTIVE DISCUSSION OUTLINE. Ultrasonic level transmitter DISCUSSION

Internet of Things Student STEM Project Jackson High School. Lesson 3: Arduino Solar Tracker

LED + Servo 2 devices, 1 Arduino

APDS-9960 RGB and Gesture Sensor Hookup Guide

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

USER MANUAL SERIAL IR SENSOR ARRAY5

Intelligent Systems Design in a Non Engineering Curriculum. Embedded Systems Without Major Hardware Engineering

Table of Contents. 2 P a g e

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters

Attribution Thank you to Arduino and SparkFun for open source access to reference materials.

// Parts of a Multimeter

Arduino Digital Out_QUICK RECAP

Boe-Bot robot manual

INTRODUCTION to MICRO-CONTROLLERS

INTRODUCTION to MICRO-CONTROLLERS

Sten-Bot Robot Kit Stensat Group LLC, Copyright 2013

Lab 06: Ohm s Law and Servo Motor Control

Objective of the lesson

Peek-a-BOO Kit JAMECO PART NO / / Experience Level: Beginner Time Required: 1+ hour

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Introduction 1. Download socket (the cable plugs in here so that the GENIE microcontroller can talk to the computer)

CNC Router Parts CNC Router Parts 2.2 kw Plug and Play Spindle / VFD System CRP800 Set Up Guide

The Discussion of this exercise covers the following points: Differential-pressure transmitter. Differential-pressure transmitter

User Interface Engineering FS 2013

Introduction to. An Open-Source Prototyping Platform. Hans-Petter Halvorsen

Prelab: Introduction and Greenhouse Construction

A Day in the Life CTE Enrichment Grades 3-5 mblock Programs Using the Sensors

Ultimate Actuator Drivebox 30A Quick start guide

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

Two Hour Robot. Lets build a Robot.

ZX Distance and Gesture Sensor Hookup Guide

Robotic Manipulation Lab 1: Getting Acquainted with the Denso Robot Arms Fall 2010

Build a Mintronics: MintDuino

HC-SR501 Passive Infrared (PIR) Motion Sensor

IET BBC micro:bit class session A sun exposure alarm

Transcription:

CONSTRUCTION GUIDE Robobox Level I

This month s montage is an that will allow you to detect any intruder. When a movement is detected, the alarm will turn its LEDs on and buzz to a personalized tune. 1X Buzzer 1X Uno Card Pièces 1X PIR Sensor 5X Male Female cables 1X Breadboard 1X LED 1X Resistor 4X Male Male cables Instructions We suggest that you follow these instructions step by step. Additional details are available on your member space on Robobox.io. Please don t hesitate to ask any question, we will answer them promptly. Good luck!

Step 3 Step 1 Step 2 _0_ 1NTR0DUCT10N Go to www.robobox.io/members and enter the username and password you received by email. Next go to General to download the drivers for your card if you haven t already done so. Open and execute the file. In the same folder, download the Arduino software version corresponding to your operating system. Once installed, launch it and plug in your card. Let s now check your Robobox UNO : - Go to Tools, then ports and choose your card (ex: COM4) - Be sure that in Tools/Card, Arduino Uno is selected - Now go to: File/Examples/Basics/Blink In the window that just opened click on upload. Step 4 Wait until Done Uploading shows at the bottom of the window. You should now see the LED close to the pin 13 blink. Now unplug the card and check the content of your box

Step 7 Step 6 Step 5 _1_ M0NT4GE 2 1 Place your Robobox UNO close to the breadboard. Current flows on the breadboard along the 1 and 2 axis as shown with the arrow ( ). Dessins réalisés avec A C B Place the IR sensor so that the 3 pins show on your right and the sphere shows heads up. Plug in 3 Male-Female cables, we will call the cable on the top A, the middle one B and the bottom one C. 2 1 Plug the LED on the two leftmost column of your breadboard (ZAZZ) with the shortest leg on the left and the longest on the right. Next use a resistor to bridge side 1 and 2. Short Long

Step 10 Step 9 Step 8 _1_ M0NT4GE GND 5 Take 2 Male Male cables and plug one from the GND to the resistor (black cable) and the other one from pin # 5 to the LED s longest leg (red cable). Now plug the A wire from the PIR sensor to the pin marked 5V on the Robobox UNO, plug the B wire to pin # 2 and finally wire C to GND. A C B Next, plug two Male Female cables to the buzzer, link the one with the buzzer s longest leg to the Robobox UNO on pin 6. Join the one with the shortest leg to the third GND pin. That s it! You re done with the montage, let s now program this alarm!

Etape 11 _2_ PR0GR4MM1NG We will now go through the software instruction, that is to say the code that will be sent to our circuit. This code will enable us to get any behavior wewant from our circuit. In order to write this code we will need to launch Arduino. You will then need to type the program in the big white window at the center of the screen. You can copy / paste the lines below but we advise you to read and understand the explanations. Have fun! int ledpin = 5; // Pin that is linked to the LED int inputpin = 2; // Pin used to communicate with the PIR sensor int pinspeaker = 6; // Pin used to communicate with the buzzer int pirstate = LOW; int val = 0; First we will define global variables, which are variables that will be used throughout the program. We set up pin 5 to give instructions to the LED, the pin communicating with the PIR sensor will be pin 2 and the buzzer will be controlled via pin 6. You see that these values are the pins on which the different component are plugged. We therefore inform our card that we will use these pins to communicate with these items. This abstraction helps us understand more easily the code that will follow. The double dash : // that you see after the first lines of command are comments which means they will not be taken into account by the compiler. It is good practice to add them to your code to increase readability and remind you of your thought process.

Step 12 _2_ PR0GR4MM1NG We could also add Const in front of int when we declare these variables to indicate that these values will not change throughout the program. The PIR sensor can output two values : LOW when no movement is detected and HIGH when a movement is seen. We will initialize the value at LOW since this is the default value for our program. Finally we set up val at 0 (we will see its use later). void setup() { pinmode(ledpin, OUTPUT); pinmode(inputpin, INPUT); pinmode(pinspeaker, OUTPUT); } We define the ledpin to be an output We define the inputpin of the sensor to be an input We define the buzzer s pin as an output Setup() is a function that you will always find in your Arduino programs, it is only executed once and is used to define all the general parameters of our programs. For instance, here we define how our card should behave with the sensors and actuators: pinmode(ledpin, OUTPUT) indicates that the information will go from the Robobox UNO and towards the LED, whereas pinmode(inputpin,input) sets data to go from the sensor to the Robobox UNO.

Step 13 _2_ PR0GR4MM1NG void playtune (long length, int freq) { length *= 1000; int period = (1.0 / freq) * 1000000; long time_elapsed = 0; while (time_elapsed< length) { digitalwrite(pinspeaker,high); delaymicroseconds(period / 2); digitalwrite(pinspeaker, LOW); delaymicroseconds(period / 2); time_elapsed = time_elapsed + period; } } Let us now write our first function! We want to create a function that will turn on the buzzer and play a sound at a certain frequency and for a certain length. Frequency (in Hertz) sets whether the sound is high or low pitch. Thus our function will look like playtune( length, freq), and we will be able to change these parameters as we wish. First we will initialize some variables : - Since the program computes values in milliseconds, we need to multiply the value by 1000 to get the value in seconds - We adjust how often we send a sound to adjust to the input frequency. - We initialize the time_elapsed variable

_2_ PR0GR4MM1NG Then, we instantiate a loop, which means our program will repeat what is within the brackets of this loop. There are different types of loop with different syntaxes, in this loop we will : - Turn the buzzer on (digitalwrite(pinspeaker, HIGH)) - Wait for some time - Turn the buzzer off (digitalwrite(pinspeaker, LOW)) - Wait again for some time - Finally increment the time_elapsed variable to keep track of the time that has elapsed since the beginning or our function. We repeat these steps until time_elapsed has reach the time set in length. Don t worry if you don t make sense of all of this so far, this was just your first lesson! We will have time to go back to these structures and commands during the coming months! Program Starts No Movement detected? Yes Turn LED on Turn Buzzer on Turn LED & Buzzer off

Etape 14 _2_ PR0GR4MM1NG void loop(){ val = digitalread(inputpin); if (val == HIGH) { digitalwrite(ledpin, HIGH); playtune(300, 160); delay(150); } else { digitalwrite(ledpin, LOW); playtune(0, 0); delay(300); } } Now we will write the core of our program : the endless loop. This means that everything between the brackets of this loop will repeat as long as the circuit is supplied with power. First we will give our variable val the value of the state of the PIR sensor, this means HIGH if a movement is seen or LOW if nothing is detected. Then if our circuit detects a movement, that is to say if val == HIGH, we will ask our program to : - Turn the LED on : digitalwrite(ledpin, HIGH) - Play a tune for 0.3 seconds at 160 hertz : playtune(300,160) - Wait for 150 milliseconds If the circuit doesn t detect anything, it should : - Turn the LED off: digitalwrite(ledpin, LOW) - Play nothing : playtune(0, 0) - Wait 300 milliseconds

_2_ PR0GR4MM1NG And that s it! We re done! You just need to copy these lines in the Arduino compiler and click on the upload button. Your Robobox UNO, when plugged will process all this code and will be ready for use. After a few seconds for calibration, your alarm will detect any intruder! PS: you can adjust the sensitivity of your alarm by moving the two potentiometers of the PIR sensor. If you alarm turns on two often, adjust their position until you find the right behavior. On your right is the ideal position for the two potentiometers: Delay Sensibilité Too easy? Then try to do the following : - Play 3 different sounds when a movement is seen - Turn the alarm on only when 3 consecutive movement are seen within ten seconds Share your results or ask for help on Robobox.io/members...COMPLETED

_3_ ELECTR0N1C _CONC3PTS Here we will go a bit deeper on some key electronic concept seen in this first montage. I The Charge (Q) : In our cables and any conductor electrons are moving. These electrons are almost weightless but have a negative charge. This charge is measured in Coulombs and we will call it Q. II The current (I) : The current measures the movement of electrons in our circuit. The more electrons or the quicker they move, the higher the intensity. This intensity is measured in Ampères. The general formula is : Q / t = I. (where t is time in seconds). The current is the same all over the circuit. For instance : If we measure a 10 Coulomb current during 5 seconds, the intensity will be 10/5 = 2 Ampères. III Tension (V or U) : This represents (in a direct current circuit) a relative difference of potential between two points. In the circuit below, the tension between point a and c is 5V whereas the tension between a and b is 2V and 3V between b and c. You see that (a - b) + (b - c) = a-c IV The resistance (R) : In the circuit to the right we divided the tension in two thanks to two items called R1 and R2. Those are resistors and their goal is to limit the current that flows through the circuit but they can also divide the current as is shown in this example. 5v 0v R1 R2 a 2v b 3v c When resistors are set in series (as is above) the total resistance is equal to the sum of the individual resistances : Rtotal = R1 + R2. In our example we see that the difference of potential between b and c is 3V where it is only 2V between a and b. This means that R2 has a stronger resistance that R1. Actually R1 is worth 2/5 of the total circuit resistance where R2 is worth 3/5.

_3_ ELECTR0N1C _CONC3PTS The relation between resistance, tension, and current is defined by Ohm s law which states that I = V / R. Thus in the previous example, if R1 = 10 Ohm then : R1 = 10 = 2 5 Rtotal Rtotal = 10 5 2 = 25 R2 = 3 Rtotal = 15 5 By applying Ohm s law we find that the current is : V Rtotal = 5 25 = 0.2Ampères The IR alarm montage was a bit more complex and introduces new elements that we describe below. In our circuit, le IR sensor has 3 pins, two in charge of supplying current (5V & GND) and one which sends information to the pin 2 of our Robobox Uno. Our LED receives 5V but a 330Ohm resistor in series lowers the current to 5/330 = 0,01515A (15,15mA). You see that the resistor s position ( before or after the LED) doesn t impact its behavior since the current is the same all over the circuit. 330Ohm RESET A5 D0 A4 D1 A3 D2 A2 D3 A1 D4 A0 VCC GND GND AREF XLAT1 AVCC XLAT2 D13 D5 (PWM) D12 D6 (PWM) D11 (PWM) D7 D10 (PWM) D8 D9 (PWM) 5v Some of these electronics (LED, Buzzer, sensor, PIR) incorporate a built-in resistor which allows them to be used without an additional resistor. LED Buzzer IR Sensor