Close circuit to power Arduino, then let the Arduino cut the circuit again.

I'm building a battery-powered Arduino-based long-range doorbell.
For the transmitter I'm planning to use a 3v Arduino pro mini, a 433Mhz transceiver (CC1101), 2 AA batteries, a button.

Obviously I don't want to be changing the battery all the time, so the circuit that provides the Arduino with power should only be closed when someone presses the button on the doorbell, but once the Arduino has sent a signal to the receiver and the receiver (which also has a transceiver) has answered, the Arduino should immediately power off again. I'm not talking about deep sleep here, I mean completely off.

Is there a simple way to make such a circuit?

Of course you could probably rig something up but the arduino wouldn’t be very responsive as it would have to power up each time and the button press would be over before it did anything. Why not put it to sleep.

No, I don't want the button to close the circuit directly because obviously then power might get cut too early.

I was thinking about a button that closes a circuit which can then keep itself alive using a transistor or something.

I've also been thinking about simply using a capacitor that could get charged in a millisecond and power the Arduino for a few seconds, but that would always waste some power.

I don't want to use sleep because the Arduino still uses power in sleep and I want the batteries to last as long as possible.

Yes you can. I would post a picture, but that isn't working right, so you'll need to go to the Github repo on my mailbox notifier and look at the schematic.

You would replace the magnetic reed switch with your pushbutton. When you press it, that turns on the P-channel mosfet, which powers up the Arduino. The first thing your code should do is switch D2 (or whatever you use) to OUTPUT, HIGH. That turns on the NPN transistor, which in turn keeps the mosfet on when you release the pushbutton. Then when you're done, just turn off D2 and the power will be turned off. I believe the Arduino would boot up fast enough to make this work, but you would have to test it.

Edit: Sorry, I forgot where I was. Attachments aren't working on EEVBlog forum, but they are here. So here's the schematic.

Nice solution and if it doesn’t boot fast enough a small capacitor might be enough and could be sized to waste very little power

pmagowan:
Nice solution and if it doesn’t boot fast enough a small capacitor might be enough and could be sized to waste very little power

Yes I think a capacitor between the source and the gate would extend the effective period of the button press and allow the Arduino more time to boot up. Pushing the button would ground the gate end of the capacitor, and it would only rise slowly through R1 after the button is released.

Also, I think putting the capacitor there, instead of from gate to ground, would prevent the Arduino from automatically powering up when power is first connected. If you connect it to ground, then when power is applied the source would immediately go high, but the gate would stay low until the capacitor and the gate are charged through R1, so the mosfet would turn on for a while, possibly long enough for the Arduino to keep it on. But if you connect the capacitor to the source, then when the source goes high that increase would be immidiately transferred to the gate through the capacitor, bypassing R1 in effect. So the source and gate should come up together, and the mosfet should stay off until you actually push the button.

The Arduino boots extremely fast. Why not just connect the push button to the power supply. It takes only a few milliseconds to send an RF packet, send it immediately. Then sit and do nothing, or keep sending packets, whichever you prefer. The user releases the button, power goes down, and you're ready for the next cycle. :slight_smile:

Do you think a short button press would be enough time for the arduino to boot up, read the battery voltage, create a checksum, transmit that data (voltage value + checksum) to the receiver, let the "receiver" validate the checksum, wait for an echo response from the "receiver" and validate its checksum?
We also have to assume that other 433mhz devices are in the area and may interfere, so I may have to resend the package a couple of times before success.

@ShermanP Thanks, that looks very promising.

Well now you've expanded the function of your button a bit. It might still work more times than not, but might not be all that dependable.

You have a couple options though. You could have the doorbell Arduino light up an LED when the process has completed, and have a little sign that says "Push button until LED lights up." Or you could install just the mosfet, pullup resistor and capacitor part of the circuit, and select the resistor and capacitor values so the mosfet would stay on long enough after the button is released to complete the process, or maybe twice that long, just in case, for cold weather. Then you wouldn't need the NPN and base resistor.

