# Help with frequency divider

#### alexanderfoti

Jan 10, 2013
24
Hi all

I am struggling to understand the implementation side of circuit dividers.

I am running an mpguino on my motorbike. Its an arduino based MPG calculation device, It uses 2 inputs, Injector feed and VSS pulses.

My motorbike makes 120000 pulses per mile, which is very high compared to other vehicles. As a result, it cannot keep up at speeds past 70ish mph, and losses information.

The VSS input into the mpguino is 0-5v WRTG.

My aim is to divide the pulses by 24 to give a more reasonable 5000 pulses per mile, but I do not know how go to about it using a circuit.

I have read about using a CD4027 or a flip-flop device but I dont know where to start (despite reading page upon page of information!). If somebody could give me a hand designing a simple circuit to go inbetween my VSS signal and the mpguino I would be very greatful!

#### Gryd3

Jun 25, 2014
4,098
I'm sure a decade counter, or a pair of decade counters would work.
I'd have to dig around to be sure though... but the 120000 pulses would feed into the counter, and you could wire it to divide the input by 2 to 10. (Daisy chain them to divide further)

This is a beginner's thought process. Stick around and other ideas will pop in.

#### alexanderfoti

Jan 10, 2013
24
Ah yes, this site has a really easy to intepret explanation of a decade counter http://www.doctronics.co.uk/4017.htm

That could work, 1 would give a divide by 10 which should work to be honest, from 120000 to 12000. An ideal vss pulses would be 5000-6000.

#### Arouse1973

Dec 18, 2013
5,178
What about a CD4059 divide by N counter?

#### Gryd3

Jun 25, 2014
4,098
What about a CD4059 divide by N counter?
Because I did not know those existed
Stick around and other ideas will pop in.

Thanks Adam. I would have pointed that out if I knew about it!

#### alexanderfoti

Jan 10, 2013
24
CD4059 sounds ideal, I cant find any example circuits used to drive them though

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Yes, a CD4059 if you can find one (Digi-Key still have some) or for a smaller solution, a CD4024, but that will only give you division by powers of 2, i.e. 2, 4, 8, 16, 32, 64 etc, unless you mess around with the reset pin.

You need to convert your incoming signal into a clean wave with steep sides (quick clean transitions between low and high) that swings fully between the supply rails. There is probably circuitry that already does this; you can intercept the connection from that circuitry to the processor. The output signal will do the same. CMOS can be powered from the +5V rail of your Arduino.

#### alexanderfoti

Jan 10, 2013
24
4024 should work, divide by 16 would work at 7500 pulses.

Would it be possible to make a seperate circuit to go in between the VSS pin and the mpgiuno? The reason I ask is that a custom case has been build for the mpgiuno so the device would have to go somwhere else in relation to the main unit.

The signal is being generated on the bike, by a hall effect effect sensor in the gearbox, so, should theoretically, be a clean square wave, and require little "conditioning" compared to say, a reed switch.

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Yes, you can build it on a piece of stripboard. See http://nz.mouser.com/ProductDetail/...=sGAEpiMZZMtgbBHFKsFQgo04jOHntgNPn3TJGm1G4JE=

If you want it as small as possible, you could try using an SMT (surface mount technology) version of the CD4024, or the 74HC4024 which is functionally identical but only runs at 5V and may be easier to get in SMT because it's newer than the CD4024.

The SMT version has pins at half the spacing (0.05 inches), but it's possible to assemble it on a standard 0.1 inch stripboard if you're careful, and you won't be connecting to many of the pins anyway.

Your circuit board will need a power source; presumably this will be the 5V from the MPGuino, which will probably already be present because the Hall sensor needs it, right?

The connector from the MPGuino should have three pins - VDD (+5V), VSS (GND), and signal, right? I don't understand your use of "VSS" in your earlier posts. VSS is just another name for 0V or GND; the negative supply rail and reference rail for the MPGuino.

