Hi I have a QWIIC ALPHANUMERIC DISPLAY that is hooked up to an Arduino uno with jumper cables. The power is coming from a USB cable to my computer. Power is from 3.3v and I have connected SDL and SDA to my uno.
The basic examples seem to work fine but when I try to use anything in a loop, like alternating words, the display will freeze or display weird characters. I am not sure what is wrong? I have attached a basic example that will both freeze the display and stop anything printing in serial. I have tried multiple UNO boards and sketches with the same effect.
Please Help!
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_Alphanumeric_Display by SparkFun
HT16K33 display;
void setup()
{
Serial.begin(115200);
Serial.println("SparkFun Qwiic Alphanumeric - Example 1: Print String");
Wire.begin(); //Join I2C bus
if (display.begin() == false)
{
Serial.println("Device did not acknowledge! Freezing.");
while (1);
}
Serial.println("Display acknowledged.");
}
void loop()
{
Serial.println("LOOP");
delay(500);
display.print("SIT");
delay(1000);
display.print("DOWN");
delay(1000);
display.print("NOW");
delay(1000);
}
Try swapping to 1 or 2 messages and shorten/lengthen the delays to experiment further
Thank you for the reply. I have tried this with one message and short delays and it still freezes. It will cycle through once and then freeze with the display going to strange characters. I have also tried to display a simple timer that will freeze. Pretty much anything in the loop function does not work.
I am planning to have the display print a lot of different messages that are randomized, maybe 20 or 30.
Is there a problem with the display that it can not handle that? Is there another way to write the code to make this work?
I hope this can be solved.
I also tried putting different code to send random numbers in setup and resetting the Arduino. This ran for a few times and also freezes. I feel like I have tried everything with different sketches. Do you think it is a hardware issue or is there a way to clear the cache in the board?
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_Alphanumeric_Display by SparkFun
HT16K33 display;
void(* resetFunc) (void) = 0;
long randNumber;
void setup() {
Serial.begin(115200);
digitalWrite(Reset, HIGH);
Serial.println("SparkFun Qwiic Alphanumeric - Example 1: Print String");
Wire.begin(); //Join I2C bus
if (display.begin() == false)
{
Serial.println("Device did not acknowledge! Freezing.");
while (1);
}
Serial.println("Display acknowledged..");
// if analog input pin 0 is unconnected, random analog
// noise will cause the call to randomSeed() to generate
// different seed numbers each time the sketch runs.
// randomSeed() will then shuffle the random function.
randomSeed(analogRead(0));
randNumber = random(300);
delay(2000);
display.print(randNumber);
}
void loop() {
// print a random number from 0 to 299
randNumber = random(300);
Serial.print("A random number from 0 to 299: ");
Serial.println(randNumber);
delay(3000);
resetFunc();
}
Run the example here https://learn.sparkfun.com/tutorials/sp … the-basics -
Does it work?
It also might be worth trying a different MCU if you have another option around to rule out the Uno/its buffer as a suspect
try doing a display.clear() call before each display.print()
HI Thanks for the help. I tried the display.clear() before each print and it worked for about 3 loops and then stalled again.
I have also tried all the examples provided by SparkFun and they all work. But nothing will work that loops or progresses like alternating text or numbers.
I will try to look for another arduino, all I have are UNO boards. Non of them work…
I have a deadline for a project so hopefully I can get it working soon! Any other suggestions would be appreciated.
some question / try :
what is : digitalWrite(Reset, HIGH); in your latest example doing ?
Are there other boards connected on the Wire? (if so remove for now)
Did you cut the pull-up resistor? ( it should not be cut)
What happens if you only do 1 character per display.print(). e.g. change between A, B, C and D
Try to reduce the Wire-speed with Wire.setClock(35000) ( this will set for 35Khz instead of default 100Khz )
Use your first example (not the second you provided) and add display.clear() for each print.
Thank you Paul! The second code was a bit messy and I am sticking to the first one I posted with nothing else attached to the UNO. Setting the clock did not work for full words.
However, I tried just printing one letter and it is not freezing!
What could this mean? Do you know how I can get it to print full words now that alternate?
Cheers!
Here is the code I used
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#SparkFun_Qwiic_Alphanumeric_Display by SparkFun
HT16K33 display;
void setup()
{
Serial.begin(115200);
Serial.println("SparkFun Qwiic Alphanumeric - Example 1: Print String");
Wire.begin(); //Join I2C bus
Wire.setClock(35000);
if (display.begin() == false)
{
Serial.println("Device did not acknowledge! Freezing.");
while (1);
}
Serial.println("Display acknowledged.");
}
void loop()
{
delay(1000);
display.clear();
display.print("S");
delay(1000);
display.clear();
display.print("D");
delay(1000);
}
Just another quick note, even this sketch stops working after 10 minutes and freezes on a letter. I would need this to run over the course of a day. Is this a common issue with these displays?
No… it should be working.
I assume you have connected 3v3, GND, SDA and SCL to the display QWIIC connector. By only doing 1 character the power consumption is far less. I wondered whether there could be an issue with the 3v3, maybe believe there still is. Can you measure ?
Also look at the other questions/ remarks… try reducing the speed (who knows??)
Oh man… Yes I have everything connected the way you mention. I have tried short and long delays… I am using old UNO boards to test but I am not sure that makes a difference? I don’t have anything to check the power but I can try to find a meter. Do you know what Arduino boards people usually use for this display? So strange…
I would expect that any board currently available should do… maybe you have a bad display.
One more aspect about “display freezes”. In your sketch, add Serial.println(“x”); where x = the letter you use for display.print(). Does Serial.print continue to show and the display stops updating ?
Ahh Ok Maybe I should send the display back for a new one… Are you a rep for Spartkfun? I ordered from another company so I am not sure how that works to do a replacement?
When the display freezes the serial print stops too. So it seems like the whole Arduino stops.
Very frustrating…
I am not a rep of Sparkfun, but you need to go back to the point where you bought it.
I just wonder about the freeze of the Arduino, have you tried other programs or maybe it is a power problem. Try to connect another power source. E.g. another computer or just USB wall wart power supply.
I have just tried another computer and a wall plug and also a different cable. I used this same Arduino with relays for extended periods and no friezing. So I don’t think it is the Arduino. I have spent way too much time on this with no results…
I wonder if it is possible to talk with a rep? Seems like Sparkfun technical assistants won’t answer on these forums?
Thanks for your help Paul. Not sure what else to do except ask for a returning… If there are any other thoughts on this please let me know…