Introduction: Seaperch

A Step toward Autonomy

This Seaperch was developed for the U.S. Naval Academy’s STEM Program in an initial effort to develop an autonomous Seaperch.

It employees an Arduino Uno R2 microcontroller and several sensor modules- all powered by a 12V, 9800mAh Lithium Polymer battery. It uses a 12Vdc RF remotely activated switch to control power on/off; an Adafruit V2 Motor Shield for motor control; an Adafruit Wireless SD Shield used in conjunction with 2 ZigBee Series 1 Modules for wireless communications between the Arduino and the computer; an Adafruit INA219 current/voltage breakout module, to monitor battery voltage and load current; an Adafruit 9DOF breakout module that incorporates an accelerator, gyroscope and magnetic compass; a Freescale MPX5500 pressure sensor to maintain depth and various other electronic devices.

At present, the plant can control depth using the MPX5000 pressure sensor’s output and theoretically can measure pressure of up to 72.5 PSI and maintain depths of up to approximately 170 feet.

It communicates wirelessly through two XBEE wireless modules and other associated hardware, which provides the ability to wirelessly upload Arduino sketchs and monitor and display all sensors outputs.

Since the state of the battery is highly important, the INA219 current/voltage sensor measures battery bus voltage and system load current, which are displayed by the Arduino Serial Monitor.

With further development, the 9DOF module will provide speed control via its accelerator, stability control via its gyro and direction control via its magnetic compass. At present, these functions have not been fully incorporated, but their respective outputs are measured and displayed by the current Arduino sketch and the Serial Monitor.

Step 1: Step 1: Details

USNA Seaperch

Sensor Suite

By: J.C. Johnson

Modifications to Seaperch structure, mounting technique and wire connections

Increase the width of the seaperch cross members from 4.5” to 5.5” to accommodate a 5” x 6” aluminum mounting plate and 5” x 7” x 3”, waterproof enclosure that houses an Arduino Uno, the Adafruit V2 Motor Shield, an INA219 current/voltage breakout module, Arduino Wireless SD Shield, a 9DOF breakout module and the 12V- 9800mah Lithium-Ion Battery.

The motor mount surface was modified by filing the horizontal and vertical members with half- round file to a depth and width to accommodate the motor’s circular structure. Replaced existing motor mount tie–wraps with quarter-twenty - 3” x 1-3/8” threaded U-bolts, metal backing plated and end-cap beauty nuts to protect the exposed threads of U-bolts and applied shrink-wrap tubing to U-bolts to minimize rusting of their exposed surfaces.

Cut the Ethernet tether connection from the Seaperch end of the Ethernet cable to a length of approximately 18”. Remove 6” the outer jacket of the cable. Insert the cut end of the cable into one of cable glands installed in the Water-Proof housing. Strip ½” off, then fold and tin the ends of the expose wire pair and connect each pair to the corresponding (M) motor connections of the V2 Motor Shield as follows:

Orn/Orn-Wht pair to the left/right connector of M1

Blu/Blu-Wht pair to the left/right connector of M2

Grn/Grn-Wht pair to the left/right connector of M3

Brn/Brn-Wht pair to external battery charger connector

Attach an RJ-45 connector, using Table 1 as a guide, to the other end of the Ethernet tether that was cut. This end will then be connected to the out-board side of a water-tight Ethernet cable gland installed in the enclosure. This allows the seaperch to be disconnected from the controller when not in use. Cut and use a piece of Ethernet cable, approximately 6” long, that has a RJ-45 male (Jack) connector on one end and nothing on the other end. Remove about 3” of the outer jacket from the cut end of this piece of cable to expose the wire pairs of the cable. Strip 1/2” from the ends of each wire pairs- taking care not to nick the copper conductor. Fold and tin the exposed ends of each conductor. This adds strength to the small wires of the Ethernet cable. Connect the RJ-45 end of the Ethernet cable to the in-board side of the Ethernet gland then connect the tinned ends to the respective V2 Shield’s Digital Input pins- referring to the following as a guide.

RJ-45 pin# Wire Color V2 D-I/O pin

1 ORN/WHT D3

2 ORN D2

3 GRN/WHT D5

4 BLU/WHT D7

5 BLU D6

6 GRN D4

7 BRN/WHT +5V

8 BRN GND

