# What power regulator can I use ?

Status
Not open for further replies.

#### pic.programmer

##### Advanced Member level 3
I am making a small device which uses ATMega328P, Ultasonic sensor and nRF24L01. ATMega and nRF should get 3.3V and Ultrasonic sensor should get 5V. I have two questions.

1. If ultrasonic US-020 is powered from 5V then does the Trigger and echo pins of it (5V TTL) affect the 3.3V input pin of ATMega ? Should I use resistor to drop the 5V TTL echo signal of ultrasonic sensor to 3V range for ATMega ?

2. Can I use zener to provide 3.3V to ATMega and nRF24L01 and 5V to Ultrasonic sensor from 9V battery.

I want the device to run on battery for atleast 1 year.

It checks distance and then sends the data to master powered from adapter and then goes to power down for 8 seconds and then wakes up again due to WDT and then repeats the same thing. It is like starting the function at beginning of while(1) loop then get distance data and send it to master and then at the end of while(1) loop it goes to power down mode and then wakes after 8 seconds.

How long can my device work on a 9V battery ?

I am referring this.

https://arduino.stackexchange.com/q...the-max-power-consumption-of-arduino-nano-3-0

Last edited:

#### d123

##### Advanced Member level 5
Hi,

1) I would assume so. Does the ultrasonic thing ever really output the full 5V - if not then you could connect it directly to 3.3V input. A ~3.3V Zener there may be suitable.

2) How about a dual fixed output LDO? Many available with 5 and 3.3V. I'd avoid using a Zener if possible unless you have some need for returning to the 1970s ( ). Another benefit to an LDO relates to those with an "Enable" (or same difference maybe, "Shutdown") pin.

How (long is a piece of string...) much current, or power in Watts does the whole cycle need? By knowing that you can roughly calculate how long the 9V battery may last by referring to the batterys alleged mAh capacity. It's hard to know without adding up standby power draw and active power draw for the circuit.

pic.programmer

### pic.programmer

Points: 2

#### pic.programmer

##### Advanced Member level 3
135 mA is consumed once every 8 seconds for say 200 milli seconds.

I am using this module only in transmit mode.

Only three devices will be used in the syste,. One HC-SR04 sensor (15 mA), ATMega 328P (5 mA), nRF24L01 (135 mA during transmission). I have to use mosfet to power the nRF24L01. ATMega328P (SMD) wakes up due to wWDT once every 8 seconds and then powers the sensor and gets distance data and then powers the nRF and transmits 2 bytes within 200 ms and then goes to power down mode and again it wakes up after 8 seconds and repeats.

Last edited:

#### KlausST

##### Super Moderator
Staff member
Hi,

I want the device to run on battery for atleast 1 year.
You know time is measured in hours.
Current is measured in A.
Electric charge is measured in Ah.
1A x 1h = 1Ah.

If you want to know how long it can run on the battery then you need to know A and Ah. Independent of voltage.

But if you use a 9V battery and run the circuit on 5V you need to drop 4V.
If you use linear regulators this means you waste 4/9 of the energy.

A step down could improve this, but it maybe has lower efficiency at low load.

Klaus

pic.programmer

### pic.programmer

Points: 2

#### pic.programmer

##### Advanced Member level 3
I read this but unable to decide what regulator to use.

https://electronics.stackexchange.c...t-my-atmega328-to-run-for-a-year-on-batteries

I have decided to power ATMega328P from 5V and ATMega itself will power the 5V ulrasonic sensor after wakeup from its IO pin. Sensor draws max 15 mA. So, 15 mA is drawn once every 8 seconds. nRF draws 135 mA once every 8 seconds.

So, how to do the calculation. 9V battery capacity is 500 mAH. Is it better to use Li-Ion battery or AA / AAA alkaline batteries ?

#### CataM

##### Advanced Member level 4
I have decided to power ATMega328P from 5V and ATMega itself will power the 5V ulrasonic sensor after wakeup from its IO pin. Sensor draws max 15 mA. So, 15 mA is drawn once every 8 seconds. nRF draws 135 mA once every 8 seconds.

So, how to do the calculation. 9V battery capacity is 500 mAH. Is it better to use Li-Ion battery or AA / AAA alkaline batteries ?

In other post you said the current drawn is for 200ms, so we have this:
Q=(135+15)*10^(-3) Amps * 200*10^(-3) seconds=0.03 C

1 year= 365 days=365*24*3600=31536000 seconds in 1 year.

Your cycles are like this:

How many cycles do we have in 1 year? => 31536000 seconds/8.2 seconds each cycle = 3845853.659 cycles of 8.2 seconds.

Even though there are 8.2 seconds in each cycle, we use just 0.03 C (charge for those 200 ms). Is the same as saying this: we use less mA(Amps used=0.03 C/8.2seconds) but during 8.2 s or we use more mA (150 mA) but just for 200ms, the charge used is the same (0.03 C).

Total charge used in 1 year is 3845853.659*0.03 C = 115375.6098 C in 1 year ≈ 32 Ah.

pic.programmer

### pic.programmer

Points: 2

#### David_

##### Advanced Member level 2
I'd like to begin this by saying that I am my self only at the start of exploring batteries for low power devices(low and high power) and I am not sure that you can trust what the adds at ebay claims but I just want to give you a couple of battery options while pointing out that using a 9V battery would probobly be a mistake in point of view since 9V batteries can be rated as any thing between 80mAh up to 600mAh(I think there are 1200mAh to but they cost big \$) and 600mAh looks ridiculous when you start looking at Li-Ion re-chargeable batteries.

On ebay you can buy cheaply a few options(I will post links to all the below options):

1, ether you can use 5*1,2V @ 3000mAh, they are AAA or AA size.
By the way, you parts that need 5V, do they have to run at 5V or can they run at 4,8V?
Because there are neat holders with leads for 4 1,2V re-chargeable AAA batteries some of which contains switches.

2, or you can use a single 3,7V battery with a boost converter to raise that to 5V.

3, or you can use 2*3,7V batteries with anywhere from 1800mAh to 10000mAh, then you need only a 5V LDO(Low Drop Out) regulator.

Or you can buy a single 7,4V Li-Ion battery which can have as much as 5000mAh last I checked.

I don't know what you are comfortable with but in my solution I will probably go with a single 3,7V battery and use a boost converter to raise that to above 5V and then use a LDO regulator

Anyway here is a list of ebay adds. There are chargers and all you need just search for ex 3,7V rechargeable battery and you'll find so much is a horrible experience going through it all.

AA LR06 3000mAh 1.2V NI-MH re-chargeable battery:
AAA LR03 1600mAh 1.2V Ni-Mh re-chargeable battery:
18650(size) 3.7V 6000mAh Li-ion re-chargeable battery:
AA(14500) 3.7V 1300mAh Li-ion re-chargeable battery:
18650 3,7V 10000mAh Li-Ion re-chargeable battery:

Regards

pic.programmer

### pic.programmer

Points: 2

#### pic.programmer

##### Advanced Member level 3
Ok.

This is not shipping to India.

Any alternative links for 3.7V 10000 mAH batteries ?

Can I use this with 3.7 V betteries ?

I think it steps the voltage to 12 V and can I use AMS1117 5.0V LDO to get 5V for the ATMega328P ? Ultrasonic sensor gets power from ATmega's digital output pin just before sending a trigger and after distance data is received it shutsdown the power to sensor. I have to get 3.3V for nRF24L01. Should I use another AMS1117-3.3V LDO to power it ? Should I use a mosfet driven by ATmega's digital output pin to control power to nRF24L01 ? Is there any better power regulator with low quiscent current and having a shutdown function so that I can use it to power nRF and control its shutdown pin using ATMega ?

- - - Updated - - -

Edit:

Ok. I will experiment using these.

ATMega328P

https://www.banggood.com/3A-LM2577-...e-Step-up-Power-Converter-Module-p-87541.html

https://www.ebay.com/itm/NRF24L01-P...ommunication-module-2-4G-1100m-/310651702557?

I will connect 3.7V 6000 mAH bettery to battery charger IN+/IN- pins and connect the battery charge's OUT+/OUT- pins to stepup DC -DC booster and adjust its output to 5V. I will power ATMega from 5V and Atmega will power Ultrasonic sensor. I will use LDO AMS1117-3.3V to get 3.3V for nRF24L01.

Will this setup work. I need the device to run on fully charged batteries for atleast 6 months. Once every 6 months the device will be put on charge for say 2 or 3 hours.

#### KlausST

##### Super Moderator
Staff member
Hi,

Generally:
* Use low power devices. Don't consider only the active current, but consider the idle current (multiplied with the idle time) also
* use low supply voltage. If the atmega can run with 3.3V then you save power against 5V supply.
* save processing power. Use microcontroller_idle_state during wait instead of busy wait.
* use batteries with only small voltage headroom and use low power linear regulators.
* regulators in idle consume power. Consider to use one supply for the timing control (is it controlled by the microcontroller) and an extra supply for the rest of the circuitry that us completely switched OFF during idle.
* consider to use a solar cell

Klaus

#### pic.programmer

##### Advanced Member level 3
No, the device will be placed where there will be no sunlight. It is used indoors. Actually the whole system is made of 4 boards. Two are sensor baord and they are identical and have to operate on batteries. The other two boards and display board and control board. All have nRF24L01 and use mesh network to communicate with each other. The control and display boards are powered from power adapters.

I just need a perfect boost device which provides 5V and 3.3V from 3.3 - 4.2V. Ultrasonic sensor needs 5V. It can't work with 3.3V and nRF24L01 needs only 3.3V. So, ATMega should get 5V from boost circuit and nRF24L01 should get 3.3V from buck circuit and ATMega will power the Ultarsonic sensor.

So, please tell me how to find the best device which provide both 5V and 3.3V without consuming much current. Also it should be able to provide say 50 mA on 5V line and 200 mA on 3.3V line. I will use one 3.7V 6000 mAH battery with USB charger circuit. If the device runs for more than 6 months then I will put all the circuit on a single small PCB.

#### Easyrider83

##### Advanced Member level 5
You should look for LDO with ultra low quiescent current, like a MCP1710
nRF24L01 takes 28-30mA for ~0.5ms during TX only.
Ultrasonic sensor have to be switched off from power supply in idle mode and you can get your 1-2 years battery life from 9V battery.

- - - Updated - - -

Another was - use Lithium battery 3.3V and switching DC/DC 3.3 -> 5.0 converter to supply ultrasonic sensor.

#### c_mitra

##### Advanced Member level 5
No battery acts as a constant voltage source. You need to figure out the range you are going to use. Perhaps you can use it upto 7.5V when you need to discard it. Let us assume that you will get about 500mAH in that time. This is about 0.05 mA-year. This is clearly not suitable.

You may be able to get 6 months with a 3.7V 6000mAH Li battery. You need to be really conservative. You also need to balance between complexity (every added component adds to inefficiency) and idle current. It will be a rather subjective decision.

#### Easyrider83

##### Advanced Member level 5
3 years ago I made a keyless access system. The key based on STM8L+nRF24L01 works from CR2032 200mAh battery for a 6 years. Transmit data every 2 seconds.

#### FvM

##### Super Moderator
Staff member
The key based on STM8L+nRF24L01 works from CR2032 200mAh battery for a 6 years. Transmit data every 2 seconds.
Although the average current consumption (3.5 µA) doesn't exactly fit the previous assumptions (nRF24L01 takes 28-30mA for ~0.5ms during TX, makes already 7.5 µA), I agree with the order of magnitude. It's well manageable with recent "nanopower" processors, ultra low power voltage regulators and similar stuff.

pic.programmer

### pic.programmer

Points: 2

#### pic.programmer

##### Advanced Member level 3
Lithium battery comes in 3.3V ? I have only see 3V Lithium batteries. Where can I get 3.3V lithium batteries ? How to power nRF if Lithium battery (Coil Cell) is used ? Can I connect nRF's VCC pin to ATMega's digital output pin and power from it ? ATMega pin can supply 40 mA max.

I want to try 3.3V Coin Cell, 9V battery and and 3.7V 6000 mAH battery.

If I use 9V battery should I use 9V to 3.3 and 5V buck power supply ?

#### Easyrider83

##### Advanced Member level 5
Lithium battery comes in 3.3V
New battery gives ~3.33V
Discharged ~2.9V
Where can I get 3.3V lithium batteries ?
CR2032, 2025, 2016 ant e.t.c.
How to power nRF if Lithium battery (Coil Cell) is used ?
Directly! Also, some capacitors will be helpfull. I'm using 3x100nF 0603 Y5.
Can I connect nRF's VCC pin to ATMega's digital output pin and power from it ?
Yes, you can. But it is useless. You will have to reconfigure chip each start up. Use idle mode to reduce consumption.
I want to try 3.3V Coin Cell, 9V battery and and 3.7V 6000 mAH battery.
Be brave! Life like risky men.
If I use 9V battery should I use 9V to 3.3 and 5V buck power supply ?
buck power supply is bad solution for such low current. I recomended you to use LDO and helped to choose with one. Do you hear me? It is ok to loose 6V on LDO, you will obtain your 600mAh from 9V battery anyway.

pic.programmer

### pic.programmer

Points: 2

#### pic.programmer

##### Advanced Member level 3
Here is what I decided. I will power the ATMega from 3.3V Coin Cell and also the nRF directly and use this

https://www.sparkfun.com/products/10968

to step up 3 - 3.3V to 5V for Ultrasonic Sensor.

Will this give 6 months battery life ?

How to turn OFF power to Ultrasonic when not in use ?

Can I connect the input of DC-DC converter to ATMega's digital output pin and power it to get 5V, 15 mA for Ultasonic when needed ?

#### Easyrider83

##### Advanced Member level 5
There are no 'enable' pin on that converter. Also, you will loose energy charging output capacitor only to perform single measure. You can use something like a FDC6329L to operate converter, but battery life will be pretty short I expect.

pic.programmer

### pic.programmer

Points: 2

#### d123

##### Advanced Member level 5
Hi,

I came across this today, it's about battery charger circuits, nevertheless I think it has interesting little design ideas aplicable to other circuits; in part based on the thread, and mainly on your last post, I thought maybe you may be able to adapt an idea or two for your application, for example: the way they use a FET to gate the input (in your case maybe could implement for "How to turn OFF power to Ultrasonic when not in use"), or the series diode on the other side of the regulator to reduce drain to an impressively miserly minimum when disconnected ..., it's worth a read to see if any would be useful.

View attachment Battery Charging snva557 TI.pdf

pic.programmer

### pic.programmer

Points: 2

#### pic.programmer

##### Advanced Member level 3
My nRF draws 135 mA during Tx because it has power amplifier and the range is 1 Km.

Status
Not open for further replies.