Let's Make Robots!

The Picaxe Support Chips - What are they for?


There are various different chips which are commonly used with the Picaxe chip. Here I attempt to explain what each one does, where it goes and why you might care.

Most of this has already been mentioned, but I thought I would collect the information together here and add a little more detail where I can. I apologise in advance for the wikipedia scholarship that follows, so please let me know what I got wrong and I'll try and update this page to match.

It seems almost obligatory to preface every post offering advice, with the statement 'I am no expert but...' and to put this in perspective, I've never even touched the chips I'm about to describe (you can read why here). What I have done, is spent a little time reading up about what they are and what they do.


The Darlington Driver

chip_darlington.png

What does it do?

When you but the Pixace starter kit you get one of these for free. This chip allows the small output signal of a chip to switch on and off a large current. This allows the small output from the chip to control large devices such as a motor.

How does it do it?

A Darlington Driver is an arrangement of two transistors that allows a small signal strength current to switch a larger current. This is already what transistors basically do, but in this arrangement the effect is amplified. Transistors have three legs and operate a lot like a switch which you can turn on or off by sending a high or low signal to the 'base' leg. When there is sufficient current to this base leg then the transistor opens and allows current to flow from the 'collector' leg to the 'emitter' leg. In this way a transistor can use a smaller current to allow a larger one to flow.

In a Darlington Driver this effect is used twice by taking the output (from the emitter leg) of the first transistor and connecting it to the signal listening leg (the base leg) of another. That way a small input current is changed into a medium input current for the second transistor, which allows it to switch a large current through itself.

Although you could create this circuit for yourself using transistors, a conveniently packaged chip is a lot simpler, and can also provide extra features such as protection for feedback from the device. A much more thorough discussion with diagrams can be found here.

How does it integrate with the project board?

If you look at the chip you will notice that it has 9 legs on each side to drive 8 channels. Looking at Fritsl's excellent guide to the board you'll notice that the bottom right leg of this chip is connected to the V2 voltage on the board. This is the higher power that we are switching with the driver and theoretically could be much larger than the 5V input V1.


L293D - Motor Driver

chip_L293D.png

What does it do?

The motor driver circuit allows you to change two signal lines into control for a single motor which can send it backwards and forwards. Unless your robot does not know the meaning of retreat, this is probably a handy thing to do. Without this, naively connecting a single output to a motor would only allow you to go forward or stop.

How does it do it?

I can't claim to understand the precise workings of this chip but I think the general theory is pretty straight forward. Each of the signal level inputs in a pair (for one motor) are connected to amplifiers which perform the same job as the Darlington Driver above, stepping up the output from a small input. The connection of these is such that the main output of each is connected to a different terminal on the motor. When no signal is provided to the amplifier it is able to act as a 'sink' (a route back to ground or 0V). This means that adding a high signal to one input will cause the current to flow in one direction through the motor, and sending a high signal to the other will do the reverse causing the motor to spin backwards or forwards. Lord knows what happens if you turn on both at once.

This arrangement is very similar to an arrangement of switches or relays (switches controlled by an electric current) known as an H-Bridge, which is much easier to look at and understand. The H-Bridge also has an interesting ability to short circuit the terminals of the motor whilst isolating it from the power supply. This uses the generator properties of the motor to create a current which opposes it's direction, causing the motor to brake.

How does it integrate with the project board?

There is a specific DIP socket for a motor driver on the project board. The chip, or a pin compatible alternative can be dropped in here. The board is wired up such that outputs 0-3 will now control a the A and B marked areas on the board as described. If you are planning on controlling a million output devices you may wish to consider hacking a servo instead, as this only uses one output for forward and backward control.


330R DIL Resistor

chip_dil_resistor.png

What does it do?

If you buy the servo upgrade pack for the Picaxe (i.e. you hate money) you'll get what looks like a little chip to plonk in place of the Darlington Driver. This chip is in fact a series of 330 Ohm resistors linked across like the legs of a ladder. This drops the current on the output side to allow you to connect passive devices without worry of frying the Picaxe chip.

How does it do it?

