1 / 25

South Jersey Robotics Club

South Jersey Robotics Club. June 2014 Meeting Presentation Topic – Intro to Arduino. Agenda. New Member Introductions! Building membership Show and Tell Maker Fare trip planning Intro to Arduino Next meeting planning… Lunch! But First…. Say hello to the Atlanta Hobby Robotics Club!.

zev
Download Presentation

South Jersey Robotics Club

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. South Jersey Robotics Club June 2014 Meeting Presentation Topic – Intro to Arduino

  2. Agenda • New Member Introductions! • Building membership • Show and Tell • Maker Fare trip planning • Intro to Arduino • Next meeting planning… • Lunch! • But First…

  3. Say hello to the Atlanta Hobby Robotics Club!

  4. Introductions • Please state your: • Name • Interests in this area • Software? Electronics? Mechanical? • Which platforms (Arduino, Pic, NXT, Vex, RasPi, etc.) • Level of experience • What you want to get out of the club • Quick description of any projects you’re currently working on or want to start

  5. Building Membership • Flyer was sent to several local high schools. • Comments on Flyer? • Ideas on how we can get the word out more?

  6. Show and Tell • http://www.popularmechanics.com/technology/how-to/gadgets/10-magnificent-builds-from-maker-faire-2014-7#slide-8 • Phoenix 3D Printer on the way! http://phoenix3dprinter.com • Xbox One Kinect coming for PC - July 15, $199

  7. NYC World Maker Fare 2014 • September 20+21 • Do we want to do a group ride?

  8. Intro to Arduino • What is it? • Hardware • Software • Boot loader • Sketches • How do you use it? • Basic Sketch structure • Basic wiring concepts • Libraries • Resources

  9. Hardware • Intended for the “artistic” crowd • Hence, SIMPLE to program! Take away all the headaches and focus on getting something working fast and easy. • Number of different models, each with different caveats. • Be careful of voltage levels (3.3V or 5V) • Processor speed, RAM, # pins, etc. • Best for getting started is the Uno / Leonardo • Small Flash storage on the chip for storing your program (1 at a time)

  10. Software – Boot Loader • Boot Loader comes pre-installed • Small program that knows how to interpret the Sketches. (Like the “Arduino OS”) • Simplifies a lot of the “dirty work” typical with microcontrollers • Can buy the AVR chips without the bootloader and then install it. • 99% of the time you don’t need to worry about this…

  11. Software – Editor • Simple free editor for making your own programs in. • Limited – no debugger, no breakpoints, but does have serial output display. • Pretty easy to add libraries, comes with lots of examples, color coding of statements, code formatting • Edit, manage, and upload your code right from here

  12. Software - Sketches • Your programs are called “Sketches” (comes from the artistic heritage of Ardiuno). • Very C-like with some simple OO mixed in. • Pretty simple to learn to do the basics. • Let’s look at one!

  13. Simple Sketch - Blink • 3 basic parts • Global Declarations • Setup() • Loop()

  14. Setup() Section • Happens 1 time, as soon as you turn the power on. • Describe what you want each pin to do (input, output) • Input – pinMode(10, INPUT); • Output - pinMode(13, OUTPUT); • Initialize any variables or objects you need here. • Also a good place to put the “5 second countdown” or anything else you need run only a single time at the start. (wait for a button press to start, etc.)

  15. Loop() Section • Where all the “Magic” happens! • Runs as soon as the Setup is done. • Repeats over and over until power is turned off. • Here’s where you actually read or write data to/from the pins you set up in the setup. • Read (Digital) – value=digitalRead(10); • Read (Analog) – value=analogRead(A0); • Write (digital) – digitalWrite(13, HIGH); • Write (PWM) – analogWrite(13, 130); • Let’s look at the Blink example…

  16. Analog vs. Digital = On 5.0 V 5.0 V 3.234 V = ??? 1.854 V 1.854 V = Off 0.01 V 0.01 V A-to-D (ADC) 255 200 64 0

  17. PWM • Remember in the previous slide we had this line: • Write (PWM) – analogWrite(13, 130); • Can only do this on certain pins on the Arduino…(Marked with ~) • What does this mean??? • Pulse Width Modulation – • Think of it as a % of intensity… (0-255 scale, maps to 0-100%) • 10% duty cycle – means that every second 1/10th of the time it’s set HIGH, the other 90% it’s set LOW • 50% duty cycle – means ½ time it’s HIGH, ½ time it’s LOW • If applied to a LED – changes the intensity of the light. • If applied to a motor – controls the speed.

  18. PWM Visually 80% 50% 20%

  19. Libraries • Arduino comes with a number of libraries to work with common hardware (buttons, Leds, servo motors, LCDs , Stepper motors, etc.) Examples for each as well! • Extensive stuff built in – time functions, serial input/output, and more! • Good language reference: http://arduino.cc/en/Reference/HomePage • Can add in libraries for new hardware (Pololu’s stuff for instance often has libraries to add to make working with their stuff simple). • Can make your own as well! (Common functions you always use… Can just import them into your sketches..)

  20. Upload and run! • When you’re ready, attach your Arduino over the USB port… • Select the proper USB interface (might have to install a driver on your machine…) • Compile and Upload your sketch… • Wait a couple seconds, and boom it’ll start running! It’ll run every time you give the board power too!

  21. There’s a LOT more to it… • Remember, don’t put EVERYTHING into to Loop() – You CAN call out to other functions you make… • Everything runs in a single thread of execution, so remember that if the processor is busy reading something, or waiting for a button press, or looping through a big array, it’s NOT doing anything else. • Some advanced techniques can be used to get around this, but it’s far from straightforward. • Interrupts • Don’t be wasteful! VERY limited memory!!! • Other interfaces (I2C, I2S)

  22. Suggested Progression • Start out using shields (a motor shield is usually a good starting point for a robot). • Lets you worry more about the programming… • Remember, shields hog certain pins, can’t reuse pins for multiple shields! • Once you get the hang of it, then move to using smaller modules that you wire up (e.g. TB6612FNG motor controller breakout board) • More flexibility in terms of size/shape/power/combinations of functions. • If you are REALLY good with electronics, then you can do low level circuit design with individual chips, etc. • E.g. TB6612FNG, (just the chip) • And we all bow down to your EE greatness!

  23. For Example, my Sumo Bot… • First Gen: Uno + Motor Shield • Second Gen: Nano + TB6612FNG motor module

  24. Questions??? • Good reference book : “Beginning Arduino” • Covers both basic hookup of devices, as well as the code. • Be careful buying shields if you pick up a 3.3V Arduino (like the Due). Many expect 5V… • Don’t fry the board!!! Most of the pins are only made to handle 100ma Max! • The board itself will run off USB power, but usually to drive anything else hooked up to it, you’ll need to plug in the aux power (wall jack, battery pack, etc.) • Don’t let pins “float” – always use pull up/down resistors • Lots of 3rd party compatible devices – Pololu Orangutan series, Netduino, Mintduino, RFDuino, etc.

  25. Next meeting • What’s a good date? July 12? 26? • Location? • Topic? • Some Ideas: • Build a simple robot • OpenCV for beginners • Intro to ROS (Robot Operating System) • Maze Solving • Obstacle detection and avoidance/tracking • Web based robot control interface • Line following / line sensors / PID control • Basic Electronics/ Circuits • Mini Sumo • IMUs + GPS • Filtering (Particle / Extended Kahlman) • Encoders • Raspberry Pi primer • How to use an O-Scope / Logic Analyzer • How to use EagleCAD • How to Solder

More Related