TM1638 7 Segment Display & Keypad (HCMODU0095)

LCD, TFT, OLED, LED modules
Post Reply
admin
Site Admin
Posts: 879
Joined: Sun Aug 05, 2012 4:02 pm

TM1638 7 Segment Display & Keypad (HCMODU0095)

Post by admin » Sat Jan 23, 2016 8:56 am

Image




This 8 digit seven segment display module (HCMODU0095) uses a TM6138 controller allowing full control of the display using just 3 digital pins on a microcontoller. In addition to the seven segment display there are 8 individually controllable 3mm LEDs and a keypad with 8 push buttons arranged in a single row. These can also be controlled through the TM6138 IC and so require no extra digital pins. A standard 5 pin header provides easy interface to the module from your microcontroller.

Additionally if you plan to use this module with an Arduino development board we have created an exclusive library (HCTI6138) to make controlling the module as easy as possible. The library will provide full control over the seven segment display (providing the ability to display alphanumeric text), the 8 LEDs, and reading the state of the keypad. It is also capable of controlling multiple modules from one Arduino and is only limited by the number of spare pins and memory. The library can be downloaded from the software section of our support forum.

Where to buy: http://hobbycomponents.com/displays/721 ... lay-keypad





Product code: HCMODU0095
Supply Voltage: 5V
Controller: TM1638
Dimensions: 76mm x 50mm







Example: Driving the module from and Arduino with the HCTM1638 library

Image

Image



Image

Code: Select all

/* FILE:    HCMODU0095_Text_And_Numbers.cpp
   DATE:    21/01/16
   VERSION: 0.1
   AUTHOR:  Andrew Davies
   
   
21/01/16 version 0.1: Original version

This sketch demonstrates the use of the HCTM1638 library with the Hobby
Components TM1638 Serial Seven Segment Display & Keypad (HCMODU0095) to
display some text and numbers.

Connect the module to your Arduino as follows:

Module.....Arduino
VCC........+5V
GND........GND
STB........Digital pin 7
CLK........Digital pin 8
DIO........Digital pin 9

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/

/* Include the library */
#include "HCTM1638.h"

/* Set the digital pins used to interface to the module */
#define STB 7 // Strobe pin
#define CLK 8 // Clock pin
#define DIO 9 // Data pin


/* Create an instance of the library */
HCTM1638 HCTM1638(STB, DIO, CLK);



void setup() 
{
  /* Set the LED display brightness to maximum */
  HCTM1638.Brightness(0x07);
}



void loop() 
{
  /* Display some text starting at position 8 */
  HCTM1638.print7Seg("HELLO !!", 8);
  delay(2000);
  HCTM1638.Clear();
  
  /* Display a integer number starting at position 6*/
  HCTM1638.print7Seg(1234, 6);
  delay(2000);
  HCTM1638.Clear();
  
  /* Display a decimal number starting at position 7 with 3 decimal places */
  HCTM1638.print7Seg(-12.345, 7, 3);
  delay(2000);
  HCTM1638.Clear();
  
  /* Display a decimal number starting at position 7 cropped to 1 decimal place */
  HCTM1638.print7Seg(-12.345, 7, 1);
  delay(2000);
}


Image

The HCTI6138 Arduino library can be downloaded from the software section of our support forum here:

http://forum.hobbycomponents.com/viewto ... 954&p=4760



TM6138 datasheet:
TM1638_V1.2.htm.pdf
You do not have the required permissions to view the files attached to this post.

stargazzr
Posts: 3
Joined: Sat Aug 06, 2016 12:16 pm

Re: TM1638 7 Segment Display & Keypad (HCMODU0095)

Post by stargazzr » Sun Aug 14, 2016 12:09 pm

I am very new to the Arduino Uno. I have built this lab and tried to run it.

I get this error message below. Can somebody help me figure out what I'm doing wrong?

I do have, or I think I have copied this file "HCTM1638.h" to the same folder as my sketch.
I will keep trying to troubleshoot this while I wait for help.

Error message:

"C:\Users\Robert\Documents\Arduino\TM1638 8-Digit 7 Segment LED Display\sketch_aug14a\sketch_aug14a.ino:36:22: fatal error: HCTM1638.h: No such file or directory

#include "HCTM1638.h"

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno."

stargazzr
Posts: 3
Joined: Sat Aug 06, 2016 12:16 pm

Re: TM1638 7 Segment Display & Keypad (HCMODU0095)

Post by stargazzr » Sun Aug 14, 2016 12:14 pm

  • I have enabled verbose feature.

    Arduino: 1.6.10 (Windows 7), Board: "Arduino/Genuino Uno"

    C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\Robert\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10610 -build-path "C:\Users\Robert\AppData\Local\Temp\buildf0a37083c95b16d9593428b22b4bd2e3.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\Robert\Documents\Arduino\TM1638 8-Digit 7 Segment LED Display\sketch_aug14a\sketch_aug14a.ino"
    C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\Robert\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10610 -build-path "C:\Users\Robert\AppData\Local\Temp\buildf0a37083c95b16d9593428b22b4bd2e3.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\Robert\Documents\Arduino\TM1638 8-Digit 7 Segment LED Display\sketch_aug14a\sketch_aug14a.ino"
    Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
    Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
    Detecting libraries used...
    "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Robert\AppData\Local\Temp\buildf0a37083c95b16d9593428b22b4bd2e3.tmp\sketch\sketch_aug14a.ino.cpp" -o "nul"
    "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10610 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Robert\AppData\Local\Temp\buildf0a37083c95b16d9593428b22b4bd2e3.tmp\sketch\sketch_aug14a.ino.cpp" -o "C:\Users\Robert\AppData\Local\Temp\buildf0a37083c95b16d9593428b22b4bd2e3.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
    C:\Users\Robert\Documents\Arduino\TM1638 8-Digit 7 Segment LED Display\sketch_aug14a\sketch_aug14a.ino:36:22: fatal error: HCTM1638.h: No such file or directory

    #include "HCTM1638.h"

    ^

    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    Thanks!

andrew
Site Admin
Posts: 1427
Joined: Sun Aug 05, 2012 4:15 pm

Re: TM1638 7 Segment Display & Keypad (HCMODU0095)

Post by andrew » Mon Aug 15, 2016 7:47 am

Libraries have to be put a particular place in your my documents folder. For this library you need to make sure that all the files (most importantly the two files ending in .h and .cpp) contained in the zip file are placed in the following following folder:

C:\Users\username\Documents\Arduino\libraries\HCTM1638\

If either the Arduino or libraries folder doesn't already exist in your my documents folder then just create them. In most cases the easiest way to install a library is to install them via the Arduino IDE. From the Arduino menu simply select Sketch->Include library->Add .Zip library

Then point it to your downloaded zip file and the Arduino IDE will put it in the right place for you.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

stargazzr
Posts: 3
Joined: Sat Aug 06, 2016 12:16 pm

Re: TM1638 7 Segment Display & Keypad (HCMODU0095)

Post by stargazzr » Mon Aug 15, 2016 12:13 pm

Thanks I got that part working. I still have an issue. If I can't figure that out I'll post that here. It's been 1994 since I did much of anything with circuits when I graduated from DeVry. We had nothing like Arduinos. They are amazing and I wonder what I would have done with hours and hours to play with them in the electronics lab.

Tooky
Posts: 1
Joined: Wed Feb 22, 2017 9:08 am

Re: TM1638 7 Segment Display & Keypad (HCMODU0095)

Post by Tooky » Thu Feb 23, 2017 6:41 am

stargazzr wrote:Thanks I got that part working. I still have an issue. If I can't figure that out I'll post that here. It's been 1994 since I did much of anything with circuits when I graduated from DeVry. We had nothing like Arduinos. They are amazing and I wonder what I would have done with hours and hours to play with them in the electronics lab.
Same here. Can you imagine having Arduinos back then?

Post Reply

Return to “Display”