Quick Question

I was wondering if you could program the microcontroller to act as a switch. For example, i have a wireless camera with 2 cables, power and ground. Could I cut one of these 2 cables, say power, and feed the 2 cut power ends into the microcontroller and then program the microcontroller to allow electricity to pass through the cable or not?

I have EasyC V2.

Thanks

Pioneer14

You could do it with a relay and one of the digital out ports.

This looks good but if I was to use this would I be using the same battery as the microcontroller? Sorry I am really bad at this stuff and I don’t know any where else to ask.

Thanks,

Pioneer

Depends on what your camera voltage is. If it is close to 7.2 volts than sure you could use the vex battery but if it is higher or lower you either need a separate battery or a way of reducing the vex battery output, like voltage regulator, which are fairly cheep.

It is probably about 5 volts in which case you could use a voltage regulator from radio shack.

My camera voltage is 9v. You just plug it into a 9v battery. I think I am going to get this relay, it sounds good and looks relatively simple. I just have one more question. How would I wire 2 9v batteries so that if the first one dies, the second one will kick in and start supplying voltage? I know this doesnt have to do with VEX, but I have looked all over the internet and cant find anything.

Thanks

Pioneer

Generally, you just wire the two batteries in parallel. This causes them to wear down together, but it’ll take twice as long since the load will be split evenly between the two batteries.

If you want them to be used one-at-a-time, you’ll need a much more advanced circuit. It would require some switches to select which battery was providing power (probably MOSFETs, since relays draw too much power to be kept on continuously), and a voltage monitor to determine when it was time to switch batteries, and a bit of logic to control the measurement & switching.

Cheers,

  • Dean

The digital ports do not put out enough power to directly operate a relay. You’ll need something like a transistor to drive the relay. See here for a drawing of how to wire up a transistor drive to a digital port.

Cheers,

  • Dean

The simplest way to extend your battery life is to wire 2 batteries in parallel. This way you are drawing power from both batteries. You can wire 2, 3, 25 batteries this way.

or

You could use a voltage monitoring circuit and a relay to switch from one power source to another… but this circuit would also draw power.

(Quazar ya just beat me)

I guess my “quick question” is more complex than I thought haha…

The battery in parallel thing sounds good and I will try that out-thanks.

But a digital output is not strong enough to power a relay?, could this work though: http://www.dimensionengineering.com/PicoSwitch.htm

This relay looks simple enough. If it doesnt work do I have to plug it into the diagram made my Qazar? If so…how?

Thanks for all your guys help, its just I am really bad at this stuff.

This relay looks simple enough. If it doesnt work do I have to plug it into the diagram made my Qazar? If so…how?

Thanks for all your guys help, its just I am really bad at this stuff.

This product should work, but it plugs into a Motor port, not a Digital I/O Port. It isn’t just a relay; it actually has some electronics built into it to drive the relay.

Also, you’ll need some of [these to plug it into the Vex ports.

Cheers,

Ok, I am starting to understand this stuff. I know I am asking you guys how to do pretty much everything,:slight_smile: but I have one more question and then I am done. I found this diagram for the relay:

Instead of the light bulb I want to have my wireless camera being controlled. Could the following diagram work instead, where the lens is the camera:? (Obviously the battery would be a 9v instead of the 2 AA’s shown)

[http://www.picresize.com/popup.html?images/rsz_1pico.jpg

Thank you so much for everyone’s help!!!

Pioneer](http://www.picresize.com/popup.html?images/rsz_1pico.jpg)

I am actually just going to use this relay:

http://www.dimensionengineering.com/BattleSwitch.htm

I will tell you guys how it works out.

FYI, I just posted a new diagram showing how to use a transistor to control a small DC load, but power it from another battery.

Cheers,

  • Dean