MPX5500 Sensor wiring

Use a 6” piece of Ethernet cable with the jacket completely removed to connect the MPX5500 to the corresponding Analog input of the V2 Motor Shield as follows.

(See MPX-5500 data sheet)

Pin1 - (notched) WHT/ORN wire- Sensor output to Shield input (A0)

Pin2 - BLUE wire System Ground

Pin3 – ORN wire to +12V Positive Supply from V2 shield Vref pin

Description of the Waterproof Enclosure and circuitry

The waterproof enclosure (PID 905, SID 95.1) was purchased from Adafruit Industries. The dimensions of L 6.75” x W 5.0” X H 3.0” were found necessary in order to accommodate all internal components and cabling. The enclosure requires drilling of three holes to attach the various cables and tubing via several water-tight cable glands. The Ethernet gland requires a hole of approximately ¾” in diameter (exact .794”). The other two, smaller glands require holes of approximately ½” in diameter (exact .494”).

Modification to Seaperch Controller

In order for an existing Seaperch controller to work with the Arduino Uno & Adafruit V2 Motor Shield it will be necessary to make several modifications to the controller. Note: It was decided to modify and existing controller switch box rather than going through the effort of designing and constructing an entirely new one. Furthermore, since there is the possibility that the next step in sensor development may be to control the direction of the Seaperch through the use of a gyro or compass this approach may better lend itself toward that direction.

The controller modifications are accomplished by cutting several circuit board solder traces and adding several jumper wires. These modifications are necessary, since the original function of the controller, which was to provide +/-12V to the Seaperch motors for forward/reverse and up/down direction control will change. Instead the controller will now provide +5v, representing a logical “1” and ground, representing a logical “0” to the Arduino to control direction of the Seaperch via the V2 Motor Shield. Note: the modifications that follow can be performed much easier if the circuit board is unpopulated i.e. one where no components are installed

To start, the spare Brn-Brn/Wht wire pair of the Ethernet cable will now supply +5v and ground from the Arduino Uno and V2 shield to source the controller side of its switches, thus providing the necessary logical inputs to the Arduino Uno via the V2 Motor Shield. First, unsolder and remove the Red and Black wires to the external battery from the controller. Next, connect and solder a jumper wire from pin 8 (GND) of the RJ-45 connector to the -12V eyelet connection labeled (BLK) on the controller’s under side. Add a second jumper wire from the (BLK) solder pad to the fuse holder connection closest to the STBD side switch. Add a third jumper wire across the top two contacts of Port switch- SW2. This modification will now be used provide a “Ground”, sourced by the Arduino Uno R2/V2 Motor Shield circuitry, to the appropriate switch contacts of SW1 (STBD) & SW2 (Port) switches and to the (NC) contacts of SW3/4 & SW5/6 (UP/Down) switches, which were originally connected to the negative side of the external 12V Battery. This new connection will then be used to provide logical “0” to digital inputs D4-D7 to the Arduino Uno. Note: It is IMPORTANT to remove Fuse (F1), as it is no longer required for protection and if left in place will cause a short between the +5V and GND. However, the fuse holder can now be used to connect a LED (L1) through a 330 ohm current limiting resistor. LED L1 which will be used as a visual indicator that the controller is receiving +5v and ground from the Arduino Uno.

The controller circuit board trace cutting modifications require the careful cutting of several solder etched traces of the circuit board. This can be accomplished using a Xacto Knife or similarly cutting sharp tool as follows: cut the trace immediately adjacent to the (NO) connection eyelet of SW5/6 on the topside of the circuit board. It is also necessary to cut the circuit board solder trace that was originally connected to the +12V side of the fuse immediately between C2 and C3 eyelets and immediately next to the STBD label. Next, cut the traces immediately adjacent to (NO) connection eyelet of SW3/4 on the under side of the circuit board. Connect and Jumper wire from pin 7 of the RJ-45 connector to both SW3/4 & SW5/6 circuit board pad labeled (NO) and to the +12V eyelet. These modifications now allow +5V from the Arduino Uno to be connected to the (NO) contacts of SW3/4 and SW 5/6 in order to be used as “logical 1” from these switches to the Digital Inputs D2 & D3 of Arduino Uno.. This also eliminates the need for an external battery connection to the controller, as the 12Vdc required to drive the seaperch motors will now be provided by the Li-Io battery internally housed in the waterproof enclosure on the seaperch. Switches SW3/4 and SW5/6 will now have their (NC) contacts connected to Ground and their (NO) contact connected to +5v in order to provide a logical “0” or “1” to digital inputs D2 & D3 of the Arduino Uno. SW1 & SW2 will now have all of its switched contacts connected to GND in order provide logical “0” to the normally “Pulled-Up” inputs of D4-D7 of the Arduino Uno.

