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

Similar documents
CONSTRUCTION GUIDE Robotic Arm. Robobox. Level II

CONSTRUCTION GUIDE Light Robot. Robobox. Level VI

Experiment 1 Identification of Components and Breadboard Realization

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

Coding with Arduino to operate the prosthetic arm

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

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

The Motor sketch. One Direction ON-OFF DC Motor

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

FABO ACADEMY X ELECTRONIC DESIGN

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

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

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

Module: Arduino as Signal Generator

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

Electronic Components

1. Introduction to Analog I/O

CONSTRUCTION GUIDE IR Alarm. Robobox. Level I

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

Lab 2: Blinkie Lab. Objectives. Materials. Theory

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

Blink. EE 285 Arduino 1

Assignments from last week

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

Welcome to Arduino Day 2016

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

Using Transistors and Driving Motors

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

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

Figure 1. Digilent DC Motor

Lesson 3: Arduino. Goals

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

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

Rodni What will yours be?

Arduino An Introduction

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

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

Sten-Bot Robot Kit Stensat Group LLC, Copyright 2013

TV Remote. Discover Engineering. Youth Handouts

Mechatronics Engineering and Automation Faculty of Engineering, Ain Shams University MCT-151, Spring 2015 Lab-4: Electric Actuators

TWEAK THE ARDUINO LOGO

Project 27 Joystick Servo Control

Lab 06: Ohm s Law and Servo Motor Control

Motors and Servos Part 2: DC Motors

Arduino Application: Speed control of small DC Motors

The Robot Builder's Shield for Arduino

Servomotor Control with Arduino Integrated Development Environment. Application Notes. Bingyang Wu Mar 27, Introduction

Boe-Bot robot manual

// Parts of a Multimeter

Portland State University MICROCONTROLLERS

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

C++ PROGRAM FOR DRIVING OF AN AGRICOL ROBOT

Megamark Arduino Library Documentation

1. Controlling the DC Motors

Tarocco Closed Loop Motor Controller

Parts List. Robotic Arm segments ¼ inch screws Cable XBEE module or Wifi module

Two Hour Robot. Lets build a Robot.

DFRduino Romeo All in one Controller V1.1(SKU:DFR0004)

Experiment #3: Micro-controlled Movement

Arduino Lesson 1. Blink. Created by Simon Monk

Pulse Width Modulation and

INA169 Breakout Board Hookup Guide

Introduction to Arduino HW Labs

Studuino Icon Programming Environment Guide

BeeLine TX User s Guide V1.1c 4/25/2005

Blue Point Engineering

SPI, Talking to Chips, and Minimizing Noise

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

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

Arduino Control of Tetrix Prizm Robotics. Motors and Servos Introduction to Robotics and Engineering Marist School

LAB 1 AN EXAMPLE MECHATRONIC SYSTEM: THE FURBY

2D Floor-Mapping Car

Introduction. 1 of 44

Electronics, Sensors, and Actuators

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

Experiment 15: Diode Lab Part 1

INTRODUCTION to MICRO-CONTROLLERS

HANDS-ON LAB INSTRUCTION SHEET MODULE 3 CAPACITORS, TIME CONSTANTS AND TRANSISTOR GAIN

Arduino Advanced Projects

The µbotino Microcontroller Board

Chapter 14. using data wires

Preface. If you have any problems for learning, please contact us at We will do our best to help you solve the problem.

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

Experiment 4.B. Position Control. ECEN 2270 Electronics Design Laboratory 1

Activity 2: Opto Receiver

Micro Wizard Instructions

Capacitive Touch with Conductive Fabric & Flora

Lesson4 Obstacle avoidance car

SCHOOL OF TECHNOLOGY AND PUBLIC MANAGEMENT ENGINEERING TECHNOLOGY DEPARTMENT

Embedded Controls Final Project. Tom Hall EE /07/2011

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

Experiment Manual Electronics Learning Circuits Manual Cover.indd 1 3/29/11 2:19 PM

T6+ Analog I/O Section. Installation booklet for part numbers: 5/4-80A-115 5/4-90A-115 5/4-80A /4-90A-1224

Lesson 2 Bluetooth Car

The Transistor Tester user manual

