I have a vector of 500 numbers and would like to output these at a sample rate of 1kHz, thus a signal time of 0.5seconds. Is there any way to do this using a Pi? Do the GPIO pins only allow for an On/Off Response? or using PWM to get a value somewhere in-between e.g. 3.3Vpin @75% PWM gives 2.475V. is there any way to get a pin to do PWM@75% for 0.001 seconds, then 50%for 0.001 seconds etc. etc. Another way I thought I may be able to solve this is outputting the signal via the 3.5mm jack, is there a way to isolate the L+R+video channel in the jack to send an analogue version of this signal through? I would be gathering this signal at the output at a sample rate of 1kHz. I am new to Pi and a previous MATLAB user trying to learn Python (slowly). Any whiff of a helping hand would be much appreciated. Thanks

1 Answer 1


I doubt this is practical using PWM.

The only method I know of to do the timing would be to use (my) pigpio waveform feature which allows you to switch GPIO on and off for accurately timed periods at accurate times. The maximum switching rate would be 500 kHz. I doubt that would be enough to achieve the effect you are after in a millisecond frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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