Author Topic: My first try at using a mosfet.EDIT:lower standby cuurent of SPI LED  (Read 2058 times)

0 Members and 1 Guest are viewing this topic.

Offline buck converterTopic starter

  • Regular Contributor
  • *
  • Posts: 165
  • Country: us
Progress with my project was going full speed ahead until I realized that apa102 addressable leds use too much current even when the LEDs are off for a battery powered device. So i thought i could use a Mosfet as a switch so they could be turned on with a HIGH signal from a attiny85, and disconnected from ground when the attiny sleeps. After watching a few videos about mosfets, I came up with a diagram. Would this work?
Here is the datasheet. https://www.diodes.com/assets/Datasheets/DMN65D8L.pdf
« Last Edit: July 24, 2017, 01:35:36 am by buck converter »
Just me and my scope.
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2416
  • Country: us
Re: My first try at using a mosfet.
« Reply #1 on: July 24, 2017, 12:42:13 am »
Don't disconnect it from ground, disconnect it from power. Then you don't have to worry about the data lines providing a path to ground in the off state.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2317
  • Country: au
Re: My first try at using a mosfet.
« Reply #2 on: July 24, 2017, 12:47:49 am »
That's not a complete diagram, as you haven't drawn the data and clock connections for the APA102 LEDs. If you have those connected directly to the Attiny85, you'll have to be mighty careful because:

If you take the gate of the MOSFET low, the MOSFET switches off, so the drain voltage of the MOSFET rises to the (say) 4.2V from the LiPo. This is correct, it's what you want, because that means that both the VCC and GND of the APA102 are at (say) 4.2V, so there's zero volts across the APA102, i.e., it's off.

However, if you were to make a software mistake, and program the attiny to make it output a '0' on the clock line, that would mean you had:
APA102 VCC: 4.2V
APA102 GND: 4.2V
APA102 CI: 0V

In other words, from the APA102's point of view, you'd be applying negative 4.2V to the CI pin. This is in excess of the limits of the datasheet, and could cause damage, or the LEDs would try to power themselves via the protection diodes in the APA102. The same goes for the DI pin as well.

So it'll work fine, but you have to be absolutely sure that your code leaves the DI and CI pins either high or floating before switching the MOSFET off.

If this seems confusing, you might consider using a P-channel MOSFET to switch off the supply to the APA102, rather than using an N-channel MOSFET to switch off the ground connection. This might be a bit easier to understand, although you still have to be 100% sure that if the MOSFET is switched off, you must have the DI and CI pins either low or floating.

Don't disconnect it from ground, disconnect it from power. Then you don't have to worry about the data lines providing a path to ground in the off state.

Correct, except if you disconnect the power, you have to be equally worried about the datalines providing a path to VCC in the off state, it's exactly the same problem. It's just easier to intuitively understand the risk if you disconnect from power.
« Last Edit: July 24, 2017, 12:51:00 am by rs20 »
 

Offline buck converterTopic starter

  • Regular Contributor
  • *
  • Posts: 165
  • Country: us
Re: My first try at using a mosfet.
« Reply #3 on: July 24, 2017, 01:10:04 am »
Ok, I think I will use a P channel Mosfet, would high-value current limiting resistors on the dataline protect the LED
Just me and my scope.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2317
  • Country: au
Re: My first try at using a mosfet.
« Reply #4 on: July 24, 2017, 01:21:38 am »
Ok, I think I will use a P channel Mosfet, would high-value current limiting resistors on the dataline protect the LED

The DI and CI pins shouldn't draw very much current, so indeed some resistors could offer some protection from programming errors. Just be wary not too make the resistors too large; or else they'll form an RC filter with the input capacitance of the DI and CI pins, and limit the max frequency that you can drive the LEDs at as a result.

The datasheet that I found for the APA102 is absolutely awful, it doesn't offer any information that might be helpful for selecting this resistor value (input pin currents, input pin capacitances, etc). I'd go with 100 ohms to 1k as a first guess, I dunno.

This is a somewhat subjective decision, some think that the added cost, effort, and potential issues of adding these resistors might outweigh the cost/risk of programming errors. I'm on the fence myself. Up to you.
 

Offline buck converterTopic starter

  • Regular Contributor
  • *
  • Posts: 165
  • Country: us
Hmm... any other ways to lower standby current? This is a one-off project, so i'm not worried about cost / effort of LEDS ;)
Just me and my scope.
 

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2317
  • Country: au
Re: My first try at using a mosfet.EDIT:lower standby cuurent of SPI LED
« Reply #6 on: July 24, 2017, 03:35:30 am »
No, cutting power to the power-hungry device is absolutely the right and best way of reducing power consumption. You can consider other additional power-saving measures too, like exploiting the sleep modes of the attiny.

Please don't interpret my previous message as any sort of questioning of your overall strategy, I was only commenting that the specific idea of using those protection resistors is an idea that some people would encourage and others would discourage.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf