Python file gets corrupted during AC fluctuations

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
shivams
Posts: 2
Joined: Sun Dec 06, 2020 9:14 am

Python file gets corrupted during AC fluctuations

Post by shivams » Sun Dec 06, 2020 9:35 am

I have installed a few ESP32s for a test project. Some of them are powered using an AC-DC adapter (with 5V DC output). Rest are powered using direct DC from batteries. The ones powered by the AC-DC adapter have had a high failure rate. They often get corrupted: some of the Python files are not readable, while the firmware itself is intact. Re-uploading the Python files make them work again. I am hypothesizing that this problem is caused by the AC fluctuations. However, since the firmware survives and only the Python files are corrupted, then MicroPython also may have shortcomings. I'm not sure. I live in a region in India where AC fluctuations are common. Has anyone witnessed the same?

And yes, I am planning to upgrade my power supplied to something which gives a more refined DC supply. However, I wish to know if something can be done at the MicroPython end to make it more resilient.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Python file gets corrupted during AC fluctuations

Post by pythoncoder » Sun Dec 06, 2020 12:08 pm

The only solutions to electrical problems are electrical. Many USB adaptors are fit only for charging phones rather than for supplying continuous power. But even the best adaptor will fail if the AC voltage drops too far. In that case you need to look at some form of battery backup. Some ESP32 boards have support for LiPo battery power, otherwise you'll have to engineer your own solution.
Peter Hinch
Index to my micropython libraries.

shaoziyang
Posts: 363
Joined: Sun Apr 17, 2016 1:55 pm

Re: Python file gets corrupted during AC fluctuations

Post by shaoziyang » Sun Dec 06, 2020 2:38 pm

If the system is reset when writing a file, the file system will be damaged.

Post Reply