Divide square wave signal by 5/8ths? - Page 1
Forum section: electronics / beginners

author: Chris Wilson
author_rank: Super Contributor
timestamp: March 03, 2015, 12:03:26 pm
content: I want to breadboard a circuit to take a 300Hz to 3kHz square wave signal in and output it divided by 5/8ths. What chip should I use, and where might I find a schematic to work from please? Thanks.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: March 03, 2015, 12:19:13 pm
content: Am I missing something, but at this frequency,why a simple resistor divider will not do it ? (if it is multiplying by 5/8)Do you want to multiply the amplitude by 5/8 or 8/5 ? Or something else.Then, it will depend on the amplitude of the voltage you are looking for. I assume not toolarge if it is a breadboard. You can the use for multiplying by 8/5, a level translator.74HC4050, 4050or other specialized level translators like TXB0104 .

author: Andy Watson
author_rank: Super Contributor
timestamp: March 03, 2015, 12:25:28 pm
content: Quote from: Chris Wilson on March 03, 2015, 12:03:26 pmHow quickly does it vary between 300 and 3kHz? (Is this derived from speech?)I'm thinking PLL to multiply by 5 then simple divide by 8 logic.

author: dannyf
author_rank: Super Contributor
timestamp: March 03, 2015, 01:20:07 pm
content: QuoteRun a 8x PLL on it and then run a 5:1 divider on it.

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: March 03, 2015, 01:59:51 pm
content: @dannyf and Andy WatsonThis maybe a trivial question, but how do you know, just by the content of his message, that Chris Wilson wants to change the frequency and not the amplitude ?

author: codeboy2k
author_rank: Super Contributor
timestamp: March 03, 2015, 02:04:49 pm
content: I like danny's PLL idea as the best here so far.I'll offer this too: if it's purely digital and you don't care about pulse widths, just pulse counts, then you can simply use a small PIC12, input one side, output on the other, and drop 3 pulses for every 8 input pulses. 8 in, 5 out. You can do it all at once (i.e. reset a counter to 0, drop 3 pulses, then output the next 5, and start over), or you can intersperse it, so you count 8 pulses, but don't change the output bit on pulses #2, #5 and #7, then reset.in:0 1 2 3 4 5 6 7out:0 1 3 4 6pulses 1, 4 and 6 are lengthened because of this, but the average frequency is now 5/8 of the input frequency.@Jacques.. I think it's frequency too, due to the context. The poster mentioned a square-wave, and frequency in and divided-by 5/8 out. Generally we think of a square wave having fixed amplitude at digital logic levels, not needing to be divided down in amplitude, just level shifted between logic domains. So for level shifting it would have been worded differently, I think.

author: Andy Watson
author_rank: Super Contributor
timestamp: March 03, 2015, 02:23:32 pm
content: Quote from: JacquesBBB on March 03, 2015, 01:59:51 pmI don't - it's just an assumption based on: Chris is very specific about the frequency range and not the amplitude. I could be wrong

author: Chris Wilson
author_rank: Super Contributor
timestamp: March 03, 2015, 02:29:03 pm
content: Sorry, my question was vague. It's another of my automotive projects. Some vehicles with electronic speedometers only read in kilometres per hour. By intercepting the digi signal from the propshaft speed sensor just before the speedo and doing the 5/8 division it will then read in MPH. these are commercially available, but I fancy building my own, just "because"

author: Andy Watson
author_rank: Super Contributor
timestamp: March 03, 2015, 02:34:35 pm
content: Quote from: Chris Wilson on March 03, 2015, 02:29:03 pmIn that case I would use a PIC micro (or ATmel if you prefer). Presumably you want the output frequency to drop to zero when the input disappears. Micro-controller all the way!

author: JacquesBBB
author_rank: Frequent Contributor
timestamp: March 03, 2015, 02:37:27 pm
content: Thanks to all for the complementary explanations. Makes things much more clear.

author: tszaboo
author_rank: Super Contributor
timestamp: March 03, 2015, 02:49:43 pm
content: Quote from: Chris Wilson on March 03, 2015, 02:29:03 pmMake sure you make it from 4000 series ICs like the 4046 and 4017, not these fancy 5V logic ICs.

author: Howardlong
author_rank: Super Contributor
timestamp: March 03, 2015, 02:52:14 pm
content: Quote from: Andy Watson on March 03, 2015, 02:34:35 pmThe PIC/other MCU would have been my favoured solution given the low frequency range, you could even get away with a PIC10F for the ultimate in minimalism.

author: jwm_
author_rank: Frequent Contributor
timestamp: March 03, 2015, 03:03:53 pm
content: CD4017, take outputs 0, 1,3, 5, 7 through diodes and a pull down to or them together for your output and tie output 8 to reset. Don't even need a regulator, will run from 3-18V direct. Total cost, maybe 45 cents.An MCU is not really necessary for something that can be dead bug soldered in less time than it takes your computer to boot up to your MCU dev environment. Not to mention being able to run the chip at car battery voltages directly. Gotta love the 4000 series.

author: macboy
author_rank: Super Contributor
timestamp: March 03, 2015, 03:27:23 pm
content: Quote from: jwm_ on March 03, 2015, 03:03:53 pmI don't think this will do what you think it will do.I think that 3 pulses of various lengths will be produced. How do you see 5 pulses being produced? By diode-ORing 5 of the outputs, you don't get 5 pulses... instead you get 5/8 of the total time spent at high state, and 3/8 at low state. Since you only transition to the low state 3 times per 8 cycles, you get a pulse rate of 3/8, not 5/8. Simulate or build it if you don't believe me. In fact, the fastest rate you can get out of the CD4017 counter would be 1/2 by diode-ORing every other output (or by resetting at 2).The way that I would tackle this is to use a small microcontroller (PIC is my weapon of choice, but almost any type will do), and use a pair of PWM/CCP modules. One of them will be used to measure the time between input pulses. That will be scaled by the appropriate ratio (5/8 is close, just .5% error), then use to other module to output a pulse with the new width. Using this technique, you wouldn't even need to update the output pulse rate constantly, just periodicially (20 times per second would be plenty). The output will happily keep running at the rate that you last set it to.You need to understand that what you are doing will also alter the reading rate of the odometer, which is quite illegal basically everywhere.

author: Chris Wilson
author_rank: Super Contributor
timestamp: March 03, 2015, 03:34:45 pm
content: Quote from: macboy on March 03, 2015, 03:27:23 pmYes, thanks for the heads up, I am aware of that, that's why i said it needs to go right by the speedo, and after the odometer. I have never looked inside a commercial unit, I may have a car inb the workshop with one fitted, and I may have to pull the dash out for another job. I'll have a look inside it, assuming it's not potted, if I have to go in there. Cheers. Some commercial ones have DIP switches, I have never had cause to look what they are for, would that go along with a micro processor being used?

author: tszaboo
author_rank: Super Contributor
timestamp: March 03, 2015, 04:13:44 pm
content: Quote from: macboy on March 03, 2015, 03:27:23 pmIf you AND gate the output signal of the diode ORing, you get pulses.You can also make the PIC10 to act like certain resistor for 3V but that doesnt mean you should do that.