• Thanks for the circuits @allObjects - I think that's another one to go on the forum links page.

    edit: I take it back about the MOSFET - that's an extremely elegant solution!

    The ADC actually functions way better with a low input impedance, so if you add a capacitor between the GPIO and GND it'll protect the IO and increase accuracy.

    In fact, if you're feeling really lazy you could just use some high values like 2 x 560kOhm resistors and then a reasonably sized capacitor. While there's power draw it'll be in the 4uA kind of territory, which in this case is probably ok. It won't be super accurate but then the battery voltage fluctuates with temperature anyway so it'll be good enough.

    Having said all that it looks like the BG96 may itself have a battery level monitor. I think if you send the AT command AT+CBC it'll give you a battery charge value.

  • Having said all that it looks like the BG96 may itself have a battery level monitor. I think if you send the AT command AT+CBC it'll give you a battery charge value.
    @Gordon I have tried to use the command this way:

    var at = require("AT").connect(Serial3);  
    at.debug();
    
    at.cmd("AT+CBC\r\n", 1000, function(d) {
      if (d===undefined) ; 
      console.log("DATA"+d);
    });
    

    Unfortunately it only returns undefined. Should I use another module or what might cause this error?

About

Avatar for MobiTech @MobiTech started