I have developed a circuit to process the PMT pulse output, For the testing, I need an artificial signal which is similar to the PMT pulse.How can i use the AnalogWrite() to create such type of signal.Attached image show the waveform of PMT Pulse

  • Do you mean you are looking for a way to generate a pulse as in the picture? The pulse is 40 ns. The Arduino AVR family of boards will have a hard time doing that! Mar 23 '19 at 15:16
  • Or do you mean a cascade of pulses with random width, duration and delay? All in the range of micro-seconds. Mar 23 '19 at 15:31
  • The PWM frequency of Arduinoboards is normally 490Hz, that means the shortest puls using analogWrite(PIN, 1) would last 8000ns.
    – RJPlog
    Mar 23 '19 at 15:50
  • You could write 200 NOPs @ 62.5ns each, assuming a 16MHz clock (minus overheads) Mar 23 '19 at 17:57

Short answer: You can't.

The Arduino can't do analog output at all, much less matching a specific analog waveform of ≈40ns duration.

PWM on the Arduino simulates constant analog voltages using square wave pulses of variable duty cycle. It has no support for creating analog waveforms of any type, much less ones with such a short duration.


As mentioned in this thread: Generate a ramp input with an Arduino Uno

You could use a resistor ladder to create a roll-your-own DAC, and then use direct port register manipulation (not digitalWrite) to set the pins controlling your resistor ladder and get a crude approximation of your waveform.


I doubt very much AVR-based Arduinos could do that.

SAMD21-based Arduinos do have a DAC, but their conversion time is about 2.85 μs. Their timer/counters can be clocked at 96Mhz, so about 10.5ns/tick, but would yield a square pulse (that may or may not degenerate into what you need 8-).

Overal I don't think an Arduino is the right tool for the job. Maybe something like the Teensy 4.0 could do it, but I don't know much about those.

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.