Pins stop working on Motorshield R3

I was wondering if anyone else has had a problem with this and if so if there is a fix. I'm using the standard motorshield that radioshack is selling attached to an Uno board.

The problem is that several of the pins have stopped working on the motorshield. I'm running a laser pointer ("death-ray laser") off the board that is triggered by having a pin with an output "High" to power it. Originally I ran the laser pointer off the A1 pin, but it stopped working after a few days. When I remove the shield and run straight from the arduino uno it works fine from that pin. I was in a hurry during project development, so I moved the trigger/power pin over to digital pin 5 and everything worked fine. Zip ahead to 3 weeks later and suddenly the "death ray" isn't working on digital pin 5 anymore.

Does anyone have any suggestions? Has anyone else had trouble with motorshield pins?

Can you show us the circuit, tell us where the datasheet is for the laser pointer (or give a rough idea of voltage / current)?

The laser pointer is just a cheap dollar general version that we had around the house. Was originally running off two 1.5v button cell batteries (AG3) in series, so it comes ready to run on 3v.

Here is the motorshield I am using attached to my uno: http://arduino.cc/en/Main/ArduinoMotorShieldR3

Here is the pinout that I have on the motorshield currently:

Pin:
3 - Motor Power A (Comes pre-set this way with motorshield)
4 - Servo1 control
5 - laser power. pinmode OUTPUT, HIGH = laser on
6 - Trigger for an ultrasonic rangefinger
7 - Echo for an ultrasonic rangefinder
8 - Brake B (comes set this way with motorshield)
9 - Brake A (comes set this way)
10 - not used
11 - Motor Power B (pre-set)
12 - Motor Direction B (pre-set)
13 - Motor Direction A (pre-set)

A0 - Servo2 Control

Both servos and ultrasonic rangefinder are powered from the 5V pin on the motorshield. The servos, rangefinder, and laser pointer all run their ground back to the two ground pins on the motorshield.

So laser receives power when pin is set to high, and turns off when set to low. Applicable code looks like this:

int laser1 = 5; // set laser trigger to dig pin 5

void setup(){
pinMode (laser1, OUTPUT); // prepares pin to power the laser
}

void loop(){
digitalWrite(laser1, HIGH); // fires on target
delay(1500);
digitalWrite(laser1, LOW);
delay(1500);
}

You are powering the laser diode directly from an Arduino pin? No wonder its blown. Typical laser diode will need more current than
the abs. max rating of an Arduino pin - and you have no current limiting resistor anyway. I presume you are powering the Uno at 5V?

You must keep the current from each pin below 40mA maximum, or it can fry. Typical red laser diode might be something like 2.5V forward voltage or so under load, try to power it from 5V and it'll simply overload the Arduino pin's output FET by a large factor and fry it.
Typical laser diode probably won't even start to lase at 40mA, a driver circuit is prob. required.

Okay, that made sense. I don't have a datasheet for the laserpointer or anything, but I can look up what the batteries were providing.

According to what I see online, an AG3 buttoncell battery is 1.5V and 35mA. Since the device came with 2 x AG3's in series, that should be 3V at 35mA. Based on this it looks like I should be under the 40mA limit, but I think (and I'm really still learning here) that what you're saying is that since the laser is set up with a diode which reduces a 3V / 35mA to the proper level for the laser, based on Ohms law when I increase the voltage to 5V, the current will be much higher?

According to what I see online, an AG3 buttoncell battery is 1.5V and 35mA. Since the device came with 2 x AG3's in series, that should be 3V at 35mA. Based on this it looks like I should be under the 40mA limit,

That doesn't make sense - to find the voltage and current you'd need to know the response curve for the laser diode and the internal resistance of the battery and find the intersect - it'll certainly be less than 3V, and could easily be more than 40mA.

I think you found the capacity rating for an AG3 in mAh and confused that with current? Capacity is the amount of charge a battery can hold, not the rate at which is can supply it.

For instance an LR44 (somewhat larger alkaline button cell) is rated at 160mAh but a new one can push 0.7A through a short-circuit indicating an internal resistance of about 2.2 ohms. The AG3 probably has internal resistance of about 6 ohms and thus could push 0.25A or so max.

Okay, yes, I see now that I certainly confused the capacitance with the current.

Based on my last post I went out and bought a pack of 100 ohm resistors. I was going to move the laser over one pin, put a 100 ohm resistor on in the line, crack open a beer and hand out high-fives, but now I'm thinking that isn't a great idea.

How do I find the "response curve for the laser diode" and the internal resistance of the battery so I can "intersect" them?

Now you're confusing capacity with capacitance!

Your 100 ohm resistors will protect the Arduino pins but will probably stop the laser diode from lasing - laser diodes need a minimum current to work (unlike an LED which just glows dimmer at lower currents). Without data on the exact laser diode there's no easy way to know how
to guarantee it will work.

Okay, haven't experimented yet to see if the resistor in the line will work with the laser diode, but assuming that it doesn't... what if I just used the original two button cell batteries in circuit with the laser, and then just used a mosfet or something to trigger the laser on and off?

In case anyone else checks out this thread looking for information for their own projects:

The laser works perfectly well with a 100ohm resistor in the line.