Description of Components, Circuitry and Connections

The Ethernet gland is a female-female RJ-45 connector and allows connection/disconnection of the Seaperch from the controller as required. One of smaller cable glands is used to insert the motor end of the Ethernet cable that is internally attached to the V2 motor Shield’s motor drive outputs (M1-M3) via headers. The V2 Motor Shield has a fourth motor output (M4) output which is now a spare The other, smaller cable gland is used to insert a length of Tygon or similar tubing that protrudes through one of the smaller glands and is exposed to water pressure. The other end of the tubing connects to positive pressure side of the internally mounted MPX5500 differential pressure sensor. This sensor measures atmospheric pressure at various depths and supplies an analog signal that is connected to analog input A0 of the Arduino Uno via a V2 Motor Shield header connection and will be used as feedback to control the desired depth of the Seaperch. The V2 Motor shield is attached to the Arduino Uno via male headers that require soldering to the V2 shield. It is also necessary to solder several female header connectors to the V2 in order to connect the various inputs and outputs to/from the Uno microcontroller. Extreme care and attention is required when soldering the headers to the V2 shield, as they are very small, close together and melt easily. A 12V, 9800mah, rechargeable Lithium-Ion battery with an ON/OFF switch and internal charging circuitry will now be housed in the waterproof enclosure used to supply power to the Arduino Uno microcontroller, Adafruit v2 Motor Shield and will supply sufficient power to drive Seaperch motors. The V2 Motor Shield provides a point of connection for inputs/outputs from/to the seaperch controller, the MPX5500 pressure sensor and seaperch drive motors. The V2 Shield employees a TB6612 MOSFET driver with 1.2A per channel and 3A peak current capability. This should provide sufficient power to efficiently drive the seaperch motors. These PWM, reversible polarity outputs are connected to terminals M1-M4 of the Shield, where the Vertical, Port and Starboard motors of the Seaperch are connected. The Shield piggy-backs onto the Arduino Uno via header pin connectors, as previously described. Inputs from the modified seaperch controller now provide logical inputs 1‘s and 0’s (+5v=true GND=false) to the Arduino digital inputs, D2-D7, to control the motor direction. The signal from pressure sensor, as previously described, provides an analog signal to the Arduino analog inputs, A0 & A1, thus providing feedback that works in conjunction with the vertical motor signal to set and control the depth of the seaperch. The logical signals from the switch controller’s Port and Starboard switches will, depending on their position/state, drive each motor in the forward or reverse direction and do not rely on any feedback. Table 2 described the controller switch positions, the resulting logical state and the resulting action to take:

Table 2

SW1- Starboard Position RJ-45 Pin V2 Pin /State Action

Center-Off D4/D5-Pulled-up Do nothing

Forward 3 D4 - 0 M2-CW

Backward 6 D5 - 0 M2-CCW

SW2- Port

Center Off D6/D7-Pulled-up Do nothing

Forward 5 D7 - 0 M3-CW

Backward 4 D6 - 0 M3-CCW

SW3/SW4

OFF D2 - GND Do nothing

ON 2 D2 - +5V M1-CW

SW5/SW6

OFF D3 - GND

ON 1 D3 - +5V M1-CCW

SW3/SW4 & SW5/SW6

ON / ON D2/D3 -1 / 1 read/store the pressure sensor input

Remote Control Power Circuit

In order to reduce the need to open the plastic enclosure to turn power on/off to the internal circuitry an RF-controlled, 12v 15amp remote control switch was used. This switch takes +12Vdc on its input (Red-Black pair) that is switched to its output (White-Black pair) when the “ON” button of the remote transmitter is pressed. When the “OFF” switch of the transmitter is pressed the +12Vdc is removed form its output.

Software:

