stm32 blue pill battery powered - Page 1
Forum section: electronics / general

author: mercurial
author_rank: Regular Contributor
timestamp: February 03, 2024, 06:29:25 pm
content: HelloI want to power the stm32 blue pill board with a battery around 4 batteries of 1.2V each in series this will be directly given as 5V in to the blue pill board.The blue pill board seems to accept a range of +3.6V to +5.5V as input on its 5V power pin.However I read onhttps://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.htmlQuoteThe problem is that I want to simultaneously sent serial data over usb from blue pill board to a pc, so I will have a usb cable connected to the pc the same time I power the board with a battery.Would I need to do some changes to this setup so that nothing blows up, or causes damage to either the pc or the board.

author: Sniper1
author_rank: Regular Contributor
timestamp: February 03, 2024, 06:35:59 pm
content: So then you need to either1 disconnect the 5V from the USB-PC side2 undersold the on board LDO and power the STM32 directly with an external LDO/SMPS using the 4 AA batteries3 disable USB power on the PC side not sure if you can do that but there is a chance u can (depends a lon on how the USB is implemented

author: DavidAlfa
author_rank: Super Contributor
timestamp: February 03, 2024, 07:12:17 pm
content: Something like this. Low gate threshold voltage p-fet, schottky diode.

author: mercurial
author_rank: Regular Contributor
timestamp: February 03, 2024, 07:57:05 pm
content: Thanks @Sniper1 and @DavidAlfaso in either case I will have cut a copper trace on the board, correct?.Fine that's not an issue I guess, I will just need to find that USB power trace on the board, hope fully I can get that from the schematics and pcb layout in case they are available.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 03, 2024, 08:20:01 pm
content: The STM32 has a 3.3V supply voltage.You don't need 4 batteries, 3 is enough.I don't remember the maximum allowable voltage, it seems to be 3.6V, but I would recommend connect Schottky diode with 3 batteries to slow down a little. And this will become a protection against the struggle of power sources.At the same time, there is no need to cut anything instead, just connect batteries with diode to 3.3V pin.

author: pcprogrammer
author_rank: Super Contributor
timestamp: February 03, 2024, 08:20:58 pm
content: Or you connect the USB DM, DP and GND to the GPIO pins of the bluepill.PA11 = DMPA12 = DPGND = GNDCut of one end of a USB cable and figure out which wire is which and stick some dupont connectors on them. No need to cut any traces on the board. When you use the bluepill on a daughter board add a USB connector to is and route the data an ground pins, but don't connect the power supply pin.

author: mercurial
author_rank: Regular Contributor
timestamp: February 03, 2024, 09:05:52 pm
content: @pcprogrammer nice idea!@S. Petrukini was going to use a LDO in between the battery and the blue pill board so chose 4 batteries, 1.2V per battery nominal .I guess in reality the voltage would probably be higher maybe 1.3 to 1.4V per battery especially a fully charged one. so that would be close to 3.9V.A schottky perhaps yes, I see in the STM32F103x8 datasheet the absolute max for Vdd is 4V.Also was going to use the Adc peripheral so not sure what effect A slowing dropping Vdd will have on Vref.

author: DavidAlfa
author_rank: Super Contributor
timestamp: February 03, 2024, 10:26:29 pm
content: Why don't you get a Li-ion board with a small battery?Like this one:www.aliexpress.com/item/1005004616088520.htmlThe module will always output 5V on the VO+/VO- pads. Solder a battery to B+/B-.Cut the 5V USB trace from the BluePill usb port and connect it to the charger board.

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 04, 2024, 10:48:00 am
content: Quote from: mercurial on February 03, 2024, 09:05:52 pmSimilarly, you can connect 4 batteries to 5V pin thrue diode.For a reliable situation, you need to add another diode to the USB power supply circuit or cut off the track - it is clearly visible on the PCB.The board already has LOD 5-3.3V. Why add more?Do not forget that LDO simply drop part of the battery charge into the air.Vref does not depend from supply voltage, it is stable over the entire range of MC performance.

author: iMo
author_rank: Super Contributor
timestamp: February 04, 2024, 03:47:16 pm
content: A single diode would be ok, see below.The regulator there should work fine from 4V up.Btw the ADC ref voltage is the Vcc3V3 in case of this stm32 chip..

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 04, 2024, 04:36:59 pm
content: Quote from: iMo on February 04, 2024, 03:47:16 pmThis is the pin of the external Vref connected to the VDDA (intermally in package LQFP64), but we have an internal Vrefint = 1.2V, isn't it?

author: iMo
author_rank: Super Contributor
timestamp: February 04, 2024, 04:59:52 pm
content: Bluepill 103C8T6 is not in a 64pin package, and there is no 1.2V internal ref, afaik.There is a special pin for an external Vref on 100+ pins packages only (talking stm32F103xxx).PS: below v2 - it protects USB against a short in your battery, and it allows a trickle charge of the battery as well..

author: S. Petrukhin
author_rank: Super Contributor
timestamp: February 04, 2024, 05:43:27 pm
content: Quote from: iMo on February 04, 2024, 04:59:52 pmIt looks like I forgot this old processor and made a mistake - it really doesn't have a built-in reference voltage.

author: pcprogrammer
author_rank: Super Contributor
timestamp: February 04, 2024, 06:28:18 pm
content: Quote from: S. Petrukhin on February 04, 2024, 05:43:27 pmIt does have an internal reference voltage, but it is on an internal input channel on ADC1. It is not used for the conversion process. It is mentioned in the RM0008 Reference manual for the STM32F10 series. See page 217 for the block diagram of the ADC peripheral and page 219 for more info.QuoteThe value is typical 1.2V. This is mentioned in the datasheet for the STM32F103x8 on page 41.

author: profdc9
author_rank: Frequent Contributor
timestamp: February 05, 2024, 02:49:35 am
content: I made my own version of the Bluepill you can have custom manufactured at JLCPCB. It already has the BOM/CPL done. You could customize it for your needs, add a TP4056 or MT3608 or stuff like that to it to accommodate charging and regulation.https://github.com/profdc9/STM32surface

author: mercurial
author_rank: Regular Contributor
timestamp: February 05, 2024, 06:53:04 pm
content: Quote from: iMo on February 04, 2024, 03:47:16 pmWon't this circuit act like a charger to the connected battery.I was considering connecting the battery to 5V.so 4 * 1.2 = 4.8 or say worst case 5 to 5.1V.But the usb supply would be around 4.9 to 5V.So once the battery drops below 4.9 the usb would try to charge the battery.Correct me if I'm wrong.