2.1. Description of DomoControl 128
The DomoControl128 system is the result of the collaboration of Transylvania University with Siemens PSE .
It is an embedded system designed to cover an application spectrum including: bridging different kinds of house networks, acquiring analogue and digital signals, controlling digital and analogue outputs.
The component cards of system are based on ATmega128 microcontroller produced by Atmel Corporation. The two main parts of the system are represented in figure 4.5
1. Process interface card; - implement the communication with one of RS485 bus, and assure the interface to the process. It offers the following signal processing functions:
- 4 analog input signals acquisition (10 bits resolution – 300 ms sampling period)8 digital input channels with medium input resistance
- 8 digital output channel, (opto-isolated, open collector with 500mA maximum current on outputs at 50V)
- 2 analog output signals (12 bits resolution, maximum voltage 2.5V on output, maximum current 40mA)
- 2 channel “ac switch”, with 30mA maximum current, voltage 220Vac
- 1 channel “ac switch” with 8A maximum current, maximum voltage 600Vac.
2. Human Machine Interface Card. - assure the main communication functions with the user. The features of this part are:
- A graphical display 64x128 pixels
- A keyboard with 4 keys
- 2 serial interfaces: the first is RS232 –console for programming ISP the system, and the second is RS485.
These two cards are interconnected using SPI serial interface, which implements the transfer of telegrams between the two processors.
Other important functions implemented by the system are:
- Temporization: 8 independent channels (including the real time clock)
- Watch dog function (assure the automatic hard reset when the corresponding timer is overflow).
- Brown level detection (an analog threshold that indicates the down fall of the power supply voltage)
The memory of system includes: EEPROM memory 4Kbytes, and SRAM memory 4kBits. The block diagram of the DomoControl128 is represented in figure 3.5

Figure 3.5 Block diagram of DomoControl 128 system
The DomoControl 128 system assures the implementation of following items: bridge between the two RS485 buses, (one to the home automation system supervisor, and the other that can control another RS485 bus placed at the button of the hierarchy of HAS); acquisition from the process of analogue signals, such as: temperature, pressure, water/gas flow; control of digital outputs for: window blinds, electro-valves used for switch water / gas circuits in house, input door automation and so on.
Figure 3.6 Software modules and databases implemented by DomoControl 128 system
By designing modular and scalable the software, the implementation time of applications was reduced (see figure 3.6). “Image processing” model, includes all the items that characterize each device linked through RS485 to DomoControl 128 system. By using it and also by applying the processing function on the whole we obtain a very flexible structure for the software modules that allow the fast development of applications. (See figure 3.7)
At the level of process interface card, the controller will periodically sample the inputs of system; will insert the parameters value in a memory buffer. In the same time, according to the sampling rate for commands the memory corresponding for outputs are transferred to these. A hierarchy is established and this is represented in figure 3.7.
So the digitized signals are included like items in a record. So, for analogue signal we establish to use only 8 bits/sample. All the values could be processed and grouped corresponding to devices. The assembly forms the “image process” of a home appliance (domotic) control system.

Figure 3.7 Hierarchy of signal processing using modular programs
- The implemented mechanism has the following features:
- Offer a whole image of the process
- Rigorous manipulation of dates in relation with the time coordinate
- Assure the reliability of data processing and transfer
- Opened for specific implementation
- Conversion of physical addresses into technological addresses in order to simplify elements structuring in the entire system
- Mapping in “process image” of all variables integrated by the system (both local and slave devices) will suppose not only to chart the devices but to attach data structure corresponding to each of these devices
- Time stamp information in order to assure the coherency of data transferred
2.2. Description of ATmega128 microcontroller
ATmega128 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture (see figure 4.8). By executing powerful instructions in a single clock cycle, the ATmega128 achieves throughputs approaching 1 MIPS per 1 MHz for the maximum frequency 16MHz that means 16 MIPS.
Having 133 instructions and most of them executed in one clock cycle, the processor can control until 53 input/output lines, 4 kBytes SRAM memory that include 32 x 8 bits registers, 4 kBytes EEPROM memory and 128 kBytes program flash memory.
A lot of peripheral devices are included on chip, such as: 2 timers at 8 bit each with prescalers and other 2 timer/counters 16 bits each that accept a large variety of programming modes. An analogue to digital converter is implemented on chip with 8 inputs that are multiplexed.
The microcontroller includes two USART (Universal Synchronous and Asynchronous Receive Transmit) units, one SPI (Serial Peripheral Interface) unit and the other TWI (Two Wire Interface), unit that allows implementation of a wide kind of possibilities for serial communication between the microcontroller and external systems.
A lot of possibilities are allowed to preset the system clock, such as: internal clock based on RC calibrated oscillator, external RC oscillator, and external crystal stabilized oscillator. The clock signal can be divided by software in a wide range of modes.
A large variety of power saving modes could be programmed in order to choose the optimal saving mode.
The direction of signal can be set for all the input/output lines (input / output 20mA /each line). If the port is programmed as a special peripheral unit (USART, timer, etc) this programming has priority. Interrupt sources are defined for all the peripheral devices that are treated separately using interrupt vectors.
Programming language includes instructions that implement the transfer of data from/to internal and external memory, transfer of data from/to input and output ports, using direct/indirect-addressing modes, decision instructions.
This allows to redirect the running of the program (logical and mathematical), functions of a bit or byte value, repeating instructions (loops without or with test applied in advance or at the end of loop) and arithmetical operations: addition, subtract, multiply and division. By using data transfer instructions the user can configure all the ports in a wide variety of modes, including also the internal memory and the mapping of registers in it.

Figure 3.8 Structure of ATmega 128 microcontroller
The interrupt service routines run starting from fix addresses allowing to treat specifically each of interrupts. The time loss for the change of context is very low, only four clock cycles. In this period the processor recognizes the interrupt source.
It determines the highest priority if more interrupts occur simultaneously and, in this case, decides which of them will be treat first. After it saves in memory the program counter (PC) jumping to the interrupt service routine. For more information access the site: www.atmel.com.