If you do include the full circuit and make it fool-proof, you'll need to add logic that would shut things down after a few tries. Otherwise, if things crap out at the receiver end, you would keep transmitting and run down the battery.

felic:
Do you think a short button press would be enough time for the arduino to boot up, read the battery voltage, create a checksum, transmit that data (voltage value + checksum) to the receiver, let the "receiver" validate the checksum, wait for an echo response from the "receiver" and validate its checksum?
We also have to assume that other 433mhz devices are in the area and may interfere, so I may have to resend the package a couple of times before success.

@ShermanP Thanks, that looks very promising.

No, not enough time. But it is relatively easy to modify a Pro Mini so that it doesn't use more than a few microAmps in sleep. It would be hands down easier than building an external power control circuit.

aarg:
No, not enough time. But it is relatively easy to modify a Pro Mini so that it doesn't use more than a few microAmps in sleep. It would be hands down easier than building an external power control circuit.

The Pro Mini with the power-on LED removed, and even the regulator removed, used to sleep at less than 1uA. But the last two batches I ordered sleep at 150uA, and there's an ongoing question whether all new 328P chips now behave that way. But I agree that if you can get one that sleeps properly, and if you don't need the regulator, there's really no point in adding the power control circuit. A 3.3V 8MHz Pro Mini will run just fine on direct battery power. But you would have to test your transceiver to see if it will also work. If you have to use a regulator to produce 3.3V, then I would lean toward using the power control circuit because the regulator would never sleep.

You can more or less depend on the transceiver to operate on battery power, as there are details about that in the data sheet. Where did you source your 328P's? They might be counterfeit parts.

The 328Ps were on standard Pro Mini clones that I got from two Ebay sellers. However, it appears Ralph Bacon has had the same problem with a 328P-PU dip chip from a Chinese source, and sleemanj on the EEVblog forum reports the same problem with his Minis, also Chinese. I'm working with Kevin Darrah to try to figure out what's going on. He's received a 328P-AU from Digikey, presumably genuine, and will test it this week if he has time. So far the key appears to be the date code, with parts dated 2018 or earlier working fine, but later ones not. But as you say, they could all be fakes, so the test of the Digikey part, which is dated in 2020, is really important. I've been unable to find anything from Microchip saying they made such a change beginning in 2019, or any errata on this issue.

The modified 8MHz Pro Mini has been my go-to part for very low current battery powered projects. I hope it continues to be, but I'm a bit dubious at the moment. But maybe Kevin will report some good news.

Here is another latch circuit. It differs from the one in #3 in that it is immediately self sustaining. That is, it does not need to wait for the Arduino to start to sustain the latch. However, at the end of the task, in this case transmitting a payload and waiting for a response (or timing out), the Arduino must explicitly break the latch. It does this by changing the connected pin state from high impedance (input) to OUTPUT LOW.

I simulated it in LTspice to check it, then stripped out the simulation artefacts, hence it looks strange.

I agree, though, with those who have said that using sleep mode would be the better approach in this case.

  • note: a current limiting resistor (say 1k) should be shown before the Arduino pin.

It really sounds like you have counterfeit parts. It is possible to buy good parts from China, you just have to learn how to avoid the "skeezy" vendors. I use one supplier based in HK for IC's... they've always been the real deal. Actually, behind my desk I must have several hundred boards with various processors too, and I have never, ever had any problem with a fake processor. The only fakes I have encountered were USB-serial interface IC's. If you PM me, I'll tell you the name of a good Ebay supplier.

aarg:
. . . If you PM me, I'll tell you the name of a good Ebay supplier . . .

Personal recommendations (at least from people with a good history on this forum), I'll always take seriously.

