MECH 400 Design

Download Report

Transcript MECH 400 Design

MECH 400
Underwater Glider Design Project
May 20, 2008
MECH 400 Tips and Tricks
1
Introduction
1.) Major electrical pitfalls from previous years
• Electrostatic Discharge
• Wiring
• Noise
• Grounding
2.) OOPic basics
• Common Blunders
• Variables and OOPic Math
• Pulse Width Modulation
• Events, Virtual Circuits and Gates
May 20, 2008
MECH 400 Tips and Tricks
2
Electrical Tips
May 20, 2008
MECH 400 Tips and Tricks
3
Shady Wiring Practices & ESD
Damaged equipment: $$ comes out of your own pocket
May 20, 2008
MECH 400 Tips and Tricks
4
Electrostatic Discharge (ESD)
• Electro-static discharge
– Sources: carpets, other types of floor, chairs in the
Fluids lab!!!
– Use a suitable workspace, keep food/drink far from
your work
May 20, 2008
MECH 400 Tips and Tricks
5
Electrostatic Discharge (ESD)
Preventative Measures
• Wear a $5 ground-strap (with 1MΩ resistor)
• Use a grounded working surface, or clip on to a power
supply chassis
• Please ask your TA how to set this up, if you are unsure
or worried about electrical shock!!!!
USE MIDDLE
PRONG ONLY
Aluminum Plate or Static Mat™
1MΩ
Use the ground prong (middle fat one ONLY!!!)
USE EXTREME CAUTION: Improper use will KILL you!
May 20, 2008
MECH 400 Tips and Tricks
6
Creative Wiring 101
• Do it right the first time, do it once
– Do it wrong: happy hunting
• Remember wires have mass, and occupy space!!!
• Last year
– One group’s AUV didn’t make it in the water due to
creative wiring. They were trouble-shooting on the
side of the pool until they ran out of time
May 20, 2008
MECH 400 Tips and Tricks
7
Creative Wiring 101
May 20, 2008
MECH 400 Tips and Tricks
8
Creative Wiring 101
• Use solder to make a firm connection
• Use shrink wrap to avoid shorts
• Use cable ties to organize or bundle
May 20, 2008
MECH 400 Tips and Tricks
9
Grounding
• Proper grounding is essential to reduce noise
– Cause for many problems last year
• Put a capacitor between power and ground to minimize
the AC noise
• Avoid ground loops
– This is where two grounding points have different
potential
– Use a central grounding point – don’t daisy chain your
grounds
• Use caution with power leads and chassis ground
May 20, 2008
MECH 400 Tips and Tricks
10
Electrical Noise/Disturbances
• All circuits are subject to environmental and local noise
– Sources: MOTORS, 60 Hz
• Typical mistakes
– Circuits work fine until the system is combined
– Long wire runs collect noise
– Improper grounding
May 20, 2008
MECH 400 Tips and Tricks
11
Reduce noise by proper shielding
– How do you shield?
– don't solder the shield
at both ends
• This creates a parallel
circuit, commonly known
as a ground loop.
• this will make the
problem worse!
– The shield will attach to the same connection point as
the ground.
– Antenna principal: the shield acts as an antenna for
noise – you don’t want to be feeding the noise into
your sensor.
May 20, 2008
MECH 400 Tips and Tricks
12
OOPic Basics
May 20, 2008
MECH 400 Tips and Tricks
13
Common OOPic/Speed Controller
Blunders
– Hooking the 9V battery up backwards
• NO reverse polarity protection on the OOPic
– Hooking up the speed controller signal pins
backwards to the power pins on the OOPic
– Don’t use more power than devices are rated for
May 20, 2008
MECH 400 Tips and Tricks
14
OOPic & Speed Controllers
• All documentation is online at www.oopic.com
– Pseudo C, and some tutorials
• Try figuring it out first, but ask if you don’t understand
May 20, 2008
MECH 400 Tips and Tricks
15
OOPIc Troubleshooting
• Know these steps!
• Problems uploading programs, or no response
1) Serial cable screwed into ports?
2) Check 9V power supply
3) Check voltage regulator for 5V output
4) Check EEPROM is seated properly
5) …and if all else fails
May 20, 2008
MECH 400 Tips and Tricks
16
OOPic Troubleshooting: if all else fails
• 5) Last ditch effort for OOPIc-R – Reset EEPROM
– Power OFF OOPic
– Remove the EEPROM chip CAREFULLY!!!!
– Power the board back up w/o the EEPROM chip
– Start download of program
– IDE will tell you that there is no EEPROM and will ask
you to reinstall it
• Make sure it is installed the proper direction (little
dot is pin 1)
• KEEP POWER ON
– Install the EEPROM and click OK
May 20, 2008
MECH 400 Tips and Tricks
17
Using Variables on the OOPIC
• Signed versus Unsigned
– 16 bit variables:
oInt is signed
oWord is unsigned
– 8 bit variables:
oChar is signed
oByte is unsigned
• When you define an object be careful to look whether it
is expecting a signed or unsigned value for the inputs or
outputs.
• Signed numbers use a 2’s Complement Representation
i.e. -x= (2N-x)
May 20, 2008
MECH 400 Tips and Tricks
18
Mathematics on the OOPIC
• There are not provisions for doing signed math on the
OOpic.
• Addition and Subtraction will still work with 2’s
complement numbers.
• Multiplication and division of signed values can be
handled by multiplying or dividing positive values
(equivalent to unsigned) and then adjusting the sign of
the result. For example: A* ( - B) = - (A * B).
May 20, 2008
MECH 400 Tips and Tricks
19
Pulse Width Modulation
May 20, 2008
MECH 400 Tips and Tricks
20
Pololu Speed Controller
• 2 Channel, 16 V Max input voltage + protection
• Things to note:
– Two IO Lines + PWM channel per motor
– Will have to make a cable (simple)
• The added benefit of reliability from these speed
controllers is worth the additional wiring hassle
May 20, 2008
MECH 400 Tips and Tricks
21
OOPic & Speed Controllers
• Documentation regarding driver connections are online
on the OOPic website
May 20, 2008
MECH 400 Tips and Tricks
22
Polling vs. “Interrupt” style
• What is polling?
• What is an interrupt?
• e.g. teacher checking for hand to raise
– Polling: teacher checks each person to see if their
hand is raised
– Interrupt driven: class manager informs teacher when
someone’s hand is up
May 20, 2008
MECH 400 Tips and Tricks
23
Real Time Systems and Polling
May 20, 2008
MECH 400 Tips and Tricks
24
Using Event Detection
May 20, 2008
MECH 400 Tips and Tricks
25
OEvent Features
• oEvents can be prioritized
– See oEvents on the online manual
– By default all events have equal priority
• BE CAREFUL: real time systems are a pain to debug!
• Do yourself a favor - make a nice flow chart!
May 20, 2008
MECH 400 Tips and Tricks
26
Event Programming
May 20, 2008
MECH 400 Tips and Tricks
27
oEvents and Logic Gates
• Powerful OOpic Objects that can be used with events
May 20, 2008
MECH 400 Tips and Tricks
28
Questions?
• Be prepared for lab demos
• Don’t debug during demo
• Persons requiring a basic run down or more
information regarding the OOPic operation can
stay behind and ask questions
May 20, 2008
MECH 400 Tips and Tricks
29