Robotics using Lego Mindstorms EV3 (Intermediate)

Understanding the Arduino to LabVIEW Interface

Microcontrollers and Interfacing

ADVANCED SAFETY APPLICATIONS FOR RAILWAY CROSSING

5v AC R. 12v. 1kohm. F=35KHz oscilloscope. 3 Final Project OFF. ON Toggle Switch. Relay 5v 2N3906 2N uF LM311. IR Detector +5v GND LED PNP NPN

Transcription:

CONSTRUCTION GUIDE Capacitor, Transistor & Motorbike Robobox Level VII

Capacitor, Transistor & Motorbike In this box, we will understand in more detail the operation of DC motors, transistors and capacitor. The roles of these components are completely different, but their importance in modern electronics is equally great. At the end of our construction, we will be able to direct our motorcycle and understand the electronic and programming principles. 1X Capacitor 1X Frame 2X Transistor Parts 1X Motor Block 1X Fork 1X Servo Block 1X Front Wheel 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!

MOTORCYCLE _1_ CAPACITOR The first role of the capacitor is to act as a small battery, it allows you to store a charge relative to the current that is applied on it. The capacitor acts like a reservoir of water that is filled from below, the more the reservoir is filled, the more difficult it is to fill it with current. However, unlike the water tank, once the capacitor is full, no current can pass through it. In a series DC circuit, a capacitor will thus charge until it is filled and, when filled, will prevent any current from flowing and therefore will force the LED to go out. In an alternating current circuit, the capacitor can act as a filter by blocking certain frequencies. + C1 LED LED Light Capacitor charge - R1 To be effective as a small current source, our capacitor will be installed in parallel on our circuit. In this case, once the other voltage source is disconnected, the capacitor will discharge for a period oftime and turn the LED on in the meantime. + C1 - R1 LED The possible charge of the capacitor, its "capacitance" is measured in Farads (usually in microfarads). When capacitors are connected in series or parallel, the total capacitance is changed: C1 C2 C3 In Series : 1 Ctotale = 1 σ 1 Cn Ici : 1 Ctotale = 1 1 C1 + 1 C2 + 1 C3 C1 C2 C3 In Parralel : Ctotale = Cn Ici : Ctotale = C1 + C2 + C3

MOTORCYCLE _2_ TR4NSIST0R The transistor is another basic component of most electronic assemblies. It acts like a gate enabling or disabling current in a circuit. When we plug an LED on a battery, the current passes directly through the LED, we can not control it. The transistor will enable us to turn on and off the current flow, and adapt the circuit to our needs. At the core of the transistor is a "semiconductor" material, that is to say a material which transmits the current only when it is itself connected to a current source. Today we use Silicon. pin3 1KΩ b The higher the voltage at pin3, the higher the current that passes through the circuit (and the LED). 5V c e NPN Transistor GND Why not simply use the pin3 to modulate the current that is sent through the LED and do without the transistor? Well, because the current generated by the source 5V is much stronger than that generated by the pin3. The pin3 can have a voltage of 0 to 5V but can not have a current as powerful as the 5V pin. The transistor thus acts as a current amplifier. The ratio between the current in our circuit and the current from the pin3 is called the current gain. There are two types of transistors: NPN and PNP, we will focus here on NPN. A transistor therefore has three ends: The base b The transmitter The Collector c Be careful, the transistor is polarized, meaning its meaning is important. For the NPN transistor, the transmitter (e) is connected to earth. Connecting it in the opposite direction could burn the transistor.

Step 3 Step 2 Step 1 MOTORCYCLE _3_ BUILD Start by inserting the motor in the Motor Block", and then add the wheels on their axes. Take a cross-shaped servo horn and insert it into the fork. Note that the two sides of the horn are not exactly the same length. "S" or "Short" indicates the short side, and "L" or "Long" indicates the long side. Then slide the wheel into the fork and fix it. Slide the "Servo" into the "Block" provided for this purpose.

Step 5 Step 4 MOTORCYCLE _3_ BUILD You can now fit all your parts on the "Frame". The Battery Block" is located under the "Frame", the "Breadboard" on the "Boardholder", above, and the "UNO Card" on its "Cardholder" on the highest clip. Finally, you only have to hang the "Servo Block" at the front of the "Frame". Then the Motor Block" at the back of the motorcycle and the "Fork" at the front of the vehicle. For more stability, you will need to screw the horn to the servo.

