Author Topic: Powering from MCU pin  (Read 1296 times)

0 Members and 1 Guest are viewing this topic.

Offline MihaTopic starter

  • Contributor
  • Posts: 36
  • Country: fi
Powering from MCU pin
« on: April 24, 2023, 11:41:38 am »
Helllo.
I need to power the accelerometer like LIS2DH12 from a MCU pin in my battery (CR2032) powered device. So not much electric power do I have.
The goal is to control a power consumption of accelerometer.
Power consumption of accelerometer is about 10 uA, but it requre a good quality of power rail. The DS is requre 10 uF + 0.1 uF capacitors.
I think that not good idea to connect large value capacitor to MCU pin.

I have only one idea - is good capacitor blocking of all MCU power pins and small capacitor (like 10..100 nF) in the pin of MCU, that powers accelerometer. Even in this case I will have "power on" spikes when accelerometers capacitor will be charge.

May be exist common prictise decigion of this problem?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11725
  • Country: us
    • Personal site
Re: Powering from MCU pin
« Reply #1 on: April 24, 2023, 11:11:50 pm »
Ideally you should use a MOSFET. But if you are limited on board space, you can try to connect a series resistor between the MCU pins and the capacitors. Resistor would limit the current when turning it on or off. This will slow down the power supply rise on the sensor side, make sure that sensor is ok with that.

And also make sure that MCU can both source and sink sufficient current to charge and discharge the capacitor, otherwise you'll need a diode too, and at that point might as well use a MOSFET.
Alex
 

Online Kim Christensen

  • Super Contributor
  • ***
  • Posts: 1699
  • Country: ca
Re: Powering from MCU pin
« Reply #2 on: April 24, 2023, 11:25:47 pm »
Quote
But if you are limited on board space, you can try to connect a series resistor between the MCU pins and the capacitors. Resistor would limit the current when turning it on or off. This will slow down the power supply rise on the sensor side, make sure that sensor is ok with that.

If the resistor voltage drop is too high, you can use this trick if you have two MCU pins.
MCU-pin1: This pin is connected directly to the accelerometer's power rail. Set it as an input (tri-state it) but command it's output state as a high.
MCU-pin2: This pin is set as an output and is connected via a suitable resistor to the accelerometer's power rail. Set it low initially.

To activate the accelerometer's power rail, change MCU-pin2 to a high. Delay for a time to charge the capacitor, and then change MCU-pin1 to an output (Set to high already)
To deactivate the accelerometer's power rail, change MCU-pin1 back to an input and at the same time make MCU-pin2 low.

« Last Edit: April 24, 2023, 11:33:08 pm by Kim Christensen »
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4701
  • Country: dk
Re: Powering from MCU pin
« Reply #3 on: April 24, 2023, 11:33:06 pm »
Ideally you should use a MOSFET. But if you are limited on board space, you can try to connect a series resistor between the MCU pins and the capacitors. Resistor would limit the current when turning it on or off. This will slow down the power supply rise on the sensor side, make sure that sensor is ok with that.

And also make sure that MCU can both source and sink sufficient current to charge and discharge the capacitor, otherwise you'll need a diode too, and at that point might as well use a MOSFET.

you could set the pin to input and not discharge the capacitor, it is just wasted energy
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10220
  • Country: nz
Re: Powering from MCU pin
« Reply #4 on: April 24, 2023, 11:39:20 pm »
I have seen it work fine in a production product with a LIS2DE12 powered from 1 MCU output (15mA source/sink) with simply a 1uF and 100nF in parallel across the GPIO power rail next to the LIS2DE12. This MCU was also powered from a CR2032.

Is this in line with regard to what DS says (10uf), no, but it worked in this case just fine.
At least for 50hz sample rate and under, I dunno about when using it at full sample rate or other features.


One word of warning about CR2032, (unrelated to LIS2DE12),  there is a huge difference between brands of CR2032 and how much current you can pull from them due to different ESR and ionic resistance. Test your product on the CR2032 brand you instead to use and fully retest if you change the brand.
« Last Edit: April 24, 2023, 11:48:32 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11725
  • Country: us
    • Personal site
Re: Powering from MCU pin
« Reply #5 on: April 25, 2023, 12:04:30 am »
you could set the pin to input and not discharge the capacitor, it is just wasted energy
I'd be very careful with that. I don't know about those sensors, but many devices may not work correctly if the voltage drops below certain level, but not to 0V.

