Wiring up the PicAxe - Serial Interface

You are in home \ microcontroller \ PicAxe \ tech ref. (back)  

PicAxe pages: Picaxe General   Wiring up the Picaxe   Programming the Picaxe   Projects  
Hardware

General

'08 Ports

'18A Ports

Power
Supplies

Input &
Output

Keypad
Options

serial
interface

   
 

On this page:   Download cable,   Serial interface Circuits,

Download cable

The serial download cable is described in several of Rev-Ed's pdf files. The Range Summary pdf, the manuals and tutorials for the '08 and the '18... The chart above is based on a summary of that information. ("axe003_manual.pdf", "AXE001_pinout.pdf" & "AXE025.pdf")

Parts for the serial programming cable

For wire just about any 3-core (or more) cable will do, however a shielded type can have advantages. Two suitable cables from Dick Smiths are twin-core shielded audio cable DSE# W-2035, where the shield is used for the ground connection, or 4-core flat telephone cable DSE# W-2121, where two of the leads can be used together for ground. When choosing a suitable but cheap cable, remember that you'll need 3-core (more isn't a problem as long as the cable doesn't get too big and stiff), and the wires in the cable must be stranded wire, not solid, to withstand flexing. At the relatively low data speeds involved here, and with the cable length within a couple of metres, just about any cheap cable with 3 conductors will do. Do check that it isn't so stiff that flexing isn't spread along the cable, and that its size isn't too much for a good connection to the connectors at either end, and that it'll fit within the housing of the connectors.

If you solder it up yourself, be sure to do a continuity check (with multimeter on ohms, or a beep tester) between all the pins to make sure that none of them are shorting together, even with the cable flexing a bit at the connector, and that each wire connects through from one end to the correct pin at the other end.
One idea is to use the lead of an old serial mouse. Usually they have 4 wires inside, corresponding to pins 2, 3, 5 & 7 of the D9 connector. Identify pins 2, 3 & 5, ignoring the wire to pin 7.
If you can't make up a cable, and don't have an electrically minded friend to make one up for you, you'll be buying the cable from one of the PicAxe distributors near you. Check the list of agents on the PicAxe General page.


Serial Interface Circuits

The serial interface a la Rev-Ed.
This is the stock standard serial interface circuit for programming that Rev-Ed use. It is simple and cheap.

Here is a circuit that I use, which allows me to use serin and serout commands to the Serial Terminal window in the Programming Editor. See the Software serial page for examples.
One of the serial interfaces I use
The key difference between my circuit and the Rev-Ed circuit is that I've added two protection diodes, so as not to use the internal diodes in the picaxe ports. For the zener diode I use a 5v1 zener, and for the other diode I use a 1N60 germanium, although any small signal diode will do (eg. 1N4148, 1N914).
The resistor values shown are not critical, but some of their ratios can matter.
Use anything from 4k7 to 22k for the input resistor to ground (shown as 8k2 on my design, and 10k on Rev-Ed's circuit).
Use anything around 10k up to 22k for the series resistor (marked as 10k in my circuit, and 22k in Rev-Ed's circuit).
Use a value around 100k to 470k for the serin pin pulldown resistor (shown as 220k in my circuit).
Note that you don't have to connect the SerIn line to leg_4 and jumper it to SerIn pin like I have, you can just connect it like the the Rev-Ed circuit, just with the extra diode and zener diode for decent input port protection.
Note also that If you wish to connect serin to port-pin 3 (leg 4) then you must provide a protection diode there to prevent overvoltages on that pin, as it is different from the other ports in not having that diode to +V internally. All that's required is to provide any small signal diode (eg. 1N4148) to +V, with the band on the diode at the +V end. The zener in my circuit performs that function, and so the protection diode to +V isn't needed.


Quality Serial Interface

Quality Serial Interface
This is almost a standard proper RS-232 interface, except two transistors have been added to invert the serin and serout signals. This is because the MAX-232 chip inverts the signals and we don't want that, so we negate it. Use an NPN and a PNP general purpose small signal transistor, such as BC547 (or BC547), and the BC557 (or BC556). The advantage of this circuit is that it provides a real EIA-232 interface, and will work with any pc serial port. Of course you'll notice that a connection to +V is required as well for the MAX-232 chip to operate, so the common phono socket connector will have to be replaced with a 4-way connector.