Robotics Session day 1

54
CIRCUIT S

Transcript of Robotics Session day 1

Page 1: Robotics Session day 1

CIRCUITS

Page 2: Robotics Session day 1

Electronic circuits?They are a combination of electronic components like resistors, capacitors, transistors etc.

Page 3: Robotics Session day 1

REsistorsThe ohm guy iscalled the Resistor.

Page 4: Robotics Session day 1

transistorsTransistors are an amazing device that can act as a switch.

Page 5: Robotics Session day 1

What do these circuits do?They make each and every thing around us. All the electronic things we see are made from a circuit board.

Page 6: Robotics Session day 1

A simple circuitA simple circuit to light up a bulb.(I know that’s a Boring example)

Page 7: Robotics Session day 1

A mouse with a simple enough circuit

Page 8: Robotics Session day 1

What about a proximity sensor?This circuit can sense any move-ment around it.That’s so very amazing.

Page 9: Robotics Session day 1

A computer motherboard

Page 10: Robotics Session day 1
Page 11: Robotics Session day 1

A motherboard is the major circuit board inside a computer that controls the entire computer. As you saw there were a large number of black boxes on it. So, what are these? The answer is an amazing technology that transformed the world we live in.

Page 12: Robotics Session day 1

Integrated circuit - the magical black box

Integrated circuit are a combination of different circuits elements mounted on a single chip of silicon. These blocks can reduce the size of a large circuit to less than a fingertip while increasing the efficiency.

Page 13: Robotics Session day 1

MicrocontrollersA microcontroller is a combination of processor, memory and input- output peripherals. It is a basically a small computer reduced to the size of a black box.

Page 14: Robotics Session day 1

Microcontroller

Page 15: Robotics Session day 1

What is programming a microcontroller?Programming a microcontroller means setting a set of instructions on the microcontroller to perform a task.The taskmay be addition of two numbers or lighting up an LED or running a motor.

Page 16: Robotics Session day 1

How to program a microcontroller?A software called a compiler is used to convert human level code to electronic instructions. Then these instructions are feeded to the memory of the microcontrollerand these instructions are executed when required.

Page 17: Robotics Session day 1

Arduino The

programmable circuit board

Page 18: Robotics Session day 1

What is an Arduino Board ?A programmable multi-purpose circuit board used to make projects. It is a learning platform for beginners in microcontroller programming.

Page 19: Robotics Session day 1

Describing different parts of Arduino 1: The microcontroller - Atmega328p2: The clock - 16 MHz

3: Input -Output pins4: USB programming port

Page 20: Robotics Session day 1

About the various parts of ArduinoThe microcontroller is the brain of the board. All the commands are given as input to the microcontroller and it works as a C.P.U to process them and gives the output.But it’s not a simple C.P.U or processor.

Page 21: Robotics Session day 1

The microcontroller gives output in the form of current or voltage that can be used to drive other components of a circuit for example- an LED or a motor.

Page 22: Robotics Session day 1

How do you think the controller work?There is a clock attached to the microcontroller that controls the amount of work done by the microcontroller in a second. This clock controls the number of things the controller can do in a second.

Page 23: Robotics Session day 1

The clock- basically a crystal that vibrates.It is similar to the crystal that controls your analog watch.

Page 24: Robotics Session day 1

The clock on the Arduino board here is of 16 Mhz. So, it can process 16 million instructions in a second.

Page 25: Robotics Session day 1

The USb programmer The Arduino board is an advanced board soIt can directly be programmed through aComputer software. There is a USB port available on the board for connecting it to the computer.

Page 26: Robotics Session day 1

The USB port connects the board to the computer. The Arduino software is used to write the program and then upload it to the board. The program then executes itself on the board.

Page 27: Robotics Session day 1

The input and output pinsDigital Input pins- There are 13 digital input/output pins on the board marked as 0-13. These pins can give output of 0V or +5V.They can also take input but only as 0V or +5V.

Page 28: Robotics Session day 1

Digital - meaningDigital means we will work with discrete values of voltages. Normally we use 0V as LOW signal and +5V as HIGH signal. Only these two values are used in digital electronics because they resemble binary numbers.1 - +5V , 0 - 0V.

Page 29: Robotics Session day 1

Analog pinsThe analog pins are named as A0-A5. These pins can be used to get an analog input. Analog means the voltage can be any value between and may not be just 0V or +5V.

Page 30: Robotics Session day 1

