Author Topic: Divide square wave signal by 5/8ths?  (Read 5767 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1081
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Divide square wave signal by 5/8ths?
« on: March 03, 2015, 12:03:26 pm »
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.
Best regards,

                 Chris Wilson.
 

Offline JacquesBBB

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: fr
Re: Divide square wave signal by 5/8ths?
« Reply #1 on: March 03, 2015, 12:19:13 pm »
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 too
large if it is a breadboard. You can the use  for multiplying by 8/5, a  level translator.
 74HC4050, 4050
or  other specialized level  translators like TXB0104 .
« Last Edit: March 03, 2015, 01:10:29 pm by JacquesBBB »
 

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2084
Re: Divide square wave signal by 5/8ths?
« Reply #2 on: March 03, 2015, 12:25:28 pm »
I want to breadboard a circuit to take a 300Hz to 3kHz
How 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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Divide square wave signal by 5/8ths?
« Reply #3 on: March 03, 2015, 01:20:07 pm »
Quote
output it divided by 5/8ths

Run a 8x PLL on it and then run a 5:1 divider on it.
================================
https://dannyelectronics.wordpress.com/
 

Offline JacquesBBB

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: fr
Re: Divide square wave signal by 5/8ths?
« Reply #4 on: March 03, 2015, 01:59:51 pm »
@dannyf and Andy Watson

This 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 ?
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Divide square wave signal by 5/8ths?
« Reply #5 on: March 03, 2015, 02:04:49 pm »
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 7
out:0 1    3 4    6

pulses 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.
 

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2084
Re: Divide square wave signal by 5/8ths?
« Reply #6 on: March 03, 2015, 02:23:32 pm »
@dannyf and Andy Watson

This 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 ?
I 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 :)
 

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1081
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Re: Divide square wave signal by 5/8ths?
« Reply #7 on: March 03, 2015, 02:29:03 pm »
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" :)
Best regards,

                 Chris Wilson.
 

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2084
Re: Divide square wave signal by 5/8ths?
« Reply #8 on: March 03, 2015, 02:34:35 pm »
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.
In 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!
 

Offline JacquesBBB

  • Frequent Contributor
  • **
  • Posts: 829
  • Country: fr
Re: Divide square wave signal by 5/8ths?
« Reply #9 on: March 03, 2015, 02:37:27 pm »
Thanks to all for the complementary explanations. Makes things much more clear.
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7374
  • Country: nl
  • Current job: ATEX product design
Re: Divide square wave signal by 5/8ths?
« Reply #10 on: March 03, 2015, 02:49:43 pm »
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" :)
Make sure you make it from 4000 series ICs like the 4046 and 4017, not these fancy 5V logic ICs.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: Divide square wave signal by 5/8ths?
« Reply #11 on: March 03, 2015, 02:52:14 pm »
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.
In 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!

The 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.
 

Offline jwm_

  • Frequent Contributor
  • **
  • Posts: 319
  • Country: us
    • Not A Number
Re: Divide square wave signal by 5/8ths?
« Reply #12 on: March 03, 2015, 03:03:53 pm »
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.
« Last Edit: March 03, 2015, 03:10:11 pm by jwm_ »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2254
  • Country: ca
Re: Divide square wave signal by 5/8ths?
« Reply #13 on: March 03, 2015, 03:27:23 pm »
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.
I 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.
« Last Edit: March 03, 2015, 03:29:29 pm by macboy »
 

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1081
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Re: Divide square wave signal by 5/8ths?
« Reply #14 on: March 03, 2015, 03:34:45 pm »

You need to understand that what you are doing will also alter the reading rate of the odometer, which is quite illegal basically everywhere.

Yes, 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?
Best regards,

                 Chris Wilson.
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7374
  • Country: nl
  • Current job: ATEX product design
Re: Divide square wave signal by 5/8ths?
« Reply #15 on: March 03, 2015, 04:13:44 pm »
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.
I 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.
If 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf