# PWM to control modular synthesizer

**URL:** <https://forum.xod.io/t/pwm-to-control-modular-synthesizer/1263>\
**Category:** Uncategorized\
**Created:** [October 23, 2018, 11:01am UTC](https://forum.xod.io/t/pwm-to-control-modular-synthesizer/1263 "2018-10-23T11:01:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fracnesco](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@fracnesco](https://forum.xod.io/u/fracnesco)\
**Post date:** [October 23, 2018, 11:01am UTC](https://forum.xod.io/t/pwm-to-control-modular-synthesizer/1263/1 "2018-10-23T11:01:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dox](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/dox/32/424_2.png) [@dox](https://forum.xod.io/u/dox)\
**Post date:** [October 23, 2018, 11:57am UTC](https://forum.xod.io/t/pwm-to-control-modular-synthesizer/1263/2 "2018-10-23T11:57:30Z")

</div>

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.
