Powering the QT Py

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
DanKramer
 
Posts: 10
Joined: Sat Feb 04, 2017 12:13 am

Powering the QT Py

Post by DanKramer »

I know there's a dedicated backpack built for this (Product ID: 5397), but it's out of stock shortly after more are made, so I'm looking for alternatives.

I have the QT Py - SAMD21 (Product ID: 4600) that I need to run off a battery for a model kit. I chose this because it will both run the lights and it can do sound effects without an external board added. I want one or two sounds to play from buttons.

At the same time, I got one of the LiIon/LiPoly Backpack Add-On for Pro Trinket/ItsyBitsy (Product ID: 2124). I'm hoping that the output of this board is compatible. It won't be the neat little flush mount, but I'm fine with that. I also need the option of an external power switch as the boards will be inside the model housing.
Has anyone else tried this before? the part that makes me pause is that the QT Py has one 5v pin for both input and output. It seems unsafe to have that one pin both charging the battery and taking power from it. The QT Py backpack is made for this, but the trinket one has two pins. Does it just need a diode to prevent charge from going up the battery out pin? What about another diode going the other way on the other pin?
Is there another way to rig this to work? I couldn't find a circuit diagram of the QT Py backpack to see if I could figure out a method that way.

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

Re: Powering the QT Py

Post by dastels »

You seem to be right on all counts. A diode from the Vbat output of the backpack to the 5v pin of the QtPy (as well as the 5v pin powering the backpack for charging). If there was a schematic available for the BFF (I'm surprised there isn't) it would be easier to figure out. Other than that output diode the two boards should be pretty much identical. But there is, as you point out, the issue of the battery powering the charger due to input & output being the same connection.

Dave

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Powering the QT Py

Post by adafruit2 »

guide will be up soon but there's a big diode on the BFF to protect the battery so that 5V can be used for both input and output. its worked pretty well in our testing!

User avatar
DanKramer
 
Posts: 10
Joined: Sat Feb 04, 2017 12:13 am

Re: Powering the QT Py

Post by DanKramer »

Thanks folks! That gives me the confidence that I can start breadboarding this without worrying about blowing out my boards. They're not expensive, but I still don't want to waste them.

User avatar
lambtor
 
Posts: 21
Joined: Tue Apr 10, 2018 10:09 am

Re: Powering the QT Py

Post by lambtor »

looking forward to the bff documentation, so i can figure out what pins are unavailable as gpio when one is connected.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Powering the QT Py

Post by adafruit2 »

just A2 (but you can cut the jumper for battery monitoring)

User avatar
armatronix
 
Posts: 6
Joined: Mon Mar 12, 2012 9:29 pm

Re: Powering the QT Py

Post by armatronix »

Hi, should I be able to monitor battery level using A2, as well as determine the plugged in/not plugged in state of the USB-C? Or do I need to use a fuel gauge to do that?

Thx

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Powering the QT Py

Post by adafruit2 »

yep! if its over 4V its probably on USB power

User avatar
armatronix
 
Posts: 6
Joined: Mon Mar 12, 2012 9:29 pm

Re: Powering the QT Py

Post by armatronix »

Ah ok thank you, I got it - the voltage divider on A2 devides the battery voltage in half, so that it can then be compared to 3.3V.

so, for posterity:

battV = 2 * 3.3 * analogRead(A2) / 4095.;

User avatar
armatronix
 
Posts: 6
Joined: Mon Mar 12, 2012 9:29 pm

Re: Powering the QT Py

Post by armatronix »

* I noted that as the battery falls lower than ~3.4V as measured by a meter, the analog reference voltage presumably starts to decrease, and the reading above never goes below 3.33V until battery approaches 3.0V and either its protection circuitry shuts the battery off, or the circuit browns out.

So there's some portion of the lower end of the battery's usable voltage range that can't be measured directly using the above.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Powering the QT Py

Post by adafruit2 »

yep its very rough - a fuel gauge will be able to measure more and better
https://www.adafruit.com/product/4712
but is bigger!

User avatar
armatronix
 
Posts: 6
Joined: Mon Mar 12, 2012 9:29 pm

Re: Powering the QT Py

Post by armatronix »

Yes the reading seems to float around a lot, I had to average many many samples to get a steady value.

The Fuel Gauge also gives the advantage of seeing the battery level as it's charging, although the indicator LED on the BFF turns off when it's done charging so I think this isn't a bad solution. I'll call anything under 3.4V "reserve" battery.

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

Return to “Microcontrollers”