Dear all,
I am currently delving into the realm of Arduino shield and PCB design, and I find myself facing a challenge with my project. Specifically, I have encountered an issue with the 7-segment display, which is not functioning as expected.
To provide some context, I have included the schematic of my design below, and I have also successfully fabricated the PCB based on this schematic. However, despite my best efforts, the 7-segment display remains unresponsive.
I would greatly appreciate it if someone with expertise in this area could take a moment to review the attached schematic and possibly offer guidance or insights on how to troubleshoot and rectify the issue.
Welcome, @sidbij, to the forum! Thanks for posting a schematic right off the bat, it really helps.
7805 regulator family usually need a 0.1 uF capacitor at input and at output for best results - see any number of datasheets on the web, they usually have a reference, or typical, design schematic to look at.
Other than that, nothing jumps out at me as terribly wrong with your hardware, so how about showing us your sketch, please?
Oh, and disconnect your solenoid, or replace it with an LED and resistor - I find many projects get sucked into the morass of debugging solenoid transients while trying to get their code working; instead, get it all working, then add the solenoid, so that you KNOW it's the solenoid causing problems, if it does, when you get to that step.
Ditto with your buzzer, some of those aren't really Arduino-output-compatible.
Thank you @camsysca, your guidance has been invaluable, and you're truly a lifesaver.
Regarding the sketch, I must admit I haven't had the chance to develop it yet. I've been experimenting with various codes I found online, primarily to test each individual component of the project. Fortunately, I haven't encountered any issues with the buzzer so far.
I'll make the necessary adjustments as per your suggestions and take another shot at the PCB. Should I encounter any further challenges or require additional help, I won't hesitate to reach out to you again.
You can grab any one of half a dozen example codes(most libraries come with at least one) that will test the 1637 functionality, without confusing the issue with other devices, or adding your own code. I suggest you start there, so that if it doesn't work we can begin debugging using a stable starting point.
I tried multiple codes, appended below is one sample. Apologies, I don't have permission to attach a file here. I am confident code isn't an issue here.
Thanks & Regards, Siddharth
// Include the library
#include <TM1637Display.h>
// Define the connections pins
#define CLK 11
#define DIO 12
// Create a display object of type TM1637Display
TM1637Display display = TM1637Display(CLK, DIO);
// Create an array that turns all segments ON
const uint8_t allON[] = { 0xff, 0xff, 0xff, 0xff };
// Create an array that turns all segments OFF
const uint8_t allOFF[] = { 0x00, 0x00, 0x00, 0x00 };
// Create an array that sets individual segments per digit to display the word "dOnE"
const uint8_t done[] = {
SEG_B | SEG_C | SEG_D | SEG_E | SEG_G, // d
SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F, // O
SEG_C | SEG_E | SEG_G, // n
SEG_A | SEG_D | SEG_E | SEG_F | SEG_G // E
};
// Create degree celsius symbol
const uint8_t celsius[] = {
SEG_A | SEG_B | SEG_F | SEG_G, // Degree symbol
SEG_A | SEG_D | SEG_E | SEG_F // C
};
const int buzzer = 10; //buzzer to arduino pin 9
void setup() {
Serial.begin(9600);
pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
}
void loop() {
// Set the brightness to 5 (0=dimmest 7=brightest)
display.setBrightness(7);
Serial.println("Display Brightness");
//digitalWrite(buzzer, HIGH);
// Set all segments ON
display.setSegments(allON);
delay(2000);
Serial.println("Display Clear");
display.clear();
// Show counter 0-9
int i;
for (i = 0; i < 10; i++) {
display.showNumberDec(i);
delay(50);
}
delay(2000);
display.clear();
display.showNumberDec(-12); // Prints _-12
delay(2000);
display.clear();
display.showNumberDec(-999); // Prints -999
delay(2000);
display.clear();
display.showNumberDec(31, false); // Prints __31
delay(2000);
display.clear();
display.showNumberDec(31, true); // Prints 0031
delay(2000);
display.clear();
display.showNumberDec(14, false, 2, 1); // Prints _14_
delay(2000);
display.clear();
display.showNumberDec(-5, false, 3, 0); // Prints _-5_
delay(2000);
display.clear();
// Prints 12:34
display.showNumberDecEx(1234, 0b11100000, false, 4, 0);
delay(2000);
display.clear();
// Prints 15°C
int temperature = 15;
display.showNumberDec(temperature, false, 2, 0);
display.setSegments(celsius, 2, 2);
delay(2000);
display.clear();
// Prints dOnE
display.setSegments(done);
while (1)
;
}
Hey, sorry for the late response.
The components and pcb fabrication was done via JLCPCB. The component datasheet was in mandarin, so took me some time to translate.
You guys are spot on. I should be using a common anode display, that's compatible with tm1637. But that's not what I am doing.