Well... it's a resistor. You'll notice the 330 Ohm value batted about quite a lot in the Picaxe documentation, but where does it come from? If you read the Picaxe introductory manual, you'll see buried in there somewhere that the maximum current the output pins can sink or source is 20mA, or 0.02A. Not a lot, so applying a bit of basic electronics and assuming nothing else is in the circuit, how much voltage is that?

    V = IR
V = 0.02 x 330 = 6.6V

Knowing this is handy for a number of reasons. If you are hooking things up to the same battery pack for V1 and V2, then anything you add in here is only going to increase the resistance and so drop the current. This means you can hook up what you like without worrying about the chip as long as it doesn't generate current for itself. If you are planning on hooking up servos etc. using a separate battery pack for the V2, then don't go above 6V with these resistors or you could start stressing the chip. If you are going to hook it up to a petrol generator to power your space heater, you are going to need a bigger resistor (and professional help).

How does it integrate with the project board?

This resistor set sits in the same socket as the Darlington Driver chip, so you'll have to pull that out to use it. It doesn't need the voltage feed in the last pin position, so it sits across the output pins 0-8 leaving two clear beneath. This allows you to use servos (which only require a small pulse signal) or LED's etc. on the normal output connector pins without worrying about frying the chip.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Nice to so all this stuff clearly laid out. 

I'm not entirely sure, but I think you're wrong about the 330 resistor and the servo setup. The resistor limits the current to the signal line of the servo. No matter what voltage / current you are sending through the servo, none of it will reach the picaxe. At least not through the signal line. 

Picaxe documentation says each output can source 20 mA.  I think the idea is to limit the amount of current you try to draw from the output based on the resistor.

If you are powering the Picaxe with 4.5V, the Ohm's Law yields:

V = I x R

I = V / R

I = 4.5 / .02 =  225 Ohms

So using  330 Ohms ensures you never draw the maximum current, which is good.

The 330 ohm resistor is used to prevent frying the chip's transitor by limiting the current, if the pin is shorted to ground.

It used to be standard practice on any output pin, but people are geting sloppy.

I understand all that.

What I meant was, that it this walkthrough suggests to use a bigger resistor if you run a servo with more than 6 volts. If you run a servo that runs at 100V / 25A the signal line would still need a 330 Ohm resistor because the signal will be sent with low/high or 0/1 somewhere between 0 and 5V.

After rereading the original walk through, you are right, it does sugest requiring a bigger resistor for higher voltages.

That is wrong.

The servo imput pin is looking for a logic level voltage no matter what the voltage actually being used by the internal servo motor. this is similar to the '293 or the '2803 motor drivers.

 The 330 ohm resistor is just a protection as has been discussed before. 

where can i buy 330r dil resistor. i looked up on other websites like. roboticconnections.com radioshack.com frys.com and other websites. i just want to buy the chip thats not with the servo pack. :(

Frys.com has single 330 ohm resistors online : http://shop4.frys.com/product/1005043 and in their stores I believe I've seen the DIN package. 

So does Radio Shack : http://www.radioshack.com/product/index.jsp?productId=2062341

Jameco : Resistor net, 16 pin, 330 ohm

Mouser : 59 versions, only first 5 or so useful

 

 

 

 

Great writeup! I was always wondering about the op amp configuration in the darlington driver! I just happened to notice though that the picaxe documentation (part 3 I think) says that if you set both pins high on the l293d it will do the same thing as setting both pins low; which is in this case stopping the motor altogether.

Great post, thanks for the info.

I'm not sure about the l293d specifically, but H-bridge motor controllers basically have 4 output modes

  • Set Input1 high, Input2 low: motor turns one direction
  • Set Input1 low, Input2 high: motor turns the other directcion
  • Set both inputs low: motor freewheels, and stops due to friction
  • Set both inputs high: motor stops

So thinking the l293d would work the same way.

Try this simple test. Take a small DC motor and turn the shaft by hand.  That's freewheeling.  Now apply voltage to both the + and - leads on the motor and try to turn the shaft by hand and you will feel the breaking power.  This behavior of DC motors is important when you have a lot of mass, like in an electric vehicle or if you want to stop a high speed power tool quickly.

Thanks guys, I hope it's of some help to other people. I'm sorry for bumping it up to the top of the front page again. I spotted some typos and didn't realise it would do that.