Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

Type C Battery Charger
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Type C Battery Charger

by zap86000 on Fri Jan 21, 2022 12:49 pm

Hi. How do I find out what percent the battery is at when I'm using the 5V (and other required) pins? I'm using this charger: https://www.adafruit.com/product/4410.

zap86000
 
Posts: 4
Joined: Tue Jan 18, 2022 2:01 pm

Re: Type C Battery Charger

by dastels on Fri Jan 21, 2022 1:36 pm

Depending on your situation, this https://www.adafruit.com/product/4712 works well. You would need an MCU board with I2C as well as some output mechanism.

Dave

dastels
 
Posts: 9742
Joined: Tue Oct 20, 2015 3:22 pm

Re: Type C Battery Charger

by zap86000 on Fri Jan 21, 2022 2:36 pm

Hi. So this could work, but I will need an Arduino. My Raspberry Pi 4 is the motherboard for my project, which is a laptop. I have a PiRTC Clock which already uses GPIO pins 2 & 3. But I have a new question. First, can I power multiple devices with it? I have an idea to have the Arduino send the percent to the Pi using a GPIO pin. It will probably use multiple pins (so that the Pi can say it's ready, etc.).

zap86000
 
Posts: 4
Joined: Tue Jan 18, 2022 2:01 pm

Re: Type C Battery Charger

by dastels on Fri Jan 21, 2022 3:39 pm

You can hook the battery meter to your Pi. Multiple devices can connect to an I2C bus. That's one of the features of it. As long as they have different addresses. You can power multiple devices, as long as the battery can supply enough current.

Dave

dastels
 
Posts: 9742
Joined: Tue Oct 20, 2015 3:22 pm

Re: Type C Battery Charger

by zap86000 on Fri Jan 21, 2022 4:20 pm

Hi. The battery I'm using can supply 3.3A (https://www.adafruit.com/product/353). So, four questions. First, how do I connect multiple devices to pins 2&3? Second, how to I set them to different addresses? Third, (pretend I'm using the same colored wires from the product page image connected to the screen) where would each wire go? Fourth, when reading and writing from and to the pins, would I read from them by using them as normal GPIO pins or by using them as the I2C bus? That may confuse you, but I'm using Windows on my Raspberry Pi 4 (you can check the community out at https://worproject.ml/) so I have to use the Microsoft code for Windows 10 IoT Core (the link is https://docs.microsoft.com/en-us/windows/iot-core/learn-about-hardware/pinmappings/pinmappingsrpi and even though it says it is for the Raspberry Pi 2 & 3, it'll still work), so I need to know how I will need to write the code in the drivers I will make.

zap86000
 
Posts: 4
Joined: Tue Jan 18, 2022 2:01 pm

Re: Type C Battery Charger

by dastels on Fri Jan 21, 2022 4:55 pm

FYI, there's a relatively new ~10000 mAh version of that battery that's the same physical size should you need it.

As for I2C. You mean pins 3 & 5, right? https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

Everything just gets connected together: 5v pins on the Pi and each I2C device connects together, ground pins connect together, SDA pins connect together, and SCL pins connect together.

Each device will have a specific address. It's part of the hardware. There are some devices that let you program their address, but they aren't common. Some devices support a small range (2, 3, 8, etc) of addresses. Those you can wire to set which of the supported addresses it will use.

That battery gauge is only at address 0x0B. The piRTC appears to only be at 0x68. So neither supports having their address adjusted. But that's fine in this case since they use difference addresses.

You would need to use them as I2C devices. The windows IoT core should have support for working with I2C devices. For reference you can look at the Adafruit drivers/libraries for those devices. it's all on GitHub. It doesn't matter what the host hardware or OS is; the I2C interaction will be the same.

Dave

dastels
 
Posts: 9742
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.