The Arduino Uno Microcontroller and the Adafruit V2 Motor Shield are programmed using “Sketches” written in C/C++ code. While not extremely complicated code, it does however require extensive reading of the code basics, the review of online tutorials and sample sketches available from numerous sources. The code for the Arduino and Motor Shield is “Open Source”- meaning it can be copied and used free of licensing cost from the Arduino, Adafruit and various other websites. For “Novice” non-programmer types, in-depth research of how to write, compile and upload the code is critically import to the present and future success of this project. This is and can be a very time consuming effort. The code developed for the USNA Seaperch Sensor Suite will not be included in this document, but will be provided in electronic format to the USNA STEM Program Director and other STEM personnel. Future modifications to the code and electronic circuitry will be required as other sensors and/or electronic devices are added in any effort to enhance Seaperch performance and to achieve the goal of the USNA Seaperch “autonomy”.

Parts list

Description Supplier Cost

Arduino Uno R2 Microcontroller Amazon $13.28

Arduino Wireless SD Shield Arduino $20.00

Adafruit V2 Motor Shield Adafruit Industries $19.95

MPX5500-005DV Pressure Sensor Omega $10.00

RJ-45 waterproof Cable Gland Adafruit Industries $9.95

Small Waterproof Cable Gland Adafruit Industries $1.95

12V 9800mah Li-Po battery Amazon $26.00

Large Plastic Enclosure Adafruit $34.00

U-Bolts, 3 each @ $2.39ea Ace Hardware $7.17

RJ-45 Crimp Tool & Connectors Lowes $20.00

RF Remote Control Switch MSD-INC via Ebay $15.60

2 each FTDI XBEE Adapter Adafruit $40.00

2 each Series1 XBEE modules Adafruit $20.00

2 each FTDI USB-Serial cables Adafruit $40.00

1NA219 Current/Voltage Sensor Adafruit $20.00

9DOF Breakout Module Adafruit $40.00

Total Cost: $337.90

Supplier References:

ACE Hardware website: http://www/ace.com/index

Adafruit website: http://www.adafruit.com

Amazon website: http://www.amazon.com/ref=ap_frn_logo

Arduino website: http://arduino.cc/

Lowes website: http://www.lowes.com

Omega website: http://www.omega.com/index.html

Seaperch website: http://www.seaperch.org/index

Parts References:

http://www.adafruit.com/products/163

http://www.adafruit.com/products/1120

http://www.adafruit.com/products/1018

http://www.adafruit.com/products/1032

http://www.adafruit.com/products/1604

http://www.adafruit.com/product/1714

http://www.adafruit.com/products/905

http://arduino.cc/en/Main/ArduinoWirelessShield

http://www.adafruit.com/products/70

http://www.adafruit.com/products/126

http://www.adafruit.com/products/128

http://www.amazon.com/dp/B008QKJNOA/ref=pe_385040_30332190_TE_3p_M3T1_ST1_dp_1

Modified Seaperch Controller Wiring Diagram

Seaperch structure modifications

Controller top side trace cuts

Controller Underside Jumpers and Trace Cuts

V2 Motor Shield

V2 Motor Shield Schematic

Arduino Uno R2 1

Waterproof Container 1

Li-Io Battery, Charger & Extension Cable

Product Description

9800mAh DC 12V Super Lithium-Ion Battery Pack

Descriptions:

This Rechargeable battery is a 12V 9800mah Li-ion Battery and it is specially designed for powering the system device which use 12V DC power.

Specifications:

Color: Black

Capacity: 9800mAh.

Type: DC 12680

Size: 115x62x21 (mm)

Built-in ON/OFF switch to save power usage

Input voltage: 12.6V

Output voltage: 10.8~12.6 DC

Product life: Circulation charge and discharge ≥500 times

Package includes:

1x AC adapter

1x 6800mAh Rechargeable Lithium-ion Battery

1x 3’extension cable

RJ-45 Gland 1

RJ-45 Gland 2

RJ-45 Gland 3

INA219 Current/Voltage Sensor 1

9DOF Breakout 1

Working on the Sea Perch sensor suite has been a true learning experience. In the following paragraphs I will attempt to explain some of my experiences, observations and conclusions about using an Arduino microcontroller, an Adafruit Motor Shield, a MPX5500 pressure sensor and other electronics sensors used to control and drive Sea Perch motors.

