0
\$\begingroup\$

I have made a capacitance meter with a 555 timer and an Arduino. It's mostly complete except for the digital pin that triggers the 555. I have narrowed it down to two possible solutions. Both of them use a differentiator to make sure the trigger pin on the 555 returns positive, even if the Arduino is interrupted with a timer. One solution uses Arduino digital pin (clk) to charge and discharge one leg of the trigger cap (10nf). Charging And Discharge with Arduino

The other uses the 5v rail to charge, and the Arduino pin to discharge the trigger cap. Discharge Only With Arduino

My questions:

  1. Is one safer than the other for the Arduino pin?

  2. Is there a better way to do this in general? Perhaps by using a transistor to switch the cap to ground?

  3. Are the RC values the correct size for what I'm doing?

\$\endgroup\$
  • \$\begingroup\$ Generally speaking there's no reason to use a 555 if you are using an MCU like an Arduino, and especially not for this. As for what you are asking, a lot depends on the maximum capacitance you intend to measure, and if the capacitor might have already been charged before connecting to the tester. \$\endgroup\$ – Chris Stratton Feb 19 at 0:56
  • \$\begingroup\$ You don't need any of the components. Simply feed the GPIO pin directly to the *TR pin. Set the pin low, then immediately high to trigger the measurement. You should also add a minimum capacitance value to ensure that you still get timing information with no cap in place to measure. \$\endgroup\$ – Jack Creasey Feb 19 at 1:05
  • \$\begingroup\$ @JackCreasey You're right. I am using interrupts to time it. I had pulseIn() in my head and was thinking the trigger line would get blocked low. Thank you. \$\endgroup\$ – Michael McDonald Feb 19 at 1:09
  • \$\begingroup\$ @ChrisStratton Oh I don't want to discharge the capacitor under test through the Arduino pin. I want to discharge the capacitor on the RC differentiator, the 10nf one on the left. As Jack pointed out, I don't really need to, but I'd still like to know if it's safe to discharge low value caps through GPIO pins with a resistor. For future projects. \$\endgroup\$ – Michael McDonald Feb 19 at 1:11
1
\$\begingroup\$
  1. As the Atmega328 datahseet states the current on the IO pins should not exced 40mA. "Stresses beyond those ... “Absolute Maximum Ratings” may cause permanent damage to the device." But for short periods of time(microseconds) and low energies you may exced those limits. You can use the first circuit as long as you have at least a 125Ω resistor in series (to ensure a current of 40mA if working with 5V). Also you should consider that the IO pins are not simple switches. They have an internal resistance, capacitance and induncatce (that vary with temperature). Also the pins have clamping diodes connected to the MCU ground and VCC.
  2. If your aim is to measure capacitance I think that it's possible to avoid the 555 and measure the time it takes to charge/discharge the cap using timers and ADC. Atmel do this to implement the QTouchADC (http://ww1.microchip.com/downloads/en/AppNotes/doc8497.pdf). It's a capacitive touch sensor aproach. You can find code for this in github as reference to control all the peripherials.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.