Correct output doesn't go HIGH when using Arduino to test/detect battery voltage

I'm using an Arduino UNO to load sketches to my Arduino Pro Mini using the Arduino as ISP process. My setup consists of a 3.7 LiPo battery that is hooked to a 5V power booster (Adafruit MiniBoost 5V @ 1A - TPS61023) that powers my Mini and an RFID reader module. The Mini is supposed to read the raw voltage of my battery and tell me when it is below 20% by turning the external LED red (pin 4 output) rather than green (pin 3 output).

Please see the attached JPG for the schematic of my setup.

I first loaded the sketch to my Mini using the regular "Upload" option (with the bootloader on the Mini), and an FTDI serial to USB cord (which provides power through the VCC and I connect a 3.7V battery to GND and A0). The green LED turns on when the battery is above my 20% threshold and changes red when I give it a voltage less than the 20% threshold. HOWEVER, it doesn't work when hooked up to ONLY the battery setup (5V to VCC from power booster and 3.7V+ from battery to A0 with shared GND). It did the same thing when I load the sketch using the ISP process (UNO with the "Upload Using Programmer"), the red LED is the only one that turns on.

Full sketch attached below.

I tried a simple test sketch to make sure my output pins and LEDs were working correctly and loaded it using the ISP process and the test flashes for each LED work (showing that the BUILT-IN, external red, and external green all work). Once the program gets into the logic part of evaluating the voltage and displaying the corresponding LED, I only get the red LED to light up. I've also connected the FTDI serial USB cord to my Mini to monitor the voltage values and if my "if" statement was working correctly as well, and everything seemed to work okay.

Test sketch attached below.

The only thing I can think of is that it's something to do with the power coming into the Mini. Like I said, it works well when plugged into the FTDI cable (which provides power through the VCC and I connect a 3.7V battery to GND and A0), but doesn't work when hooked up to ONLY the battery setup (5V to VCC from power booster and 3.7V+ from battery to A0 with shared GND). I tried to eliminate the variable that it's something to do with the bootloader vs no bootloader thing.

Am I doing something wrong with how I am utilizing the inputs and outputs?

Arduino_2nd_Serial_w_BAT-Check.ino (4.02 KB)

BAT_Check.ino (1.85 KB)

More information would be helpful. Are all the grounds connected together. Your schematic is missing the power supply section which I believe is your problem area.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.