DJI Mavic Air battery recovery (Clear PF) using Arduino

Learn how to revive a dead or hibernating Mavic air battery using Arduino by clearing the PF flags.

Hey, are you the owner of Mavic Air Drone, and facing issues like the battery LED lights not glowing, battery not charging, battery not working, battery hibernating or battery voltage fluctuations locked the BMS? Here are the steps to rescue it and make it work again.

In this Tutorial, lets learn how the DJI Mavic air intelligent battery works, its BMS chip and its pinout, battery connections and finally how to remove the PF flag and recovering the battery.

Mavic air battery is also called as an intelligent battery as it has a Battery Management System which monitors everything like cell voltages, temperature, battery health and send it to the drone to display them on the remote controller. Not only monitoring but it also performs safety features like charging the Li-Po cells in limits accordingly, and discharging them automatically when not used for long time to increase the life of them. It also monitors the voltage fluctuations if a battery is malfunctioning and creates power failure Flags which makes battery hibernate and not responsive.

Even when you store the battery for more than 3 months without using in between they switch to hibernation mode. This mode makes the battery unresponsive to push buttons and they wont even charge.

Mavic Air Battery Specifications

  • Nominal Voltage: 11.55 V,
  • Max Charge voltage: 13.2 V,
  • Rated Capacity: 2375 mAh, 27.43Wh
  • Battery Type: Li-Po 3S(3 cells in series)
  • BMS Board: BQ9003

Mavic Air Battery BMS Circuit and Pinout

dji mavic air battery bms circuit board

As you can see from the above image the outer cover of the battery is removed so that the BMS Chip is visible. Its BMS has a lock sensor which checks weither battery is fixed inside the drone or not. It also has a temperature sensor attached between batteries to monitor the heat from the batteries while charging and discharging. This BMS has 10 pins.

Mavic Air Battery Pinout diagram

dji mavic air battery pinout diagram SDA and SCL pins

From the about pin diagram you can see there are 10 pins numbered from right to left. The first 4 right pins are for Ground( GND) and the pins 7,8,9,10 are positive terminals. The between pins 5 and 6 are SDA and SCL respectively. There are the Data pins which can communicate through SMBus and I2C communication protocols.

Also read : best IoT Projects

Required Components:

Product NameQuantityamazon logoamazon logo india
Arduino NANO1https://amzn.to/3jVNZONhttps://amzn.to/3KpUQry
Few Connecting Wireshttps://amzn.to/3H2BV4ehttps://amzn.to/3J0WVu2
You can buy the required components from the given best buy links. We choose the components according to value for money.

Connecting with Arduino

Now lets connect the battery to Arduino with the help of below circuit diagram.

connecting mavic air battery with arduino

Here we are using Arduino NANO board, you can even use Arduino UNO as well the pins are same and very simple. Just take 3 jumper wires and connect them. So in this case the A4 from Arduino which is SDA is connected to Pin 5 of battery and A5 from Arduino which is SCL is connected to Pin 6. And finally the GND pin from Arduino is connected to any of the 1,2,3,4 pins.

Arduino Code:

After connecting, its time to upload the code for that you need Arduino IDE.

  • Download Arduino IDE: here
Due to some reasons we are not able to share the code here. If you need the code please comment below with the reason why your battery is locked or not responding along with your email. we will reply with code.
  • Download exclusive Code : here.
  • Password for Zip file: circuitschools

After downloading the code Download Xloader: here

Next upload the code to Arduino board using it. Choose the port and Baud rate to 115200.

dji mavic air xloader file upload

After uploading the code open serial monitor in Arduino IDE at a baud rate of 115200. There you see the output as below screenshot.

DJI Mavic air unseal and clear pf on arduino serial monitor

This is an automatic process connect the battery, upload the code, open the serial monitor with baud rate 115200 and with in 5 seconds your battery will glow.

Charge the battery and it will be ready to use. Fly with caution for first use.

Errors and Troubleshooting:

  • Battery not connected ……

