Module – TM1651 – LED segment displays
Hardware
Let op: Aansturing dmv microcontroller, dit is niet direct een voltmeter om op een batterij aan te sluiten!
Informatie (ENG)
This is battery level display module based on battery style digital tube LED. It contains 10 segments LEDs.
There is driver chip TM1651 onboard, so the control interface is simple, just two signal lines and VCC / GND. It can be used to display the battery power.
Features:
– Compatible with UNO R3
– It is suitable for battery indicators and you can read it in the sun
– Color: Red
– 8 adjustable luminance levels
– Working voltage: 3.3-5.5VDC
– Working current: 20mA(MAX)
– Logic level voltage: 3.3V / 5V
Pinout
Arduino - Battery indicator
Wat heb je nodig?
1) TM1651 bibliotheek
Sluit de module aan volgens onderstaand overzicht:
Script – Battery charging
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include "TM1651.h" // pins definitions for TM1651 and can be changed to other ports #define CLK 3 #define DIO 2 TM1651 batteryDisplay(CLK, DIO); void charging() { for (uint8_t level = 0; level < 8; level++) { batteryDisplay.displayLevel(level); delay(500); } } void setup() { batteryDisplay.init(); // BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7; batteryDisplay.set(BRIGHTEST); // light the frame of the battery display batteryDisplay.frame(true); } void loop() { charging(); } |
Script – Battery blink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include "TM1651.h" // pins definitions for TM1651 and can be changed to other ports #define CLK 3 #define DIO 2 TM1651 batteryDisplay(CLK, DIO); void blink() { batteryDisplay.displayLevel(7); batteryDisplay.frame(true); delay(1000); batteryDisplay.displayLevel(0); batteryDisplay.frame(false); delay(1000); } void setup() { batteryDisplay.init(); // BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7; batteryDisplay.set(BRIGHTEST); } void loop() { blink(); } |
Script – Battery heartbeat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include "TM1651.h" // pins definitions for TM1651 and can be changed to other ports #define CLK 3 #define DIO 2 TM1651 batteryDisplay(CLK, DIO); void beat() { for (uint8_t level = 0; level < 7; level++) { batteryDisplay.set(level); batteryDisplay.frame(true); delay(100); } for (uint8_t level = 7; level > 0; level--) { batteryDisplay.set(level); batteryDisplay.frame(true); delay(100); } } void setup() { batteryDisplay.init(); batteryDisplay.displayLevel(7); batteryDisplay.frame(true); } void loop() { hbeat(); } |
Arduino Library
Library for LED Battery Display based on TM1651
Download @ https://platformio.org/lib/show/6865/TM1651/examples
Schema
Teardown
GEEN GEGEVENS
Datasheet
GEEN GEGEVENS
Fritzing
GEEN GEGEVENS
Downloads
GEEN GEGEVENS