Reverse polarity with relays

Thread Starter

dannich

Joined Feb 18, 2011
6
Hi all:

I am using a picaxe 8M microcontroller to run an LDR circuit.
This circuit will run a lens exchanger for a camera. IR filter for daytime and clear at night. I need some help to figure how to reverse the polarity to the exchanger when it changes from night to day and back again. I assume that I will need some type of a relay but I do not know which type or how to wire.
The LDr input on the PIC is on pin 6. the daytime output is on pin 5 and will output 5 volts. The output for nighttime is on pin 3 and will output 5 volts.
basically I need pins 5 and 3 to run a relay that will reverse the polarity when they are energized for day or night.

I hope this makes sense
If you know what I need to do please if you can post a diagram of how to wire and what relays I will need it will be greatly appreciated


Thanks

Dan N

newer than new
 

SgtWookie

Joined Jul 17, 2007
22,230
Welcome to AAC, Dan.

So, when you raise pin 5 to 5v for daytime, you want the motor to run one way, and for nighttime you raise pin 3 to 5v.

Does the exchanger have a limit switch?
Do you intend to keep pin 3 or pin 5 high all the time, or just run the exchanger for a certain period of time?

Is 5v used for everything, or does perhaps your exchanger operate on 12v, or something else?

It would help a great deal if you put your general location in your profile, otherwise a recommended component may not be available in your country. Country and state or province is fine. Nearest large city can turn out to benefit you as well.
 

Thread Starter

dannich

Joined Feb 18, 2011
6
Hi SGTWookie

Thanks for the welcome
You are correct in as to how I want it to operate.
The exchanger has no limit switch.
5 volts will operate the exchanger very well.
When the pins go high to 5v it only needs a 1/2 second or 1 second max to switch this and then the pin will go low so after the switch there is no need for current to the exchanger.
I am in MI in the US and able to get access to whatever may be needed for this.

Thanks for the help and the quick reply
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Here's one way to do it:



RLY1 and RLY2 are shown as single-pole double-throw relays with coils rated for 5v, 100mA current or less.
D1 and D2 could be any 1N400x series diodes. You might get away with 1N4148/1N914 diodes as well.
R1 and R2 are rated 1/8 Watt or more.
Q1 and Q2 are common general-purpose transistors.
M1 represents your exchanger motor.
Raising InA to 5v makes the motor run forward.
Raising InB to 5v makes the motor run backwards.
If InA=InB, the motor is braked to a stop.

Not shown is a capacitor across ground and the 5v supply. It should be roughly 470uF to 1000uF. Without it, voltage spikes from the motor may cause your PICAXE to reset. You should have an 0.1uF ceramic or metal poly film cap across your PICAXE Vdd/GND pins.
 

Attachments

Thread Starter

dannich

Joined Feb 18, 2011
6
SGT wookie

In the diagram you posted for me I have a question
In the diagram do the flats of the transistors face each other or do they both face the same way.
In other words on my circuit I have the flat of the left hand transistor facing to the right. Will the Flat of the right hand transistor face to the left or also to the right.
I am very new to this and the symbols are a bit greek to me as of yet.

Thanks

Dan N
 

SgtWookie

Joined Jul 17, 2007
22,230
Looks like you need a bit of help with understanding the schematic representation of a transistor.

Have a look at Q1, on the left; a 2N2222 transistor. The emitter is on the bottom (with the arrow). The base is on the left, and the collector on the top.

Have a look at Fairchilds' datasheet for the PN2222; it's about the same specs as a metal-can 2N2222 but in a plastic TO-92 package:
http://www.fairchildsemi.com/ds/PN/PN2222.pdf
OnSemi's datasheet, same part: http://www.onsemi.com/pub_link/Collateral/PN2222-D.PDF

So, with the part number on the transistor facing so that you can read it (flat towards you, pins down), the terminals from the left are numbered 1, 2, 3, and correspond to the emitter, base and collector.

As far as the diodes go, the ring/stripe around the diode indicates the cathode end. The arrows on the diodes in the schematic points towards the cathode. So, you want the cathode pointing towards the more positive side of the coil.
 

Thread Starter

dannich

Joined Feb 18, 2011
6
So the transistor on the right has the arrow on the bottom as well and that woul dbe the emitter on the right is the base and the top is the collector
 

SgtWookie

Joined Jul 17, 2007
22,230
So the transistor on the right has the arrow on the bottom as well and that woul dbe the emitter on the right is the base and the top is the collector
That is correct.

Usually, schematics are drawn with the inputs coming from the left, and outputs going towards the right. However, with symmetrical circuits like this, it makes a good deal more sense/aids rapid comprehension to depict the circuit as mirrored; ie: left of motor is identical to right of motor, just mirrored.
 
Top