The reset buttonThere is a button on the corner of the borad . It is a reset button. Whenever we press this button , all the instructions feeded inside the board run from the very beginning.

Page 31: Robotics Session day 1

Power pins3.3V- This pin gives an output of 3.3 V.5V - This pin gives an output of 5V.GND- This pin gives an output of 0V.Vin- This pin is used to power the borad.

Page 32: Robotics Session day 1

How do we power the board?The board can be powered with a battery orAny other source having a voltage between 7-12 V. Different ways are- 1.Vin pin2.Black coloured jack

Page 33: Robotics Session day 1

Normally when connected to a computer, the board is powered by the USB port of the computer.

Page 34: Robotics Session day 1

Did you know?The USB port on your computer provides a constant voltage of +5V. This power is used by external cooling fans for laptops or computer or even to power any USB device.

Page 35: Robotics Session day 1

Why do we use Arduino ?1: Cheap circuit board2: Easy to use3: Multiple sensors and devices supported4: Open source project 5: Online support

Page 36: Robotics Session day 1

Where do we use it ?1.Make small playful projects.2.Make small robots.3.Implement some solution of a real life problem

4.Make projects related to IOT - Internet Of Things Video

Page 37: Robotics Session day 1

How do we code the board ?The Arduino IDE - the software on which wecode.What is this code? C /C++ - the language on which we code

Page 38: Robotics Session day 1

IMportant information1: GND= 0V2:The language used to write the code here is case sensitive. So, please write the code as shown to you. Don’t even miss a “;” or a “()” or”{ }”.

Page 39: Robotics Session day 1

Glow the on-board LED:There is an on-board LED near the mark L.We can switch on/off this LED via a code.

Let’s try to do some interesting things

Page 40: Robotics Session day 1

Instructions:1: Connect the wire to the arduino board.2: Connect the USB to the USB port.3: Open the Arduino software.

Page 41: Robotics Session day 1

Blink1: Go to File->Examples->Basics->Blink.

Page 42: Robotics Session day 1

Functions usedThere are two parts in our code that are enclosed in { }.These are called functions. Each function has a set of instructions.

Page 43: Robotics Session day 1

Void Setup() - This function is used to set up the initial conditions on the board. In this code we use a command called “pinMode” .This command tells the board the about the mode in which we want to use the pin. The mode is specified as shown - OUTPUT. This means the pin 13 on the board is going to give output of 0V or 5V as it is a digital pin.

Page 44: Robotics Session day 1

Void Loop() - This function runs on repeatedly once the program starts. After the setup gives the instructions about pin-modes, the instructions written inside the loop are ran continuously for infinite time until you switch OFF power.

Page 45: Robotics Session day 1

How to switch the LED on?The LED is a device that works when the longer end is connected to high voltage and shorter leg to low voltage. The on- board LED has it’s longer leg connected to digital pin 13 and shorter leg to GND=0V.

Page 46: Robotics Session day 1

So, when we give output as 5V on pin 13, the LED glows while when we give 0V the LED is OFF.

Page 47: Robotics Session day 1

Digitalwrite commandThis command is used to give output to a pin. The command “digitalWrite(13,HIGH);”means give an output of +5V on the pin 13.Here 5V=HIGH and 0V=LOW.

Page 48: Robotics Session day 1

Once you make the Arduino pin HIGH or LOW the output voltage does not change until you change it by a command. So, the output on pin 13 will be HIGH until we change it to LOW or HIGH again.

Page 49: Robotics Session day 1

Delay commandThe delay command is used to stop the reading of instructions for a given amount of time. The command “delay(1000)” means the code stops for 1000 millisecond or 1 second and then moves on.

Page 50: Robotics Session day 1

1:Write the given code.2: Go to Tools->Board ( Arduino/Genuino UNO)3: Go to Tools->Port-> (whichever port is shown).4: Click on the to upload the code to board.

Page 51: Robotics Session day 1

LED - change the delay time1: Change the blink time - delay() function.2: The given time is in Milliseconds3: Upload to board

Page 52: Robotics Session day 1

Let us program Different led1: Plug in the Longer leg of the LED in Digital pin 2 and shorter leg in digital pin 3.2: Copy the program as shown.3: Upload to board.

Page 53: Robotics Session day 1

Using multiple LEds1: Connect longer legs of LEDs to digital pins 2, 4 and 6 and shorter legs to 3,5 and 7.2: Copy the code as shown.3: Upload.

Page 54: Robotics Session day 1