EECS 192: Mechatronics Design Labee192/sp20/slides/dis1-intro.pdfOne weird trick to unk ee192! image...
Transcript of EECS 192: Mechatronics Design Labee192/sp20/slides/dis1-intro.pdfOne weird trick to unk ee192! image...
EECS 192: Mechatronics Design LabDiscussion 1: Introduction
GSI: Ducky Lin, Derek Chou
January 22, 2020 (Week 1)
1 Administrivia
2 FRDM Board Intro
3 Soldering
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 1 / 21
Administrivia Getting Started...
Welcome
Welcome to EE192!
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 2 / 21
Administrivia Getting Started...
Project
I Project: build an autonomoustrack-following racecar given a stockchassis and microcontroller dev kit
I Teams should be 3 studentsI Combined skillset should include
mechanical design / fabrication,electronics, programming
I Controls experience helpful
I Teams formed by checkoff FridayI Read the competition rules
I NATCAR
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 3 / 21
Administrivia Getting Started...
Checkoffs
I One-hour time slot on Friday TBD todemonstrate that your project is where itshould be
I At least one team member needs to showup to run your hardware
I These are graded, half credit if late
I First checkoff this FridayI Form project teams and check out carsI Trade a $300 deposit check for a carI Get private course GitHub repositoryI Details on website
Get your cars!
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 4 / 21
Project Detail
The Project in more detail(Project Proposals Due February 7, 2020)
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 5 / 21
Project Detail Overall Philosophy
Planning & Reliability
I Get started early thinking about how toapproach the project
I Measure once, cut twice, then hammer
I Measure twice, cut onceI Start thinking about high-level project plan
I Plan ahead and examine feasibilityI Get feedback on design ideas
I Reliability first, THEN performanceI “Better is the enemy of the good enough”I Very fast car going into a wall (and
breaking) gets you few pointsI Fast enough car hitting all of the checklist
items gets you all the points
One weird trickto flunk ee192!
image from LOLCaption.com
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 6 / 21
Project Detail Mechanical Design
Mechanical
I Goal: Solid plan for mounting boards /other mechanisms
I Level of detail: screw holes, dimensions
I Paper and pencil is acceptableI Possibly even the most expedient solution
I Cameraphone to take and annotate photosI Draw over picture in Paint or PowerPoint
I Can even be physically accurate
I SolidWorks only if you know howI Parametric CAD is really, really nice, but
not worth learning for this
Use the provideddiagrams!
Links: (top) (side) (CAD)
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 7 / 21
Project Detail Electrical Design
Electrical
I Goal: Motor driver design, power supplydesign and board layout plan
I Understand the boards we give you, andmake your own!
I EDA toolsI free & open source: (KiCAD, shown here)
I freemium: (DipTrace) (EAGLE)
I Tutorials for each can be found on theinternet
Schematic
Board
3D Render
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 8 / 21
Project Detail Theory
Car Critiques (Next Week)
I Goal: don’t reinvent the wheelI Assist in understanding all of the pieces
that go into the projectI Take design cues from those who came
before you - recognize and use good ideasI Conversely, learn from others’ mistakes,
so you don’t have to repeat them
I Some design points to consider:I RobustnessI MaintainabilityI Design for TestI Graceful error handlingI Anything else you want to add?
It’s been done before(don’t repeat it!)
©Fox
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 9 / 21
BeagleBone Blue Intro Hardware
Hardware
I Beaglebone Blue (BBBL)I Octavo Systems OSD3358 Processor
I 1 GHz ARM Cortex-A8I 4 GB 8-bit eMMC flash storageI 512 MB RAM
I Program over network via USB or WiFiI I/O connectors including
I GPIOI 12-bit SAR ADCI USB2.0, I2C, SPI, and UART
I LEDs, Buttons, 9-axis IMU, Barometer
Beaglebone Blue Boardimage from BeagleBoard.org
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 10 / 21
BeagleBone Blue Intro Board Refresher
IO Refresher
I GPIO (general purpose input/output) pins(strawsondesign.com GPIO link)
I Output: sets pin voltage from software:either GND (0) or Vdd (1)
I Input: samples pin voltage:0 (low) or 1 (high)
I PWM (pulse-width modulation) module(strawsondesign.com PWM link)
I Every period, the pin is high based on theduty cycle, then low for the remainder
I Can digitally approximate analog outputs
I Analog Inputs (ADC) (strawsondesign.comADC link)
I Converts a continuous analog voltage(0-1.8v) to a 12-bit (0-4095) quantity
Beaglebone Blue pinout
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 11 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would happen if the GPIO was 1?
I The GPIO output would be 3.3v,and the LED lights up
I What if the GPIO was 0?
I Nothing: the GPIO would be 0v,and no current flows across the LED
I What if the GPIO was PWMed?Pulse Width Modulation (PWM) toggles an output
between 0 and 1 ”really fast”, controlling the on
and off ratio
I The LED would light at half intensity,but it may be (perceived as brighter)
”Analyze” this simplecircuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 12 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would happen if the GPIO was 1?I The GPIO output would be 3.3v,
and the LED lights up
I What if the GPIO was 0?
I Nothing: the GPIO would be 0v,and no current flows across the LED
I What if the GPIO was PWMed?Pulse Width Modulation (PWM) toggles an output
between 0 and 1 ”really fast”, controlling the on
and off ratio
I The LED would light at half intensity,but it may be (perceived as brighter)
”Analyze” this simplecircuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 12 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would happen if the GPIO was 1?I The GPIO output would be 3.3v,
and the LED lights up
I What if the GPIO was 0?I Nothing: the GPIO would be 0v,
and no current flows across the LED
I What if the GPIO was PWMed?Pulse Width Modulation (PWM) toggles an output
between 0 and 1 ”really fast”, controlling the on
and off ratio
I The LED would light at half intensity,but it may be (perceived as brighter)
”Analyze” this simplecircuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 12 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would happen if the GPIO was 1?I The GPIO output would be 3.3v,
and the LED lights up
I What if the GPIO was 0?I Nothing: the GPIO would be 0v,
and no current flows across the LED
I What if the GPIO was PWMed?Pulse Width Modulation (PWM) toggles an output
between 0 and 1 ”really fast”, controlling the on
and off ratio
I The LED would light at half intensity,but it may be (perceived as brighter)
”Analyze” this simplecircuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 12 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would the GPIO read if the switchwas pressed?(shorted)
I The GPIO would read 0,because of the 0v at the pin
I What if the switch was not pressed?
I The GPIO would read 1,because of the 3.3v at the pin.
”Analyze” this simplecircuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 13 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would the GPIO read if the switchwas pressed?(shorted)
I The GPIO would read 0,because of the 0v at the pin
I What if the switch was not pressed?
I The GPIO would read 1,because of the 3.3v at the pin.
”Analyze” this simplecircuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 13 / 21
BeagleBone Blue Intro Board Refresher
Exercise: Hardware from Software
I What would the GPIO read if the switchwas pressed?(shorted)
I The GPIO would read 0,because of the 0v at the pin
I What if the switch was not pressed?
I The GPIO would read 1,because of the 3.3v at the pin. ”Analyze” this simple
circuit
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 13 / 21
BeagleBone Blue Intro librobotcontrol
Robot Control Library
I C library hardware interface for BeagleboneBlue
I Examples and testing programs available
I Documentation:http://strawsondesign.com/docs/
librobotcontrol/index.html
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 14 / 21
BeagleBone Blue Intro librobotcontrol
“Hello, World!” Code
#include <stdio.h>
#include <robotcontrol.h>
int main()
{
printf("Hello World !\n");
rc_led_set(RC_LED_GREEN , 1);
rc_usleep (500*1000);
rc_led_set(RC_LED_GREEN , 0);
rc_led_cleanup ();
return 0;
}
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 15 / 21
BeagleBone Blue Intro connecting
Detour: How to not kill your BeagleBoneBlue
I The supply of replacement boards islimited...
I Only power board from USBI Do NOT use the barrel jack or the LiPo
connectorI because of a deficiency in the circuit
design, this may fry the boardDon’t let this happen
to you
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 16 / 21
BeagleBone Blue Intro connecting
Detour: How to not kill your BeagleBoneBlue
I Your body builds up static chargeI ... just by walking, especially when dryI ... and up to several kV
but under ∼2kV is imperceptible
I Chips are sensitive to high voltages:may cause permanent damage
I read: board stops working“for no reason”
I Remember to ground (discharge)yourself before handling sensitiveelectronics
I Touch the grounded lab bench surfaceI Use a ESD wriststrapI Avoid touching traces on boards
Don’t let this happento you
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 16 / 21
BeagleBone Blue Intro connecting
Getting Started with your BeagleBone Blue
I We will be releasing a starter project soon...I Two (not mutually exclusive) documented options
for development environment:
I Eclipse IDE on computer, cross-compilingto BBBL
I Command-line compilation on BBBL
I Setup directions to come soon!
I Reference the librobotcontrol API athttp://strawsondesign.com/docs/
librobotcontrol/index.html
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 17 / 21
BeagleBone Blue Intro connecting
Hello, World! Demo
Live Demo!connect to Beaglebone Blue, print ”Hello World”, toggle LEDs, GUI debug in Eclipse
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 18 / 21
BeagleBone Blue Intro Version Control
So, how are you going to manage your code?
I main.cppmain 1.cppmain final.cppmain really final.cppwhat a disorganized mess
I on a single team member’s laptopwhat if their hard drive fails?or they’re out sick during checkoff day?
I by emailanother disorganized mess
I by email, with code in .doc filesI don’t even...
Don’t let this be yourcode. ©Fox
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 19 / 21
BeagleBone Blue Intro Version Control
Use Git!
I Git: distributed version control softwareI Each commit: like complete snapshot
I Full version history:you might not realize it now,but you’ll be glad you had it
I Distributed: everyone has compete copyI Most operations local, periodically sync
I Allows branching for concurrent work,which can be merged
I Best PracticesI Small, logical, frequent commitsI Write good commit messagesI Keep master clean
git logo, by Jason Long, CC BY 3.0
Learn git here:try.github.io
Ducky, Derek (UCB EECS) Mechatronics Design Lab January 22, 2020 (Week 1) 20 / 21