I am trying to design a custom atmega328p board directly powered with a li-ion battery, so around 4.2v most of the time and the goal Is to reduce current consumption as much as possible.
I want to connect a temp sensor that runs at max 3.6v. I was planning to use pull up resistors for SCL and SDA connected to a 3.3v ldo. Since the voltage difference isn't that big, the chip should be able to read the voltage highs correctly (0.7x 4.2v = 2.94v). I have read that I have to disable internal pullup resistors in order to avoid too high currents.
The sensor's application circuit is like so with 10k pull up resistors across SCL and SDA:
And here's my schematics
Would this work ? Will I get 3.3v on the I2C pins and not 4.2v ?
If so, isn't 10 k too high for my use ? I have seen people suggesting 3k3 or 4k7 pull up resistors for 3.3v and I'm not sure what to pick. Maybe I have to add 3k3 resistors close to the SCL and SDA pins of the atmega in addition to the 10k resistors of the sensor ?
You are definitely right, I had never considered powering both the atmega and the sensor through the ldo. The wireless module is a Sim7080g that apparently uses a 1.8V UART interface and they explain in detail in the hardware design how to use a level shifter circuit for 3.3v to 1.8v so I guess my problem isnt a problem anymore.
That said, I don't quite understand why I need the two 10k I2C pull up resistors in the sensor's reference design if the atmega has inbuilt pull up resistors. Aren't they redundant ?
I suspect the SIM700x is going to draw quite a bit of current in bursts… you REALLY need to plan your power and interface circuits properly, or you’ll have all sorts of issues.
I think you will find that the Atmega will draw less current from the battery if you run it at 3.3V. So if you can communicate ok with the wireless module when it is powered directly from the battery, then powering both the sensor and the Atmega through the LDO is probably the optimal solution.
My memory is that Wire.begin turns on the pullup resistors on SDA and SCL. You may be able to run ok with just those enabled, but they are 40K or something like that, so it may be better to have external resistors. You'll see 4.7K in circuits, but I would certainly try 10K to see if that works.
I now remember why I never thought about powering the atmega through the ldo.
It's because I use the internal 1.1v voltage reference to keep watch on my battery voltage.
What can I do to continue monitoring battery voltage before LDO with minimal power consumption ? (few microamps at max)
You would use a resistive divider to bring the maximum battery voltage down to under 3.3V. But to keep power consumption to a minimum, you would switch the divider on only when you need to read the battery. Below is my favorite way of doing that.
It requires an extra GPIO pin to do the switching, and you would have to experiment to find the capacitor value that keeps the mosfet turned on long enough. I think this works with something like a TP2104, or really any cheap P-channel that can be switched with 3.3V. RDSon doesn't matter. The top pullup resistor would be high value - 100K or maybe higher. The capacitor protects D4 from excess voltage.
Not sure about the capacitor and resistor values but the voltage divider should drop the battery voltage from 4.2 to 3v max
EDIT : I just saw this :
I think the drain and source are reversed.
Is this new schematics better with the source at the top and the drain at the bottom ?