Technical Article
PICAXE to PC Connections
August 01, 2015 by Charles R. Hampton
This article describes in detail the connections necessary for two way communications between PICAXE microcontrollers and personal computers. Both serial connections and USB to serial conversion connections are covered.
Recommended Level
Recommended Prerequisites
Introducing the PICAXE System
One of the chief advantages of the PICAXE system is the ease and low cost of getting started. The chips themselves are inexpensive, the programming software is free, and no hardware programmer is needed. The hardware connection from the PICAXE to a personal computer consists of a cable (AXE026) that connects to a serial port on the PC, or a different cable (AXE027) that connects to a USB port. This article provides details on those connections, as well as the information needed to assemble a serial cable at little cost.
PICAXE Serial Data Communications
In order to communicate with a PICAXE microcontroller, a personal computer is most often used. Communications to the PICAXE are primarily for the purpose of programming it, and communications from the PICAXE may be displayed on the computer monitor for debugging the program, or simply for seeing the results of the program instructions. Only three wires are required between the PICAXE and the personal computer: one carries information from the PICAXE to the computer, one carries information from the personal computer to the PICAXE, and the third wire connects the signal ground on the computer to the ground on the PICAXE µC. Communications in both directions are in a serial format, i.e., logic 1s and 0s are sent one after the other over each wire in a specific order to represent every letter, numeral, and symbol in the message.
On the personal computer end, the serial data format is called RS232, which includes a total of nine (or ten, but that's another story) leads, each with a different designation. However, only two of the leads are used for actual data communications: the Receive Data lead (abbreviated RxD,) and the Transmit Data lead (abbreviated TxD.) Likewise on the PICAXE end, only two leads are used for data communications: the Serial Out lead (abbreviated SO,) and the Serial In lead (abbreviated SI.) When the signal ground in the PC and 0V (ground) in the PICAXE are connected together, and SO in the PICAXE is connected to RxD in the PC, the PICAXE can "talk" to the PC. Likewise, when the signal ground in the PC and 0V (ground) in the PICAXE are connected together, and TxD in the PC is connected to SI in the PICAXE, the PC can "talk" to the PICAXE. Thus, three wires between the PC and the PICAXE enable two way communications.
Connecting to a PC with an RS232 (Serial) Port via a DB9 Connector
In the early days of personal computing, almost every PC had an RS232 serial port. Today, very few laptops and only some desktop machines have one. If your PC has an RS232 port available, that's the least expensive route to PICAXE connectivity. And the easiest way to make that connection is with an AXE026 cable available for $10 or less. However, it's also possible to make your own cable, which can not only save a little money, but also allows you to learn something about RS232 wiring.
An RS232 connection on a PC usually uses a specific type of connector called a DB9. The "D" refers to the shape of the housing, and the "9" refers to the number of pins in the connector. (If you are interested, you can research the origin of the "B" on your own, but it's not vital information at this time.) There are two "genders" of DB9 connectors: the DB9F (female) connectors (shown below left) have nine holes to receive nine pins, and the DB9M (male) connectors (shown below right) have nine pins. Look for a DB9M on your PC; if you find one, it's probably an RS232 port, and should be labeled as RS232, Serial, or Com. Without an RS232 port, you will need to skip to Connecting to a PC with a USB Port later in this article.
Assuming you have an RS232 port available on the PC, you need to locate the three leads to connect to the PICAXE. Each of the DB9 pins has a specific number (as shown in the photos above) and carries a specific signal; RxD is on pin 2, TxD is on pin 3, and Signal Ground is on pin 5. Therefore, what is required is to connect the DB9 pins to the PICAXE pins according to the table below.
RS232 Signal Designation
DB9 Pin Number
PICAXE Pin Designation
PICAXE Leg Number
Receive Data (RxD) 2 Serial Out Depends on the PICAXE model.
Transmit Data (TxD) 3 Serial In
Signal Ground 5 0V (Ground)
In order to plug into the DB9M (male) connector on the PC, and extend the three leads to your PICAXE, you will need a DB9F (female) connector that has a cable attached. Such cables are often available in thrift stores or on the web for very little money.
Most often, identification of the three wires in the cable that you need requires that you check the continuity of the wires in the cable. That is usually done with a Digital Multimeter (DMM) by setting the meter in the resistance measurement mode, connecting one of the meter probes to pins 2, 3, and 5 (in turn) in the DB9F, and then checking the resistance from each pin to each wire. When a very low resistance (less than 5 ohms) is detected, note which wire (by color) and which pin (by number) to which your DMM probes are connected. The three wires that show low resistance to pins 2, 3, and 5 are the only wires in the cable that you will need. The others should be arranged so that they will not short together and are out of the way.
An alternative method is to start with a bare DB9F, and connect a different color wire to each of the pins numbered 2, 3, and 5. The three wires should be insulated stranded wires in the AWG22 to AWG30 range, and should be twisted together to form a cable.
Connecting to the PICAXE
Once you have a cable with a DB9F on one end, and the three wires that are to go to the PICAXE identified, those wires must be prepped for whatever method you plan to use to connect the cable to the PICAXE. The most common way is via a 3.5mm stereo plug that mates with a 3.5mm stereo jack. Such a plug is shown in the photo below left, and a suitable jack is shown below right. Both must be wired as shown in the schematic diagram below.
If you are on a really tight budget, you can omit the 3.5mm plug and jack, and just plug the cable's three wires directly into the solderless breadboard. To do so will probably require that you solder some AWG22 solid wire extensions onto the cable wires similar to those shown in the photo below.
Connecting to a PC with a USB Port via AXE027 Cable
The easiest way to connect your PICAXE to a PC is via an AXE027 cable, which is available for about $20. The AXE027 cable is approximately 70 inches long, and has a standard USB Type A male connector on one end, and a 3.5mm 3-conductor plug on the other. It is intended to be plugged into a USB Type A female connector on a personal computer, and into a 3.5mm 3-conductor jack in the PICAXE circuit. However, there is more to the AXE027 than meets the eye. Inside the plastic housing covering the USB connector is a USB-to-serial circuit, as shown below right.
This circuit performs the task of converting the USB data signals (D+ and D-) to a serial format that correctly interfaces with the Serial Out and Serial In leads of the PICAXE µC. A proprietary software driver is required to use the AXE027, and is available here, along with full installation and setup instructions. The photo below shows how the AXE027 can be connected to a PICAXE, and the photos and schematic drawing provided in the Connecting to the PICAXE section of this article supply additional details.
"What about making a substitute for the AXE027 using one of those USB to serial converter boards I have been reading about?" you might ask. It is possible, but it's not as easy as it might seem. The PICAXE signalling scheme is inverted from that used on most standard USB to serial converter circuits, and without that inversion, the PICAXE simply won't communicate with a PC. Designing and building a pair of inverter circuits is better left for another time.
After all, you have programming to do!
u-blox Expands Its Bluetooth Portfolio with Three New BLE Modules
Remote Viewing: Communicating with an Arduino via Infrared Light
Utilizing SiC JFETs in Circuit Protection Applications
Ideal Op-Amp Characteristics
oa81 September 09, 2015
To program a PICAXE chip (28X2) via USB with an FTDI breakout board, I inverted the TX & RX lines using FTDI's FT_PROG.exe utility (which modifies the flash memory inside the FTDI chip). This avoids having to use any additional inverters.
Connection is as with the AXE027 cable shown above: white wire = RX -> Serial Out; blue wire = TX -> Serial In via a 22K resistor shunted by 10K to ground. See the 'Serial Download Circuit' in the PICAXE manual.
This was with a 3.3V Sparkfun FT232R breakout board, but much cheaper boards using the FT232RL chip are available and may also work. As a bonus, the breakout board can also provide power (up to about 100mA at 3.3V or 5V) to the PICAXE chip and and the rest of the circuit - hence there's no need for a separate power supply.
Like. Reply
justarunner November 27, 2015
Thanks for the PicAxe articles!
I have been using PicAxe with model railroading since seeing a presentation by Dave Bodnar in 2008. He's a great resource that I refer to often for ides and problem solutions.
Now I have my 11 year old grandson writing simple codes, troubleshooting problems and dreaming up modifications. GREAT FUN!
Thanks for the articles and I look forward to reading the entire series.
Charles R. Hampton February 10, 2016
Thanks for your comments. Due to a software glitch, I was not being notified when comments were posted, but I believe that is corrected. I am glad you are enjoying the PICAXE series.
kentmh September 19, 2018
I purchased this adapter cable recently and it works great:
https://www.ebay.com/itm/Ugreen-USB-2-0-to-RS232-DB9-Serial-Cable-Male-A-Converter-Adapter-PL2303-for-Mac/153141429108?ssPageName=STRK:MEBIDX:IT&var=452992988415&_trksid=p2057872.m2749.l2649
It sells for $10.99 Canadian or $8.43 US. Although its listing states that it is for Mac, it comes with a mini CD that has drivers for Mac, Linux and Windows. I use it on a Win 10 32bit laptop with PicAxe Editor 6 and the included Windows driver which must be installed before the adapter cable is inserted to a USB port.
My PicAxe chips are 08M2 that are part of Elenco Snap Circuit sets, so I made a converter from a plastic hooded female DB9 RS232 connector and three Snap wire connectors (yellow, orange and black, just like the original Elenco adapter cable that is a converted AXE027 cable). I purchased the female DB9 RS232 connector on eBay (https://www.ebay.com/itm/DB9-D-SUB-VGA-female-10pin-Terminal-Breakout-PCB-Connector-COVER-HOOD-SHELL-nut/302393572582?ssPageName=STRK:MEBIDX:IT&_trksid=p2057872.m2749.l2649) for $4.00 US. It has screw connectors so no soldering is required. The Snap wire connectors are available from http://cs-sales.net/ for $0.85 US each, part nos. 6SCJ1 (18" black), 6SCJ3A (8" orange) and 6SCJ3B (8" yellow). I cut the Snap connector off one end of each wire, adjusting the longer black wire to the same length as the other wires. I stripped 1/16" of insulation off the cut end of each wire and installed them to the DB9 RS232 connector screw terminals. Black goes to Ground on terminal #5, yellow to RxD on terminal #2 and orange to TxD on terminal #3.
If you want to convert this adapter cable to match the OEM AXE027 programming cable, you would just replace the Snap connector wires I used with a wired 3.5mm stereo plug. The wire going to the tip (or end) contact of the plug connects to Ground on the female DB9 RS232 screw terminal #5, the wire from the plug's ring (or middle) contact goes to TxD on screw terminal #3 and the wire from the plug's shaft (or bottom) contact goes to RxD on screw terminal #2.
The female DB9 RS232 connector mates with the male DB9 RS232 connector on the adapter cable and the USB connector on the other end of the cable plugs into the laptop USB port. Clicking "Ports" in Device Manager shows the Prolific PL2303TA device in the adapter cable and the COM port to which it is assigned. To change the assigned port, double click on the Prolific device, select the Port Settings tab, click the "Advanced" button and choose any other available COM port from the "COM Port Number" pull down list. When running the PicAxe Editor program, make sure the correct COM port is selected for the adapter cable.
Enhancing Conversion Efficiency in Power Management ICs
In Partnership with ROHM
In the Latest Semiconductor Merger, Marvell Buys Inphi
Simplifying Secure Product Release with Microchip's Trust Platform and AWS' Multi-Account Registration
In Partnership with Microchip Technology
Microchip Jumps on New CoaXPress Standard with Chips for Machine Vision
Implementing Secure Authentication with AWS IoT and Microchip's Trust Platform