Initially, it was decided to use 12 volt, 4500mah Lithium-Ion Battery pack to power all the electronic circuitry. This type battery pack was chosen as it is rechargeable, light weight and has a small form factor. However, soon after adding some additional electronics devices it became necessary to disassemble (break apart) the battery pack in order to access its internal circuitry and to further reduce its height so it could more readily fit into the water proof enclosure along with the other electronics.

It was further decided that in order alleviate the need to open the enclosure every time it became necessary to turn battery power on/off, a commercially available 12V RF, remote control switch was incorporated. This allowed the system to be remotely energized/de-energized without having to open the enclosure. In order to externally charge the battery, without having to open the enclosure, I connected one end of the BRN/BRN-WHT cable pair internally to the battery and connectorized the external end of the pair- using an AMP SUPERSEAL 1.5 series waterproof connector. The charger was also modified- adding the connector mate to the output end of the charger.

For visual effects, a series of white LEDS were added and are powered by +5Vdc developed by using a LM7805 voltage regulator that takes +12Vdc on its input from the battery and provides +5Vdc output to the LEDS, via series 920 ohm resistor. The LEDS and resistor came from my grandson’s discarded “Mr. Moon in my Room” child’s light that I found in his closet.

After system assembly was completed, it was discovered that when energizing the system if more than two of the Sea Perch motors were energized simultaneously the entire system would “shut-down”. In an effort to determine the cause of shut-down the current draw from the battery was monitored and it was observed that the load presented by each individual motor was approximately 500ma. It was further observed that when more then one motor was energized the output voltage of the Li-Io battery randomly dropped to 4.35vdc thus, de-energizing the remote switch- causing the shut down. The 4.35 volts is believed to be the battery’s “fail safe” voltage level intended to keep the battery from completely discharging.

Initially, it was thought that the system “shut down” was caused by a defect in the remote switch. However, with some further troubleshooting, I discovered that if I substituted a 12V-7.0A/hr battery for the Li-Io battery the switch held and I could drive all three motors simultaneously.

Through some online research, I discovered that Li-Po battery packs employee several types of internal protection circuits, one for low voltage protection intended to reduce total discharge of the battery; one for excessive current draw intended to protect the battery from over heating (considered a severe fire hazard) and one for over voltage protection- all intended to reduce permanent damage to the battery.

Through my research, I surmised that the system “shut-down” was actually caused by one of the battery’s protection circuits tripping. I then discovered by substituting the more substantial battery for the Li-Io battery all three of the Sea Perch motors would run when simultaneously energized and presented a total load of approximately 1.5amps. To my dismay, my initial load calculation and reason for using a 4500mah battery seemed to be in error since the 1.5A load appeared to be to too much for the battery. Determined that the chosen battery should have been sufficient, I decided to recharge the battery and try again. During recharge, I noticed a small spark at one the battery’s inner terminals. Upon further investigation it was discovered that the wire connecting the positive terminal of the upper most cell of the battery to the negative terminal of the inner most battery cell was loose and improperly soldered. I then carefully re-solder the connection, powered the system on monitored the load current and engaged all three Sea Perch motors. The system stayed energized and did not trip, for a while then started tripping immediately when energized! Further investigation found that one of the cells of the battery had been cut, probably during disassembly of the outer packaging and was emitting a pungent odor. At this point the battery was replaced with a 9800mah battery and the system held under load.

A second and more challenging problem to diagnose occurred sometime after I initially submerged the system to check for leaks. Once submerged, I immediately observed a leak that originated at the RJ-45 cable gland. It was further determined that the leak developed around the controller’s cable was most likely due to its asymmetric shape where it entered the gland.

One night, after struggling with the Arduino control program, I inadvertently left the system connected to my computer’s USB port. The next morning, when I returned to continue my efforts, I observe the starboard motor turning in the clockwise (forward) direction. Puzzled by this unexpected experience I began troubleshooting the system. Upon opening the RJ-45 gland it was observed that the gland had retained some water internally. It was further discovered that the common contact of the starboard forward switch read 1.89 volts when the switch was not engaged. Since my sketch was designed to run the Sea Perch motors when the Port and Starboard switch inputs to the Arduino were at 0 volts and stop them when “pulled-up to 5 volts. It was further determined that the1.89 volts, being less than the 5 volt stop state, being at an undefined level was sufficient to cause the starboard motor to run forward.

Further diagnosis also revealed that the Sea Perch end of the control cable, having been exposed to water inside of the RJ-45 cable gland, produced a slight resistance between the +5 volts on pin7 and starboard forward pin6 of the RJ-45 connector and must have been enough to cause the starboard motor to turn in the forward direction without its switch being engaged. The gland and cable end were replaced and the drive rotation stopped until commanded. In an effort to stop the future leaks, I placed a small piece of tubing around the cable to make it more symmetric where it entered the gland and additionally coated the gland and cable where it entered the gland using “Goop” sealant in an effort to provide more water tight integrity of the RJ-45 gland. I also coated the smaller glands at their entry points for the same reason.

In conclusion, Lithium-Ion (Li-Io) battery packs, while considered suitable for this application, must be carefully selected based, not only on their size and weight, but more importantly on their current delivery capacity. During my research I learned the there are several types of Li-Po batteries available on the market, some with built-in protection some requiring external circuitry for protection. I also learned that if improperly charged they can explode and present a serious fire hazard. Therefore, it is extremely important not to over charge the battery and perhaps should not be left unattended when charging.

I have also concluded that water tight integrity in any device intended to be submerged in water is extremely important, particularly devices which house electronics and connective components. Exposure to water, no matter how slight can induce problems, which can be very difficult to pinpoint and diagnose.

Finally, properly programming microcontrollers and associated circuitry can be quite challenging- particularly for someone with minimal in C++ programming experience. One misplaced squiggly {} or one forgotten apostrophe; can cause one much angst and hours of effort!

2014

Continuing development of the Seaperch proved that the need to open the waterproof container to access the Arduino USB port was a problem. It not only put excessive stress on the internal wiring, but also proved to be problematic to the watertight integrity of the enclosure, by excessively stressing the enclosure’s seal. After some thought it was decided to attempt to program the Arduino wirelessly, thus alleviating the need to open the container any time a new or modified sketch upload became necessary. An earlier conversation with a USNA colleague, Joe Bradshaw, instigated the idea of Arduino wireless programming using Xbees. I decided that this would be the next logical step to assure water tight integrity of the plant and the further pursuit of Sea Perch Autonomy.

While wireless programming is not an extremely difficult task, it has proven to be a bit daunting! Fortunately, there are reams of “How-to” documentation available on the Internet from sources such as Ladyada of Adafruit, Inc and many other adventurous developers. The cost, ~ $100.00, of the disparate parts required to accomplish this task is, to me, reasonable, but perhaps not to the average hobbyists. I will attempt to explain the process and my experiences in the paragraphs to follow.

First, I will list the parts required, their source of purchase and then the process of assembling a PAN (Personal Area Network) using two XBEE 802.15.4 Series 1 and associated hardware. I chose the Series 1 XBEES, as recommended by http://ladyada.net/make/xbee/arduino.html and further found in a tutorial at http://www.ladyada.net/learn/avr/setup-win.html Understanding AVR programming is not totally necessary, but I found that going through the tutorial very helpful in understanding AVR setup and the AVRDUDE up/down loader utility used by Arduino for uploading sketches,

Parts needed to create a Personal Address Network (PAN):

2 each - XBEE Series 1 802.15.4 modules purchased from Adafruit, Inc. http://www.adafruit.com/products/128

2 each - XBEE adapter kits purchased from Adafruit, Inc. http://www.adafruit.com/products/126

2 each - USB FTDI-TTL.232 cable-TTL232R 3.3v from Adafruit, Inc. http://www.adafruit.com/products/70

Driver download site: http://www.ftdichip.com/Drivers/VCP.htm

1each- Arduino Wireless SD Shield purchased from Arduino http://arduino.cc/en/Main/ArduinoWirelessShield

1 of each – 2N2222 NPN transistor, 10K resistor, 0.1 microfarad capacitor purchased at Radio Shack

Before assembling the PAN I found it necessary to download and install several programs, which I found very helpful to the process. First is MAXSTREAM X-CTU software is very useful for configuring and testing the XBEE modules. It can be downloaded from the following link: http://www.digi.com/support/kbase/kbaseresultdetl?id=2125 Although any terminal program, such as Windows Hyper Terminal will suffice, one must be versed in the use of AT commands to configure and test the XBEE modules, which are actually just modems. X-CTU is extremely helpful not only for configuring XBEES, but it contains several useful utilities for testing and monitoring XBEE responses.

