Embedded Programming and Robotics

advertisement
Embedded Programming and
Robotics
Introduction and Overview
Presented by
John Cole
Senior Lecturer in Computer Science
The University of Texas at Dallas, USA
Embedded Programming and Robotics -- Introduction
1
About the Course
• During the two weeks we will be together, our main
objective is to learn the fundamentals of embedded
programming on two processors: the Arduino and the
Raspberry Pi
• To do this, our main project will be to build a working robot
that can be controlled by various programs. We will use
both the Arduino and the Pi for this.
Embedded Programming and Robotics -- Introduction
2
About the Course
• You’ll work in teams of 4. You can select your own team.
• This is a collaborative effort, not a graded class; you are
encouraged to help each other learn
• By the end of the workshop, each team will have a working
robot and various programs for it
• We will also do other small embedded-programming
projects to illustrate principles
Embedded Programming and Robotics -- Introduction
3
About the Course
• We’ll be doing a little soldering, and we’ll use the multimeter
when necessary to check out circuits
• You’ll learn basic Python programming and gain some
familiarity with Linux if you don’t already have it
• Above all, we’re here to have fun while we’re learning
Embedded Programming and Robotics -- Introduction
4
About Your Instructor
• Six years as an adjunct (part-time) faculty member in the
Computer Science Department at The University of Texas at
Dallas from January 2006 through May 2012, full time senior
lecturer since then
• Taught at Collin College and, long ago, Illinois Institute of
Technology in Chicago
• 40 years of writing software in a large variety of industries
• Completed MS in Computer Science from Illinois Institute of
Technology and some work toward PhD
Embedded Programming and Robotics -- Introduction
5
Instructor Web Site
• Web page: www.utdallas.edu/~John.Cole
Embedded Programming and Robotics -- Introduction
6
Logistics
• We start at 9:30 every morning and finish the morning
session at 12:30
• One hour break for lunch
• Return at 1:30 and work until 4:30
• Breaks at 11:00 and 3:00 for about 10-15 minutes
• If you need to take a restroom break other than the
scheduled times, just go
• Please wear your nametag
Embedded Programming and Robotics -- Introduction
7
Workshop Format
• This will be done as a workshop, not a regular class
• This means that I’ll present for a while, never more than an
hour at a time and usually less
• After I have introduced a topic or defined a project, you will
work on it in your group
• Once everyone has finished or come to a stopping point,
we’ll discuss it as a class, then go on to the next topic
Embedded Programming and Robotics -- Introduction
8
Workshop Format
• If your group gets behind, try to catch up during lunch or
after class
• If I’m going to fast for the group, ask questions or ask me to
give you more time
• You can take photos of things I present if you like
• Slides and code will be made available on my Web site
Embedded Programming and Robotics -- Introduction
9
What You Should Already Know
• You should know how to program in C/C++ at some
reasonably good level
• You should have a basic understanding of the components of
a computer and how they work together
• An understanding of basic electricity is helpful, but I’ll cover
that
Embedded Programming and Robotics -- Introduction
10
Secondary Skills
• We will be doing a little soldering, but not much. If you want
to make things more permanent, you can get circuit
prototyping boards and solder components onto them.
• We will be doing a little mechanical assembly, but again, this
will be pretty simple.
• You should document your work so you remember what you
did. Often, we will build something, then take it apart and
build something else. Photos are great, and so are written
notes and diagrams.
Embedded Programming and Robotics -- Introduction
11
What We Will Cover: Week 1
Morning
Afternoon
Intro and logistics
Basic Electricity and precautions
Arduino Basics, including tools setup
C/C++ Refresher
Simple counter exercise
Transistor Basics
Sensor Overview
Robot Assembly: connecting the motors, basic wiring
LCD display and keypad
Mechanical design
The motor control chip
Simple program to move forward for 10 seconds and
stop
Program to turn in a circle for 30 seconds
The IR sensor and edge-following
Bluetooth communication
Controlling your robot from Bluetooth
Joystick control
Light sensors
Follow the light beam program
Temperature/humidity sensor: sending back status.
The range finder.
“Follow me” program
Interrupts and interrupt service routines
Intro to Raspberry Pi
Basic Linux commands
Using the GPIO pins
Introduction to Python: basic syntax, conditionals,
loops, GPIO access
Embedded Programming and Robotics -- Introduction
12
What We Will Cover: Week 2
Morning
Afternoon
Continuing Python: functions, the camera, Internet
access
More Python: Bluetooth, CURSES screen control
library, etc.
Robot control with the Raspberry Pi through
Bluetooth
Android control program
Robot controller with the Pi.
PWM on the Pi
The Raspberry Pi camera.
The OpenCV library
Roving camera
Programming the Pi in C/C++
More C/C++ on the Pi
Intro to Pi assembly language
Design your own program
Finish projects and discuss future direction
Embedded Programming and Robotics -- Introduction
13
Schedule Notes
• There are some basic things we must cover, such as Arduino
programming, Python, the basics of the boards, and so on
• However, if the class has a consensus on an additional
related topic, or expansion on some of the existing ones, I’m
open to suggestions
Embedded Programming and Robotics -- Introduction
14
Murphy’s Law
• Anything that can go wrong will go wrong
• Corollary: at the worst possible time
• This course involves wiring, electronic parts, and software you didn’t
write. Things will go wrong. Connections will come loose, chips will
burn out, programs won’t work the way you think they should, and so
on. This is all part of our craft. Don’t worry about it.
Embedded Programming and Robotics -- Introduction
15
Let’s Get Started!
Embedded Programming and Robotics -- Introduction
16
Download