Analog signal 50Vpp into 3.3V MCU - Page 1
Forum section: electronics / beginners

author: Saimoun
author_rank: Frequent Contributor
timestamp: May 29, 2021, 05:28:56 pm
content: HiHere is the situation: I am using a piezoelectric sensor which generates analog signals like these two attached (showing lowest and highest + imagine anything in between). Lowest is about 4Vpp and highest 50Vpp.My board is running at +3.3V.I do not care about the actual signal, I just want to send it to a MCU and digitalize it:1 = there is a signal there (say above 4Vpp), 0 = there is not.The MCU input can be an ADC or comparator input.I am guessing the 50Vpp signal would actually damage the MCU, so the signal needs to be contained before being sent to the MCU.How would you do that, without using a complex analog circuit (like a boost converter and an opamp)? I was thinking maybe adding some diodes to clip the signal?Thank you!!

author: Saimoun
author_rank: Frequent Contributor
timestamp: May 29, 2021, 05:34:50 pm
content: Actually thinking about it I do not now much about piezo sensors... I guess I should add a load to the sensor in any case?

author: ledtester
author_rank: Super Contributor
timestamp: May 29, 2021, 06:13:55 pm
content: Have a look at this Sparkfun tutorial:"Piezo Vibration Sensor Hookup Guide"https://learn.sparkfun.com/tutorials/piezo-vibration-sensor-hookup-guideAlso, this page contains circuits which employ a piezo as a vibration or motion detector:http://www.discovercircuits.com/S/s-vibration.htm

author: Saimoun
author_rank: Frequent Contributor
timestamp: May 30, 2021, 08:51:00 am
content: Thank you for the reply. I checked the sparkfun tutorial, but their piezo does not much low in voltage - mine is coming from a drum pad which is hit with a stick, probably why the spikes are a lot greated.I try loading it with about 17k, then the spikes are about 14Vpp (-7V still sounds too violent for a MCU right?), problem is then the smaller hits are now only 2Vpp which might be harder to detect.On the other side, I am thinking: these piezo sensors have a huge output impedance (mine should be around 40k I think), so with the output impedance and the diodes inside the MCU, would that not be enough to protect it?

author: gcewing
author_rank: Regular Contributor
timestamp: May 30, 2021, 10:00:45 am
content: You could use a resistor and zener diode to limit the input voltage.I wouldn't like to rely on the MCU's protection diodes -- they're there to protect against damage, not to be used in normal operation. There's a chance that using them that way could cause glitches in the MCU.

author: nali
author_rank: Frequent Contributor
timestamp: May 30, 2021, 10:15:23 am
content: Having done something like this before with analogue (a vandalism detector) I'd probably opt to rectify and measure the signal with ADC. Fine tuning the detection so ambient noise/vibration and accidental bumps don't cause false triggers can sometimes be a bit tricky, and it's easier to play about with in code.

author: Alti
author_rank: Frequent Contributor
timestamp: May 30, 2021, 11:21:46 am
content: Use an opamp in differential arrangement and feed that to ADC.This is like 6 resistors and raw opamp.

author: e0ne199
author_rank: Regular Contributor
timestamp: May 30, 2021, 12:54:26 pm
content: try comparator

author: Saimoun
author_rank: Frequent Contributor
timestamp: May 31, 2021, 08:23:51 am
content: Thank you all for the replies, I think I have what I need

author: mrkev
author_rank: Regular Contributor
timestamp: May 31, 2021, 04:56:49 pm
content: Quote from: gcewing on May 30, 2021, 10:00:45 amActually, most MCU's have a limit current (usually something like 5mA, 20mA per port) which is specified in datasheet. This current should be absolutely fine (if the chip layouter didn't do something shady).On the other hand, I fully agree that it's not a good practice. It's much better to use an extra shottky diode (with a smaller VF) between the pin and the VDD.I think that the best solution would be a basic voltage follower with a resistor divider.

author: Saimoun
author_rank: Frequent Contributor
timestamp: May 31, 2021, 08:33:33 pm
content: @mrkev: correct, my MCU says +/-5mA max per pin.I am not sure what you mean with a voltage follower with a resistor divider? As I said I would rather not use an opamp unless really necessaryBut actually I realized the output already had a TVS diode and a series resistor on, which does clip the signal.Do you think that is ok to use the TVS diode for this (thinking now it will be used for "normal" operation and not only in case of ESD events)?The circuit is basically:Code:sensor -> cable -> plug -> + -> 1.8k resistor -> MCU pin+ -> TVS -> GND