MOTORCYCLE _4_ DC MOTOR Now let us apply our new knowledge to our circuit. In previous robots we used the L293D chip directly to operate the car, but we didn t go through much detail. Now we will use the bike to understand more precisely how a motor works. A DC motor can be inserted easily into a circuit. Just connect one side to a current source and the other one to the ground. 5V M GND This simple circuit will work but shows some limits : - The motor can only go in one direction - It can not be controlled remotely - One can not control its speed - Finally, it may send an erratic signal (noise) to the card and degrade it. pin10 One solution is to use an NPN transistor. As we saw earlier, this component allows you to remotely control whether or not the current flows in our motor. By integrating it into our circuit, we can now turn the motor on and off with pin 10. 5V M c 1KΩ b e GND We also add a diode to the assembly. The diode is an LED that emits no light but forces the current to flow only in one direction. This is important because when the engine stops, its momentum can turn it into a generator! We must therefore protect our circuits from this current.

MOTORCYCLE _4_ DC MOTOR Now let s plug in our Arduino, you just have to take the transistor, a motor from month 4 and your Uno card. The flat face of the transistor must face us. Motor -> Collector Motor -> 5V Emitter - > GND Base -> pin10 Let's test our circuit with this code. Here we define our motor pin at pin 10 and we set the motor speed to 0. We then set the motor pin to output and initialize communication with the serial monitor. When we type a value in the monitor we do not type it in the same language that is understood by the computer. We need to translate it from a "symbol" alphabet into an "ASCII" alphabet as shown in the table below. If the typed number is greater than 0, e transform this input into a signal worth '1 and send it through pin10. The engine will then start. We then wait 2 seconds and turn off the engine. int moteur1 = 10; int vitmoteur = 0; void setup() { pinmode(moteur1,output); Serial.begin(9600); } void loop() { vitmoteur = Serial.read()-48; if (vitmoteur >0){ Serial.print(vitMoteur); int valeur=1; digitalwrite(moteur1,valeur); delay(2000); } digitalwrite(moteur1,low); } ASCII 0 1 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 Symbol NUL SOH / 0 1 2 3 4 5 6 7 8 9 : ; < = >?

MOTORCYCLE _5_ REMOTE CONTROL Now we can use the remote to control our engine and turn our motorcycle into a remote controlled vehicle. The circuit is quite simple, we use the unused part of the breadboard to recreate the circuit from month 5 with an infrared sensor ready to read the instructions of the remote control. To map the behavior of our robot to the keys of our remote control, we will use the library <IRRemote.h> as explained in part II of the construction guide of month 5. You will notice that our program does not always recognize the same signal coming from our remote control. Indeed, the infrared protocol of our remote control, or the order of the HIGH-LOW sequences emitted by the IR LED at 38KHZ is not always recognized by the library. If you want to retrieve much more accurate data, you can follow our tutorial on receiving custom IR signals on teamrobobox. In addition to receiving the instruction "engine on" or "engine off", our program must be able to rotate the front wheel of the motorcycle. We will use the "right" and "left" keys on the remote control to allow the motorcycle to rotate: Pressing "left" once will rotate the wheel 15 to the left Pressing "right" once will rotate the wheel 15 to the right. Pressing these buttons repeatedly increases the front wheel angle accordingly.

MOTORCYCLE _5_ REMOTE CONTROL We went through the different steps to build this robot: using the motor, the role of the transistor and the use of the infrared receiver. Let us now see how the whole circuit is organized. First we add two libraries : IRremote.h and Servo.h. We will use them to manage the remote control and the servomotor. Then we define several variables, motor1 will be the pin from which we will send our instruction to the engine. This pin will therefore be connected to the 'base' of the transistor. Then we will set the motor speed to 0 and we will define pin 5 as that of the infrared sensor. As in box5 we will create the two IRrecv and decode_results objects to hold the IR sensor data. In the setup() we will define motor1 s pin as an output, start the receiver and attach the servomotor to pin 3. In the loop() we will use the same code as in month 5 for the IR sensor data, but we will additionally run the action() function. #include <IRremote.h> #include <Servo.h> int moteur1 = 10; int vitmoteur =0; int IRpin = 5; long val; int servoangle; IRrecv irrecv(irpin); decode_results results; Servo servo1; void setup() { pinmode(moteur1,output); irrecv.enableirin(); servo1.attach(3); } void loop() { if (irrecv.decode(&results)) { val = results.value; action(val); irrecv.resume(); }; }