You can just leave it floating, but then fully discharge on the next power on cycle. This would eliminate full discharge throguh the  MCU.
Alex
 

Online jpanhalt

  • Super Contributor
  • ***
  • Posts: 3762
  • Country: us
Re: Powering from MCU pin
« Reply #6 on: April 25, 2023, 12:59:56 am »
Wouldn't a current limiting diode (attachment) protect the I/O pin (if really needed) too.  More expensive than a resistor, but another option.
 

Offline JustMeHere

  • Frequent Contributor
  • **
  • Posts: 813
  • Country: us
Re: Powering from MCU pin
« Reply #7 on: April 25, 2023, 01:17:23 am »
Read your datasheet.  Your accelerometer draws half a uA when in "powered down" mode.  Use that. 

It's something like 50 years of power from a CR2032
« Last Edit: April 25, 2023, 01:55:31 am by JustMeHere »
 
The following users thanked this post: Siwastaja

Offline MihaTopic starter

  • Contributor
  • Posts: 36
  • Country: fi
Re: Powering from MCU pin
« Reply #8 on: April 25, 2023, 06:50:33 am »
Thanks everyone.

Using of MOSFEETs is good idea but It can't help with power spikes when we have weak power supply (CR2032). Power spikes can be reduced only by limiting of current (Resistor) or by strengthening power supply (capacitors).

Second thing is useless capacitors charging. If I calculated correctly, battery CR2032 (220 mA*h) can charge 10 uF capacitor only 15k times. For my application it is not enough.
But good information from @Psi (thanks!), that 1u+0.1uF works good for LIS2DH. Will try this and will try more decrease capacitors value (think about 0.1uF+10nF, or only 22nF).

I can use LIS2DH Power down mode, but my application uses also gyroscope, that have no good power down mode.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5023
  • Country: si
Re: Powering from MCU pin
« Reply #9 on: April 25, 2023, 07:29:23 am »
GPIO pins survive short circuits just fine.

The transistors driving the pin have such a high RdsON or such a low channel saturation current that even when sending a logic high into GND they don't let trough more than a few 10s of mA. So the power dissipation is so low that the chips die can cool it.

If you want to avoid a pulse of current you can use two GPIO pins. The first one provides power via a 100 Ohm resistor to change up the caps, then the 2nd GPIO pin then provides direct power to it, bypassing the resistor. Multiple IO pins could also be paralleled for more current handling capability (Tho only up to a point, if you try to drive a short circuit with 100 pins simultaneously you will likely kill something).
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3322
  • Country: gb
Re: Powering from MCU pin
« Reply #10 on: April 25, 2023, 07:36:05 am »
Ideally you should use a MOSFET. But if you are limited on board space, you can try to connect a series resistor between the MCU pins and the capacitors. Resistor would limit the current when turning it on or off. This will slow down the power supply rise on the sensor side, make sure that sensor is ok with that.

And also make sure that MCU can both source and sink sufficient current to charge and discharge the capacitor, otherwise you'll need a diode too, and at that point might as well use a MOSFET.

you could set the pin to input and not discharge the capacitor, it is just wasted energy

As the capacitor naturally discharges the voltage will drift into the range that likely to turns on both input transistors and cause higher power consumption.  Minimising that time is usually a good idea unless more energy is wasted dumping the caps charge.
« Last Edit: April 25, 2023, 07:38:40 am by mikerj »
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13971
  • Country: gb
    • Mike's Electric Stuff
Re: Powering from MCU pin
« Reply #11 on: April 25, 2023, 08:03:28 am »
you could set the pin to input and not discharge the capacitor, it is just wasted energy
I'd be very careful with that. I don't know about those sensors, but many devices may not work correctly if the voltage drops below certain level, but not to 0V.

Definitely agree with this - I once had an accelerometer ( memsic I think) which would get into a state which was unrecoverable via I2C if the power browned out.

Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13971
  • Country: gb
    • Mike's Electric Stuff
Re: Powering from MCU pin
« Reply #12 on: April 25, 2023, 08:07:18 am »
The main thing when switching power to devices is to have significantly more capacitance on your power rails than on the load you're switching, especially when you have a high impedance supply like a coin cell. 10uf seems like a lot for a low-power device like an accelerometer.
Decoupling is often way over-specced without giving much thought to it - I'd suggest doing tests to see how little you can actually get away with, then using maybe 5x that figure.
I wouldn't be at all surprised if 100n or less was just fine.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf