Author Topic: Low frequency (fractional) divider  (Read 2096 times)

0 Members and 1 Guest are viewing this topic.

Offline brainwashTopic starter

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: de
    • Hack Correlation
Low frequency (fractional) divider
« on: April 19, 2018, 01:29:05 pm »
I don't know how to get started or search for a circuit that does the following: takes a 0.1Hz-2Hz square wave and is able to raise/lower its frequency by 0-25%.
The input is a Hall (bicycle) switch and I would like to keep it as low power as possible, but doubt it can work powerless.
Of course I can whip out some Arduino sketch that easily does this, but assuming there are older designs that can achieve this with less power.

Another idea which could I would like to achieve is to limit the signal frequency - if it goes above some threshold it should still stay at the same frequency, but lower frequency would track 1:1. No idea if this is possible only with a limited number of analog parts or gates.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Low frequency (fractional) divider
« Reply #1 on: April 19, 2018, 01:51:38 pm »
I don't know how to get started or search for a circuit that does the following: takes a 0.1Hz-2Hz square wave and is able to raise/lower its frequency by 0-25%.
The input is a Hall (bicycle) switch and I would like to keep it as low power as possible, but doubt it can work powerless.
Of course I can whip out some Arduino sketch that easily does this, but assuming there are older designs that can achieve this with less power.

Another idea which could I would like to achieve is to limit the signal frequency - if it goes above some threshold it should still stay at the same frequency, but lower frequency would track 1:1. No idea if this is possible only with a limited number of analog parts or gates.

Incoming frequency shall be converted to voltage which then drives voltage controlled oscillator. Unfortunately frequency is way too low for dependable analog solution. Only way I can see this happen -  microcontroller. Forget about "powerless" solution because perpetuum mobile is not invented yet. You definitely need some power, at least in form of button cell battery. There are zillions of low power microcontrollers, virtually any is able to do what you need.

 

Offline CopperCone

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • *knock knock*
Re: Low frequency (fractional) divider
« Reply #2 on: April 19, 2018, 01:55:49 pm »
Youwant a frequency to voltage convetter followed by a voltage to frequency converter.

If you want small integrated and really easy use a linear technology timerblox voltage controlled oscillator for your output (or something with a 555 might be cheaper but messier and harder with low frequency signals due to timing capacitor requirements)

I dont know the best solution for a cheap easy frequency to voltage converter. Plenty exist but i dont know the market here
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14297
  • Country: fr
Re: Low frequency (fractional) divider
« Reply #3 on: April 19, 2018, 02:28:33 pm »
You may have to define how many periods of your incoming signal should be considered for frequency estimation. Is the duty cycle 50%?

A simple microcontroller solution would probably be the simplest cost- and part-count-wise.

If this behavior is what you're after, you could measure incoming pulse width and output the corrected pulse width (of course with a delay of one pulse).

If the incoming signal doesn't have a 50% duty cycle and you want to keep the duty cycle intact, you can even do this at each edge transition (rising, falling) and output the corresponding level (0, 1) for the corresponding corrected period.

At such low frequencies, the µC could spend most of its time sleeping, and the power draw would be very low.
 

Offline brainwashTopic starter

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: de
    • Hack Correlation
Re: Low frequency (fractional) divider
« Reply #4 on: April 19, 2018, 02:59:54 pm »
Thanks for the suggestions so far.
I took a look at LM331 even before seeing the comments, but it seems to have a minimum frequency of 1Hz. I suspect it could probably go lower than that but linearity is not guaranteed (which is not a huge issue).
Seems like a low-power micro is the way to go, since it provides a bit more flexibility (assuming you have a computer at hand).
Is there any low-power non-intrusive way to forward a signal to another Hall switch?

Maybe I should rethink this into a mechanical problem with some 3D printed parts (gear reduction).
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14297
  • Country: fr
Re: Low frequency (fractional) divider
« Reply #5 on: April 19, 2018, 03:12:27 pm »
Is there any low-power non-intrusive way to forward a signal to another Hall switch?

What exactly do you mean by "forward"? Do you mean that your output should activate something in order to make another Hall sensor output your desired output signal? Why not bypass the other Hall sensor altogether? Maybe this has to be done without any modification or electrical contact?
 

Offline mino-fm

  • Regular Contributor
  • *
  • Posts: 142
  • Country: de
Re: Low frequency (fractional) divider
« Reply #6 on: April 20, 2018, 07:48:05 am »
I think you need a frequency-to-frequency converter, which can be done by a small AVR. Incoming frequency is measured by a reciprocal counter. After calculating (divide/multiply) the new frequency is generated by a timer. Take a look at an example using an ATmega48 with high accuracy: http://mino-elektronik.de/Generator/takte_impulse.htm#bsp4 where Timer1 is doing reciprocal counting and PWM generation.
For lower accuracy a simple ATtiny85 can used as well with internal clock oscillator. To reduce power this ATtiny should be clocked by 128 kHz or below. This is fast enough to calculate even floating point numbers within 0,5 s.

Please notice that input frequency as low as 0,1 Hz will take 10 s to be measured and further 7,5 - 12,5 s to see the new frequency at Fout-pin.

Maybe someone is interested in low frequency-to-voltage converter. This can be done by an ATtiny44 very fast and offering high accuracy nearly the same way as shown above: http://mino-elektronik.de/fmeter/fm_software.htm#bsp11
 