Secondly, as recommended in the ladyada’s avr tutorial I listed above, I downloaded and installed the latest version of WinAVR from Sourceforge. It can be downloaded by following the link in the tutorial or directly from sourceforge at http://sourceforge.net/projects/winavr and provided valuable insight in the process of programming ATMEL AVR microcontrollers.

Assembly of the Sea Perch PAN, using the components previously described proved very challenging and required numerous hours of research and development, which ultimately became necessary to build and to configure a working model. However, once completed, this effort proved worthwhile in the uploading further modifications to the Arduino Sea Perch sketch.

The Process:

First, assemble the XBEE Adapter kit. SEE http://ladyada.net/make/xbee/solder.html

Something that is not shown in the assembly instruction, but is required to reset the Arduino when uploading code is that the RTS pin-16 of the adapter must be connected to the DI03 pin-17 of the XBEE.

NOTE: I my zeal not to overheat the 74ACH125N line driver chip by soldering it directly on the adapter board I first install a 14-pin chip socket. DON’T DO THIS, as it proved to be a problem and made the chip sit too high on the board to accommodate the XBEE module! Fortunately, with the help of Norman Tyson of WS&E he was able to de-solder the chip socket so I could solder the chip directly on the board. Once the adapters are assembled, insert the XBEE module and insert it in the adapter’s header connector- taking care of the XBEE’s orientation- hint pin1 of the XBEE goes next to the red led on the adapter. SEE BELOW

You are now ready to configure each XBEE, one at a time, by connecting the adapter to a computer USB port via the USB FTDI-TTL.232 cable as shown next.

It’s hard to see in this picture, but the first pin (Green wire) of the FTDI cable is connected to pin-2 of the adapter - not pin-1. Once connected to the computer, Windows “found new hardware” message will display and request driver information for the adapter. Windows Device Manager will recognize the FTDI cable as a virtual com port, runs the driver install and display a new USB Serial Device under Ports (COM& LPT). Double-click the new device and configure it as a new COM port. I used COM10 as it was available and configured it with default settings Baud Rate 9600, No-Parity, 8 bits, one stop bit. i.e. 9600, N, 8, 1. While configuring the new port, there is one other setting is necessary to allow proper resetting of the Arduino. Under Port Settings, select the Advanced tab, and check “Set RTS on Close”.

The new COM port will now be available to X-CTU, which should communicate with the XBEE with its default settings, to configure and test each XBEE.

I will not attempt to explain each step in the XBEE configuration via X-CTU process here, as they are too numerous to discuss, once up and running, using X-CTU becomes fairly intuitive. However, there are a few things to note. First, the default PAN ID on each XBEE should be changed to a new setting as not to interact with other XBEES that might be in the vicinity. Secondly, the 16 bit address of each XBEE should be set to agree with one another- i.e. in its simplest form, the XBEE directly connected to the computer should have its DH=0 DL=1 and MY=0 and the remote XBEE should be set its DH=0 DL=0 and MY=1 SEE http://www.ladyada.net/make/xbee/configure.html

I also observed that there is one setting (EE) AES Encryption Enable which should be Disabled. However, even when AES is disabled each time X-CTU starts anew it persistently wants to know the KY (AES encryption Key) setting. I just enter “0” and that does it. Setting the NI key to a name for each of your XBEES you recognize is also useful. Don’t forget to write all setting changes and save them to a file for future loading.

Finally, and this is very important! In order to configure the remote XBEE at the Arduino end, the local XBEE connected to the computer must have the AP (API enabled) set to enable API enable (1). If the AP setting is left in this mode, Arduino will communicate with the local XBEE on the computer end. Before exiting X-CTU set the AP setting to disabled (0) and write the new setting to the local XBEE!!!

Once the XBEES are correctly configured and communicating with each other it’s time to attach the remote XBEE to an Arduino. Note: following ladyada’s example I purchased an Atmel 328P Duemilanove Bootloader chip from Adafruit and installed it on an Arduino Uno. I’m not sure if this was totally necessary, but in keeping with ladyada’s instruction, I did it. I installed the remote XBEE on an Arduino wireless SD shield and connected the shield to the modified Arduino. As was recommended in ladyada’s wireless XBEE-Arduino tutorial I also constructed the Arduino reset circuit on the shield described and shown here.

