Uno only semi works on two of four computers

The purpose of the program is to send a HIGH LOW signal to a transistor that opens and closes a relay. The UNO has the example blink program uploaded on it with the digital pin connected to the transistor. I plug the USB into my laptop and it works (switches relay on and off). I plug it into my other laptop, and it works. I plug it into my third laptop and it stops. I plug it into an external power supply and it works. If I plug it into my third laptop with the external power supply it also doesn't work. All in all, I have four laptops and it works on two and doesn't on two..? All four have arduino software uploaded and can upload programs onto to the board. Two can upload the blink program and can make the board's LED blink but will not work with my circuit.

The circuit is simple but may be where the problem lies. Digital pin to base pin of triac. AC power supply to relay to pin 1 of triac, pin 2 of triac to ground and return AC.

Laptop that will not power the circuit but can light up the board's LED. When I connect the base to digital pin 13 (pin with the board's led) the LED dims but still blinks but relay does not switch. I do the exact same thing with my other laptop and the LED and switch work fine..?

Any thoughts..?

Used to be that some laptops had weaker USB ports. Might check the supply voltage to the board to make sure they are getting enough voltage?

groundfungus:
Used to be that some laptops had weaker USB ports. Might check the supply voltage to the board to make sure they are getting enough voltage?

I agree and that's what I thought too. But then when connecting a external 9V battery to the Vin pin, should this not have fixed the problem?

if the 9v battery by itself, yeah. if 9v with USB plugged in maybe not. i was working on my robot a while back and with the USB plugged in (only) my rangefinders wouldn't work right. I read that they needed more voltage to work so i plugged in a 9v battery while USB plugged in (to read rangefinders). The USB voltage was low enough that it pulled the battery down and drained it rather quickly. only when i ran the arduino with 9v by itself would the rangefinders work right.

That's interesting. Is there a way to stop this from happening. The laptop that does this is the one that is connected up to all the power supplies with all the labview software to run them on it so I can't really switch out computers..

opto-isolator with the 9V supply fixed problem. Thanks for your help.

Could you show me what you did? May help me in the future.

9v battery as in the small rectangle style? That wouldn't be doing you any favors.

Hmm. The arduino digital pin is sending the signal to the opto (pin 1, pin 2 ground). The 9V is going into the opto collector pin (pin 5) and when the opto gets the signal from the arduino pin it closes the circuit and allows this 9V to go to the triac base (via opto pin 4) which lets the AC current flow. The arduino wasn't opening and closing the triac but the 9V will.. Is there another way to work this, sorry for not having a pic. ?

In the first post you seem not to have any ground return path.
However what voltage was your AC, it is not a good idea to hook up circuits to mains without an optical isolator.
You can find out how much your triac gate ( not base ) needs from the data sheet. I would have thought there should be a resistor to limit the current in the gate.

You can dispense with the battery by using the mains to supply the voltage to the gate through a series resistor and capacitor.

Grumpy_Mike:
You can dispense with the battery by using the mains to supply the voltage to the gate through a series resistor and capacitor.

Awesome, thanks Mike. I really don't want this battery in my circuit but I'm a little confused on this series resistor/capacitor that you describe. Could you go into a little more detail on where this fits in to the opto and triac part of the circuit?

A bit like this:-

triac.png

don't use pin 13.

use another pin like pin 2.. if the voltage is low to begin with, the led will only lower the current further to the transistor.

cjdelphi:
don't use pin 13.

use another pin like pin 2.. if the voltage is low to begin with, the led will only lower the current further to the transistor.

Well pin 13 has a load on it but it is only a mA or so, it will not affect the voltage appreciably.

well it would depend on the input voltage and resistor used...

format22:

groundfungus:
Used to be that some laptops had weaker USB ports. Might check the supply voltage to the board to make sure they are getting enough voltage?

I agree and that's what I thought too. But then when connecting a external 9V battery to the Vin pin, should this not have fixed the problem?

Nope. A 9v battery probably supplies a lot less current than a USB port.

OTOH if you're outputting enough current on an I/O pin to cause problems then that pin isn't going to last very long.