Author Topic: stm32 blue pill battery powered  (Read 11997 times)

0 Members and 1 Guest are viewing this topic.

Offline mercurialTopic starter

  • Contributor
  • Posts: 49
  • Country: gb
stm32 blue pill battery powered
« on: February 03, 2024, 06:29:25 pm »
Hello

I 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 on

https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html
Quote
Warning: The +5V pins on this board are directly connected to the +5V pin of the USB connector. There is no protection in place. Do not power this board through USB and an external power supply at the same time.

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

Offline Sniper1

  • Regular Contributor
  • *
  • Posts: 96
  • Country: ro
Re: stm32 blue pill battery powered
« Reply #1 on: February 03, 2024, 06:35:59 pm »
So then you need to either
1 disconnect the 5V from the USB-PC side
2 undersold the on board LDO and power the STM32 directly with an external LDO/SMPS using the 4 AA batteries
3 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
 
The following users thanked this post: mercurial

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6266
  • Country: es
Re: stm32 blue pill battery powered
« Reply #2 on: February 03, 2024, 07:12:17 pm »
Something like this. Low gate threshold voltage p-fet, schottky diode.

Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: mercurial

Offline mercurialTopic starter

  • Contributor
  • Posts: 49
  • Country: gb
Re: stm32 blue pill battery powered
« Reply #3 on: February 03, 2024, 07:57:05 pm »
Thanks @Sniper1 and @DavidAlfa

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

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: ru
Re: stm32 blue pill battery powered
« Reply #4 on: February 03, 2024, 08:20:01 pm »
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.
And sorry for my English.
 
The following users thanked this post: mercurial

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4388
  • Country: nl
Re: stm32 blue pill battery powered
« Reply #5 on: February 03, 2024, 08:20:58 pm »
Or you connect the USB DM, DP and GND to the GPIO pins of the bluepill.

PA11 = DM
PA12 = DP
GND = GND

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

Offline mercurialTopic starter

  • Contributor
  • Posts: 49
  • Country: gb
Re: stm32 blue pill battery powered
« Reply #6 on: February 03, 2024, 09:05:52 pm »
@pcprogrammer nice idea!

@S. Petrukin
i 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.
 

Online DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6266
  • Country: es
Re: stm32 blue pill battery powered
« Reply #7 on: February 03, 2024, 10:26:29 pm »
Why don't you get a Li-ion board with a small battery?
Like this one:  www.aliexpress.com/item/1005004616088520.html

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

Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: mercurial

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: ru
Re: stm32 blue pill battery powered
« Reply #8 on: February 04, 2024, 10:48:00 am »
Also was going to use the Adc peripheral so not sure what effect A slowing dropping Vdd will have on Vref.

Similarly, 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.
And sorry for my English.
 
The following users thanked this post: mercurial

Online iMo

  • Super Contributor
  • ***
  • Posts: 5243
  • Country: bj
Re: stm32 blue pill battery powered
« Reply #9 on: February 04, 2024, 03:47:16 pm »
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..
Readers discretion is advised..
 
The following users thanked this post: mercurial

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: ru
Re: stm32 blue pill battery powered
« Reply #10 on: February 04, 2024, 04:36:59 pm »
Btw the ADC ref voltage is the Vcc3V3 in case of this stm32 chip..

This 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?
And sorry for my English.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5243
  • Country: bj
Re: stm32 blue pill battery powered
« Reply #11 on: February 04, 2024, 04:59:52 pm »
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..
« Last Edit: February 04, 2024, 05:11:57 pm by iMo »
Readers discretion is advised..
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1273
  • Country: ru
Re: stm32 blue pill battery powered
« Reply #12 on: February 04, 2024, 05:43:27 pm »
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..

It looks like I forgot this old processor and made a mistake - it really doesn't have a built-in reference voltage.  :-//
And sorry for my English.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4388
  • Country: nl
Re: stm32 blue pill battery powered
« Reply #13 on: February 04, 2024, 06:28:18 pm »
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..

It looks like I forgot this old processor and made a mistake - it really doesn't have a built-in reference voltage.  :-//

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

Quote
Temperature sensor/V REFINT internal channels
The Temperature sensor is connected to channel ADCx_IN16 and the internal reference voltage V REFINT is connected to ADCx_IN17. These two internal channels can be selected and converted as injected or regular channels.
Note: The sensor and V REFINT are only available on the master ADC1 peripheral.

The value is typical 1.2V. This is mentioned in the datasheet for the STM32F103x8 on page 41.

Offline profdc9

  • Frequent Contributor
  • **
  • Posts: 334
  • Country: us
Re: stm32 blue pill battery powered
« Reply #14 on: February 05, 2024, 02:49:35 am »
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

 
The following users thanked this post: mercurial

Offline mercurialTopic starter

  • Contributor
  • Posts: 49
  • Country: gb
Re: stm32 blue pill battery powered
« Reply #15 on: February 05, 2024, 06:53:04 pm »
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..

Won'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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf