Comments: Using the Serial 7-Segment Display

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • -------------------- Tech Support Tips/Troubleshooting/Common Issues --------------------

    Default Firmware

    If you are having issues uploading the default firmware try using the older version of the firmware branched here => [ https://github.com/sparkfun/Serial7SegmentDisplay/tree/v3.1_live/firmware/Serial%207-Segment%20Display/Serial_7_Segment_Display_Firmware ]. This is the same firmware that is used in our production department.

    Microcontroller Sending Commands Too Fast to Serial 7-Segment Display

    If you have issues using the serial enabled 7-segment display where the LEDs flicker and display random numbers, it could be the way that you wrote your code. There was one case that I encountered where this happened after using a sequence of commands to clearing the screen, setting the mode, setting the brightness, and adjusting the cursor.

    Testing with a 5V RedBoard, the major issues that seemed to be fixed was removing the clearDisplay() function and adding a delay between setting the brightness and your cursor position. The flickering may be due to clearing the screen and writing back on the screen in your main function. By avoiding the clear screen function every time my main function looped back, the serial enabled 7-segment displayed the counter better. By adding a 1ms delay, the serial enabled 7-segment stopped displaying random numbers and flickering. It's possible that the serial enabled 7-segment display does not have enough time to set the brightness for the entire display. Adding the delay probably helped in completing the function before moving onto the next command.

    .
    .
    .
    void loop(){
    //1) Reset Command (0x76) in a one byte write (one CS cycle)
    //clearDisplaySPI(); //try not to use so much, will cause flickering when constantly clearing and displaying
    
    //2) Mode Command (0x82) followed by Data Mode (0x00) in a two byte write (one CS cycle)
    digitalWrite(ssPin, LOW);
    SPI.transfer(0x82);//command character for mode
    SPI.transfer(0x00);//data mode
    digitalWrite(ssPin, HIGH);
    
    //3) Brightness Command (0x7A) followed by Value (0xC0) in a two byte write (one CS cycle)
    /*make sure to have the modular setBrightnessSPI()function defined
    from the example code => https://learn.sparkfun.com/tutorials/using-the-serial-7-segment-display/example-2-spi */
    setBrightnessSPI(0xC0);//brightness 0xC0 = 0d192
    delay(1);//add delay to finish this function before moving on
    
    //4) Cursor Position Command (0x79) followed by Value (0x00) in a two byte write (one CS cycle)
    digitalWrite(ssPin, LOW);
    SPI.transfer(0x79);//command character cursor position
    SPI.transfer(0x00);//cursor position on the left most position
    digitalWrite(ssPin, HIGH);
    
    //rest of SPI example code with Arduino
    .
    .
    .
    

    Arduino Compile Issues w/ "0"

    If you are trying to send a special command and a data byte of 0, the compiler won't like:

    Serial.write(0x0);
    

    It will output an error similar to this:

     ... error: call of overloaded 'write(int)' is ambiguous
    C:\Program Files (x86)\Arduino\libraries\SoftwareSerial/SoftwareSerial.h:123: note: candidates are: virtual size_t SoftwareSerial::write(uint8_t)
    C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:49: note:                 size_t Print::write(const char*)
    

    The value 0x00 is not specifically defined so it could be a char(NULL), int, or a byte. The compiler doesn't understand what you are referring to. To work around this, try saving the byte into a defined variable and using it with the Serial.write() function similar to this:

    byte zero = 0;
    .
    .
    .
    Serial.write(zero);
    

    Default I2C Address on Other Microcontrollers

    The Arduino I2C library uses 7-bit addressing [ https://www.arduino.cc/en/reference/wire ]. I believe the library ignores the last bit because there is a function for reading or writing. Other development boards outside of the Arduino ecosystem may require different addressing techniques. This was stated briefly in the I2C example code:

    Please Note: 0x71 is the 7-bit I2C address. If you are using a different language than Arduino you will probably need to add the Read/Write bit to the end of the address. This means the default read address for the OpenSegment is 0b.1110.0011 or 0xE3 and the write address is 0b.1110.0010 or 0xE2. For more information see https://learn.sparkfun.com/tutorials/i2c .
    

    Additional Tutorials and Examples

    For an example using the serial 7-segment display with Raspberry Pi, I2C, and Python, check out this tutorial => http://www.derekscholten.com/2013/09/02/raspberry-pi-sparkfun-7-segment-display-clock/.

    For an example using the 7-segment serial display with Raspberry Pi, I2C, and MatLab support package, check here => https://www.mathworks.com/examples/matlab/4551-controlling-a-4-digit-7-segment-display-using-i2c.

  • Member #663794 / about 2 years ago / 1

    I can’t find the SoftwareSerial.h library in the Arduino 2.03 IDE. Where can I get it from to run the basic serial sketch?

  • Micro Maker / about 5 years ago / 1

    Using this board with MKR 1010 is pretty simple. Just connect TX on MKR to RX of the display in addition to Vcc and GND. Then open Serial1 and simply write your data.


If you've found an issue with this tutorial content, please send us your feedback!