4
\$\begingroup\$

I have an interesting design challenge. Reed switch S1 is feeding pulses at a maximum of five per second into a 3.3 V microcontroller input. I want to halve the pulse rate. I don't have access to the 3.3 V supply so I hope to power the circuit from the original reed switch's pull-up resistor! This may be possible if I can keep the average current requirements low by putting the ATtiny85 to sleep between pulses from the reed switch, S1 below, and running at 1 MHz.

enter image description here

Figure 1. S1 is (normally) connected to SENSOR IN. I want to power an ATtiny85 from the pull-up resistor R2 and only pass every second pulse through by pulling J1-2 to ground by PB1.

The plan:

  • Charge up C2 via R2 and D1. This has to provide adequate voltage stability to power the Tiny during the 10 ms pulses when PB1 pulls low.
  • Configure PB2 as an interrupt and have S1 wake up the Tiny, check if it's an odd or even pulse and, if even, set PB1 to LOW for 10 ms.
  • Go back to sleep.
  • The Tiny should draw about 1 mA while awake running at 1 MHz. At 5% duty cycle I'd have a 50 uA average current resulting in an average voltage drop on R2 of 150 mV.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 2. A crude simulation of the circuit. PWM1, etc. represents the duty-cycle of the ATtiny85 while PWM2, etc. represents PB1 pulling the J1-2 line low.

enter image description here

Figure 3. The results of the simulation.

The results are pretty much as expected but leave me with a few questions:

As drawn PB1 is connected to a line which is one diode-drop higher than the Tiny's VCC. I can see two ways to address this: - Use a Schottky diode for D1 which will give several improvements including reducing the overvoltage on PB1. - Add a diode on PB1 input to match the voltage drop on D1. This isn't likely to help much as there should be little current flowing.

  1. What's the best way to address the points above?
  2. I've never run a micro as low as 2.3 V before. Are there any pitfalls I need to be aware of?

Many thanks.

\$\endgroup\$
6
  • \$\begingroup\$ I can't understand if this complexity come from "the challenge requirements", why not use a flip/flop IC to halve the pulses ? \$\endgroup\$
    – gino
    Commented Oct 24, 2021 at 21:08
  • \$\begingroup\$ @gino, the flip-flop would give a 50% duty cycle and I don't think I have the power budget for that although CMOS might not draw too much power. The ATtiny85 gives me options on pulse width and further manipulation of the output. Thanks. \$\endgroup\$
    – Transistor
    Commented Oct 24, 2021 at 21:16
  • \$\begingroup\$ Newer logic families like the AUP are running on static supply currents in the single digit microamps range, and from 0.8 to 3.6V. The 74AUP1G80 (from any manufacturer) might suit your application. \$\endgroup\$ Commented Oct 24, 2021 at 21:43
  • \$\begingroup\$ When using the flip-flop approach, you might want to have a series capacitor on the FF output. So it doesn't cut its own supply off if the reed pulses stop in the output low state, or if it's low on power-on. \$\endgroup\$ Commented Oct 24, 2021 at 21:53
  • \$\begingroup\$ Analyze the startup conditions particularly carefully. Consider Schottky leakage, especially at high Ta. Output drive current and maximum clock frequency drop with low Vdd, should be ok but check the former. \$\endgroup\$ Commented Oct 24, 2021 at 22:56

3 Answers 3

0
\$\begingroup\$

Powering an ATtiny85 from the pull-up resistor

I love the idea you propose, but would point out the following:

  1. Using a Diode (conventional or Schottcky) to charge the supply capacitor is problematic. You have an ATTiny 45 I/O pin connected to the pullup resistor and this has an intrinsic diode from the output to the supply (VCC) for the MCU. See Figure 10-1 in the datasheet.... enter image description here This provides another path to charge the supply capacitor, but use of this path might change charge times or predicted supply voltage.

  2. If the MCU pulls the input pin down for too long, it's possible that the supply voltage could drop. Whether it would drop below a working voltage is unknown, but it's hard to deign for.

I would suggest the following might work for you:

  1. Use a rechargeable battery such as the Maxwell ML 1220 battery, which is viable up to about 3.3V. The pullup resistor could provide the charge limit, and the battery will provide 1-2mA capability with relatively stable MCU voltage over 2.5V. This will reduce the needed capacitance to a more manageable level, with perhaps only 1uF required.

  2. Use a FET to provide the pulldown signal into your interface, which will isolate the MCU I/O pin. There are plenty of low VGS(th) FETs available such as the BSS138.

  3. The internal pullup on the ATTiny is all you need on the Reed relay input, you can turn it off once you sense the switch closure.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
  • \$\begingroup\$ I've ordered some MOSFETs and Schottky diodes (which I've never used in all my years). I'm inclined to try your M1 on my PB1 without your battery and see how far I get. What's R1 doing? Thanks. \$\endgroup\$
    – Transistor
    Commented Oct 28, 2021 at 19:05
  • \$\begingroup\$ @Transistor R1 limits the charging current for the battery. It could also be sized to ensure that the input to your external device does not see a low when the unit is first connected ...if you are not going to use the battery. \$\endgroup\$ Commented Oct 28, 2021 at 21:15
0
\$\begingroup\$

Using a schottky for D1 is sensible. I haven’t had any problems running ATtiny micros at low voltage; the main issue would typically be interfacing to other devices but that seems to be handled here.

\$\endgroup\$
2
  • \$\begingroup\$ This is at best a comment, certainly not an answer. \$\endgroup\$ Commented Oct 24, 2021 at 22:11
  • 1
    \$\begingroup\$ On the contrary I believe I have addressed both of the OP’s concerns. \$\endgroup\$
    – Frog
    Commented Oct 25, 2021 at 23:34
0
\$\begingroup\$

Mechanical switches have contact bounce, so this signal would need some conditioning. An ATTINY is a great solution for that and can work at a much lower frequency than 1MHz for this purpose.

But let's pretend for a moment that we've got the contemporary chips that were also available circa 1980. There still is a way to do it without the MCU, but for similar cost.

The circuit outputs every other pulse, and ensures that the pulses have a fixed width of 10ms.

The circuit is nanopower: \$I_Q<100{\rm\,\mu A}\$ at room temperature, and can run from R2=470R all the way to R2=1M. The value you chose, R2=3k, is good for noise immunity.

schematic

simulate this circuit – Schematic created using CircuitLab

Note that CD4093B has Schmitt inputs.

D5 should have a voltage drop lower than Q1's Vbe or else the circuit may not initialize properly.

The waveform at SWOUT and SWIN would look as follows:

Output Waveform

If one wished to be fancy, R1, R3 and R4 could be replaced with 1uA current sources, e.g. with LM334. This would increase the cost just for the fanciness factor, nothing more.

Diodes D2, D3, D4, D7 protect CMOS inputs from latch-up.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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