0
\$\begingroup\$

I am trying to build a simple pulse generator circuit for electrophysiological stimulation purposes. It seems to be surprisingly difficult to generate a square/ pulse waveform where the pulses have precise amplitudes.

To generate pulses I have tried audio output from my computer, the digital outs from an Arduino, and a 555 monostable, and when recorded they all turn out with a bad case of the jitters (randomly varying amplitude).

Below are recordings taken straight from audio out of my computer into acquisition box. I have also tried using alternative generators such as an Arduino and a 555 and got the same jitter on everything.

My primary questions are what is causing this jitter, what am I doing wrong and how do I fix it? I need precise amplitude control. I have tried different recording devices and they show the same thing. 2) How can I get rid of overshoot? I have tried diodes for this and not had much luck.

Image 1: Original waveform outputted to audio. Original waveform

Image 2: Signal (inverted) recorded by aquisition box receiving audio out from computer, showing jitter in amplitude and unwanted positive overshoot. Inverted signal recorded from audio out with amplitude jitter and positive overshoot.

Image 3: Pulses of what are supposed to be equal amplitude with negative overshoot. Pulses of equal amplitude, with unwanted jitter and variable negative overshoot

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Could you please define the specification of what do you want to achieve? You said you would like to build a pulse generator but you did not explain what frequency, amplitude, duty cycle, duration (maybe just a train of pulses). Your question is not about how to make it but knowing the spec would also give some hint \$\endgroup\$ – Eloy Calatrava Nov 7 '20 at 10:16
6
\$\begingroup\$

recordings taken straight from audio out of my computer

The main problem with what you are doing appears to be expecting your computer to handle the DC content of your signals. It won't do this and it may well produce the unwanted artefacts you show in the pictures. An audio output or input on your computer is AC coupled; in other words it will neither record nor reproduce any DC content associated with your waveforms. After all, audio doesn't contain DC content so why should your computer (or any audio device) faithfully reproduce what you originally generated.

enter image description here

I would try and get hold of an oscilloscope and prove this to yourself.

\$\endgroup\$
2
\$\begingroup\$

Amplitude variations are not "jitter" which relates to timing variations.

What you are seeing here looks like sampling artefacts on short duration pulses. You are sampling either before the peak or after it, and missing the peak itself.

Increase the sample rate of your ADC : probably by a factor of 10. Or, increase the duration of the pulses.

Related: Low frequency present on sampled waveform

\$\endgroup\$
2
  • \$\begingroup\$ I don't think it is sampling artefacts on the recording end because when amplified and stimulating neurons ex-vivo, the pulses that appear larger do cause the neurons a stronger synaptic response. The pulses are 1ms width. \$\endgroup\$ – Benj Prush Nov 7 '20 at 16:36
  • 1
    \$\begingroup\$ The pulses are 1ms width ... that's one piece of new information that should go in the question ... but we still have no idea of the specs of this "acquisition box"? Nor have we had a good zoomed in look at a pulse at either end of this process. \$\endgroup\$ – user_1818839 Nov 7 '20 at 16:42
2
\$\begingroup\$

Adding to Andy aka's answer: it's not just AC coupling but it's also insufficient bandwidth. Pulses have a lot of high frequency content and typical consumer grade audio hardware will apply an anti-aliasing filter at 20 kHz. Your sampling rate should be much higher than the inverse of your pulse width.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.