NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Using MCU to connect two wires

March 02, 2010
by nrotstan
nrotstan's Avatar

Ok, I thought this was going to be really easy, but I'm failing :-( I have an external device that has two wires -- power and ground. When they touch, the device runs. I want to control it from the nerdkit processor.

Originally I thought a transistor was what I wanted, but now I'm not sure. If I connected the power wire to drain and the ground wire to source, then I'd have nothing left to run to the breadboard ground, so the gate doesn't work right. I tried putting both the ground wire and a connection to breadboard ground on the source, but that just left the transistor open even when the MCU wasn't providing power to the gate.

So how would I go about accomplishing this? What I want is so simple -- just connect two wires! :-)

Thanks for your help! Neil

March 02, 2010
by treymd
treymd's Avatar

Check out the motors tutorial, it should give you a start. They use the 2N7000 Mosfets to control a small motor, you could, if you want use the same method to control an appropriate size relay too. Just remember the flyback diode! Inductive loads can be chip killers!

March 03, 2010
by nrotstan
nrotstan's Avatar

Ok, so after going back and watching the tutorial again, I realized I was missing the 100k resistor connecting the gate to ground. Now everything works.

So here's what I did, in case it helps anyone else:

  • external device ground is connected to transistor source
  • breadboard ground is also connected to transistor source
  • external device power is connected to transistor drain
  • MCU is connected to transistor gate
  • 100K resistor is also connected to transistor gate, and goes to breadboard ground

Thanks everyone for the help!

Neil

Post a Reply

Please log in to post a reply.

Did you know that interrupts can be used to trigger pieces of code when events happen? Learn more...