7 years, 11 months ago.

sensing with AnalogIn, no input but there is voltage

Hi everyone! I'm doing a project regarding to the data logger using mbed LPC1768 as my microcontroller. The signal from the piezoelectric sensor is feed into my LPC1768, after pass through the interface circuit which is made up capacitors. The interface circuit is mainly to divide the AC voltage from piezoelectric sensor, so that the voltage feed into my LPC1768 is suitable and prevent the microcontroller to be fried up. However, the sensor reading from Analog pin (p17) shows reading of 0.45 once I press the 'reset' button on mbed, but the analog pin isn't connect to any sensor yet. The reading is then slowly drop down to 0.10 after 5 to 10 minutes. Anyone facing this problem can help me to solve it as well? Much appreciated.

1 Answer

7 years, 11 months ago.

What is the pin connected to? If it's not connected to anything then you are going to get random numbers.

The pin is supposedly connected to my piezoelectric sensor. When the pin isn't connect to anything, it shows reading of 0.45++. Once it connected to my piezoelectric sensor, it shows reading of 0.75++. I viewed this values via serial port using TeraTerm The reading then drop slowly to lower until 0.10 or even lower. Do you have any idea about this?

Note: the reading showed is not in Volts. It is the percent reading which valued from 0.00 (lowest) to 1.00 (highest).

posted by Zi Jen Sam 26 Apr 2016

You're not seeing anything that would make me worry, it all seems perfectly reasonable.

All IO pins default to inputs with a pull up until they are configured. So any capacitance on that pin is initially charged up. The pin is then set as an analog input. There is now nothing driving the pin in either direction so the only discharge path for the capacitors are their leakage currents and the input current of the ADC. Both of those are very small and so the value takes a while to decay. The more capacitance the longer it takes.

posted by Andy A 26 Apr 2016

Thanks for the help Andy. So do you mean I will just wait until the reading to drop to 0.00 and I will start to log the data?

posted by Zi Jen Sam 26 Apr 2016

If you have your sensor connected it shouldn't drop to 0 since there will be something driving the circuit.

Depending upon what you are measuring you may want to add a resistor to ground - say 10k, so that things discharge quicker otherwise you'll be measuring the peak value from your sensor rather than the current value.

posted by Andy A 26 Apr 2016

My interface circuit is actually simple. It consists of 2 capacitors which valued 0.1uF and 0.01uF, and connected in series? The 0.1uF portion will feed into my mbed. Do you mean add a resistor series to the capacitors? One more question Andy. I did monitored the waveform of input sensor on oscilloscope. When I hand-press the piezoelectric sensor, it can produce about 8 to 15V which I can observe at channel 1. Then I extend another channel to observe the smaller voltage portion (capacitor of 0.1uF portion), same pattern can be observed. Due to AC voltage, the waveform consists of positive and negative cycle. Can I log the data in both positive and negative value?

posted by Zi Jen Sam 26 Apr 2016