I am hoping someone can help me with a my first problem. Quickly, this is my first attempt at Arduino programming. I have set up a 1 digit seven segment display with an Arduino Uno with Max 7219.
Since I am new, I wanted to approach the programming 1 step at a time.
My first attempt was to cycle through the numbers (0 through 9).
After uploading program, there are no errors but it only displays a "1" then "2" then is out of the loop.
This is very frustrating since I thought this may be one of the easier steps. I just need somebody to verify my code (if I am way off base, please let me know). If it may be my wiring I will deal with that. Thanks in adavance to anybody who can point me in right direction. Remember, everybody was new at this once.
#include <LedControl.h>
LedControl lc=LedControl(12,11,10,1); // lc is our object
// pin 12 is connected to the MAX7219 pin 1
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219
void setup()
{
// the zero refers to the MAX7219 number, it is zero for 1 chip
lc.shutdown(0,false);// turn off power saving, enables display
lc.setIntensity(0,8);// sets brightness (0~15 possible values)
lc.clearDisplay(0);// clear screen
}
Are you resetting or just entering loop() again? you might want to put a debugging statement in setup() to see if it is getting called.
The code looks fine, I suspect a power issue that is resetting the chip. Do you have bypassing? Where does the power for the seven segment display come from?
Thank You Guix,
Your suggestion still does not work. It now lights "0" and gets out of loop. It may be a power issue as KeithRB suggests.
I will write back summarizing my setup.
Thank You
Ok, here is the setup,
The setup from arduino uno to the max7219 is as shown in the arduino website. However, the only difference is the RSet is 1.5K. This is beacause after the max7219 and before each segment (Load approx.9V,40mA) i have installed a 2N3904NPN transistor and a 210 Ohm resistor. There is an external power source to the transistors of 16v (AC). I hope this explains some. If you need more clarification
or visual sketch, please let me know. It has been 20 yrs since i did the Electrical side of engineering.
Why did you add all that extra stuff? Is the digit one of the large, multi-LED/segment displays that needs higher voltage?
I have 4 max7219s which connect to an Arduino and run from USB power.
(the 8x8 matrix symbol looks funny because it is a dual color part and I am only using 1 color)
The digit is 8" tall with 56 leds. Eventually, when i get things working there will soon be 4 digits total.
But I am taking small steps and making sure the digit i made will work.
Ok, that makes sense.
Doesn't sound like enough parts.
You need to isolate both the anodes & cathodes to avoid putting >5V on the 7219 pins.
You're only 1/2 way there.
See this application note.
The other option is to use a TPIC6B595 *83 (83 cents at avnetl.com) per digit if they are common anode. They can handle the higher voltage and current.
Or put a p-channel mosfet to power each segment with TPIC6D595 to pull the gate low to turn the segment on if they are common cathode.
Check the specs - the TPIC6x595 are 16, 20, 24 pins, the difference being current sinking capacity.
Need more for common anode, less for common cathode.
Thanks for the suggestion.
Well, I took care of the cathode and put in a resistor. It seems to have worked. I have some teaking to do. Because on a few digits, some segments which are not supposed to be lit are dimmly lit and flickering. Any quick suggestions on where to start diagnosing?
Also, after my digits get to "9" there are a few more (about 4) strange digits that appear before going back to "0".
I am more concerned with wiring issues before i begin to develop my programming.