# Automate PCB to automatically invert the polarity of the output for every pulse

#### Johanpp

Joined Jan 5, 2016
11
I have a PCB which gives me a polarized pulse every 60 seconds. The H-Bridge relies on an external pulse to PinA the first time and then PinB for the next pulse and so on....

Currently I use Arduino V3 for these pulses. Is there a way to expand the function of my PCB to automatically send the pulse to PinB if the previous pulse was to PinA and then again to PinA the next time, and so on.......

So, pulse to PinA, then PinB, then PinA and so on.

Can someone give me a schematic?

I will appreciate this very much.

#### djsfantasi

Joined Apr 11, 2010
7,641
What is a "polarized" pulse? What is its frequency and magnitude?

#### Johanpp

Joined Jan 5, 2016
11
What is a "polarized" pulse? What is its frequency and magnitude?
It is simply a 5 volt 100ms pulse from an Arduino board.
Polarized means wire one carries the V+ and the other wire the GND. Then for the next pulse a minute later wire one will carry the GND and wire two will carry the V+. These wires then connect to a coil which will change the polarity of the magnetic field of the coil. This coil then speeds up or slows down a mechanical public clock to keep accurate time all year round.

#### crutschow

Joined Mar 14, 2008
27,025
So what you need is to reverse the polarity of the pulse between two wires.
That can be done with a transistor bridge circuit.
What is the current and voltage of this pulse?

#### djsfantasi

Joined Apr 11, 2010
7,641
@crutschow - the OP has stated it is a 5VDC pulse from an Arduino. @Johanpp - what is the voltage and current of the coil?

If the coil current is under 600ma, one could use a CD4013 wired as a T flip flop driving an LM293D H-bridge.

If the current draw is more than 600ma, you could build your own H-bridge to handle the larger current.

Do you have an extra pin on the Arduino? You could eliminate the flip flop by driving alternate pins in software.

#### Johanpp

Joined Jan 5, 2016
11
So what you need is to reverse the polarity of the pulse between two wires.
That can be done with a transistor bridge circuit.
What is the current and voltage of this pulse?
The Arduino collects the 1 second pulses from a GPS receiver and on the count of 60 sends a 5V pulse to the H-Bridge, PinA for one polarity and PinB for the reverse polarity.

The voltage of the PCB is 12V (LM7812) for some applications and 24V (LM7824) for others.
The output of the H-Bridge goes to either a 1 Amp Coil, or a DC motor, also 1 Amp, but with room for the starting surge.

I already have an H-Bridge on the board which is working well, but because of the cost I would like to eliminate the Arduino. The H-Bridge needs to be pulsed on the left side for one polarity and then the right side to reverse the polarity, hence the Arduino which I am trying to eliminate.

Since the Arduino handles the polarity and the counting of the 60 seconds it now seems to me that I will need some intelligence on the board to replace the Arduino. Something like a PIC 12F675 or a PickAxe. Any ideas as to which chip will be the easiest to master. I can program in C## and it seems the Pickaxe uses C. @@@ Wrong, it uses Basic Johanpp @@@
Your views will be appreciated.

Last edited:

#### Johanpp

Joined Jan 5, 2016
11
@crutschow - the OP has stated it is a 5VDC pulse from an Arduino. @Johanpp - what is the voltage and current of the coil?

If the coil current is under 600ma, one could use a CD4013 wired as a T flip flop driving an LM293D H-bridge.

If the current draw is more than 600ma, you could build your own H-bridge to handle the larger current.

Do you have an extra pin on the Arduino? You could eliminate the flip flop by driving alternate pins in software.
Yes, I only use Pins 2, 4, 7, 8 and 9.
But, I have now realized I still need some intelligence on the board to do the counting of the 60 seconds derived from the 1 second pulses of the GPS receiver. Would a PicAxe or similar programmable chip not the best route? I have no experience on these, so if this is the way to go, do you have any suggestions?

#### KeepItSimpleStupid

Joined Mar 4, 2014
4,690

#### crutschow

Joined Mar 14, 2008
27,025
A PicAxe can readily handle the divide by 60 count and generate the pulses, the same as an Arduino.
The PicAxe uses Basic language which is very easy to learn and use.
Personally I prefer Basic for simple programming projects as compared to the arcane C syntax.

Of course the pulses could also be generated using a couple of counter chips and a flip-flop plus a few logic gates.

Last edited:

#### Johanpp

Joined Jan 5, 2016
11
That's the good ole' flip-flop, a divide by 2 counter.

https://en.wikipedia.org/wiki/Flip-flop_(electronics) Look at the J-K flip flop. When J=K the output toggles. Q and ~Q are the inversions of each other. You have to ensure the correct power up state.
The flip flop looks like it will work, but I am too new to this and far more comfortable with something I can program, especially as this one PCB must cater for a few different applications, So I will follow that route for now.

#### Johanpp

Joined Jan 5, 2016
11
That's the good ole' flip-flop, a divide by 2 counter.

https://en.wikipedia.org/wiki/Flip-flop_(electronics) Look at the J-K flip flop. When J=K the output toggles. Q and ~Q are the inversions of each other. You have to ensure the correct power up state.
I think this sounds too complicated for my experience. I will firs have a look at the PicAxe.

#### Johanpp

Joined Jan 5, 2016
11
A PicAxe can readily handle the divide by 60 count and generate the pulses, the same as an Arduino.
The PicAxe uses Basic language which is very easy to learn and use.
Personally I prefer Basic for simple programming projects as compared to the arcane C syntax.

Of course the pulses could also be generated using a couple of counter chips and a flip-flop plus a few logic gates.
I think the PicAxe is what I will go for. I am picking up a PicAxe tomorrow to have a better look at it. I have programmed in Basic, QuickBasic and Visual basic for many years.
I will keep you updated. Thanks for your help so far.

#### Johanpp

Joined Jan 5, 2016
11
A PicAxe can readily handle the divide by 60 count and generate the pulses, the same as an Arduino.
The PicAxe uses Basic language which is very easy to learn and use.
Personally I prefer Basic for simple programming projects as compared to the arcane C syntax.

Of course the pulses could also be generated using a couple of counter chips and a flip-flop plus a few logic gates.
See my reply to you further down.