If you see this error check the wiring between Arduino and Battery. If still error there might be very low voltage in the 3 Li Po cells in it. To solve this you can charge the cells individually with very low current till they reach at least 3.9v and connect it with Arduino.

  • Battery Swollen

If the battery is swollen do not pierce or puncture to remove the air from it. If you do so the battery wont hold the voltage eventually making them to die permanently.

Video Tutorial:

DJI Mavic Air battery recovery using Arduino Cheap and Easy Method

If you like this project please subscribe to our YouTube Channel “Circuit Schools to encourage us to publish more interesting projects. If you have any doubts write to us from below comment section.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles


  1. hi can u help i need the code for DJI mavic mini BFS reader to clear PF flag due to long storage please
    i did send a message b4 but i gave wrong email .sorry

      1. Hi
        Can you share the source code?
        I would like to try to adapt it for my Mavic air battery.
        Thank you very much!

      2. Hello Sir, i have mavic pro bloated battery , can you pls help me how to replace or recell a new battery with ur arduino apps & tools.. thanks so much for ur noble advocacy in helping those who want a cheaper way of doing IoT.

  2. Hello,
    Excuse me for my approximate English because it is not my native language.
    I own a DJI Mavic Air 1 with two batteries. I haven’t used the device for several months and both batteries have gone into deep hibernation. I can’t reload them. The green LEDs do not light up when the button is pressed.
    I have an Arduino Nano, I read your very well done tutorial, I only need the code to upload to the Arduino.
    Would you be so kind as to send me this code.
    Thanks a lot

      1. Hi Thanks for the information.
        I have a Mavic air I bought second hand with 3 batteries. One works the others are dead lights will not show.
        Batteries are not swollen.
        I would like to try your fix please send me the code.
        Thanks for the information.

  3. Hi, friend. Very good the article. I’ve heard about some guys using a USB/SCI adapter to do the same, but as I already have Arduinos here, it willl be very useful and educative to try. Can you share the code? Thanks!

    1. Went to charge my mavic battery’s after sitting on the shelf for 6 months, hoping this code will recover them before I need to order a cp2112

  4. Hi all,
    i have forgotten to load my my mavic air battery. After 3 month i can’t load them again.
    Please send me the arduino code to bring them back to live. Thank you

  5. Can you make a tutorial on how to replace the cells of Mavic air with Li-Ion batteries. my original batteries are swollen and dead.

    1. It is generally not recommended to replace the battery of a DJI Mavic Air with individual lithium-ion cells. The Mavic Air’s battery is a complex and carefully designed system that includes multiple cells, a built-in battery management system (BMS), and other components that are designed to work together to provide power to the drone and ensure safe operation. Modifying the battery in any way can pose a serious risk of injury or damage to the drone, and may also void the manufacturer’s warranty.

      If you are experiencing issues with the battery on your Mavic Air, we recommend contacting DJI or an authorized DJI repair center for assistance. They will be able to diagnose any problems with the battery and provide recommendations for repair or replacement if necessary.

      But if your country doesn’t has any DJI services you can go for it.

  6. I have 3 DJI mavic air batteries from flymore combo and are not charging, they were unused for 5 months may be thats the reason please help me in turning them on. Also please send the code for arduino. Thanks in advance.

  7. Hi,
    I have a DJI Mavic Air with 3 batteries mod. PBI2375mAh 11,55V. I haven’t used the drone for 2 years and the batteries allready doesn’t work. I can’t charge them, if I press the button, the green LEDs do not light up.
    I need the Arduino code to reset them, can you send me?
    Many thanks, Fabio.

  8. I am in the same boat at Suraj – they were unused for an extended period of time – please help me in turning them on. Also please send the code for arduino. Thanks in advance. happy new year!

  9. Hello sire.
    I have two sleeping batteries not used for allmost one year. Now both are totally non responsive. Can you help please with the arduino code needed to try to activate them again?
    Thank you very much!

  10. I need the code to unlock my Mavic Air Battery. No swelling.

    Also, the link for the Arduino NANO you list above must have changed. https://amzn.to/3pxTUcK goes to a different product.
    Arduino NANO in Amazon brings up the same item photo.

  11. Hello,
    How long should it take? 5 sec? it is stuck there:

    ***Visit circuitschools.com for Circuit diagram and tutorial***
    ***This program will unseal and clearPF automatically for DJI MAVIC AIR***
    ***If this program helped you please comment on our page***
    Unseal/FAS …

    1. It means BMS is not connected to the Arduino NANO.
      Reasons: 1.Connection problem, or 2. the voltages in the internal cells are very low.
      Solutions:1.Check the wiring, 2.Charge the individual cells upto nearly 3.8v with external lipo chargers with very slow speeds.

      1. First of all thank you for your precious guide.
        My uncle gave me his Mavic Air drone that he hasn’t used in the last 2 years and all 3 batteries are gone.
        I’m trying to solve with your solution, but I’m stucked on “Unseal/FAS…”.
        Checked the wiring; I’m not sure to understand what do you mean with “Charge the individual cells…”, does it mean to try to charge for some hours the batteries with their recharger or that means something else ?
        Again, thank you so much !

  12. How long it is suppose to take? it is stuck at unseal/FAS… for ever
    is there a way to get info from the battery?

  13. Will this code work on spark batterys? i love this code couse i used it several times on my mavic air battery but i want to know if it also works on the spark drones, thanks in advance.

  14. Hello,
    sur mes 3 batteries du Mavic Air Combo, il y en a qu’ une que je ne peux la charger.
    Veuillez m’envoyer le code Arduino pour remettre cette batterie en service.

  15. I bought a mavic air from somebody that has no knowledge of lipo batteries like me turns out it’s useless and I can’t really afford a new battery I have looked all over and this seems like the way to do it

  16. Hello,
    I own a DJI Mavic Air 1 which I haven’t used for quite awhile and i was thinking of trying out what you mentioned in your article above.
    Would it be possible for you to send me the arduino source code please?
    Thanks a lot

  17. Hello,

    I have a mavic air that has not been used in a long while and my batteries appear to be locked. I will very much like to try to see if your solution works, and i hope i can get the arduino source code from you.

    Thank you.

  18. Goodnight
    I have a mavic air, I haven’t used it in 6 months and the batteries won’t start.
    Could you give me the codes?
    I thank

  19. Thanks a lot for putting this guide together. Regardless of whether I am going to be able to revive my batteries, I learned a lot!

    As others have mentioned here above, I am stuck too at Unseal/FAS… If the batteries are not turning on whatsoever, you still suggest to have these charged using the Mavic charger (not multi-charger I guess), for as long as possible, correct?

      1. Hello,
        sorry for my rough english as it is not my native language.
        I have a DJI FPV with 1 battery that has gone into deep sleep. I haven’t used the device in months and the battery has gone into deep hibernation. I can’t reload it. When the button is pressed, the white LEDs do not light up.
        I have an Arduino Nano, I read your very well done tutorial, I just need the code to upload to the Arduino. Will it work with DJI FPV?
        Could you please send me this code.
        Thank you very much

  20. Hello friend i tried to load your program using xloader, but xloader is stuck and not able to load the program. So can u share the code. I have laptop batteries, also i tried with fx2lp and some other arduino codes but not able to reset PF. I installed new batteries but need to reset PF. So if you allow me i can try with my laptop battery. Thank you

  21. hello sir

    i have left a few comments but they never stay long

    i final mange to sort out my battery.. i had to open it and charge the battery as it was 2v total got it 11.6v then did the unseal.. everything is working great now charge up .. just need to make the case look nice again as i dont have nice tools to open the case with.

  22. Hi sir
    I have 2 mavic air batteries . Not puffed . I have charged the batteries with lipo charger . Now need to clear pf
    Please share the code .

  23. does this work for the spark batteries as well? I tried it, with the mentioned settings above, however, I get the message from xloader: can’t open port. I tried it with a arduino nano and uno.

    1. It means that arduino is not connected to your pc. Check in the pc device manager for the ports weither it is connected or not. And this code is not tested with spark batteries, so we are not sure that it works with spark batteries.

      1. Yes, it worked a treat with my Sparkies. I have just successfully used it to do two dead ones. Pinout with batteries facing lights/button up and connector towards you is 1-SCL, 2-GND, 3, 4, 5, 6-SDA

  24. Hi, My DJI Mavic Air battery is not working and I am unable to charge it. Please help to share the source code.
    I would like to try to make it works again.
    Many thanks for your help in advance.

  25. Hello,
    Hope you’re doing well.
    I own a DJI Mavic Air 1 with two batteries. I haven’t used the device for several months and both batteries have gone into deep hibernation. I can’t reload them. The green LEDs do not light up when the button is pressed. Need guidance and code.


  26. At first i thought it’s some kind of a hoax. There was no reaction in the terminal after connecting the battery. The problem was lov voltage on the cells. After charging it worked just like in the above tutorial. Thank you for your work, i don’t currentylky own cp2112 interface but there’s always some arduino laying around.

  27. Brilliant guide thankyou so much. My 3 batteries were all dead. I tried your code and was stuck on the “unseal FAS” step. I was able to charge each of the cells with a TP4056. For a while I was still stuck here – with charged cells still stuck at the unseal stage. To fix this, I plugged the battery back into the standard charger for a couple of minutes. Then, running the arduino code again worked perfectly!!! 🙂
    Now I have 3 fixed batteries, and ready to fly again…. thanks again.

  28. Hi,

    Thankyou for this information and code.

    Will it work on any of the Ronin M/MX batteries?


  29. hi. i buy phantom4 pro. i haven’t used about one year. i need to remove pf error. Many thanks for your help in advance.
    best regard

  30. I dusted off my old mavic air to fly with my son just to find that the batteries are stone cold dead. Help please 🙂

  31. Hi, this procedure works with mavic pro battery? do you have codes for mavic pro batteries? Many thanks in advance.

  32. Hey can you make your code working with other arduinos, or send the code?
    Does data line work only with 3,3v or with 5v as well?
    I have arduino uno laying around, that I’d like to use.

  33. Hello, Thanks for the work.
    I am stuck with Phantom 4, DJI Spark and Dji Agras BAtteries that are under over storage issue.
    Kindly can we cooperate? I am Okay with some coffee..
    Regards ,Yiga .

  34. can you share the code, Xloader is having hard time with my different arduino board and cant proceed with mavic air 1 battery reset

  35. Dear Sir …… I have a battery ( mavic air) not accept charging and not output , so If you help I need the arduino code , thank you for your help , my mail ……….. akabood46@gmail.com ( I am from Irag ) ….thank more my name Kadhim aziz.

  36. You blokes are geniuses. I’ve just managed to unlock my 2 dead DJI Spark batteries (drone had been left unused for two years) using the method described on this page (the video wasn’t as much help as your written words) despite never having previously touched an Arduino or anything like it in my life. I spent yesterday charging up the cells (to about 11.2v total) by opening the battery housings hoping it may help get the batteries going but they still would not respond to my DJI charger even when left on it overnight. Today I went to Jaycar (an Aussie electronics shop) and bought the Arduino Nano, then began a sudden and intensive learning experience that included learning how to make my USB port act as COM4, how to download zipped files and unzip them and then how to use Xloader to upload the hex code to the nano. There were lots of little hiccups along the way to resolve by trial and error including when I got stuck at the final hurdle because I didn’t realise that leaving Xloader open on my screen after the upload was preventing the Arduino IDE’s Serial Monitor from getting the battery to respond to the unseal instructions so I was missing that final “Done Unsealing Writing Done” result. After clearing that hurdle it went perfectly and now my two batteries are alive and I can finally fly the drone. Thank you.

  37. I stopped using my drone for 1 month and when I wanted to use it the battery was blocked, the model is a mavic 2 zoom

  38. My DJI Mavic Air batteries have not been used over a year and won’t charge. I tried everything else with no luck.

    Can I kindly request the code please

  39. Hi, I have a issue when I tried to unseal the battery it stated No FAS can I know what is this error thanks.

  40. helo sir, i have a 3 mavic air 1 battery that sit a long time a go, i hope you will help me, for the code, thank you in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button