Go Down

Topic: Pro Mini 5v will not run sketch without USB Power (Read 608 times) previous topic - next topic

Gslenk

Background:

Components:
(2x) MAX7221cng
(2x) "221" Capacitors
(2x) 10kohm resistors

Board printed by oshPark

3x Common cathode 3 digit 7 segment LED displays

Schematic:
https://www.sparkfun.com/datasheets/Components/General/COM-09622-MAX7219-MAX7221.pdf
See page 13

Sketch:
Code: [Select]

//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 6 is connected to LOAD
 We have TWO single MAX72XX.
 */
LedControl lc=LedControl(12,11,6,2);

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call on both MAX's
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
 lc.shutdown(1,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(1,8);
  /* and clear the display */
  lc.clearDisplay(1);


}




void loop() {
 
  lc.setChar(0,0,1, false);
  lc.setChar(0,1,2, false);
  lc.setChar(0,2,3, false);
  lc.setChar(1,0,4, false);
  lc.setChar(1,1,5, false);
  lc.setChar(1,2,6, false);
  lc.setChar(1,3,7, false);
  lc.setChar(1,4,8, false);
  lc.setChar(1,5,9, false);
}


At first I thought, power issue.  I am using a car battery connected to the RAW input.  No dice

Then I used my 5v regulator (same one that powers a RPi carputer for ECU data logging).  No dice

Then I sent 5v through the USB pins on the mini.  No dice

Then maybe the sketch was too complicated.  I made a simpler one.  no dice.

What gives?

The mini only works when the usb is connected.  The LEDs flash on first power up, but that is all before the sketch actually begins.

This particular one is a chinese knockoff.  The authentic one I have does the same (this is just the last configured one I had to take pics since I thought maybe I fried the original. 

daveyjones

Could it be you are over drawing driving the LED's thru the arduino?

Gslenk

#2
May 13, 2015, 12:42 am Last Edit: May 13, 2015, 04:35 am by Gslenk
I suppose the power is an issue.  I swapped out resistors the diagram from 10k to 18k.  It now works on external power, with an occasional glitch.  I will up the resistance some more.

I also suppose that this is the fault of the MAX7221s and not the arduino. 

Paul__B

I also suppose that this is the fault of the MAX7221s and not the Arduino.  
What on earth makes you imagine this is in any way whatsoever a "fault" of the MAX7221?

It is just doing exactly what you configure it to do. :)

Now you know why each MAX7221 must be bypassed by an adjacent 10µF capacitor.  Did you miss that on the datasheet?

However low you program the brightness for the display, the current is always maximum for the period when the PWM is high, and since that cannot be supplied by the regulator, it crashes your system.  The USB power is provided by the far heftier PC power supply and the Polyfuse will not trip on such brief transients.

Gslenk

You seem to be addressing two potential flaws (thanks), but there only appears to be one:

 
However low you program the brightness for the display, the current is always maximum for the period when the PWM is high, and since that cannot be supplied by the regulator, it crashes your system.  The USB power is provided by the far heftier PC power supply and the Polyfuse will not trip on such brief transients.

This has been demonstrated to be true by my experimentation.  10kohm will allow about a few individual segments to light.  18kohm will allow ~3 full digits. 40kohm will allow the entire thing to light for about 16 hours so far (probably for "ever").

You did allude to a good point (beyond the mildly abrasive humor), and that is the fact that I am using 221 (220pF = .000220 uF) capacitors instead of 104 = .1uF.  I did not find a good resource to read them somehow and used the biggest ones I had on hand (now I know...).  Note, NOT 10uF, but still you are a little more right than I so I wont press that issue.   :) 

When I accidentally used a much lower capacitor, there was ghosting/interference.  That went away with the 221.  So it appears to be ok.

Do you think there could be any harm in keeping the .00022uF caps instead of swapping to 0.1uF?  And if there would be harm should it have shown up in the past 16+ hours?

PS.  What I meant by "fault" that the MAX7221 was failing due to a low resistor that I put in so yes ultimately it is my fault, but it was not the arduino causing the failure.  It was the MAX7221 failure caused by my choice in resistor value.  Which was not unreasonable given the "typical value" diagrams...

PSS.  In my attached pictures, the capacitors are clearly visible.  As well as in my description of the problem. 

Paul__B

The point is - that you need the 10µF capacitors to provide sufficient "reserve" to smooth out the current drawn in the short time that the PWM (in the MAX7221) strobes on.  220 pF will not cut it, neither will 0.1 µF.  Certainly leave the latter in place, but add the 10 µF.  The datasheet clearly specifies the requirement for both capacitors (and those specific values, though increasing each up to a factor of five is not unreasonable), and as near to the chip as practical.

Any physical harm for using insufficient capacitance?  Unlikely.

Gslenk

Paul,
Thank you for really clearing that up.  I do not see where the datasheet calls for 10uF on page 13, it looks to be 0.1uF.  But since going overboard does not matter I will line up a little bulk purchase, and use the 10k as recommended.


Paul__B

OK, I stand corrected - the datasheet shows only the 0.1 µF.

The modules with which I am used to working do incorporate the 10 µF as do the vast majority of the published designs though I note I have some of the modules (the better "chainable" ones) here which do not have them.

Perhaps more to the point, the Pro Mini uses 10 µF capacitors in its power supply while the UNO uses 47 µF, so I think you are just critically short on buffering of the supply rail.  Perhaps just try a single 47 µF on the 5V line between the Pro Mini and the displays, and keep the leads between as short as possible.

Go Up