The Graphic user interface
The Graphic user interface (GUI) design.
A microcontroller(MCU) based embedded system that measures the energy utilized over time is designed, the system must operate through a user-friendly graphical user interface (GUI). The GUI is designed using Microsoft Visual studio 2010 professional. In process of designing the GUI certain measures must be met, the graphical user interface must be capable of receiving and transmitting information in and out of the microcontroller. The data transmitted in the microcontroller will manipulate the peripheral; since the system support a light dimming device, which dims a 60 W light bulb the, amount of brightness according to the choice user must be set using the GUI and the data received will be the energy consumption must be displayed on the GUI for the 230 Volts of the rated electrical appliance during its operational period. The GUI should also support data logging capabilities.
The designed system is composed of two-part hardware and implementation and the GUI system for monitoring the data and controlling the system’s peripherals. Figure 1 demonstrates the basic ideal with atmega 16 MCU as a bridge that interconnects the two parts together to make is an embedded system
The microcontroller is interfaced with visual basic studio GUI window design interconnecting the GUI with the incandescent light bulb and the energy measure metering device as shown.
The Graphical User Interface (GUI) Development
Figure 2. Flowchart for the GUI Implementation
Figure 2 shows the flowchart for the GUI developed using Visual Basic 2010. A touchpad (cursor) is used to send the ASCII code by clicking the provided command buttons on the GUI . After the PC COM port is recognized to be connected to the system, the program reads the set-up process initialized for serial transmission before GUI can be interfaced with either an RS232 serial device or a USB to RS232 converter. Thus, the internal timer refreshes the GUI graphs in real-time and data log readings to be recorded.
Visual Basic (VB) is used because it has a default serial communication prototype tools that support universal synchronous/asynchronous, has a different type of data logging capabilities components with programmable buttons along with other useful component are very helpful for designing window form. as a result, VB is proposed to be right for the design the GUI as shown in figure 3.
Figure 3. The GUI sample design
The design of the GUI is made up of three sections the first being the communication port (COM) section; this section uses the connect button connects/Disconnect to the selected COM (only when the is any available COM ports) from AVR atmega 16 MCU, a Baud rate of 9600 bps set as a default setting in the code. the source code behind this section of the GUI enables the other two sections; called the inputs and outputs sections to be active and accessible for controlling and monitoring the embedded system to transmitting and receiving data simultaneous all this accessed right after connecting to the selected COM, to prevent runtime errors or avoiding the program to crash.
The threshold value can be set in the input section and amount of brightness is controlled using the trackbar in an interval of 20% per tick (from 0 %, as being off to 100 % brightness) and this is active. For this section, the data sent to the MCU will be in a form of a string. since we have two types of input the amount of brightness and the threshold value a differentiating character will be sent to allow the MCU to manipulate the designated feature accordingly.
lastly the output section has graph showing the accumulative average power consumption shown using the spline area graph and a preset threshold shown using the green step line graphs value recorded over time and the is also data log composed of data grids view comment found in VB, partitioned into four categories; accumulative power, instant power, threshold and the time all the data is recorded through, the data is then automatically saved on excel file stored in the computer for further analysis. For receive data the is only one data received that the value of power recorded via the microcontroller.
Interfacing serial and Universal serial bus (USB)
The serial communication between the Pc and then AVR atmega 16 can be employed be connected directly via the RS232 port adapter or via PC USB port, depending on the user type of connection. Since most PC only have the USB port. The GUI will be designed to send or receive data using such ports.
In Figure 4. it shows how MAX232 and RS232 Adapter will be implemented to convert voltage levels of the RS232 cable to TTL/COMS voltage levels to be compatible with AVR microcontroller.