Download How to Wire and Test Your Rover

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Electrification wikipedia , lookup

Power engineering wikipedia , lookup

Buck converter wikipedia , lookup

Brushless DC electric motor wikipedia , lookup

Induction motor wikipedia , lookup

Voltage optimisation wikipedia , lookup

Brushed DC electric motor wikipedia , lookup

Phone connector (audio) wikipedia , lookup

Metadyne wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Alternating current wikipedia , lookup

Portable appliance testing wikipedia , lookup

Automatic test equipment wikipedia , lookup

Rectiverter wikipedia , lookup

Wire wrap wikipedia , lookup

Mains electricity wikipedia , lookup

AC adapter wikipedia , lookup

Industrial and multiphase power plugs and sockets wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Stepper motor wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
How to Wire and Test Your Rover
Table of Contents
Resource Material ......................................................................................................................................... 1
Wiring Instructions........................................................................................................................................ 1
Hello World ................................................................................................................................................... 2
DC Motors ..................................................................................................................................................... 2
Stepper Motor .............................................................................................................................................. 3
Servo ............................................................................................................................................................. 3
Laser .............................................................................................................................................................. 3
IR Sensors ...................................................................................................................................................... 4
Medium Range IR Sensor .......................................................................................................................... 4
Medium IR Sensor ..................................................................................................................................... 5
Gyro............................................................................................................................................................... 7
XBee .............................................................................................................................................................. 8
Resource Material
1. System Interface Matrix
2. Rover Wiring and Test Instructions
Build your rover as described here. DO NOT ADD WIRES. Follow the following instructions to wire and
test your rover.
ON
OFF
Power ON/OFF Sequence
Turn on or plug in 9v adapter to Arduino. Do not power on/off the power adapter itself.
Plug in the USB
Unplug USB
Turn off or unplug the 9v adapter.
Wiring Instructions
The systems engineering document is designed to aid students in connecting the elements to the Motor
Shield board. The motor shield can be purchased through the Adafruit website. The DC motors, gyro,
medium range sensor, and bipolar stepper motor can be purchased through different vendors. A full list
of vendors can be found on the Reference Design document. The following are Fritzing diagrams and
1|Hill
actual photos. The Fritzing drawing program is a free download. Some of the elements used in the
diagrams were developed using outside software such as the medium range sensor.
Hello World
Reading: http://learn.adafruit.com/adafruit-motor-shield/overview
Download the Rover Test Suite and place in your Arduino script folder.
Arduino Only
Plug in USB
Upload Laser Blink
Open the Serial Monitor and look for Hello World
DC Motors
Reading: http://learn.adafruit.com/adafruit-motor-shield/using-dc-motors
Wire your motors as shown in the picture.
Testing
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Plug in motor shield without L293Ds
Upload DC Motor
Wait for “DC motor test!” to be displayed on the Serial Monitor
Verify 74HCT595 Pin Values
Logic 1 = Pins 1 (M2A), 2 (M1A), 9 (QH*), 10 (SCL wired to Vcc), 11 (SCK)
Otherwise logic 0.
Key pins are M1A and M1B = 102 and M2A and M2B = 102 which are wired to the L293Ds
configuring the H-Bridges to turn the motors in the positive FORWARD direction.
Wire in Battery Connector (DO NOT plug in the battery) and DC Motors to the Motor shield
(Red, Black, Blank, Red, Black).
Plug in IC1 74HCT595 with Heat Sink.
Use a small screwdriver to push the IC down so the pins are securely in place. This heat sink gets
in the way and is a major source of failure as it continues to pull the IC out of its socket.
Place the rover on a fixture (small box) so the treads can spin freely
2|Hill
12. Verify that the 7.2v NiCd battery is charged.
13. Plug in a 7.2v NiCD battery
14. The treads should now spin so the rover moves forward. Reverse the polarity of the wires going
to the DC motor if needed.
Stepper Motor
Reading: http://learn.adafruit.com/adafruit-motor-shield/using-stepper-motors
Testing
1.
2.
3.
4.
5.
6.
7.
Upload Stepper Motor
Wire in the Stepper Motor to the Motor shield (Green, Black, Blue, Red).
Plug in IC2 74HCT595 with Heat Sink.
Again use a small screwdriver to seat the IC in the socket.
Verify that the 7.2v NiCd battery is charged.
Plug in a 7.2v NiCD battery
The stepper motor should now spin the clockwise (FORWARD) direction.
Servo
Reading: http://learn.adafruit.com/adafruit-motor-shield/using-rc-servos
http://www.csulb.edu/~hill/ee444/Labs/7%20Servo%20Lab.pdf
1. Add extension cable harness to the servo, using the following color code:
Brown to Black
Ground
Red to Red
Power
Orange to Yellow
Signal
2. Plug into the Servo 1 connector again following the color code above.
3. Upload Servo test script
4. The servo should now rotate up (positive step) and down (negative step).
Laser
3|Hill
The laser diode used in the AIXIZ modules is designed to operate from a 3.2 volt DC supply @35mA.
Both the Arduino Uno and Duemilanove come with 3.3v regulated power supplies. The Arduino Uno
uses a LP2985-33DBVR 3.3 Volt LDO regulator (Digi-Key 296-18476-2-ND) which can source up to
150mA. The Arduino Duemilanove uses a FT232R USB UART IC with an integrate 3.3 Volt LDO regulator
that can source up to 50mA. Now all we have to do is add a switching circuit. Although the Atmega328P
can source and sink up to 25 mA, I would not recommend wiring the laser diode directly to one of the
GPIO ports of the microcontroller. Here are two low cost design options.
1. Use a 2N2222 (or 2N3904) NPN bipolar with 22 Kohm base resistor. You may also design your
own nMOS or pMOS FET or 2N2907 PNP transistor switch or current limiting circuit. For FET
circuit add a 10Kohm pull-down resistor wired to the base to avoid turning on the laser on reset.
3.3v
Transistor
Pinout
C
B
E
Laser Diode
Module
C
Digital Pin 2
B
22 K
2N2222
E
2. Use a Texas Instruments CD74AC05E Open-collector hex inverter (Digi-Key 296-4219-5-ND,
$0.62) sink current = 24 mA/pin plus a 14-DIP IC socket (Digi-Key AE9989-ND). Unlike a tytpical
TTL push-pull (totem-pole) output, you can tie the outputs of an open collector IC together.
Wiring the inputs together, your IC can now safely switch the 35 mA needed by the Laser Diode.
Testing
1.
2.
3.
4.
Plug in USB
Upload Laser Blink
Open the Serial Monitor and look for Hello World
The Laser should repeatedly turn on for a second and then turn off for a second.
IR Sensors
Medium Range IR Sensor
Solder Connectors for Medium Range Sensor (GP2Y0A02YK)
GND
GND
VCC
VCC
VO
Analog In Pin 1
4|Hill
Medium IR Sensor
The following diagram shows the connections made to test the Medium Range Sensor, which
will enable us to obtain readings to calibrate the sensor for future labs.
1. Wire a 4.7K resistor between AREF and 3.3v.
2. If you have not done so already add a 9v supply. During each test run your Arduino should be
powered from a power adapter or a fully charged/new 9v battery. I would strongly recommend
running from a power adapter so you do not need to worry about running out or battery power
or have to spend money replacing these batteries.
3. Upload IR Sensor test script
4. Verify that the 3.3 v is in fact 3.3 v. If it is not make sure your 9v power supply is in fact at 9v.
5. The AREF voltage should now be not less than 3.2 v (i.e., the voltage drop across the resistor
should be less than 0.1 v).
Testing Tip: Do not hold the Multimeters probe tips and the test leads unless you want to
measure the voltage generated by your body
6. If the voltage drop is greater than 0.1 v, then calculate the current through the resistor and
select a new resistor using ohms law which drops the voltage by no more than 0.1 volts (AREF =
3.2 v). The resistance value should not be less than 750 ohms. For my board the drop was
approximately 470 mA which meant I needed to replace my 4.7K resistor with a 1K resistor. The
resulting drop was 0.1 V.
7. Wire the power and ground of the medium range IR sensor with a 10 uF tantalum capacitor. Be
sure and observe the correct polarity.
5|Hill
Source: http://www.marvac.com/fun/tantalum_capacitor_codes.aspx
8. Wire the output of the medium range IR sensor to Analog Pin 1 with a 0.01 uF (10 nF) filter
capacitor. If you are thinking about skipping the addition of these capacitors please read the
article http://www.robotroom.com/DistanceSensor3.html. To quote the author:
“So, now you see that following the manufacturer’s instructions of adding an appropriate
amount of capacitance is really important. It isn’t magical pixy dust, CYA, or guesswork.”
The author also recommends a 47 nF filter capacitor in place of my 10 nF. You are invited to try
different capacitor values in the nF range.
9. Apply power and upload IR sensor test script if needed.
10. As you move a target (piece of paper works) you should observe the values displayed on the
serial monitor vary between 0 and 1023 with the profile (not voltages or distances) shown here.
11. Wire the two red power and ground wires of the long range IR sensor. For my rover I only used
one 10 uF capacitor between the two sensors.
12. Wire the output of the long range IR sensor to Analog Pin 0 with a 0.01 uF (10 nF) filter
capacitor.
13. Modify the IR Sensor test script to monitor the output of the long range sensor.
#define IRsensorPin A0
14. Power up rover and upload the updated IR Sensor test script
15. As you move a target (piece of paper works) you should observe the values displayed on the
serial monitor vary between 0 and 1023 with the profile (not voltages or distances) shown
previously.
6|Hill
Gyro
Reading: http://www.pololu.com/catalog/product/1272
The picture below shows the way the male header pins are soldered into the gyro. Once the gyro is
properly soldered it will be placed on the mini solderless breadboard.
1. Install the breakout in the breadboard as shown in the figure below (chip inverted). When the
sensor is installed upside down, it will give a positive value for clockwise rotation and a negative
value for counterclockwise rotation about the z-axis.
7|Hill
2. Wire the gyro as defined in the following table and shown in the picture above.
Arduino Uno/Duemilanove L3G4200D Carrier
5V
⇨
VIN
GND
⇨
GND
Analog Pin 5
⇨
SCL
Analog Pin 4
⇨
SDA
3. Download the Arduino library for the L3G4200D.
Arduino versions less than 1.0 (.pde extension)
https://github.com/pololu/L3G4200D
Arduino versions less than 1.0 (.ino extension)
https://github.com/pololu/L3G
4. Upload Gyro test script. Open the serial monitor window. The test program continuously
displays the output of the gyro.
Example output:
G X: 170 Y: 779 Z: 171
G X: 48 Y: -501 Z: -84
G X: -87 Y: -84 Z: 39
XBee
Wire your Xbee as defined in the following table.
Arduino
+5v
GND
Digital Pin 2
Digital Pin 3
Xbee
+5v
GND
TXD
RXD
This test your XBee will need an extra piece of software. It’s called X-CTU and it can be downloaded from
http://www.ladyada.net/make/xbee/download.html
Make sure to download and install the latest version so it would be compatible with at least windows
vista or higher.
1- Download and install X-CTU
2- Connect each XBee module to the computer with USB and go to X-CTU, click on the Modem
Configuration tab, and click on the download new version to make sure that the XBee module is
running the latest version.
3- On each XBee module, after updating the software, scroll down to Serial Interface, then click on
Interface Data Rate, and choose 19200. This is necessary for the XBee to communicate
wirelessly. Once that is selected, click on Write to store the new setting in place.
8|Hill
4- Now connect one of the XBee modules to the Arduino following this diagram
Arduino
Xbee
+5v
+5v
GND
GND
Digital Pin 2
TXD
Digital Pin 3
RXD
5- Power up the board and upload XBee_test.pde
6- Once uploaded open serial monitor , this should appear
7-
Now on the windows side, go to the X-CTU and click on the Terminal tab, you should be able to
monitor the characters flowing in from the Arduino board as shown here.
9|Hill