HOME


Nutchip programming: the PC interface

PC interfaces | suggested interface (2 transistors) | no serial ports? | interface with MAX232 | interface with logic gates | embedded or external? | suggested connectors | serial cables | 9/25 pin adapters


PC interfaces

Nutchips are easy to program with any PC with a free serial port. However, the serial port cannot be connected directly to the Nutchip, because of the different voltages (up ±12V, were ± means that the the 12 Volt can be either positive or negative) compared to the 5 Volts required by a Nutchip. The PC interface provides a safe conversion from the PC voltage to a safe level for the Nutchip.
An interface can amount to as little as a couple of transistors, but we supply many different schematics - all as good as the transistors pair - should you prefer to use a specialized interface IC like the MAX232 or a few logic gates and diodes.

  

GOT THE ROBOT?
GOT BASIC STAMPS?


NO NEED FOR INTERFACES!
DISCOVER HOW

Suggested interface: just 2 transistors

This interface is reliable and simple. It has been built without problems by thousands of satisfied readers. It is the chepest and the simplest at the same time, and it employs parts you can get from any electronics shop. We use this interface for all of the projects described in this book.

interface_schematic.gif (9197 byte)

Interface needed to program the Nutchip through the PC's serial port

PARTS LIST

  • Q1 = NPN transistor, BC337 or similar
  • Q2 = PNP transistor, BC557 or similar
  • R1, R3= 4,7 kohm (=4700 ohms) resistor, 1/4 W or bigger
  • R2, R4= 10 kohm (=10000 ohms) resistor, 1/4 W or bigger
  • CN2= 4-pole pin strip, alternatively 4 short pieces of 0.65 mm dia. copper wire
  • CN1= 9 pin female "D" type connector (aka "Canon" or PC serial port connector)
  • A small breadboard or PCB

Expert? Curious?
Here are the simulation tests results:
  - trasmission: PC to Nutchip
  - trasmission: Nutchip to PC
  - line status when idle

 

The circuit employs just two transistors and does a trick to get a negative voltage as required by some PCs. When the PC does not transmit data, its TX pin is stuck to a negative voltage. As the Nutchip transmit and receive cycles are guaranteed not to overlap, the negative voltage is picked up from the TX pin and brought back - thorugh resistor R3 - to the PC's RD pin on CN1. therefore, when the Nutchip needs to send some data, it switches the Q2 transistor between the negative voltage previously "stolen" and the 5V positive supply voltage. This results in a voltage swing well over the ±3 Volts required by the PC serial port to recognize data as valid.

 
a)INTERF_1.JPG (17142 byte)    b) INTERF_3.JPG (16961 byte)

(a) How to build the interface on a small piece of prototype board.
(b) the connections between the parts are highlighted using different colors
Note: the PC connector is soldered at the solder side only.
On the component side there are no solder joints: in order to avoid short-circuits we removed the copper pads with a small file.


The completed interface plugs directly on a serial cable, whereas the pin-strip connector plugs in the circuit or solderless breadboard with the Nutchip to be programmed.
Ensure your pin-strip is tall enough (see figure) to comfotably fit to the circuit to be programmed without touching other components.
A pin-strip is also suitable for connection to a dual-in-line integrated circuit socket: in this case, use half of a 4+4 pins socket and make the pin-strip from thin wires.

INTERF_4.JPG (16715 byte)
solder side, tracks match the color paths on figure above

 

No serial ports?

Some PCs, particularly notebooks, lack a serial port. In this case an USB to serial port adapter solves the problem, with some exceptions. Not all of the devices currently available offer a full RS232 implementation, some are limited to modems while others are designed for connectiong cell phones or digital cameras only. Therefore it is a good advice to ask your dealer to try before you buy.
Full-size computers (desktops and towers) can be expanded whit a serial port card, too; when possible, this is the solution to be preferred, as it usually works smoother and it is cheaper.

Suggested connectors

We have chosen these connectors based on cost and convenience, and we have followed these conventions throughout all of the designs published on our site. We suggest you to conform to this standard connection style: doing this, you will be alble to exchange or program your prototype on the fly, bring it in the class, exchange it with a friend, post it on the Internet with maximum clarity.

The pin-strip connector is well suited to the hobbyst:

  • you can get two pin-strip compatible female connectors from an eight pin (4+4) IC socket. Just cut it in two.
  • can fit as well a solderless bradboard, which is convenient to experiment with Nutchips
  • should you need an higly reliable connector, compatible high quality connectors are commercially available
  • advanced user can adopt a "boxed" compatible connector. The connecotrs offer the advantage of being impossible to reverse.

 

 

Serial cords

The serial cables required to connect the PC to the interface for Nutchip programming are commonly available from computer shops. Ask for a 9-pin serial extension cord. You can also buy one for by yourself with a couple of 9-pin D connectors (male+female) and 9-pole wire.

cable.gif (2876 byte) 9-pole male
(to Nutchip interface NUTCHIP )

9-pole female
(to PC)

1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9

Do not use "null modem" cables, because they don't work!

 

From 25-pin to 9-pin

Some PCs feature a 25-pin female serial port connector instead of the usual 9-pin one. If you are unable to find a ready-made adaptor, here is the connection table to build one by yourself, all you need is a 25-pin male connector and a 9-pin female one.:

pin number, 25 pole
(female on the PC)
pin number, 9 pole
(male on the PC)
RS232 name direction
2 3 TD PC out - Nutchip in (RX)
3 2 RD PC in - Nutchip out (TX)
4 7 RTS PC out
5 8 CTS PC in
6 6 DSR PC in
7 5 GND GND
8 1 DCD PC in
20 4 DTR PC out
22 9 RI PC in

Too many wires? Well, if you are going to use exclusively the transistor interface described above, you can solder just three wires:

1)    from pin 2 of 25-pin to pin 3 of 9-pini;
2)    from pin 3 of 25-pin to pin 2 of 9 pin;
3)    from pin 7 of 25-pin to pin 5 of 9-pin.

 

Alternative interface: with MAX232

This interface requires a specilized IC (MAX232) capable to make standard voltages as required by RS232 standards. Thanks to this IC, this circuit features the best noise rejection and is very reliable and protected against discharges and short-circuits. However, this circuit is also more expensive and takes more space than the transistor-based interface.

 

Alternative interface: with logic gates

If you have some spare logic gates on your application circuit, then you can profitably use them to build the programming interface.

The circuits based on logica gates do not provide the negative voltages as prescribed by the standards: the provide only the necessary logic inversion. Almost every PC can work with positive-only signals, although not guaranteed. Therefore we discourage you to use this solution if you don't know in advance whether the PC will like it or not.

The first example uses two out of the six inverters available on a 4066 (full name: CD4066B) cmos IC:

When using 4000-series CMOS logic ICs, always choose the "B" (buffered) versions, as the can supply more current than the unbuffered counterparts.
Any logic inverter can be used to build a PC interface; the following circuits take advantage from inverters realized with NAND and NOR gates, coming form two out of the 4 ports in a 4001 or 4011:

Note: don't forget to power the logic ICs connecting the respective power pins to +5V and GND!

 

 

Interface: embedded or external?

There is no general answer. Here are the rule-of-thumb: