arduino for mechatronics 2017
play

Arduino for Mechatronics 2017 This note is for those contesting in - PowerPoint PPT Presentation

Arduino An Introduction Hardware and Programming Presented by Madu Suthanan, P. Eng., FEC. Volunteer, Former Chair (2013-14) PEO Scarborough Chapter 2 27 October, 2017 Arduino for Mechatronics 2017 This note is for those contesting


  1. Arduino – An Introduction Hardware and Programming Presented by Madu Suthanan, P. Eng., FEC. Volunteer, Former Chair (2013-14) PEO Scarborough Chapter

  2. 2 27 October, 2017 Arduino for Mechatronics 2017 • This note is for those contesting in the Mechatronics 2017 organized by PEOSC • You will be shown the essential Arduino hardware, important components, and basic programming techniques for this • I am a civil engineer whose hobbies include using Electronics, Arduino, Raspberry Pi, Beaglebone Black etc. • After this presentation you should be able to incorporate and program Arduino for use in Mechatronics 2017, and other applications.

  3. 3 27 October, 2017 Learning Outline • Section 1: Arduino Hardware ▫ This will introduce you to the various important parts of Arduino. • Section 2: Important components to use with Arduino: resistors, diodes, transistors, LEDs, motors and safety considerations ▫ Voltage, and current requirements and limiting values • Section 3: Arduino IDE (integrated Development Environment) ▫ How to download the program from the Arduino.cc web-site • Section 4: Arduino Programming (called sketches) ▫ How to think in pseudo-code and write comments ▫ Include Programming Codes (Sketches) ▫ Run the sketches • Section 5: Design your car to specifications ▫ Face the judges ▫ Race the cars – May the best win ☺ .

  4. 4 27 October, 2017 Hardware are the physical parts that you can see, touch or kick

  5. 5 27 October, 2017 S1. Objectives At the end of this Section you will know • the various important parts (and pins) of Arduino • Safety and precautions to take when working with Arduino, electronics ▫ About Limiting Voltages and Currents, to be covered in Section 2 • Breadboards (Prototyping Boards) and their use • Printed Circuit Boards (PCB), soldering etc. • How to power up Arduino.

  6. 6 27 October, 2017 Section 1: About Arduino • Arduino is an open source Microcontroller Development Board ▫ There are many models ▫ Many equivalent compatible models are also available • We use Arduino Uno Rev 3, the most popular model. ▫ It is built around Atmel’s ATmega328P microcontroller (μ C) ▫ It comes in 2 flavours:  Uses removable 28 DIL 328 μ C  Uses 328 μ C surface mounted Device (SMD) • We have supplied each type to your various teams. ▫ For all your purposes they work the same way

  7. 7 27 October, 2017 S1. The 2 models of Arduino UNO Rev 3 supplied 28 pin DIL removable μ C Surface Mounted Device (SMD) μ C 328 μ C 328 μ C

  8. 8 27 October, 2017 S1 The 2 rows of strips of Pins (actually sockets) are designed to accept sensors and The important parts of ARDUINO UNO R3 actuators, and to piggyback accessory boards called Shields. 5 Power Pins: Only Vin and Gnd is used to supply power to the board. You can use 6 to USB B 20 V. Recommended is 7 to 12 V. You can also supply same value power through the Jack, but not Both. 6 Analog IN pins (A0 to A5) . To connect Analog sensors. These can measure 1024 levels of small voltages. 14 digital IN/OUT pins (0 to 13) . When set as INPUT, they can accept sensors. When set Voltage as OUTPUT, they can supply 5 (HIGH) or 0 328 μ C Regulator: 5V out (LOW) Volts to control Actuators. INPUT, OUTPUT, HIGH, LOW are specified in the Sketches. Power Jack 6 Analog OUT pins (3,5,6,9,10,11). These are actually Digital pins which can output PWM Pulse Width Modulated signals, which imitates analog output. They can be used to dim LEDs and change speeds of motors.

  9. 9 27 October, 2017 S1. Safety Considerations • Electrically Arduino is very sensitive • Supply voltages should not: ▫ exceed 5 volts through the USB (normally USB voltages are regulated) ▫ Be within 6 to 20 Volts (recommended 7 to 12 volts), through the jack or Vin pin.  A built-in Voltage regulator keeps the voltages supplied to the board at 5 volts. • Output pins (0 to 13) supplies only 5 volts or 0 volts. • Do not exceed current drawn from each pin 40 mA.  Pins are NOT overload or short-circuit protected. Easy to damage 

  10. 10 27 October, 2017 S1 – Breadboards and their use • More aptly called Prototyping Boards ▫ Used mainly to try out circuits easily as component can be plugged in wires connected and retried easily. ▫ Once finalised, final circuit boards are made and the components are soldered in. • Please note: ▫ a1 to e1 (5 holes) – Row 1 Left bank (L): are internally connected. ▫ The internal connection for Row 3 L is shown. ▫ similarly all rows 1L to 30L, and rows 1R to 30R. ▫ The + holes are all internally connected (as shown) ▫ Similarly the – holes on Left, and + and – holes on right. • This provides an easy way of wiring your components and trying your circuits for proper working, and measure voltages, currents, resistances etc.

  11. 11 27 October, 2017 S1 – Printed Circuit Boards (PCB) • Once your prototypes are working, you can transfer your circuit to a Printed Circuit Board, if highly reliable circuits are desired. • Printed Circuit Boards can be customised to your needs. ▫ Useful if you are manufacturing many similar circuits. • You can also buy circuit boards which imitate the Breadboard layout. • What we have supplied is a simple one without any traces, but can be soldered the way you wish. ▫ It is a Universal Printed Circuit Board. • Soldering is a good skill to master. • Please do it under the supervision of an experienced teacher, parent or other adult.

  12. 12 27 October, 2017 S 1: Wrap-up • Use your Arduino carefully • It can be easily damaged by over voltage and overcurrent • Once you use it carefully, it is very rugged and has long life • Apply only recommended voltage to the specified points • Any Questions before we go to the next section?

  13. 13 27 October, 2017 Arduino uses Input sensors and output Actuators. Sensors: Switches, Light, Sound, Pressure, Temperature, Shock, Proximity, Position and others Actuators: LED, Motors, Speakers, Lasers and others Other components required: resistors, diodes, transistors, capacitors, inductors etc.

  14. 14 27 October, 2017 S2- Objectives At the end of this Section you will know • the various important components used with Arduino ▫ Understanding their values, ratings, and intended uses. • Safety and precautions to take with components in electronics and Arduino ▫ About Limiting Voltages and Currents, Wattages Well selected components with make the project work reliably as intended and lasts very long – years for most cases.

  15. 15 27 October, 2017 Main components used in Mechatronics 2017 • Resistors • Darlington Transistor • LEDs • Motors Read about above components in Part 1 of the Guidelines. Read about other components supplied and their uses for designing more advanced projects (after the contest) We have supplied LDR, diodes, transistors, capacitors etc. for your learning and use at your own pace after the contest.

  16. 16 27 October, 2017 Precautions when using components • Each component has: ▫ Name & Value.  Learn to recognise a component and read its value and the rated maximum voltage, current and power (Watt).  Use on-line Datasheets to get full details of components  Values are sometimes colour codes (resistances)  Wattage is sometimes by size of component  Sometimes resistors and inductors look same (we have not supplied inductors) • Part 1: Guidelines and notes in our web-site give good information on these.

  17. 17 27 October, 2017 Connecting LEDs • Can I connect an LED directly to an Arduino • Use a suitable to resistance in series. Th OUTPUT pin and ground? resistance has to drop 5 – 2 = 3 volts. • NO! • Also the current should not exceed 40 mA (for • Why not? the Arduino or 20 mA for the LED. Try to keep it to say 10 mA. = .01 Amp. • Because the LED may burn out and the • What is the resistance required? Arduino may get damaged. • By Ohms Law: • Explain. ▫ LEDs drop about 1.7 volts to 2.4 volts R=V/I = 3/.01 =300 ohms. depending on the colour and size. We can use the nearest available resistor. If ▫ Output pins of Arduino supply 5 Volts. necessary you can connect resistors in series ▫ So if an LED is connected directly, it will or parallel to get a suitable value. • overload the Arduino and the LED! What should be the power rating of the • So how do we connect an LED to Arduino? resistor? = I 2 R = .01 2 x300 = 0.03 W. So use ¼ W.

  18. 18 27 October, 2017 Example of connecting LEDs • Diagram shows how an LED is connected to Ground and pin 10 • Note to connect the LED the right way round. • It lights only if the Anode (the longer leg) is connected to positive side. • The resistor is connected in series. • You can connect more than one LED and in the program you can make them blink in various orders. (Not required for Juniors for Mechatronics 2017)

  19. 19 27 October, 2017 Connecting motors to Arduino • Can I connect a 6 V DC motor directly to an OUTPUT pin of the Arduino? • Oh NO! • Why not? • Arduino will be fried! • A motor when running may take 100 mA or more. When stalled (shaft stopped) it may draw more than 1 Amp. (Check these by using a meter carefully set to Amp). • Arduino can supply only 40 mA. • Solution. Use a Transistor which can take this current safely. Next slide I give a possible circuit. Read about Darlington Transistor (TIP120) and how to connect Use your own ingenuity and them and use of a resistor in our Guidelines and Notes Part 1. creativity to improve on it.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend