Powering my gadget with a 9V battery

My project involves an Arduino Nano V3, an SG90 OLED and an SSD1306 oled that communicates with Nano via I2C.

The Nano is in sleep mode most of the time, and only wakes up when a button is pressed. It then displays some stuff on the OLED display and move the servo around a bit for a period as short as a few seconds and goes to sleep again.

I got programming stuff mostly figured out, but I suspect that power supply could be a huge problem later on.

The first issue involves power consumption. I need this gadget to last as long as possible on battery power. I understand that both OLED and servo could draw current even when they 'do nothing at all'. OLED draws approximately 1mA even when it shows a blank screen. While servo draws 10mA in idle state. Thus I made a transistor switch for each of them, each controlled by a pin so I could turn them off completely with software. Idealy, after a short working cycle mentioned above, Nano first turns off OLED and servo, then puts itself to sleep.

My 1st question is, is there anything more I could do to save power on Nano other than calling the sleep functions provided by avr/sleep.h?

The second issue involves a series of voltage levels. By hands-on measuring, I found out that supplying Nano with 4.7V DC power resulted in a 3.6V logic high level on its pins, so when I connected OLED's VCC to 4.7V, an insufficient 3.6V logic high messed with I2C protocol and caused the OLED to show a bunch of garbage. So I decided to have 2 power supply voltage on board: one 9V to power the Arduino and one 4.7V (or 5.0V) to power OLED and servo. It seems to me that the only way I could get a 5V out of 9V battery is through a DC converter like LM2596.

My 2nd question is, will a single 9V battery do the job? And if the answer is yes,

my 3rd question would be, can I connect a Nano directly to a 9V battery? and

the 4th, how well can LM2596 converter mitigate voltage dropoff as the battery die out? e.g. will LM2596 hold output voltage at 5.0V when battery voltage drops from 9V to say, 8.0V?

Any suggestions you have are welcome! Thanks in advance.

Edit:

Here's a picture of 4 diagrams to showcase my circuit, as per requested by @ledsyn

On the upper left is a diagram of PSU. 9V is drawn from batteries, a DC converter converts 9V to 5V. So basically PSU supplies both 5V and 9V power voltage.

Upper right shows how OLED connects to 5V power. SDA and SCL are I2C wires that are connected to corresponding pins on Nano. D4 switches OLED on/off.

Lower right shows how the SG90 servo works, practically the same as OLED except being controlled by PWM.

Lower left shows how Nano is powered and connected. 9V power goes in Vin pin, which I assume could properly push logic pins like SDA, SCL, PWM, D4 and D5 to 5V level.

All 4 sub-circuits (if that's a thing) connect to the same ground.

Connect the PSU directly to Vcc, not to the on-board voltage regulator.

For some minutes.

I'd use 3 ordinary batteries for something around 4.5V. Eventually a second stack of 4 batteries for the servo motor.

1 Like

it means that you connected it incorrectly.
Are you connect the DC to the Nano Vin pin? - it is wrong

yes, to the Vin pin.
But you wil not able to power servo from the nano, powered by 9v battery

1 Like

Thanks for the reply.

Yes I did connect Nano's Vin to 5.0V (4.7V), may I ask how is this wrong, while

connecting a 9V battery to Vin is correct?

I was thinking if I could connect servo's Vcc to 5V power, and control it via PWM generated by Nano, who should give a 5V logic high when properly powered by 9V. Given that 5V power is converted from 9V, and both 9V and 5V power share the same GND. Would this mess up logic level?

The minimum voltage, that can be supplied to Nano Vin pin, is a 7v.

No. When you power the Nano from the Vin pin, the input voltage converted to the 5v level by onboard voltage converter. This converter can pass throw only small current, which can be used for supplying the arduino board, but not a powerful modules, such as servos or motors.
Your servo will need an external power anyway. Arduino VCC pin is not a power supply.

1 Like

And this is why a circuit diagram works out beautifully, no guess work resulting in bad advice due to poor information.

Could you do us all a favor and make one? It doesn't have to be something fancy, it can be drawn by hand or if you use a program even better for clarity.

I'm getting worse at grammar... edit done.

2 Likes

Thanks for the reply.

By Vcc, are you referring to the 5V pin between A7 and RST as shown in this picture?

So the 5V pin powers the microcontroller directly without regulating anything while Vin pin regulates input voltage to a lower value before powering the microcontroller. Is my understanding correct?

Could it really be that bad though. For most of the time, OLED and servo are completely disconnected from power source since transistor switches are in cut-off region. All the PSU is powering is a Nano in sleep mode.

yes

Just test it itself. Standard 9v battery (smoke detector batt) has a very low nominal output current . If you exceeded it, the charge runs out very quickly

1 Like

Ain't that the truth. Please check out my updates on the original post. Thanks

1 Like

And thank you for being respectful. Btw, I thought that with your nick you'd be familiar with schematics and diagram :upside_down_face: (Might not be that way)

Info: If the servo and OLED will be used roughly at the same time, you could control them all together with one FET.

I'm going through a noob phase called 'throwing random fancy words together to look cool'

And no they are not. So 2 separate transistors are necessary.

What have you done about the power indicator LED on the Nano? It doesn't go dark when the Nano is sleeping, so will continue to draw current.

Can you give us an idea about how many times a day the button is pushed to activate the Nano, and how many seconds it stays on?

If power is really critical, one alternative would be to make the button power up the entire circuit, and then after processing, the Nano would power everything down. You would need a P-channel mosfet and an NPN transistor to make that work. But if the circuit is drawing very little current during sleep, switching the power off probably wouldn't be that much benefit. You need to find the circuit's total current during sleep, then calculate how much battery life that gives you.

Edit: What is the state of the SDA, SCL and PWM pins when the two power-switching transistors are off? They can be INPUT, INPUT_PULLUP, or OUTPUT- HIGH, but not OUTPUT- LOW.

Soft power latch - good idea.

You could try adding the recommended pull-up resistors to both SDA and SCL lines https://learn.adafruit.com/working-with-i2c-devices/pull-up-resistors

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.