1
\$\begingroup\$

I am attempting to build a "dice game" based upon an Arduino Uno.

There will be 5 dice represented by LEDs. To manage the number of LEDs (7 for each die + 1 for an indicator) I have elected - for this project - to use 74HC595 shift registers.

Basically each shift register is loaded with the image of a die (and its indicator.) Each of the shift registers are cascaded into a single chain of 5 shift registers. That is pin 9 (Data Out/QH') of one register is connected to pin 14 (Data In/SER) on the next one and pins 11 (SRCLK) are all connected together as are pins 12 (RCLK.)

My problem is that when I connect 1 or 2 dice, it works fine. If I connect a third (and presumably more,) the power seems to fade and basically everything shuts down.

Why is this happening?

I'm powering the Arduino (and thus the whole thing) from a powered USB 3.0 hub. It is my understanding that I should be able to draw 900mA from a single port on this hub.

I'm using blue LEDs coupled with a 470 ohm resistor. The current draw of a single LED is just under 5mA. From the datasheet, a 74HC595 consumes about 1mA (unless I've read it wrong.)

If I measure the current draw of a single die (including the shift register,) Iget the following for various "scores" on the dice:

Value of die current draw (mA)
1 4.93mA
2 9.86mA
3 14.68mA
4 19.45mA
5 24.15mA
6 28.2mA

As more LEDs are lit, the current consumption goes up linearly in line with roughly the current consumption of a single LED.

If I connect two dice together, then some sample current consumption values for the whole circuit (excluding the Arduino Uno) are:

  • 3 & 1 -> 19.4mA
  • 6 & 2 -> 38.0mA
  • 6 & 6 -> 55.6mA

Again, these seem reasonable to me (based upon the measurements I took for a single die) and well within the potential 900mA that I expect the USB to be able to provide - even if the Arduino is drawing 200mA on top of the dice.

However, if I add a third die, the power fades and the whole thing blacks out.

FWIW, and I know this is a workaround, if I power the Arduino via the barrel jack and a phone charger I can connect all three dice and the circuit works just fine. The charger is one of those "adaptive fast chargers" that produces 9.0V @ 1.67A or 5.0V @ 2.0A. When I measured it before plugging it into the Arduino, it was producing 5.02V.

Thinking about it now, why would the 5 volts from the phone charger power the board via the barrel jack? I know that 2.0A should be more than enough, but it should go through the voltage regulator which presumably requires more than 5 volts to "do its voltage regulator thing."

To summarise, my questions are:

  • Why would my Arduino powered by a USB 3.0 hub fade when 3 dice are connected to it?
  • Why would powering my USB via the barrel jack from a phone charger power the circuit?

Following is a breadboard diagram (I tried using Eagle, but my EagleCAD skills are not that great)...

Dice Game - circuit diagram

The circuitry shown on the rightmost die is repeated 3 additional times to make up the total of 5 dice.

OK, so it has not got even weirder. While attempting to answer the questions below, I've also tried answering them with the 5 dice version of the circuit. The wierder part is that with 5 dice connected (i.e. 5 x 74HC595 + 5 x 8 LED's (with 470ohm current limiting resistors) the USB hub is now powering the circuit without the Phone charger being connected - which is what I expected. FWIW, the only thing that I have done since yesterday was add the additional dice (copying the circuit as shown in the diagram) and rebooted my PC to finish installing some updates.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ Please add a schematic. \$\endgroup\$
    – StarCat
    Commented Aug 1, 2021 at 6:06
  • \$\begingroup\$ It's 'obviously' a power supply thing, so show a schematic of what ardunio pins are being used for power input, and output to the LEDs. What does an Uno do for local regulation? Note that the current output capacity of a small regulator will often be limited by dissipation, so a lower input supply voltage may allow it to deliver a higher output current before it shuts down thermally. What exact voltages are you getting on the regulator input for your two different power supplies? \$\endgroup\$
    – Neil_UK
    Commented Aug 1, 2021 at 6:09
  • \$\begingroup\$ There's a voltage drop taking place somewhere as the current increases. The issue is finding it. You'll need to post more details for any hope, there. \$\endgroup\$
    – jonk
    Commented Aug 1, 2021 at 7:58
  • \$\begingroup\$ @Gmc: Are you using a solderless breadboard? \$\endgroup\$
    – JRE
    Commented Aug 1, 2021 at 8:02
  • 1
    \$\begingroup\$ The arduino UNO had a PTC polyresettable fuse on the USB input (but not on the barrel input). Try measuring the voltage drop across this fuse when the fault condition is present. \$\endgroup\$ Commented Aug 1, 2021 at 8:15

