Electronics and Electrical Engineering Design Forum

Where you can find electronics and electrical engineering forum questions & answers.
no image Tuesday, December 12, 2017 by Chris Karlén

What is the best way to create a PWM signal by varying capacitance using your hand? (Sensor/Antenna)


We have been working on a small project trying to build a fun game but are having some issues. We basically need an oscillator that can be controlled by varying the distance between our hands and a metal plate (capacitor type of sensor), which then the signal converts into a PWM signal and is fed to a H-bridge that controls the fans. Our issue is the sensor part, oscillator and the converting into a decent PWM signal that idealy would go from 0-100% based on the capacitance. We have tried several types, relaxtion oscillator (square), 7414 schmitt trigger (square) and recently I also built a Variable pitch oscillator taken from a theremin guide, which generated a nice sine wave but only varied from the intervals 120-142kHz. We also could't figure out how to utilize it.

Is there any kind soul that have a great idea of how to make this a reality? Basically what we need is an oscillator that can be affected by just one capacitor where the interval of the capacitance (the hand) is around 20pF, this oscillation then somehow needs to be converted into a PWM signal. Our only challenge here is that we are limited to only analog components but pretty much have anything at our disposal, but mostly standard components, and also the 7414 is something we managed to get our hands on. We have tried to come up with a solution for a long time at a daily basis and are getting pretty frustrated.

Thank you in advance,



  • by  David Ashton
    Chris.... interesting question.  I'm at work and don't have much time to think about this is pretty much stream-of-consciousness.  As you've pointed out, hand capacitance is pretty small.  So you're likely to start up with a fairly high frequency.  You can divide this down to the kind of frequency you require for your PWM signal.   Say you can get a 100-200Hz signal out of this.  To PWM it, use it to trigger a 555 with a period of just under 5 ms.  When your signal is 200 Hz, you'll get around 90-100% duty cycle.  When it's 100 Hz, you'll get around 40-45%.  Obviously the wider the range of frequencies you can generate, the wider the range of PWM you'll get.  If it goes in the wrong sense, just invert it.  

    You might even be able to use a 555 for your oscillator, though I don't think they would work that well with such low capacitance.  But using the above technique you only need an oscillator that works well, it does not have to generate PCM directly.

    Hope this is clear, if not reply and I'll try to explain a bit better.

    Cheers // David

  • by  Rick Curl
    Hi Chris-

    I think you are on the right track by trying Theremin circuits.  You might also look for a cheap Theremin kit and use it a a starting point. I've seen some for as little as $19.00. Do a search on "MLP105"

    Assuming that the method of sensing doesn't have to be capacitive, let me offer a possibility out of left field. It just so happens that I've been tinkering with some laser "time of flight" sensors.  These are tiny devices that are often used in cell phones and can give a very accurate distance measurement.  If you get on eBay and search "TOF PWM" you'll find some breakout boards that contain a TOF sensor and a microcontroller that converts the I2C output from the distance sensor into an PWM signal.  I know this all sounds very complicated and expensive, but the technical "heavy lifting" has been done for you and the hardware is not very expensive.   


  • by  Aubrey Kagan


    Our only challenge here is that we are limited to only analog components but pretty much have anything at our disposal

    I don't understand this limitation. Is this a project with constraints? Otherwise you might try a micro with touch control built in (I would recommend a PSoC4 or 5) and play with the parameters. That would also have a built in PWM.  I have also seen stand alone touch controllers from Analog Devices and perhaps even Microchip- perhaps these count as analog?.

    If you do have to abide by the constraints of only analog devices, I am sorry for wasting your time.

    P.S. the 7414 is not an analog device either. You must have a pretty old bin of parts to have a standard TTL one. You might get better results if you used a CMOS 74HC14

    • by  Elizabeth Simon

      I also wondered about the "only analog components" requirement.

      To me this requirement has the flavor of a class project. If so, I'd be interested to know what class this is for.

  • by  Elizabeth Simon

    I also wondered about the "only analog components" requirement.

    To me this requirement has the flavor of a class project. If so, I'd be interested to know what class this is for.

  • by  Chris Karlén (edited)
    Thank you all for the input! I really appreciate it. I am first going to adress the curiosity of the limitations.

    This is a a class for analog components. Our projectmanagers told us it was allowed to use digital inverters for oscillators as long as we limited the digital parts to simple funktions such as oscillators or switches. Digital components that pretty much can do all of this as AIO is banned. Thus the reason why we can use a digital inverter.

    Update on the project: After a lot of hassle we finally made it to work surprisingly well. We tried several different inverters, 74HC14, CD40106, CD4093 and one other which i don't remember. We started with a relaxtion oscillator which had a terrible interval of frequency when capacitance varied, same for the pitch variable oscillator taken from a theremin schematic. They worked, but not that well. The 555 was never needed as I finally managed to resolve our issue yesterday. I used a CD4093BE with 440kOhms and a barely handsized metal plate as capacitance.

    I managed to vary the frequency from 1.8MHz to 300kHz which was filtered by two LPF and an envelope detector made by 1N4148, 220nF and 82kOhms to get a DC-signal. I then generated a triangle wave with an adjustable base which then was used as a reference for the DC-signal in a comparator LM311 to get a PWM-signal. This was then fed into a drivercurcuit made out a couple of MOSFETs e.t.c. that controlled the fan. English is not my first language, let alone the technical terms makes it difficult for me to explain. However, I finished the prototype and it worked really well.

    If someone is interested in seeing a video of it in action let me know and I will upload a short clip. I do want to mention that we did look through a lot of your ideas and tried to make a few of them work but settled for this final system because it just panned out really well to be able to just feed 12V to all the parts.

    Thank you all for the responses, we really appreciate it!

  • by  PeterTraneus Anderson
    Look up the frequency discriminator and ratio detector circuits used in FM radio receivers. As intended to be used, either will convert your Theremin oscillator's frequency into a variable DC voltage. If you look closely at the frequency discriminator and ratio detector, you will see that they contain an internal PWM circuit based on frequency-dependent phase shifts of inductor-capacitor tuned circuits.

Add Comment

You must log-in to comment.