I want to measure the frequency of a bicycle hub generator, consisting of a variable AC voltage output. Nominally, the RMS voltage is 6V, but with no load attached the voltage peaks can be tens of volts.

My plan is to use a 555 in bi-stable mode, attaching its output to an Arduino interrupt to count its "rising" event. What I need to know is if I need to, and how to protect the TRIGGER pin from over-voltage. Most probably the 555 will be powered from the Arduino (Vcc = 5V).

So the question is:

What is the maximum (positive and negative) allowed voltage on the TRIGGER pin of a NE555? How should I typically protect this pin if external circuit is expected to go over the voltage limit?

I took a look at the datasheet, but I'm afraid my current knowledge is not enough to interpret it.

  • \$\begingroup\$ I'm curious why you want to use a timer for this - what are you timing exactly? \$\endgroup\$ Jul 14 '15 at 16:22
  • \$\begingroup\$ @NickJohnson I won't use it as a timer, but as a Schmidt-Trigger (hence the "bistable" mode). \$\endgroup\$ Jul 14 '15 at 16:28
  • \$\begingroup\$ Why not use, well, a schmitt trigger IC, or a comparator, instead? \$\endgroup\$ Jul 14 '15 at 16:29
  • \$\begingroup\$ For many reasons: 1) I have one 555 around; 2) Schmidt Triggers usually come with too many ports (4 typically, thus increasing footprint). 3) It has a Schmidt Trigger mode, and so it could be considered one. But I would appreciate a suggestion for a better circuit, for sure! :) \$\endgroup\$ Jul 14 '15 at 16:30
  • \$\begingroup\$ "I have one on hand" is a powerful argument. In your place, I'd probably use a comparator for simplicity, though - you can get them in 8-pin packages too. \$\endgroup\$ Jul 14 '15 at 16:31

Per the 555 datasheet, absolute maximum voltage on the trigger pin is equal to VCC.

The easiest way to protect the pin is to use a series resistor and a schottky diode to VCC:


simulate this circuit – Schematic created using CircuitLab

The resistor should be sized sufficient to limit the current shunted through the diode; anything in the range of 10k to 1M is likely to be fine in your application.

In a pinch you can omit the diode and rely on the protection diodes in the 555, but it's generally considered a bad idea to do so.

Since your output is AC, too, you will need an additional diode to block negative voltages, or a resistor divider to shift the voltage appropriately.

  • \$\begingroup\$ Interesting! One doubt please: in your drawing, IN would be one of my AC pins (the other being grounded), OUT would be the 555 TRIGGER pin, and +5could be the 555 VCC pin, right? \$\endgroup\$ Jul 14 '15 at 16:39
  • \$\begingroup\$ @heltonbiker Correct. \$\endgroup\$ Jul 14 '15 at 17:05
  • \$\begingroup\$ Maybe change the diode part number to 1N5819 since you ask for it to be a Schottky type? \$\endgroup\$ Jul 14 '15 at 20:22
  • \$\begingroup\$ @SpehroPefhany Yes. :/ The Schematic editor automatically assigns a default part name, and I forgot to remove it. \$\endgroup\$ Jul 15 '15 at 10:55
  • \$\begingroup\$ @heltonbiker You also need a diode to ground to remove (mostly) the negative input voltages. You are not measuring zero-crossings - you are measuring the pulses of a half-wave-rectified AC signal. \$\endgroup\$
    – EBlake
    Jul 15 '15 at 22:45

The first answer to this question has the correct idea, except the diode suggested is NOT a Schottky diode. This means that it is the static protection diode on the input of the 555 timer that will carry the current. As the input voltage rises past Vcc, the current will flow through the diode with the lowest forward voltage.

Almost all chips have Schottky diodes on their input pins to both ground and Vcc - these are not intended to carry current, but are a last line of defence to protect chips from static discharge.

IMPORTANT: Because the input is an AC signal (i.e. goes negative), you will also need a Schottky diode to ground! The cathode on both diodes face Vcc.

For further protection, you can add a small (e.g. 100 Ohm) resistor between the external diode and the chip to further encourage the excess current to flow in the external diode(s), and not the internal one.

Another option is to use a reverse-biased zener to ground (which has the added advantage of also protecting against negative transients on the input line), but the problem with zener diodes is that the "knee" of the conduction curve is soft so, you are almost guaranteed to force some current through the internal input protection diode. They also tend to have a large forward voltage, so they don't do a great job of protecting against negative input voltages.

Some brave (foolish?) designers will rely on the input protection diode to limit the input voltage and they will simply install the series resistor.

But here's a question - why not feed the signal from the generator directly into the Arduino? If it has a Schmidt input (so it can deal with slowly-rising input signals), and you provide appropriate input protection, then you do not need the 555.

  • \$\begingroup\$ Thanks for the answer, but I think there has been some misunderstanding: my hub generator doesn't have Schmidt output, it outputs a (heavily distorted) senoidal wave of variable frequency and amplitude - but gives a nice quasi-rectangular shape if clipped. \$\endgroup\$ Jul 14 '15 at 21:39
  • \$\begingroup\$ Additionally, I'm not sure Arduino digital inputs have a reliable hysteresis, so I prefer to design it myself (not necessarily with a 555, of course). \$\endgroup\$ Jul 14 '15 at 21:41
  • \$\begingroup\$ The ATMega does have at least one analog comparator. \$\endgroup\$ Jul 15 '15 at 10:56
  • \$\begingroup\$ @heltonbiker I also think there has been some misunderstanding. I'm talking about a Schmitt input to monitor the clipped waveform. You need a Schmitt input because your hub generator produces a slowly-varying AC signal (it's slow relative to CMOS gates that are expecting transitions in the ns range). Suggest you read up on Schmitt inputs and CMOS latchup (both have wikipedia articles). Your hub generator is producing negative voltages half the time, so you will also need to protect the input from negative voltages. \$\endgroup\$
    – EBlake
    Jul 15 '15 at 22:43

You are adding in a 8 pin component to do complex input conditioning that could probably be done in software. You are just comparing the frequency of the pulse train.

The second circuit in this answer is all you need. You just need to size the input resistor to protect the diodes and prevent currents higher than the circuit consumption so it will not raise the 5V rail, if you fear this happening then having a crowbar Zenner diode on the supply rail or your input clamp is a good idea.

You can select a pin on the Arduino that can interrupt or count if needed.

The frequency counter project described here may give you more ideas.

Also note that you may want to be able to set the frequency setpoint, this may pose difficulty or benefits depending on the software skills and requirements yo have.

  • \$\begingroup\$ Nice answer. I have already made something very similar (with the Zener), but some time ago I read about the Shchmidt-Triggering, bi-stable mode of 555 and got interested, specifically because it has hysteresis thus making the line way less sensitive to commuting noise (which I don't expect, but one never knows). Besides, the overall volume of the 8 pin IC is not that larger than a zener diode and a resistor, but that is something to consider. Thanks again! \$\endgroup\$ Jul 14 '15 at 21:10
  • \$\begingroup\$ With your supply near 5V or more clamping it to the rails is as good as hysteresis as they will seldom spend time jittering around Vcc/2. A Dynamo has no commutator so will not have any commuting noise to contend with. If you are just making one then over design all protection, it is less trouble than troubleshooting a failure. Someone should design a peak power switch mode powersupply using the highest voltage dynamo connection and set to get the most light from low voltage LEDs (in parallel) so it only has one automatic controller with a minimum of active components in the power path. \$\endgroup\$
    – KalleMP
    Jul 14 '15 at 21:29

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.