Weird behavior when USB port is touched

This isn't a question or trouble I'm having so much as it is an observation that might help solve problems.

I am building a circuit to control the blinkers and brake light for my motorcycle using LEDs and MOSFETS. The problem I was having was that the LED would be on even without a signal being passed from the Arduino (Uno). I verified and double triple checked that I didnt have stray code sending a signal, but still the LED stayed on through a MOSFET without a Gate signal. The LED also did not respond to the signals passed form the Arduino while running the code I had written.

Then I touched the metal of the USB port on the Arduino board. When I touched the USB port, the LED dimmed. I kept my finger in contact with the metal of the port, and the LED dimmed and went out. Then I tried pressing the button that should start the program I wanted to run, and the LED behaved perfectly.

I'm guessing that by touching the USB port, I ran down a capacitance stored in the chipset somewhere? I will leave this circuit powered up and see if the problem comes back.

Also, in my trouble shooting process, I tried swapping out my Arduino Uno for an Duemilanove which returned the exact same results, pull down and all.

Very very strange behavior, but there it is. I don't get it, but hopefully my discovery will help un-brain fk those that have been brain fked by something like this.

keywords for those searching: weird strange behavior touch USB port metal

Okay, I take it back, my LEDs are not working perfectly. After writing my last post, i went back to tinker some more only to discover that the LEDs would light up only bright enough to be barely perceptible. Then when I touched the metal of the USB port again, they came on brighter! But that only lasted a few times. After maybe twice of that behavior, subsequent pushes of the button and touches to the USB port resulted in very dim or no light at all. This definitely is a problem now.

The Arduino Uno board is being powered via a 9v battery; nothing is connected to the USB port.

And now as I finish writing this post the circuit/LEDs are behaving perfectly again, and for sustained periods.

Not reliable = not useful

You need pull-up or pull-down in your transistors, with no signal the wires act like antenas and the leds can be on or off, in fact your transistor in not satured so it will start to dissipate a lot of heat.
When you touch the USB connector housing, that is grounded you introduce the electricity and the hability of your body to be a bigger antena to mess with the signals even more, so, put some resistors in those drains!!!

Thanks! I was actually thinking along those lines, but I would have tried putting a resistor in parallel off the Gate. I will try your way since you sound like you know what you are talking about. But resistor on the Drain(transistor power in) and not Source(transistor power out)?

Try to connect a resistor of arround 10Kohm from gate(in my other message I wanted to say gate but I wrote drain instead, sorry) to ground, if it still keeps erratic lower to around 5Kohm or around 3Kohm.

You shouldn't ever leave a MOSFET with a floating gate input - it will misbehave. In a power-switching circuit leaving the input floating can melt the transistor very fast indeed as it may be dissipating as much as the load (instead of a tiny fraction). If your MOSFET is powered separately to the microcontroller controlling it, you need something like a 10k resistor between gate and source to hold it fully off when not being controlled.

Thanks MarkT, I'll give that a shot! I tried a 10k between gate and ground, but still was getting weird behavior.

What makes this even weirder is that the erratic behavior is following my program, roughly. I want the LEDs to pulse when a button is pushed. During this erratic behavior, the LEDs are pulsing as if they were running the code, even though I am not pushing the button and the Arduino isn't (shouldn't be) sending any signals! Even weirder is that the same pulse is happening on a different set of LEDs that are supposed to blink on a different pattern and are on a different PinOut and MOSFET altogether! It's like the circuit has a memory or something. Very strange indeed.

Thanks for the help, I'll post back when I try this and (hopefully) with the problem solved.

This has gone from an Arduino chipset problem to a problem with my project. Mods, feel free to move this to a more appropriate spot

Okay, all solved. Thank you all for your help and patience.

I needed to both add a 10k resistor from Gate to Ground as well as ground Source to the external power supply ground and the Arduino ground.

So you didn't have a common ground? That's why its always a good idea to post the circuit schematic...

MarkT, do you have a suggestion for a good circuit builder program? I've tried searching a bit, but only come up with professional grade programs.