Low frequency (fractional) divider - Page 1
Forum section: electronics / projects

author: brainwash
author_rank: Frequent Contributor
timestamp: April 19, 2018, 01:29:05 pm
content: 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.

author: ogden
author_rank: Super Contributor
timestamp: April 19, 2018, 01:51:38 pm
content: Quote from: brainwash on April 19, 2018, 01:29:05 pmIncoming 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.

author: CopperCone
author_rank: Super Contributor
timestamp: April 19, 2018, 01:55:49 pm
content: 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

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 19, 2018, 02:28:33 pm
content: 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.

author: brainwash
author_rank: Frequent Contributor
timestamp: April 19, 2018, 02:59:54 pm
content: 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).

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 19, 2018, 03:12:27 pm
content: Quote from: brainwash on April 19, 2018, 02:59:54 pmWhat 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?

author: mino-fm
author_rank: Regular Contributor
timestamp: April 20, 2018, 07:48:05 am
content: 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#bsp4where 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

author: bson
author_rank: Unknown
timestamp: April 20, 2018, 07:58:38 am
content: 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.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 20, 2018, 08:29:24 am
content: 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.

author: David Hess
author_rank: Super Contributor
timestamp: April 20, 2018, 03:10:32 pm
content: 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.

author: brainwash
author_rank: Frequent Contributor
timestamp: April 20, 2018, 04:09:53 pm
content: 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.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 20, 2018, 04:12:55 pm
content: Quote from: brainwash on April 20, 2018, 04:09:53 pmYeah, 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.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 20, 2018, 04:41:30 pm
content: 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.

author: brainwash
author_rank: Frequent Contributor
timestamp: April 20, 2018, 04:51:27 pm
content: 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.

author: Marco
author_rank: Super Contributor
timestamp: April 20, 2018, 05:59:43 pm
content: Quote from: bson on April 20, 2018, 07:58:38 amIf 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.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 22, 2018, 12:15:50 pm
content: 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.