The PCB manufacturer (Chinese) I use , simply because someone I was working with on a project, said they use this particular firm. It was not even an explicit recommendation, more of a remark, but that was enough. Otherwise, I would not even have thought about using them. In the mean time, I have ordered about ten sets of boards and will continue using them.

Please PM me with the URL of this chip vendor, and I'll take a look at their offers.

I think it's a bit premature to conclude that all these chips from various sources are fakes. I don't think there is any history of counterfeit 328P parts. In any case, I want to be sure the new genuine part from Digikey sleeps properly. If it doesn't, then all these other chips may well be genuine, and the problem may reside at Microchip.

And what I really need is cheap Pro Mini clones with genuine 328Ps, not just the genuine chips. Everyone tells me it's easy to remove the chip from a Mini and solder on a new one without messing things up. I don't believe it for a second.

If the new genuine chip turns out to be bad too, I hope we will be able to contact someone at Microchip who can explain what's going on, and who could possibly offer a software fix for it. One other piece of data: these chips sleep at 150uA when powered at 3.3V, but they draw 330uA at 5V, which is too much to be a resistive thing. To me as a non-expert, that difference suggests it could be something like an oscillator that's left running in the bad chips. But the resonator is supposed to be completely off, so I don't know.

Anyway, I'm just gonna have to wait for Kevin to finish his tests on the new chip, which should be pretty soon.

I did take the precaution of buying two used Minis on Ebay. They work fine, and sleep soundly. Their date codes are from 2015, which I believe is pre-merger Atmel.

I ordered my Pro Mini clones in September of 2016, so I guess I should be good.

6v6gt:
Here is another latch circuit. It differs from the one in #3 in that it is immediately self sustaining. That is, it does not need to wait for the Arduino to start to sustain the latch. However, at the end of the task, in this case transmitting a payload and waiting for a response (or timing out), the Arduino must explicitly break the latch. It does this by changing the connected pin state from high impedance (input) to OUTPUT LOW.

I simulated it in LTspice to check it, then stripped out the simulation artefacts, hence it looks strange.

I agree, though, with those who have said that using sleep mode would be the better approach in this case.

Thank you! That seems to be specifically what I've been asking for.

But since you say that using sleep would be the better approach, I'm curious how long two normal AA batteries would last this way. Correct me if I'm wrong:
The Internet says roughly 2400mAh for an Alkaline AA cell and at about 50% capacity they have dropped to 1.2V. Since the 3v Pro Mini requires at least 2.4V according to the Internet (and 1.2V * 2 = 2.4V), I effectively only get 1200mAh.
So while in sleep at 1µA, it would last for 1200*1000/24/365 = 137 years. (That seems like way too much.) But there is also self-discharge (about 0.3%/month according to the Internet).... so... yeah how the hell do you even calculate that. I guess this could work:

capacity = 2400
for (month=0; capacity > 1200; month++) {
    capacity = (1-0.003) * capacity - 1200/(137*12)
}
years = month/12

=> years = 16.8

Would that make sense? It still seems like a lot.

felic:
. . .

=> years = 16.8

Would that make sense? It still seems like a lot.

I can just imagine that the batteries would be a mush of white crystals by then. But, I've had a pair of AA alkaline cells in an ATmega328P system for two and a half years. I wrote it up here. It is also, incidentally, a mailbox notifier project:
https://forum.arduino.cc/index.php?topic=693007.0

The self discharge rate can't be ignored. See Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors and search for the title: Battery self-discharge rates. These are usually higher than the processor sleep power consumption, assuming you've done everything correctly.

Perhaps you could develop things to the point of being able to test the project's sleep current, and see what you come up with. This would include the Mini's regulator if you will be using it, and your transmitter. If you get it all down to a few microamps, there's really not much point in bothering with the power-down circuit. Even if it's higher than that, you could just try it and see how long the batteries last. I used a power circuit in my mailbox notifier, but only because I used a Lolin D1 Mini as the processor, and it doesn't sleep soundly at all.