# current throughout a circuit

this is my first electronics project. I'm using a microcontroller (Adafruit ESP8266 Huzzah) connected to an IR sensor and two L293D stepper motor drivers which are connected to two Nema 17 stepper motors. I will be sending the data via Wifi to a web page. I asked my university professor about the current throughout the circuit and he said he is not sure what I mean and that major consumption, by far, will be the motors. I'm not convinced so I thought I would double-check and ask here.

The nema 17 stepper motor is rated at 0.4A

The L293d drivers have a max continuous current of 0.6A (datasheet shown below).

Here is some info for the microcontroller

And finally, the IR sensor. I found that the supply current is 1.3mA.

I plan on using a 12V battery with and LDO down to 5V to the microcontroller, driver and IR sensor. I am also using inverters to reduce the number of pins required from the microcontroller.

So my question is how do I ensure the circuit will work from those values of current? I'm rather confused by all of this but I'm guessing that the calculations start from the battery. My professor told me not to worry about the circuit current but I am skeptical. Many thanks.

EDIT:

Here is a schematic of my circuit. Hopefully you can read it. I was recommended 74HCT inverters.

• You need to include the stepper motor driver data sheet, and a schematic of your connections to the stepper and driver. Mar 7, 2018 at 16:50
• When you post the picture, make sure and double tap [Enter] twice because the picture is inline with the text if you don't... Hence why you have this sentence and then the word "...microcontroller" appeared further down the page.
– user103380
Mar 7, 2018 at 17:33

You haven't provided a complete schematic, but in practice the total current will be the sum of every device.

So you have motors (x2), microcontroller, driver, IR sensor and WiFi. So the sum is:

Imax = (0.4A)*2+(SOME CURRENT NOT GPIOs...)+60mA+1.3mA+170mA = ~1A


Your microcontroller (not specified?) will very likely not consume more than 20-40mA. The 60mA comme from logic supply of the driver. Output supply is feed to your motor so no need to compute that. So you need 1A. It is generally advisable to have some headroom, so take 1.5A.

You want to use an LDO to step down from 12V to 5V. Will will therefore minimally have to dissipate:

Pnom=(12V-5V)*1A = 7W
Pmax=(12V-5V)*1.5A = 10.5W


That is quite a lot of power to dissipate. You must ensure that you need reach junction temperature. If you decide to go with a TO-220 LM317 regulator or something of the like with a junction to ambiant thermal resistance of 37.9°C/W, with ambiant temperature of maximum 30°C:

Tj = Ta+Pmax*Rja = 30°C+7W*37.9°C/W = 295.3°C


Maximum junction temperature for LM317 is 150°C, so your regulator will be burning in a matter of seconds.

You will need proper heat dissipation, and reduced usage pattern or a better power supply design such as switching one. Lowering from 12V to 5V at such high current requires proper thermal management.

One solution is to figure out that your driver has two supply pins: you can drive your logic from 5V and your motors directly from 12V. Your driver supports this. Therefore your regulator will only have to handle a current of approximately 300mA, which is much more manageable.

Pnom = (12V-5V)*0.3A = 2.1W
Tj = Ta+Pmax*Rja = 30°C+2.1W*37.9°C/W = 109.59°C


Note: The 109°C is still quite high but you won't reach that temperature (maybe 70°C or so). This thermal resistance is usually a rough estimation. It will still get hot, so you should be using a switching regulator or use some external transistor (with more efficient package) such as shown in most LM317 datasheets for high current regulator.

• Thank you, that is very helpful. I just added a schematic. I am using an Adafruit ESP8266 HUZZAH. Mar 7, 2018 at 19:15
• They're only regulating the 5V for the logic level bits, so your sums are wrong sadly. As an aside, why use an LDO?! 7805 is perfect for this. Mar 7, 2018 at 19:16
• What are the advantages of using a 7805 vs an LDO? Mar 7, 2018 at 20:19
• @awjlogan The edit was not there when I wrote my answer so no schematic. Yogi12 specified a WiFi module for which specification are provided but it is not on schematic and account for 170mA (worst case). Like I said in my answer, motor can be driven on 12V, so 0.4A no more applies. The driver chip as 20-30mA typical consumption on logic side as per datasheet x2 so 60mA. There is no IR sensor on schematic too. LDO or not is irrelevant. I just wanted to show the calculations. The result is basically the same with a 7805: lots of heat. My answer is not wrong. Mar 7, 2018 at 20:21
• @Yogi12 none in your case. LDO = low drop out. It defines the maximum allowed difference between Vin and Vout. With an LDO, Vout can typically be as high as Vin-0.25V while on a 7805 Vout must be like 2V below Vin. Since 7805 is fixed at 5V, Vin must be at least 7V. In your case this is irrelevant since your supply is 12V, which is way larger than 5V. Mar 7, 2018 at 20:25