Introduction: PANEL MOUNT 7 SEGMENT DISPLAY WITH EMBEDDED ARDUINO
PANEL MOUNT 7 SEGMENT DISPLAY
Is not always an easy task to get a good looking finished project if it includes a 7 segment display!
The main problem to get an elegant finish is the tight tolerance needed for the rectangular hole cut where the display will be exposed, only accomplished using CNC machining or laser cutting services.
Some of the components required for building & testing:
- Arduino Pro Mini clone (As I2C master)
- Low cost panel meter (For the plastic case)
- Multiplexed 7 segment display
- Universal circuit board
- Atmega (168 or 328) DIL
- 330 Ohm resistors
- 10nF Capacitor
- Male Header pins
- Female round IC header
For more info, please visit: Absolutelyautomation.com
Step 1: CHEAP PANEL MOUNT
CHEAP PANEL MOUNT
Cheap panel meters solved the problem using an enclosure (usually bigger than 1/32 DIN), those enclosures has two advantages: Requires a rectangular cut, which could have some imperfections and can be done using home tools like drill and hand saw, because such enclosures incorporates a bezel that covers imperfections once installed. The other advantage is there is no need for additional screws to fix it to the panel/chassis.
Step 2: SMART VISUALIZATION WITH EMBEDDED ARDUINO
There are 2 kinds of devices in the market: Specific meters for panel mounting (voltage, current, RPM, etc.) and "smart" displays usually using serial protocols like I2C, SPI, shift registers, some with ATmega microcontroller included and compatible with Arduino ecosystem!.
However the last ones usually came in a PCB-shaped form factor and are not easily installed on a panel/chassis in an elegant way without using additional elements and resources.
This project brings the best characteristics of all of the aforementioned devices:
- Low cost.
Panel/chassis mount with good looking aspect.
Needs simply tools for installation.
Only 2 I/O pins required for communication.
Built in processing power to offload the main processor/microcontroller.
Programmable with the Arduino suite.
Could be used as serial slave display or as a standalone controller with the I/O pins available.
Open source hardware and software (schematics and code available for download).
Can be built with through-hole components.
The design can be accommodated on a single side PCB (some wire jumpers needed).
Step 3: PROTOTYPE BUILDING
The foundation for this project was the enclosure of a ready made cheap panel meter,
easily available in local markets. Because the idea was to use through-hole components there is no much space to waste inside the enclosure, so a minimal part count Arduino-based system like Pro Mini ( ATmega168 or ATmega328) with internal 8 MHz clock was chosen because only needs one external resistor and capacitor around reset pin.
To burn the bootloader, an AVR chip programmer is needed, also some Arduino boards could be programmed as ISP using the appropriate sketch. To modify the fuses that manages the internal 8MHz clock, sometimes an oscillator circuit is needed: A crystal and two capacitors or a square wave clock generator. It depends on how the clock fuses were initially set-up.The bootloader used was ATmegaBOOT_168_pro_8MHz.hex, see documentation in the bottom part of the article for the respective boards.txt file that has the lines than must be included in the actual boards.txt file to execute the burn. Finally to compile sketches for this device the option for Ardino Pro Mini @8MHz tools->board option was used
The display used was a seven segment 3 digit multiplexed(could be common anode or cathode) of dimensions according to the available space inside the case. A current liming resistor of 330 ohms for every segment were used. (7 + decimal point = 8 ). The circuit was built on a universal circuit board cut exactly as the original PCB of the meter, leaving also the 2 little tabs on the sides for pressure fixing. There is a crude example of a single side board(some jumper wires required!) PCB below in the documentation zone.
Due to space constrains only 5 I/O pins are available to the user in any of the following configurations:(2) UART (TX/RX),(2) SPI (SDA/SCL) and (1) analog pin A3. All (5) I/O pins as digital or a mix of them.
The test firmware is based on the SevenSeg library for display multiplexing, character mapping and string interpretation tasks.
Step 4: SERIAL SLAVE
To minimize the I/O pin count used for communication with the main
processor/microcontroller, a two wire serial protocol must be used, in this specific case I2C, because only needs two signals (SDA/SCL) also support multiple devices on the same bus, using the same pair of wires. This protocol is available in almost any microcontroller in the market. In the experimental firmware every byte sent through I2C represents an ASCII character, so there is no need for a specialized library in the master. The device is almost a "serial terminal".
The first byte transmitted is a "command", at the moment the available ones are:
0x27 Display character string.
0x25 Change I2C address stored in EEPROM.
0x26 Change displayed message blink rate (useful for alarms!).
UART (TX/RX) I/O pins are also available, so some sort of byte oriented serial protocol could be implemented, like for example Modbus RTU (adding an RS-232 or RS-485 to TTL chip)
Step 5: STANDALONE CONTROLLER
The circuit is basically a derivation of an Arduino Pro Mini,
so it can be programmed for any other purpose (than a serial display) using an USB to TTL interface. With the available 5 I/O pins (a lot of I/O pins were used for the 7 segment display) some interesting projects could be built:
* Voltmeter or Ammeter, adding a precision shunt resistor and/or voltage divider.
* RPM counter using a digital pin as counting input.
* Display for I2C or 1-Wire digital sensors.
* Universal instrumentation displays for 4-20 mA or 0-10 V signals.
* Byte oriented serial protocol analyzer (Modbus, Mewtocol, DF1, etc.).
Step 6: TESTS AND CONCLUSIONS
TESTS AND CONCLUSIONS
- The circuit required a lot of patience, however, was done using only through-hole components and single side universal circuit board.
- The rectangular orifice cut was done with a drill and a hacksaw. Precision cut isn't very important because the case's bezel will cover the imperfections.
- No screws required to keep the panel case in place. Only hand pressure is needed for installing & removing
- When using an I2C master different than Arduino, is possible that the R/W bit in the I2C address field must be written, so the address could differ from the one stored in EEPROM.
- Is feasible to design a single side PCB for the circuit, however, some jumper wires will be required.
- Due to display multiplexing, power consumption is quite low (around 25 mA ), so it could be powered by batteries for portable applications.
For more info, please visit: Absolutelyautomation.com