Powering a switch through another source

I have a device that needs a 12v power supply to activate, and my controller is only 5v.  My 12v device only needs to be activated during a certain event that the controller senses.  Is there a way that I could have the controller power a switch of some sort that turns on power to the 12v device, i.e. a switch that is activated when power is supplied?

 

Thanks for the help.

Well first you should start

Well first you should start reading about voltage regulation, here is a good start.

As for the rest, you’ll need to be more descriptive a relay might or might not do according with your setup.

For instance motors are tipically controlled through what is called h-bridges.

So what is the 12V device? what current is expected/measured it would draw?, etc.

A relay will do what I was

A relay will do what I was thinking about.  Thanks.

Just to save you an output pin

I am just getting a feeling here and thought I would save you some time/money and maybe just a pin.

DO NOT connect that relay directly to your microController. You can pretend that relay is a motor (in terms of the current it can draw). Because we know that robot brains can only send out a “data level” signal, and cannot say, turn on a motor directly, if you were to connect your relay directly, you would surely fry the output pin (if you are lucky) or probably the whole chip. You need to run this relay through a “driver” of some sort such as a NPN transistor. I would suggest a 2n2222, 2n3904 or 2n4401 but really, any general purpose NPN transistor would probably work. If you have a Darlington chip around, it would work as well (it is really just a bunch of transistors inside of a chip).

If you are using a Picaxe chip or not, the Picaxe manual happens to show this transistor/relay set-up really well. Do a seach for “Picaxe Manual 3” and find the relay example. This example will work with any microcontroller.