Type C Battery Charger

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
zap86000
 
Posts: 4
Joined: Tue Jan 18, 2022 2:01 pm

Type C Battery Charger

Post by zap86000 »

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.

User avatar
dastels
 
Posts: 15659
Joined: Tue Oct 20, 2015 3:22 pm

Re: Type C Battery Charger

Post by dastels »

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

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

Re: Type C Battery Charger

Post by zap86000 »

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.).

User avatar
dastels
 
Posts: 15659
Joined: Tue Oct 20, 2015 3:22 pm

Re: Type C Battery Charger

Post by dastels »

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

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

Re: Type C Battery Charger

Post by zap86000 »

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/window ... appingsrpi 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.

User avatar
dastels
 
Posts: 15659
Joined: Tue Oct 20, 2015 3:22 pm

Re: Type C Battery Charger

Post by dastels »

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/ ... -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

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”