How to cut off power to unused modules connected to my arduino?

Hey,

I am working on an Autonomous Fingerprint System which requires a lot of modules

https://forum.arduino.cc/index.php?topic=615605.0

And the current needed is skyrocketing over 400mA. I just learned that an Arduino pin gives 40mA tops and 30mA is the safe range.

So, yesterday, I was playing around with my arduino and trying to make a light show with my LEDs.
I used the PWM ports to control their brightness.

An idea popped in my mind, that if I manage to connect the VCC of my modules to the PWM ports and control the voltage by code, I can turn off the voltage to the module when not in use.

Now my question is, Is implementing this idea possible?
If I turn off the VCC supply, does the module stop using current from all the other ports too?(the ethernet module has 6 pins connected to it, including VCC :grinning: )
If my idea is wrong, can you please suggest any other way to cut off voltage to an unused module?
(Obviously, I am not going to used all the modules at the same time. So I can just turn them on when i need them and turn them off)

Thank You for reading through
I would appreciate your reply
Thanks in advance

Yes, it's possible. But there is a danger. Many chips/modules, if their Vcc pin is not powered, but other pins are connected to other 5V sources such as another digital pin with a HIGH signal, will power themselves from that other pin. It's called "parasitic powering" and can damage the chip/module. Also, it defeats the objective because the module is still consuming power. So you have to make sure the module or chip is isolated from all sources of power on any of its pins.

Many more complex modules/chips will have some kind of shutdown/standby mode, controlled by one of its pins or by sending an instruction/command over a data line. These modes often only use a few microamps, so don't impact your power budget.

If you have a power problem with a particular circuit, post the schematic and links to the data sheets for the main components and forum members can suggest ways to reduce power consumption and avoid problems like parasitic powering.

Sorry for the late reply, I was doing some research on what you said.

My project uses both the GT511C3 fingerprint sensor and the ENC28J60 ethernet module. The problem i am facing i that i am not able to supply enough current for both of them at the same time. The fingerprint sensor has a ampere rating of 130mA and the ethernet module has an ampere rating of 180mA.

You might already know that the max amp output from the pins of the arduino mega is 200mA. So I was thinking I could put the module in sleep when not in use.

The ethernet module uses SPI and the fingerprint sensor uses I2C.

I asked about it in the forum, and someone suggested to connect an external power supply. I want to keep the power supply as a last resort.

I found a post that explains on how to put the Ethernet module I am using (ENC28J60) to sleep,

http://blog.derouineau.fr/2011/07/putting-enc28j60-ethernet-controler-in-sleep-mode/

That solves one problem, but I also have a Fingerprint sensor(GT511C3) connected via I2C.
I could not find anything online on how to put it to sleep, It would be very kind of you if you could help me out with this.

I have attached the datasheets for the ethernet module and my fingerprint sensor. I couldnt find the schematic for the sensor.
There is a close() function in the module library, but the datasheet clearly specifies that the function does nothing.

Following is the link to the Hookup Guide (not the hookup you are thinking, I got confused too :P)
https://learn.sparkfun.com/tutorials/fingerprint-scanner-hookup-guide#example-code-for-arduino

Thank You in advance

ENC28J60-Datasheet.pdf (1.24 MB)

Fingerprint Scanner.pdf (514 KB)

You might already know that the max amp output from the pins of the arduino mega is 200mA

I thought it was more like 400mA for Mega, but I'm not sure why you think that is even relavent. The sensor and Ethernet module are not powered through the atMega chip, but directly from the Arduino's 5V regulator.

The atMega chip won't normally be consuming 400mA unless you have a large number of LEDs attached our something. Normally it will only draw perhaps 40mA, so the regulator should be able to supply the sensor and Ethernet modules without overloading. To be safe, use a 7.5V power supply connected to Vin (not 9V or 12V), or best of all, a 5V regulated power supply connected to 5V pin.

So at this time I believe your concerns about powering both modules at once is just a misunderstanding on your part.

Also, the current figures you found from the data sheets are probably the maximum value which is only seen when the modules are in active use. At other times when the modules are idle, the current drawn probably drops to afraction of that maximum. Use your multimeter to find out.

I asked about it in the forum

Are you saying that you have posted this question elsewhere on the forum? That is called cross-posting and is against forum rules. If the forum moderators find out, you will be in trouble.

Thank you for your reply.

I was thinking that the arduino can out an amp rating of 200mA tops with the 5v and 3.3v combined. I understand what you are saying, but the blue light on the fingerprint sensor blinks rapidly and glow dim. This happens when I am connecting the sensor and the ethernet module at the same time. It was the reason I trying to turn off one module when not in use.

Yes I had asked about the blinking issue on the forum earlier for which i got suggested to add a power source.
Then I had the idea of powering down one module, so I created a new topic thinking its different.
Sorry if I should have continued in my earlier post.

Here's the link.
https://forum.arduino.cc/index.php?topic=615605.0

the blue light on the fingerprint sensor blinks rapidly and glow dim.

What is the current and voltage being supplied to the module when that happens?

How are you powering the circuit?

Here's the link.

You didn't post a link. This is a link.

After what you suggested, I shifted all the modules except the fingerprint senor to the 5V supply.
The sensor can only run on 3.3V, else it heats up pretty quick.

The ampere draw of the module remains around the same for the sensor(after doing the above)
when ethernet is not connected : 79mA(when it is waiting for finger to be pressed i.e. not totally idle)
when ethernet is connected : 75mA

Thanks to you, Now the dim led problem on the fingerprint in solved.

But now the lcd is so dim, its barely visible and works so slowly(it takes a lot of time to change the characters being displayed)

Module - Voltage Supply - Rated Ampere Draw
GT511C3 (3.3 V supply) 130mA
DS1307 (5 V supply) 1.5mA
LCD 20x04 (5 V supply) 2mA
ENC28J60 (5 V supply) 180mA
SD Card Module (5 V supply) 60mA
1 Pushbutton (5 V supply) (does it draw?, I dont know)
1 4x4 Matrix Keypad ( 8 Digital Pins) 30mA
1 Buzzer (Digital PWM) 10mA
2 LED (Digital PWM) 40mA

So max ampere draw on the 5V should be 250mA

My guess is there is not enough current in the 5V supply now as I have shifted all the modules to it.(Correct me if I am wrong please.)
But I still dont understand where all the current is going....I have supplied 1A from the wall. The math just doesnt add up.

You suggested a regulated 5V supply, I found this link on someone else's post about powering LEDs
https://www.ebay.com/itm/AC-110V-220V-TO-DC-5V-12V-24V-2A-10A-15A-20A-40A-60A-Switch-Power-Supply-Adapter/292069730268

Is this what you were telling me about?Connecting this to the 5V pin should solve my problems?

Thank you very much in advance

I'm not certain if it's ok to power your ethernet module with 5V. The chip on the module needs 3.3V supply. Does your module also contain a 3.3V regulator? The data sheet you posted is for the chip alone, not the module, so I can't be sure. But many modules sold for use with Arduino which need 3.3V supply have a regulator, because the Arduino usually cannot supply high currents at 3.3V.

For the power supply, the one you linked to should be ok, even the 1A version should be enough. But that type of PSU is not very safe because you need to wire up the 110/240VAC side of things, which brings a risk of electrocution or fire if you are not experienced and make an error. A 1A 5V "wall-wart" supply that is fitted with a plug suitable for your country would be safer. These normally have a barrel plug for the 5V output, so you will need a barrel socket. You cannot plug the barrel plug into the Mega's barrel socket because that needs at least 6.5V because it connects to the Mega's built-in regulator.

You may also need a 3.3V regulator. The Mega may not be able to provide enough current at 3.3V for the fingerprint sensor, and if the Ethernet module does not have it's own 3.3V regulator, the Mega certainly cannot provide enough for both. I suggest a small module based on ams1117-3.3 regulator chip.

Your power budget list seems to contain some errors. I cannot see how a 4x4 keypad can use 30mA. It should use almost nothing. The pushbutton should use almost nothing. But the 20x4 LCD will probably need much more than 2mA for its led backlights. Read the data sheets, but also confirm using your multimeter!

Thank You a lot again for your detailed response,

The ethernet module i am using has both 5V and 3.3V pins on them. So I dont think that should cause any problems.

I found an equivalent 5V 1A power supply from a local store. When I connected it to the 5v pin, everything works perfectly.

I have still connected the 9V the the barrel connector on the Mega, I will soon replace it with the ams1117-3.3 based module as you suggested.

I double checked the datasheet for the Membrane Keypad again, it specifies 30mA as the maximum and 24V as maximum voltage drop. I am sure it uses a lot less than that.Yes I listed the LCD's ampere draw incorrectly, its recommended ampere draw is 75mA. That justifies it, as the screen size is quite large.

Thank you very much for helping through.

I have still connected the 9V the the barrel connector on the Mega, I will soon replace it with the ams1117-3.3 based module as you suggested.

I don't understand why you would do that. The Mega needs 5V, give it that from your external PSU by the 5V pin. For the fingerprint sensor, use the ams1117 regulator for that.

I have to go to the local store tomorrow to buy the ams1117 regulator, thats y.
I was using the 9V for the time being :confused:
I just removed it now to avoid magic smokes.

Thank you for your response