[SOLVED] SD card file has no data unless Nano powered from USB

Hi,
I have a strange problem which does not seem quite the same as previous posts. I would appreciate any pointers.

Situation: Nano-clone with CH340 USB driver, Deek-Robot combined DS1307 RTC and microSD shield (ID8122), running a datalogger sketch. I have not been able to find any documentation for Deek-Robot shield, but refer to https://forum.arduino.cc/index.php?topic=446133.msg3069884#msg3069884

My sketch runs fine while Nano is connected to PC, and also if I supply external 5V via USB connector. But when I power with 9V at Vin, the SD card creates the data file, but fails to write any data into it.

I tested my sketch on an Uno r3 with an adafruit-clone RTC/SD shield - all fine.
I have also connected the Deek-Robot RTC/SD to the Uno and it also works fine with either PC power or 9V at Vin. It is only when I use the Nano with 9v to Vin there is a problem.

The external power supply I am using is a 12V 7Ah sealed lead acid battery - 12.5V via a 120ohm dropping resistor to Vin. My Vin supply is "stronger" than either USB source.

Other posts have suggested the tiny 662K 3V3 regulator on the Deek-Robot shield is not adequately rated at 200mA, but it seems enough to establish the file, and to write data under some power supply configurations. The alternative 3V3 supply from the Nano's CH340 chip has only 25mA rating.

According to the Nano schematic, the 5V power to the board is sourced either from Vin via 5V regulator or from 5V pin of USB socket via a Schottky diode (Vfwd = 0.2V). Thus actual supply voltage to nano powered from USB is 4.8V. It seems strange to me that the problem arises with the slightly higher supply voltage. 3V3 supply on SDcard measures on spec for all power sources

Can anyone suggest a solution?

I can of course work-around with an external 5V regulator on my battery and feed power via USB.

Post-script:
Further tests with variable PSU showed that Vin must exceed 10V for correct operation. Appears Nano on-board 5V regulator may be under-rated. I simply removed 100ohn dropping resistor and supply 12+ V from battery direct to Vin.

If I understand correctly, the only case when it doesn't work is when the 5V regulator of the Nano is providing power. The 5V regulator of the Uno works, but not the Nano regulator. Is that right?

If so, I think the answer may be that the regulator on the Nano cannot deliver enough current to supply not only the Nano's needs but also the SD shield when it is writing data to the card, which is when it is drawing the most current.

I guess it could also be that the dropping resistor from your 12V battery is too high a value, in which case you would see the voltage at Vin drop below about 7V when you're writing to the card. Or it could be that it's not high enough, and the voltage drop across the Nano's regulator is so high that it's overheating at high current. Or, as I said before, it just may not be able to deliver the current you need under any conditions.

If you have an analog multimeter or a scope, you should be able to see what happens to the voltage on the Vin and 5V pins as you write to the card. A digital meter might work, but it would have to update pretty fast to tell you anything useful. A scope would be best.

I agree with Sherman. The Nano can't provide enough current. A quick check on the googler says that the Nano can do 50mA max and the SD card can take most of that during write cycles. The Nano isn't mean to function like that. The Uno can do it, though. Or use an external regulator.

Thank you ShermanP and MK1888.

I did some further tests and reached the same conclusion. See post-script to original post (I am still working out how to do these posts!).

I get some success by removing 100ohm resistor and feeding Vin with >12V.

I think the real solution is an external 5V regulator fed directly to +5 Vcc pin of Nano.

The external regulator needs to feed the Nano and the SD module. It's the module that is causing your power problems, not the Nano. Also, be careful that some SD modules don't have on-board 5V -> 3.3V level shifting.