2 Answers 2

1
\$\begingroup\$

A USB3.0 port will only deliver up to 150mA if unconfigured (100mA if USB2.0). It is unclear to me how to 'configure' this, but this answer may help you.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Sorta but not really. Ignoring USB-PD (where the voltage changes), a power request doesn't really change the amount of current that the port can deliver; it just lets the hub account for the power draw and make sure that the total doesn't go above what it can provide. If you take more than you ask for, then you might melt something. But if you take without asking when the answer would have been yes, it works, there isn't an adjustable current-limited supply in there. \$\endgroup\$
    – hobbs
    Commented Sep 12, 2021 at 2:03
  • \$\begingroup\$ I'd always thought there was an actual current limiter to 'ration' bus current out to individual devices. I do know for sure that laptops have (or at least had) lower limits, but I wouldn't say that I'm well versed in USB interfacing. That would explain why the information on 'configuring' it seemed to be scarce. \$\endgroup\$ Commented Sep 13, 2021 at 4:57
0
\$\begingroup\$

I have spent the past couple of days attempting to recreate this problem in an attempt to answer some of the questions.

So far, I cannot recreate the problem. As such, I will "close" this question with these final observations...

I've attempted to recreate the original scenario as best as I can by tearing down the circuit that originally experienced the problem as well as recreating it from scratch using new components.

I did recall that during my initial build, that there appeared to be a faulty 74hc595 on the original build. On this one 74HC595, Qg and Qh appeared to sometimes have a diode connected between them internally (I don't have any diodes on my breadboards). I can't remember the orientation, but if for example Qg had a 1 written to it and thus was high, then Qh was also high - even if it had a 0 bit written to it. On the other hand if Qh had a 1 but Qg had a 0, then QH would be high, but Qg would be low. Or it was the reverse - as I said I cannot remember the orientation.

Unfortunately, it never occurred to me that this might be the source of the problem - and I still doubt that it is, but I discarded the 74HC595 and thus couldn't test it any further.

The other problem of course is that there was a wiring problem. While there is potentially some hubris in this, I feel that this is not likely to be the problem. Why? Because when I encountered this problem, I had two breadboards. 1 had 2 dice on it, the other had just 1. Both worked independently. I colour code my connecting wires - red = VCC, black = GND. My breadboard "power rails" are also similarly colour coded (although they are red/blue). Finally, the power fade occurred when I was making the power connection from the board with 2 dice to add the board with 1 die. Specifically, I connected up GND - no problem, then VCC it was when VCC was connected that the fade occurred - no other connections were being made - again using colour coded wires to reduce the risk of "crossed connections" creating a short. Also, the Arduino never suffered any ill effects and nothing got warm, let alone hot.

So, it was just the act of supplying power to the one additional die that the problem occurred. If I then de-powered the Arduino, let it rest for a bit, then repowered the circuit, then it simply didn't power up. Again nothing got warm, let alone hot.

If memory serves, the "faulty" 74HC595 was on the breadboard with the 2 dice.

My current situation is as follows:

The power consumption of the 5 LED dice circuit is in line with the table of current consumption in the OP. For example, if all 8 LEDs (7 blue + 1 red per die) are illuminated on all 5 dice, the current draw of the entire circuit (excluding the Arduino) is around 168mA. If it shows a score of 5 x 6's (i.e. all but the 8th LED being lit - which is to align with the original measurements that did not have the 8th led) then the measured current draw is around 153mA. From the table above, the measured current draw of the single die circuit showing a 6 is 28.2mA. Multiplied by the 5 dice is 169.2mA - which is about more or less inline with the 153mA observed.

If all LEDs are off, it draws 25 mA (which seems a bit high, but that is what my multimeter measures).

The point is, it is will within the 900mA that my powered USB hub should be able to provide.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.