Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Teensy 4.0 & battery

  1. #1
    Member
    Join Date
    Nov 2020
    Location
    Czech Republic
    Posts
    59

    Teensy 4.0 & battery

    Hi all,
    I have Teensy 4.0 and LiPol battery 5000mAh, 3,7V and battery charger TP4056. I want use only Teensy USB connector to programm and charge battery.
    How to do it in correct way?
    Options:
    Operation on battery = battery connected to 3V3 and GND?
    Operation on USB cable and charging battery = USB cable from PC to Teensy and then 5V and GND to battery charger?
    Is it OK or I am wrong?
    Thank you.
    Michal

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,108
    No, you don't want to connect the battery to 3.3v, since the usual lipo battery produces 3.7-4.2 volts, and putting anything over 3.3v on the 3.3v line will probably damage the Teensy.

    I haven't dealt with the TP4056 charger, but in general there are two different ways to set things up:

    1) Cut the trace between VUSB and VIN on the Teensy. This means that the USB cable does not power the Teensy. Then set up the charger so that the VUSB pin is connected to the power input for the charger. The output from the battery would then be connected to VIN on the Teensy. Connect ground between the Teensy and charger. Look at the back of the card that came with the Teensy 4.0 to see where the trace is (or see https://www.pjrc.com/teensy/pinout.html).

    2) Do not cut the trace. Connect VUSB to the charger power. Connect the charger battery output to the Teensy with a diode blocking the power coming from the battery if VUSB has power.

    Typically if you use #1, the Teensy will run on the voltage that your charger produces (typically 3.7-4.2 volts) when you connect the USB cable. If you use #2, you run on 5v if the USB cable is connected.

    I've typically used the following products to add charging:


    I've thought about using the Adafruit trinket backpack (https://www.adafruit.com/product/2124), but I don't recall actually using it.

    I've also thought of providing a 2 way switch. One switch connects VUSB to VIN. The other connects the battery output to VIN with VUSB connected to charge the battery.

  3. #3
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    313
    Quote Originally Posted by frohr View Post
    Hi all,
    I have Teensy 4.0 and LiPol battery 5000mAh, 3,7V and battery charger TP4056. I want use only Teensy USB connector to programm and charge battery.
    How to do it in correct way?
    Options:
    Operation on battery = battery connected to 3V3 and GND?
    Operation on USB cable and charging battery = USB cable from PC to Teensy and then 5V and GND to battery charger?
    Is it OK or I am wrong?
    Thank you.
    Michal
    Michal (frohr):

    <This> link & <this> associated link & <this> associated link may have information useful in your situation. If you have any questions on the specific approach that successfully I used, please feel free to ask.

    Mark J Culross
    KD5RXT

  4. #4
    Member
    Join Date
    Nov 2020
    Location
    Czech Republic
    Posts
    59
    Hi, this is ok or nonsense? Thanks.

    Click image for larger version. 

Name:	wiring.JPG 
Views:	175 
Size:	64.6 KB 
ID:	26355

  5. #5
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    313
    @Michal (frohr):

    I don't think shorting input & output on your TP4056 module would be a good idea. I would suggest connecting your cable to the input of the TP4056 module, connecting the output of the TP4056 module to the power & ground on the Teensy (as you show), & splitting your cable to allow routing the D+ & D- from the cable to the Teensy. This suggested setup would allow 1) running the Teensy from battery (with the cable *not* plugged in), 2) charging the battery & running the Teensy from battery/cable (with cable plugged into the TP4056 module), & 3) programming the Teensy (with the cable plugged into the TP4056 module).

    Good luck & have fun !!

    Mark J Culross
    KD5RXT

  6. #6
    Member
    Join Date
    Nov 2020
    Location
    Czech Republic
    Posts
    59
    Quote Originally Posted by kd5rxt-mark View Post
    @Michal (frohr):

    I don't think shorting input & output on your TP4056 module would be a good idea. I would suggest connecting your cable to the input of the TP4056 module, connecting the output of the TP4056 module to the power & ground on the Teensy (as you show), & splitting your cable to allow routing the D+ & D- from the cable to the Teensy. This suggested setup would allow 1) running the Teensy from battery (with the cable *not* plugged in), 2) charging the battery & running the Teensy from battery/cable (with cable plugged into the TP4056 module), & 3) programming the Teensy (with the cable plugged into the TP4056 module).

    Good luck & have fun !!

    Mark J Culross
    KD5RXT
    I think this wiring will work - but Teensy will be powered only by battery, right?
    Thanks for your help!

    Click image for larger version. 

Name:	battery.JPG 
Views:	39 
Size:	84.9 KB 
ID:	26373

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,367
    @frohr
    what is the purpose of the VUSB connection? it only goes to usb.

  8. #8
    Member
    Join Date
    Nov 2020
    Location
    Czech Republic
    Posts
    59
    Quote Originally Posted by WMXZ View Post
    @frohr
    what is the purpose of the VUSB connection? it only goes to usb.
    VUSB is power for TP4056 and there is cutted the trace between VUSB and VIN. So if I connect USB to Teensy, I will power only battery charger TP4056 (VUSB and GND). And Battery powers Teensy (GND and VIN).
    Or am I wrong?

  9. #9
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,367
    I see now,
    I have to get a TP4056 myself

  10. #10
    Senior Member
    Join Date
    Sep 2015
    Location
    Taiwan, Asai. (Traditional Chinese)
    Posts
    174
    Quote Originally Posted by frohr View Post
    VUSB is power for TP4056 and there is cutted the trace between VUSB and VIN. So if I connect USB to Teensy, I will power only battery charger TP4056 (VUSB and GND). And Battery powers Teensy (GND and VIN).
    Or am I wrong?
    you're right, your wires should work
    I use a MCP73831 to charge my portable teensy device, made with LC, connection is similar with your picture above,

    However you can test the connections separately to make sure that works well

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •