While building my speedo project I found that I needed to simulate
the pulses coming from the truck's tail shaft at a theoretical rate
of between 0.58 and 58Hz.
Also, rather than a square wave I need a pulse so the waveform
looks something like a magnet briefly passing a hall effect sensor.
This little number does the job (0.9 to 60Hz but that's close enough).
Here's the circuit.

And the code pulse_generator_85.txt
Note that several IO pins are floating and there's no decoupling
of power supply pins, but it works just fine anyway. Also, while
the frequency is stable at any given pot setting it seems to be
very non-linear which I put down to the input impedance of ADC1
which probably forms a weird voltage divider with the 1k pot, plus
maybe I should have used a log pot. Probably using an op-amp to
buffer the pot's wiper would be a good idea to.
Still it works and I've got a speedo to build.
|