$Id: README,v 1.10 2003/09/13 07:16:03 dwalters Exp $ -- Open Automaton Project: http://oap.sourceforge.net -- DOCKING STATION INTRODUCTION ---------------------------- This README covers the source code and circuit schematics for the Open Automaton Project Docking Station. The Docking Station is a hardware device that provides an external power source as well as a battery charging power source for the robot when "docked". The PICMicro in the Docking Station turns on the external power source and charger only when signaled to do so by the robot itself via an infrared signal emitted from the Power Management Module (PMM) on board the robot. When the robot is not docked, the docking station power supply and charging contacts are kept in safe mode (open circuit). The circuit schematic (docking_station.sch) was developed in gschem, part of the gEDA package, version 20030525. Circuit schematic symbols that are not in the symbol library bundled with gEDA are included as separate sym files (these .sym files can be copied into your local symbol directory, typically /usr/local/share/gEDA/sym/local/). LICENSING --------- All source code and electronic circuit designs are copyright (C) 2003, Dafydd Walters. The Open Automaton Project software is distributed under the terms of the GNU General Public License. See the file COPYING.SOFTWARE for details. Please see the file COPYING.ELECTRONICS to see the terms under which the electronic circuit designs of the Open Automaton Project are distributed. CIRCUIT NOTES ------------- The circuit treats two of its components, the 12V 4.5A DC Power Supply, and the 12V 4A Smart Fast Sealed Lead Acid Battery Charger, as "black box" components. These are "off-the-shelf" modules. * 12V 4.5A DC Power Supply This takes 120V or 240V AC input, and outputs 12V DC at up to 4.5A. The unit must output a regulated supply in the range 11.4V to 12.6V. The power supply unit that's bundled with the Morex DC to DC converter is suitable. * 12V 4A Smart Fast Sealed Lead Acid Battery Charger This takes 120V or 240V AC input, and outputs a charging voltage suitable for fast charging, and then trickle/float charging a 12V sealed lead acid battery. This assumes that the robot's battery is capable of handling a charging current of 4A. A suitable charger is the PSC-124000A by Power-Sonic. The battery charger typically requires that the battery being charged is not loaded during charging, and that the charger is hooked up to the battery terminals before the charger is powered up. For this reason, the sequence of relay switching on the Power Management Module (on board the robot) and the Docking Station module must be properly choreographed by the two microcontrollers. The Docking Station responds to commands beamed to it from the Power Management Module on board the robot via infrared. The Sony infrared remote control protocol is used in an adapted form (refer to the Input Module documentation and source code comments for more complete details). The IR detector is a 3-pin device designed to operate with a 5 volt supply. It gives a Low output signal when IR energy (at around 940nm wavelength) is detected that's being pulsed on and off at a frequency of 40kHz. When there is no IR energy present, or there is IR energy present, but it is not being pulsed at or near the detection frequency of 40kHz, the output signal is High. The circuit has been tested with the IR detectors available from Radio Shack (Radio Shack part number 276-137B). The lower 8 bits of the command code used in the Sony IR Protocol are interpreted as follows: 11100001 - turn on external power source relay 11100010 - turn on charger relay (external power must already be on) 11100100 - "ping"; lets docking station know that robot is still there 11100101 - turn off charger relay 11100110 - turn off external power source relay (turns off charger if not off) These command codes are different from those output by appliance remote controls, so the docking station module will not respond to stray IR signals from nearby remotes. Note that the source code comments in docking_station.asm contain command codes THAT DO correspond to Sony TV remote codes, which can be used as substitutes for the above PMM commands for the sake of testing with a TV remote control (without the PMM). As a safety measure, the robot must "ping" the docking station at least once every minute to keep the relays engaged (a kind of watchdog timer). If no "ping" command is received after one minute, the charger power and external power relays are turned off. The firmware enforces a 30 second minimum time between switching the charger off and on, essentially "buffering" any pending 'on' command received within 30 seconds of an 'off' command. This is to ensure that the charger resets cleanly when powered up and goes into the correct charging state. The yellow LED flashes during this "pending charging" state, and changes to constant on once the 30s timeout has elapsed. The firmware also enforces the rule that the external power relay must be on any time the charger is turned on. The reason for this is that the robot's mainboard cannot take its power from the battery during charging, as this would put a load on the battery, so the external power source is always needed while charging. The LEDs on the docking station module signal the following states: - Both off: Both relays off, all docking station contacts safe. - Green on: External power supply live. Charger off. - Flashing Yellow: External power supply live. Charger currently off, but will be switched on within 30 seconds. - Yellow on (constant): Both external power supply and charger contacts live. When assembling this circuit, it is essential to use heavy gauge wiring and wide circuit board tracks for all of the 12V DC and GROUND runs. This is because of the high currents drawn (up to 5 Amps). Thin wires will get hot and will cause undesirable voltage drops, not to mention that inadequate wire gauge for these kinds of currents is a potential fire hazard. FIRMWARE NOTES -------------- The software for the PICMicro is written in assembly language, and compiles using the GNU PIC Assembler, gpasm. To compile the source code into a hex file suitable for programming a PIC16F819 device, type gpasm -n docking_station.asm The resulting hex file will be called docking_station.hex The -n option puts DOS-style CR-LF newline sequences in the .hex file, required by most device programmers. It also compiles with the MPASM compiler for Microsoft Windows that is a part of the MPLAB suite from Microchip. However, you must make sure the assembly (.asm) file is in Windows/DOS format (i.e. with CR-LF sequences at the end of each line) before it will successfully compile in MPASM for Windows. Some device programmers require the configuration bits to be set manually. It is very important that these are set correctly. The Docking Station module requires the following configuration bit settings: - Flash Code Protection off - CCP1 on RB3 - In-circuit Debugger disabled - Flash write enable off - EE Code Protection off - Low Voltage Programming Enable off, RB3 is I/O - Brown-out Reset Enable on - RA5/MCLR pin function is digital I/O - Power-Up Timer on - Watchdog Timer off - Oscillator: INTRC, port I/O function of RA6 and RA7 The above configuration settings are represented by the configuration word 2F50 in hexadecimal.