XBEES are pretty weak and don’t have the oomph to reset an Arduino on their own, so we need to wire it up to a transistor which will do the heavy lifting of pulling the reset line down. Pretty much any small NPN transistor will work just fine here. Put a 0.01uF to 0.1uF capacitor in series with the wire from the XBEE, and connect the other side to the NPN transistor base. The emitter of the transistor connects to ground. Put a resistor around 10K between the base and emitter. This will pull down the base to keep the Arduino from resetting accidentally.

This circuit uses the XBEE’s DIO3 signal, which was tied to the XBEE’s RST line on the computer end shown earlier, as the reset signal input from the XBEE. Now, connect everything up, start Arduino and upload a sketch. If all works well the sketch will upload successfully. Hint: open File/Preferences in Arduino and check the “Show verbose output during upload”. This will display the upload sequence and if successful will display the uploaded code and lastly display the message: avrdude done. Thank You.

NOTE:

When Arduino uploads code it creates two time stamped directories: a “build something” and “console something” in the current user’s /Username/Local/Temp directory. The build directory contains a record of what was uploaded and the console directory contains two files: stderr.txt and stdout.txt, which a very helpful in diagnosing Arduino upload activity.

Once the wireless PAN was up and reliably working, I then proceeded to add several two other sensors to my plant to include: a “Nine Degrees of Freedom” (9DOF breakout) sensor, which is a three-in-one sensor intended to add a Gyroscope, an Accelerometer and Compass intended to add stability, speed, direction and roll & pitch control to my plant. The 1NA219 sensor was added in an effort to diagnose an issue that has proven to be a consistent problem involving the Li-Po battery random shut-down during testing. Further research showed that these types of batteries have built in protection circuits intended to protect themselves from any of three conditions: under voltage, over voltage and over current. It soon became obvious that one of these conditions must have existed and was the cause of the battery shut-down. This problem was the impetus to install the 1NA219 current/voltage sensor.

Initially, I believed an over-current condition was causing the problem. Employing a current meter, I was able to observe loads of approximately 500-700ma per motor and no more that 3A total load when all three motors were energized simultaneously. Furthermore, if I manually stalled any motor I observed loads of no more than 2A, which did not trip the battery. These observations then led me to believe that an over-current condition was not the cause. Since the battery’s output voltage consistently read within specifications it was obvious that an under-voltage condition wasn’t the cause, thus leaving only one condition, an over-voltage induce to the battery as the probable cause.

Understanding that motors will act as generators when power is suddenly removed or reversed, I then thought that the Back EMF generated by the motors was being induced to the battery and causing its over-voltage protection circuit to engage. Since this phenomena is generally well know, there are certain electronic devices, such capacitors, PN junction diodes, zener diodes and filters that can reduce or eliminate this effect when placed in-line with the battery load or across the motor leads.

At the suggestion of Professor Carl Wick, I first tried adding back-to-back zener diodes across motor leads. This proved somewhat effective, but I still experienced random, albeit less frequent battery shut-downs. It was the noted that shut-down could be repetitively caused by energizing any motor then quickly reversing its direction. After a discussion with and at the recommendation of Joe Bradshaw I added a PI filter between the battery and load, again with minimal success. The addition of the 1NA219 module and test code to my sketch provided the ability to monitor battery voltage and loads. The system voltages always presented according to specifications, however, battery load currents now showed very high instantaneous load currents, sometimes in excess of 3A. This observation then led me back to the theory that excessive load current was causing the battery’s over-current protection circuit to trip.

Since all attempts to correct this problem through added hardware proved minimally effective I then decided to review my control software and found that adding a few delays at strategic locations throughout the sketch effectively minimized the battery shut-down problem.

At this juncture, I have reached a physical space limit of adding any more hardware sensors. The current Arduino sketch, as currently written, only provides for the display of output readings from the newly incorporated sensors and does not provide control of the plant using these readings. This will require further, in depth research to accomplish the end goal of a fully autonomous Sea Perch.

Step 2:

Step 3:

Step 4:

Step 5:

Battery Powered Contest

Participated in the
Battery Powered Contest