Drive the multiplexed 4 digit 7-segment display

 Author:   Posted on:    No comments

Seven segment displays are widely used in clocks, meters and other devices that need to display numerical information. The elements of the display, which are usually made from LEDs, are lit in different combinations to represent Arabic numerals. They have a limited ability to display some characters because there are only 7 elements that compose the shape of the displayed figure. Seven segment displays are very easy to find and are the cheapest display type.

In the previous post I talked about the electrical connections of such displays and how they should be interfaced to a microcontroller (MCU). A 7-segment display requires current limiting resistors on each segment and transistor drivers for each digit. This time I will identify the pins of an unmarked display device, I will wire it on the breadboard to an Arduino Nano compatible board and I’ll attempt to write the software to drive it.

Drive the multiplexed 4 digit 7-segment display

Proper wiring of a 4 digit 7-segment display

 Author:   Posted on:    No comments

Seven segment displays are widely used in clocks, meters and other devices that need to display numerical information. The elements of the display, which are usually made from LEDs, are lit in different combinations to represent Arabic numerals. They have a limited ability to display some characters because there are only 7 elements that compose the shape of the displayed figure.

Seven segment displays are very easy to find and are the cheapest display type. Nowadays, modules with such displays do exist, where a display of 4, 8 and even more digits are driven by an integrated circuit. This driver gets the digits to be displayed from a microcontroller (MCU) via a serial bus. This saves a lot of pins and makes programming easy since all modern MCUs have support for the common serial protocols. Examples of such ICs are MAX7219, TM1637 and TM1638. The latter two come with support for keypad, therefore you can build front panels with buttons and display using such ICs.

Proper wiring of a 4 digit 7-segment display

Use CH341A with AsProgrammer on Windows

 Author:   Posted on:    1 comment
CH341A serial programmers are cheap and quite popular. One of the most used device is the MiniProgrammer. CH341A is a chip with USB port. It can be interfaced with parallel ports, serial ports, I2C and SPI devices. The manufacturer of CH341A chip offers drivers for all operating systems. They even offer API for programmers who want to build software to talk to CH341A. In spite of this, software tools for CH341A are not very easy to find. Linux users have some command line tools, but Windows users had no open source software.

AsProgrammer is a graphical interface tool that can read, erase and write serial memory chips. It has been created by Alexander and it seems to exist since late 2011. It supports for UsbAsp, AVRISP-MKII and CH341A programmers. The utility is released under MIT license and can be downloaded from GitHub – binary releases here. I tested the utility with I2C EEPROM and SPI FLASH chips with success.

Use CH341A with AsProgrammer on Windows

Counting time with Arduino (basic clock)

 Author:   Posted on:    No comments
When it comes to counting time using an Arduino or other MCU platform, the use of a RTC (real time clock) circuit is highly recommended. These devices are cheap, have good accuracy and keep counting time even when the main MCU is not powered. They run from a small battery and draw low current. There are quite a lot of Arduino libraries that deal with time and make the interaction with a time source easy. One of these is the Time library by Paul Stoffregen. It is a well written library with internal time based on standard Unix time time_t (number of seconds passed since Jan 1, 1970).

But I wanted something even more basic. I wrote a 50 lines of code function that increments seconds variable each time it is called. When seconds overflow (reach 60), it increments minutes variable and resets seconds. And so on. Only when a time variable changes, it is printed on the output device (16x2 LCD in this case). Around this function I added code that turns the Arduino into a common clock. As a prototype as used the LCD and keypad shield fitted to an Arduino Uno compatible board. The code should compile on any other development board because it doesn't use specific functions or libraries. You will have to adjust LCD pin configuration and keypad buttons (require modification if using buttons connected to digital input pins instead of the analog keypad).

Counting time with Arduino (basic clock)

Truly LCD front panel: the backlight (2)

 Author:   Posted on:    No comments
Here is the follow-up of the post where I described how I took out the front panel of a router (yes, a router) and found a way to interface it with Arduino or other development board. It should be noted that the front panel electronics use 3.3V levels, therefore the popular 5V Arduino boards cannot drive the front panel. Using level shifters would complicate things and increase the possibility of something going wrong, so I ended up using a 3.3V STM32 blue pill development board. This is programmed from Arduino IDE, so the code I write is compatible with Arduino development boards.

While I was sampling various pins of the front panel connector with a logic analyzer, I noticed a strange protocol on pin 18. I was able to trace the PCB track from pin 18 near an area that seemed like a DC-DC converter. It directly drove an integrated circuit marked T43. Searching for it revealed some LDO linear voltage regulators, but this was not the case. Pin 18 carried a digital protocol that would be of no use for an ordinary voltage regulator. But without information I could only write code that would mimic the protocol I sampled. Things changed once the GPL source code has been made public. The signal on pin 18 had a meaning. It was necessary to turn on/off and dim the backlight. Upon powering the front panel on the breadboard, the backlight stayed off. You can turn it on by setting pin 18 high but if you want to adjust its level you must send two bytes using a custom serial protocol. Before getting to the code let’s see an overview of the pins and connections on the breadboard.

Front panel connector adapter on breadboard
Front panel connector adapter on breadboard

Router's LCD and keypad interfaced to Arduino (1)

 Author:   Posted on:    No comments
A router with display is not something you see everyday. That’s why when I saw two such routers that were discarded I bought them. At that time I had absolutely no idea if I could install an open source firmware on them (such as OpenWrt). I didn’t even know what type of display do they use. Currently, there is no way of installing a 3rd party firmware on those devices. But the front panel of the router can be interfaced to a microcontroller (only a specific hardware version).

The devices I’m talking about are SerComm SHG1500 routers, used for ADSL internet. They are based on Broadcom BCM6361 SoC and, although this platform is supported by OpenWrt, a specific build for this device or a way to upgrade firmware isn’t known. So I gave up this idea. But upon opening the case, the front panel with LCD display looked like a module that could be used for my projects. The LCD is color TFT, 2.8” size. Next to it there is a capacitive keypad with 5 keys. Front panel plugs into main board using a 2x15 pins, 1.27 mm pitch connector. It seemed good enough to start gathering information.

SerComm SHG1500 front panel with LCD and capacitive keypad
SerComm SHG1500 front panel with LCD and capacitive keypad