Reversing polarity of an output

The attached schematic shows a two pin connector (named SOL). When the circuit is powered, Pin1 of the 8M will go high and the output will be +5V on pin1 and Ground on Pin2 of the connector.
After a period of 1, 2, or 3min. I need to reverse the polarity on the pins of the terminal (SOL).
If necessary I could use a larger Picaxe
Actuator.jpg

Any help will be appreciated

Andres
 

premelec

Senior Member
Please clarify "reverse polarity" - you can't get a negative voltage without additional external circuitry. If you mean change which pins are on or off then that is done in code with timing instructions made to do what you want and testing if the time conditions have been met and then changing the pins... What part are you having trouble with?
 

srnet

Senior Member
Very unclear what it is you are trying to do.

"I need to reverse the polarity on the pins of the terminal (SOL)"

Then if you did that you will have a direct short because of the diode.
 

rq3

Senior Member
The attached schematic shows a two pin connector (named SOL). When the circuit is powered, Pin1 of the 8M will go high and the output will be +5V on pin1 and Ground on Pin2 of the connector.
After a period of 1, 2, or 3min. I need to reverse the polarity on the pins of the terminal (SOL).
If necessary I could use a larger Picaxe
View attachment 17455

Any help will be appreciated

Andres
Pin 2 of SOL is connected to +5. If you ground it, you will short the supply. Pin 1 of SOL is attached to the MOSFET drain, and won't "see" anything (except for minor leakages). You need to have "something" (presumably a solenoid?) connected between Pins 1 and 2 of SOL.
Also, Pin 1 of the 8M is connected to the +5 volt supply. It will always be "high" (as long as power is on), which has nothing to do with the state of the MOSFET. Only your code can determine that.
 

KMoffett

Senior Member
Th reverse the polarity of SOL (solenoid?) you will need two outputs and an H-bridge.

Ken
I forgot to ask a key question! Do you just want the polarity one way or the other, or do you want it to be unpowered also? If the former, just replace the SOL with a DPDT relay and have the relay switch polarities with just the one output. If the latter, then you will need the H-bridge. A search of this Forum for "H-Bridge" should give you all the hardware and code info you need.

Ken
 
I forgot to ask a key question! Do you just want the polarity one way or the other, or do you want it to be unpowered also? If the former, just replace the SOL with a DPDT relay and have the relay switch polarities with just the one output. If the latter, then you will need the H-bridge. A search of this Forum for "H-Bridge" should give you all the hardware and code info you need.

Ken
I did a search for H-Bridge and got a L293D from a friend. I will try on a breadboard tomorrow the schematic shown below.

Thank you again.
Andres

Actuator.jpg
 

Dartmoor

Member
In case you are planning to vary the voltage, note that with an 8 pin picaxe there is only one PWM output.
So with an H-bridge; if (for example) you want 30% voltage, then you need to set the duty cycle as 30% when the PWM pin is +ve & 70% when the PWM pin is 0v.
Easy to sort out but it did catch me out the first time I tried!
No doubt someone here has a clever fix . . .
 
In case you are planning to vary the voltage, note that with an 8 pin picaxe there is only one PWM output.
So with an H-bridge; if (for example) you want 30% voltage, then you need to set the duty cycle as 30% when the PWM pin is +ve & 70% when the PWM pin is 0v.
Easy to sort out but it did catch me out the first time I tried!
No doubt someone here has a clever fix . . .
Thank you for the heads up, it will be helpful in future projects, but in this case, I don't need to vary the voltage.
Andres
 
Last edited:

Reloadron

Senior Member
The attached schematic shows a two pin connector (named SOL). When the circuit is powered, Pin1 of the 8M will go high and the output will be +5V on pin1 and Ground on Pin2 of the connector.
After a period of 1, 2, or 3min. I need to reverse the polarity on the pins of the terminal (SOL).
If necessary I could use a larger Picaxe
View attachment 17455

Any help will be appreciated

Andres
I will venture a guess that SOL is a solenoid of sorts, be it a valve or whatever. Since you want to reverse the polarity to SOL I will also guess it is a latching type solenoid with a single coil design. Where we apply a pulse to the coil to turn it on and apply a pulse of reverse polarity to turn it off. So if we apply a positive pulse to for example pin 1 with pin 2 ground we turn it on and then we apply a positive pulse to pin 2 with pin 1 as ground to turn it off.

Should that be the case you can, as mentioned, use an H Bridge circuit. You can build an H bridge or buy a ready made H bridge driver module ready for use for under $10.00. Something like this one. You would use two output pins on your pic and a simple 08M could be used.

Now if I have the SOL guessed all wrong then all bets are off. :)

Ron
 
You guessed right about the solenoid. I decided to use an L293D IC. See the schematic is below. Merc is a mercury switch
Code:
#Picaxe 08M2

'*** Variables ***
Symbol DLY=W0
Symbol Pulse_dur=W1

'*** Pins ***
Symbol Merc=Pin4

Pulse_dur=3000

	setint %10000,%10000
Waiting:
	Low 0,1
	if Merc=0 then goto Waiting
Interrupt:
	DLY=0
	If Pin2=1 then let Dly=5000
	endif
	If Pin3=1 then let Dly=10000
	endif
	High 0
	Low 1
	Pause Pulse_dur
	low 0,1
	Pause Dly
	low 0
	high 1
	Pause Pulse_dur
	low 1,0
	Pause 1000
	setint %10000,%10000
	pause 1000
Return
Actuator.jpg
 

KMoffett

Senior Member
Is there going to be a problem with the programming cable (SO) tied to both the PICAXE's pin 7 (serial out) and the L293D's pin 2 (IN1), during programming?

Ken
 
Is there going to be a problem with the programming cable (SO) tied to both the PICAXE's pin 7 (serial out) and the L293D's pin 2 (IN1), during programming?

Ken
Nothing will be connected to SOL during program loading. PICAXE's pin 7 is active as a Serial Out only during program loading. After that it is available as an output pin.
 
Top