MOTORCYCLE _5_ REMOTE CONTROL The action() function takes as parameter the value received from this IR remote. This will be used to customize the behavior of our robot. The values received by the sensor depend on the buttons being pushed. You can go back to box 5 to see how to adapt these values to the values emitted by your remote control. The action() function will then direct our program to another function, depending on the value received: turnright() will rotate the front wheel to the right turnleft() will rotate the front wheel to the left Accelere() will start the engine. stop() simply stops the car. Your motorcycle should now be controllable with your remote control! If it goes too fast, do not hesitate to connect the transistor to the 3.3V pin instead of the 5V. void action(long token){ if(token == 16601263){ tournedroite();} else if(token == 16584943){ tournegauche();} else if(token == 16621663){ accelere(); } else if(token == 16617583){ arret(); } } void tournedroite(){ servoangle = min(180,servoangle +15); servo1.write(servoangle); } void tournegauche(){ servoangle = max(0,servoangle -15); servo1.write(servoangle); } void accelere(){ analogwrite(moteur1,1); } void arret(){ analogwrite(moteur1,0); } The motorcycle now turns left and right, but the 15 steps are not really "soft". The challenge of this month is therefore to create a function that increases the angle of the front wheel as long as a key (right to the left) is maintained. Good luck to you!

MAIN FUNCTIONS USED IN ARDUINO Here is a list of the most used functions in Arduino programs pinmode (Pin, Mode): Pin = Pin number on the card Mode = OUTPUT or INPUT Defines whether Pin data is sent (Output) or received (Input) into the card. digitalread (Pin): Pin = Port read by the function. Read the port 'Pin' to see its value (LOW for 0V or HIGH for 5V) digitalwrite (Pin, Value): Pin = Pin used Value = LOW or HIGH Sends a value via the 'Pin' port, either LOW for 0V or HIGH for 5V random (Start, End): Start & End = real numbers The random function gives a real number between the number 'Start' and the number End'-1. Delay(value): Value is an integer representing milliseconds. This will pause program execution for some time, given in milliseconds millis(): Displays the number of milliseconds since the program was launched Serial.begin(Baud) Baud = Integer. Serial.begin(Baud) initiates communication with the Arduino program interface. The Baud number corresponds to the 'BaudRate', that is to say the number of bits per second sent through the USB cable between our Arduino board and the computer. Establishing a communication between the Arduino and the computer allows you to monitor the execution of the program, to try to debug it, but also to send instructions from the computer to the card. Serial.println(Value): Value = Any variable This function is used to write the variable 'Value' in the Arduino interface. This command is especially useful for debugging our programs!

MAIN FUNCTIONS USED IN ARDUINO After writing your code, and sending it to your card, you will surely see some error messages. Here is a non-exhaustive list of common errors on Arduino: The card is not found When your card is not recognized by the program, you will see the message below: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt n of 10: not in sync: resp=0x00 We solve this error by clicking 'tools' in the menu bar of Arduino and then checking that the correct model of 'board' is selected, as well as the right 'port'. A ; was forgotten This is probably the most common mistake! One of the features of C (or C ++) is to require a semicolon ; At the end ofeach expression. Otherwise, you will get something like this : sketch_mar28a.ino: In function 'void loop()': sketch_mar28a:9: error: expected ',' or ';' before '}' token expected ',' or ';' before '}' token The syntax was inccorect Another characteristic of C / C ++ is to be 'case-sensitive' ie to understand a letter with a capital letter as different from a letter without capital letter. For example : digitalwrite( ledpin, HIGH); // will work DigitalWrite( ledpin, HIGH); // will not work You will get an error like this: «DigitalWrite' was not declared in this scope» Because C / C ++ thinks this is a function!