If that's true, you have everything you need. You just need to hook into the 3-wire cable from the MPGuino to the Hall switch, pass the VDD and VSS wires through, and intercept the signal wire. The signal from the Hall switch will need a pullup resistor (e.g. 4k7) to VDD, and you should also have some protection for the CD4024's clock input - a 10k series resistor should be enough. The 4024's output should also have a series resistor - say 100 ohms - to provide some protection.

It's probably best to put the 4024 circuit near the MPGuino, not near the Hall sensor.

The 4024 needs at least one decoupling capacitor connected as directly as possible between its VDD and VSS pins, with short leads. A 0.1 µF ceramic capacitor is typically used. You could also put a 10 µF electrolytic between VDD and VSS, to help absorb spikes, though this doesn't need to be near the 4024.

#### alexanderfoti

Jan 10, 2013
24
Sorry, I have been a bit ambiguous with the terminology! My fault!

In this case vss is vehicle speed sensor.

The mpguino uses pretty existing sensors on the bike (that in turn as used for the engine ecu) I am only tapping into those outputs.

The mpguino has 4 inputs. Ground, 12v, injector 12v (from ecu) and vss from the gearbox speed sensor. It just happens to be that the speed sensor output into the engine ecu is 0-5v.

The mpguino will take anything from 0 - 12v for the vss pulses.

I was planning on using a separate voltage regulator to power one of these chips so the device can be entirely separate.

I will try and put together a diagram of how's it's connected, and how I interpret your suggestion as well (because I'm probably getting it completely wrong).

Many thanks.

#### alexanderfoti

Jan 10, 2013
24
With the help of some electrically inclined people, I have come up with the following, to divide by 16:

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Yes, that looks good.

I have two suggestions:

The 0.1 µF decoupling capacitor must be connected as directly as possible between pins 16 and 8. It's a good idea to show it like that on the schematic, to remind you when you come to build it up.

You can use a CD4024 or 74HC4024 instead of a CD4040. It's slightly smaller.

#### Arouse1973

Dec 18, 2013
5,178
Isn't' it interesting the use of Vss and Vdd for CMOS IC's even buy chip manufactures. Voltage source and voltage drain, where the extra d and s come from anyone know? But interesting, an invertor IC labelled as such has the source of one of the transistors connected to the supply. So really should have both pins labelled Vss. Now which one goes where??

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
I don't know why the letter is doubled up. Maybe because there are multiple drains and sources connected (directly or indirectly) to each rail. I guess the convention started with VCC for transistor circuits. Some old ICs with bipolar supplies called their negative supply pin VEE.

You're right about the CMOS inverter. I think VDD and VSS probably came into use before PMOS transistors became common. In the old days of NMOS logic and memory devices. Not sure.

#### alexanderfoti

Jan 10, 2013
24
Yes, that looks good.

I have two suggestions:

The 0.1 µF decoupling capacitor must be connected as directly as possible between pins 16 and 8. It's a good idea to show it like that on the schematic, to remind you when you come to build it up.

You can use a CD4024 or 74HC4024 instead of a CD4040. It's slightly smaller.

Many thanks! I will update the schematic to remind me! Thanks for your help.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,470
Vcc = Voltage at Common Collector and I guess from sheer analogy the terms VDD, VSS and VEE were coined by people who lost the understanding of the origin of Vcc. Otherwise one would have VCD and VCS etc. But we don't.

#### Arouse1973

Dec 18, 2013
5,178
Vcc = Voltage at Common Collector and I guess from sheer analogy the terms VDD, VSS and VEE were coined by people who lost the understanding of the origin of Vcc. Otherwise one would have VCD and VCS etc. But we don't.

I think your right Harald. I always prefer to just label the supplies +12 V +5 V and 0V etc. for most of my stuff. I think this stops confusion. But that's just my choice, Vdd and Vss are meaningless on a diagram because you don't necessarily know what the voltage is.

W
Replies
16
Views
2K
Bill Sloman
B
Replies
4
Views
973
Replies
7
Views
1K
Replies
3
Views
748
Replies
9
Views
808