PWM to control modular synthesizer

Greetings to the community!

I am building an arduino project to control my modular synthesizer with some sensors.
Currently I am using a HC-SR04 sensor, so that when it gets a distance value greater than 20 cm it will output a ON signal from the Digital port of the arduino and use this signal as a trigger.
What I would like to achieve is to have the distance measured by the sensor to open/close a filter… so I don’t want it to output just an on/off signal from the Digital port but use instead PWM to create a continue voltage value that can change in time. Does anyone knows if this is possible or not or has suggestion from where I should start?

You can try to use a map-range or clip-map-range node. Connect the dm output of the sensor with the input of the node. Now you have to adjust the input value range to an output range from 0-1. Connect the output of the map-range node to the input of a analog write node and use a pwm output to get the signal. Perhaps it could be necessary to add a RC-Lowpass filter on the output pin depending on the hardware of your synth.

2 Likes