Offline bson

  • Supporter
  • ****
  • Posts: 2265
  • Country: us
Re: Low frequency (fractional) divider
« Reply #7 on: April 20, 2018, 07:58:38 am »
Are you trying to compensate for different wheel sizes?

The suggested MSP430 sounds like a winner, for example the MSP430G2201 in TSSOP-14 or QFN-16.  Run it off a 32.768kHz crystal, use a timer capture input to decode the rotational pulses, and have it generate a slightly adjusted frequency on an output using the same timer and a compare register (CCR).  The CPU can wake on the TC input edge, grab the reciprocal capture, and update the output waveform, then go back to sleep.  Only the timer and oscillator need to run.  The MSP430 is a straightforward, orthogonal 16-bit architecture based off the pdp-11, so is super straightforward to program in assembler.  The TI C compiler is also quite good, although the CCS environment is eclipse based.  ::)
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14073
  • Country: de
Re: Low frequency (fractional) divider
« Reply #8 on: April 20, 2018, 08:29:24 am »
It could help to add a few more magnets so that the frequency to start with is high by maybe a factor of 2, 4 or 8. This makes things easier, both for a µC and analog solution.

A low frequency is not a problem for the VCO solution. Just add a divider. So the VCO could still run in the kHz range and than just divide down by maybe a factor of 256 or more if needed. The difficult part is more a reasonable fast reacting frequency to voltage conversion or a suitable PLL filter.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16545
  • Country: us
  • DavidH
Re: Low frequency (fractional) divider
« Reply #9 on: April 20, 2018, 03:10:32 pm »
With micropower linear parts and CMOS gates, I think you can be competitive with a microcontroller based solution for power but it will be a lot more complicated and expensive.

I would probably implement a charge pump or ramp based frequency-to-voltage converter followed by a sample-and-hold to remove ripple and get a single cycle settling time.  Then the 0 to 25% can be subtracted and limits added before driving a simple voltage-to-frequency converter.
 

Offline brainwashTopic starter

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: de
    • Hack Correlation
Re: Low frequency (fractional) divider
« Reply #10 on: April 20, 2018, 04:09:53 pm »
Great tips so far.
I've also thought of the multiple magnets solution, it would offer a smoother output.

0.1Hz => only the initial delay is 10s, afterwards the timer is only re-adjusted, taking into account how much time has already passed. If the timer (PWM generation) is reset each time it would make for a very jittery output. This is actually what happens when some people implement POV displays or fan controllers.
Error and jitter would be acceptable - for example outputting a running average - but a slow response not.
Interesting reading: https://www.romanblack.com/one_sec.htm (as well as other pages on that site)

VCO: if there is a uC already involved, a VCO wouldn't help much, especially if it requires a divider.

MSP430 & GCC: actually I've switched to Energia a few years ago and never looked back. I've only needed CCS for USB stuff on TM4C123. I think with platform.io it should be even easier.
Not sure if floating point is needed, fixed-point integer would work just as well since the dynamic range of the system is very small.

Trigger Hall switch: I don't want to cut into wires. This is more of an exercise than anything else. Just looking for the most low-power way to trigger such a switch, whether it's a speaker or some turns of wire wound around the switch.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14297
  • Country: fr
Re: Low frequency (fractional) divider
« Reply #11 on: April 20, 2018, 04:12:55 pm »
Trigger Hall switch: I don't want to cut into wires. This is more of an exercise than anything else. Just looking for the most low-power way to trigger such a switch, whether it's a speaker or some turns of wire wound around the switch.

Yeah, I figured you wanted to make this without altering anything.

For a Hall sensor, I would guess a very small solenoid in close proximity of the hall sensor should do it.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14073
  • Country: de
Re: Low frequency (fractional) divider
« Reply #12 on: April 20, 2018, 04:41:30 pm »
A solenoid with suitable square hysteresis loop (like those for magnetic ignition) could would as a no power sensor. It would take the power from the rotation. It could even deliver power.

It would be either frequency to voltage and VCO+ divider as an analog solution or alternatively µC based as the only main part. The µC may be lower power today.
 

Offline brainwashTopic starter

  • Frequent Contributor
  • **
  • Posts: 463
  • Country: de
    • Hack Correlation
Re: Low frequency (fractional) divider
« Reply #13 on: April 20, 2018, 04:51:27 pm »
I don't understand the solenoid hysteresis thing. Do you have an example of such a part? Do you mean injectors? I thought most of the new ones are piezo.
 

Online Marco

  • Super Contributor
  • ***
  • Posts: 6694
  • Country: nl
Re: Low frequency (fractional) divider
« Reply #14 on: April 20, 2018, 05:59:43 pm »
Are you trying to compensate for different wheel sizes?

If it's for this I think you really need a microcontroller, it's less a pure frequency conversion and more an unit conversion with carry over of data between pulses. I'm not sure an analog circuit could be easily designed to maintain accuracy with varying speeds if you calculate distance from the pulses.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3321
  • Country: nl
Re: Low frequency (fractional) divider
« Reply #15 on: April 22, 2018, 12:15:50 pm »
You can use the (pretty strong) magnets out of an old HDD and the coil of the Heads motor to make an inductive pickup. You should be able to get enough energy out of it to power a small uC with LCD.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf