ALR REVOLUTION

The purpose of the device

This computer modding device allows to collect several very useful devices in one. In about four times bigger then normal Midi Tower server case there are two independent computers (standard ATX motherboards, RAID array, two ATX power supplies and other peripherals), audio-video switch, radio tuner, audio signal spectrum and level analyzer, power amplifier, cooling system that consists of the six twelve centimeters fans with adjustable air velocity, measurement of motherboards main parameters, also it is possible to start up main systems at the appointed time. All data are displayed on two 128x64 Graphical LCDs. Management is conducted with the help of a 8-button keyboard.

Key features of the device

  1. Volume, balance, equalizer [TDA9859].
  2. 4 AV inputs/outputs and 3 Audio inputs commutation [TDA9859/MAX4618].
  3. Spectrum (mono) and level (stereo) analyzer.
  4. Built-in radio: 6 presets, search function [TEA5757H].
  5. Power independent clock and calendar. Starting of any of the two computers on schedule [DS1307].
  6. The analysis and display of the data from two computers.
  7. Data collected from LPT port (CPU load (%), memory load (%), SWAP file (%), network activity (kB/s)). And directly (not through LPT) measurement of the temperature (1 sensor is connected (up to 8 maximum) ) [DS1621] and the HDDs' activity.
  8. Fan's speed management (PWM).
  9. Management of Power On/Off and Reset of two computers.
  10. Password protected start-up of the main systems with floating code. When you enter an incorrect password time before the next attempt is growing exponentially. There is a possibility of changing the password.
  11. Touch startup and automatic move up of the LCD and Keyboard unit.
  12. Automatic shutdown of the main processor after ATX power off and automatic move down of the LCD and Keyboard unit.

The structure of the electric scheme

Electric scheme is made using three processors : ATmega32, ATmega16, ATtiny2313.

ATmega32 (operating at a frequency of 18,432 MHz) has the main control functions: master of the ATmega16 (TWI Protocol), controls sound and volume, switching audio-video inputs (TDA9859 - TWI Protocol), a clock/calendar/alarm clock (DS1307 - TWI Protocol), checking of the temperature (DS1621 - TWI Protocol), and activity of the HDDs, the spectrum analyzer and level of the audio signal, passwords input, showing data on two GLCDs, backlighting and control keyboard and display.

ATmega16 (operating at a 8 MHz frequency of built-in generator) functions are: management of the radio, fan rotation speed, data from the two LPT ports, management Power On/Off and Reset of the two computers, STANDBY function of the power amplifier.

ATtiny2313 (operating at a 4 MHz frequency of built-in generator) functions are: monitoring servomotor, survey of the sensors unit indicators and keyboards, beep when you are clicking buttons (3 kHz signal generation) and operations performed by mechanics, power on/off of the main scheme ATmega32/16, communication with the ATmega32 to confirm permission to turn off the power, a volume sensor management, voltage control of the two ATX power supplies of the computers.

This electrical scheme is optically isolated, also this device has an independent power supply. Optically isolated are: LPT ports, PWM control of the fans, management of the Power On/Off and Reset, data of the HDDs activity and +5V port at the ATX power supplies.

The program structure for ATmega32

The program consists of four main modules: the initial module, password module, display of different work modes and command module.

FLAGS is a major variable in the program. Its structure is as follows: the last digit "K" is set to 0 (no keyboard clicks) and 1 (the keyboard was pressed). The remaining levels determine different working cycles. See table.

Initial loading. Definition of the I/O ports, interrupts, loading from the EEPROM constants, loading password. Loading a first animated image.

Password module. Forming a password with floating code, password control, recognizing correct entry, forming delays with an incorrect input and blocking the keaboard in case of wrong password.

Display modes. Depending on the state of variable FLAGS device will display different menus. If the digit "K" is set to 1, the program moves to fulfill the command module. For ease of navigation it is structured in five main menus with the relevant submenus.

Menu

Submenu

Spectrum Analyzer

The volume, balance, equalizer

 

The switching of audio-video inputs

 

Radio Management

Clock-calendar

 

Analysis of data from two computers

Computer #1, group of data #1

 

Computer #1, group of data #2

 

Computer #2, group of data #1

 

Computer #2, group of data #2

Power On/Off and Reset

 

Setup

 

 











Button "MENU" is used for moving through the menu. Button "SUBM" is used for choosing submenus. Button "SEL" is for selecting the needed parameter. Parameter can be adjusted using buttons "UP","DOWN". Button "SAVE" is for saving the current parameters of the screen to in long term memory. The display and keyboard illumination can be disabled by pressing button "D_OFF", the usage of the remaining buttons is clear from the context menu.

The functions of the buttons are displayed on the LCD upon the buttons, and change depending on the concrete menu or submenu.

The spectrum analyzer. In this menu processor, at first loads submenu to the right screen, and then start proceeding spectrum and level analyzer. After processing information from the ADC, checking digit "K", CPU turns into a sleep mode, goes out after ADC interrupt CPU processes data again, and so on around the circle. If it is found 1 in digit "K" - commands are processed, then again loads submenu to the right screen, and then start proceeding spectrum analyzer.

Clock and calendar. When entering this menu interrupt INT1 starts working every second (by the DS1307 - external clock scheme). If interruption occurs CPU reads time and displays it on the LCDs, checks digit "K", CPU turns into a sleep mode. After INT1 interrupt the cycle repeats.

Data analysis of the data from two computers. When entering this menu interrupt INT1 keep working every second (by the DS1307 - external clock scheme). If interrupt occurs ATmega32 reads data through TWI from ATmega16. Next the data is processed and displayed on the displays. After checking the digit "K", the controller turns into a sleep mode, from which it goes out by INT1 interrupt and the cycle repeats. In case of displaying temperature and HDDs' activity each second the temperature readout from DS1621 chip through TWI takes place. Then port PB1 start working as input and counts pulses of HDD activity through CD4503. It makes connection to the needed indicator (1 of 2 computers depending on submenu). In case of inactivity it goes to highly impedance state. That chip is used for switching between two PC-motherboards HDD Activity LEDs. When interrupt occurs Atmega32 finishes counting, port PB1 becomes output again, processing of a number of pulses and displaying data on LCDs takes place.

Menu Power On/Off and Reset. When entering this menu screens showing two pictures and inscriptions of the buttons, the processor turns into sleep mode.

Menu Setup. ATmega32 reads data from clock/calendar, from EEPROM data load about speed of the fans, the contrast of the LCD, data alarm constants necessary for ATmega16, than processor turns into sleep mode.

Command unit. Any button click starts INT0 interrupt. The keyboard is scanned and the code of the button is stored in the buffer. The digit "K" of the FLAGS variable is set to 1. Processor goes to the command unit only if digit "K" of the FLAGS variable is set to 1. After execution digit "K" of the FLAGS variable set to 0. When entering the command unit all timers and interrupts are stopped. Depending on the state of variable FLAGS code and pressed button processor performs a command. This can be change in the variable FLAGS (move to another menu or submenu), change settings (or adjusting settings) and transferring commands or data to other devices.

Data exchange protocol between ATmega32 and ATtiny2313. Indeed, the exchange takes place through a single port PA3. ATtiny2313 every 16 seconds is scanning 5V voltage coming from each of the ATX power supply. If it finds 0V on all ATX power supplies (i.e., the computers were turned off) it makes INT0 interrupt for ATmega32 and puts PA3 to zero, then, with little delay, sets the port PD4 as input. If interruption occurs ATmega32 checks the PA3. If it is zero, i.e. the power off procedure is initiated, the controller checks the alarm data. If it is not 00:00, (alarm is set) and the power cannot be turned off. In order to send ATtiny2313 this information ATmega32 turns port PA3 into output and transfers the it to zero. If ATtiny2313 detects 0 - it goes to standby mode, not turning off power of the main system, and expects a 5V on any of the ATX power supplies. If 1 is found, the system of the main processors shuts down, the block of LCDs with keaboard goes down.

The program for ATmega16

This chip is TWI-slave device and entirely subordinate commands coming from ATmega32. It can be in two states: execute a command (Power On/Off and Reset, Standby power amplifier, recording constants), or execute subprograms (data collection and handling from the LPT ports, work with the radio). One thing it always does is implementing a PWM modulation to control the fan speed. Structure of commands received from ATmega32 is presented in table.

The command consists of addresses ATmega16, subaddress of the command and data.

When working with LPT ports, it connects the needed LPT port 1 or 2 and initializes an appropriate interrupt INT0 or INT1. Indeed controller emulates the work of two character symbol HD44780 based LCD indicator. In the flow of data it is looking for a command 0x80 (starting line) and then writes the data to four buffers that are separated by spacer 0x20. Having written four data flows into the buffer, it goes to processing: collects data within each buffer in a number, then depending on the number of buffer process a "normalization" (turns the number into percents) using appropriate constants (they are received at the beginning from the ATmega32 and they can be changed in the setup menu). Then it writes the four numbers into the output buffer, where the ATmega32 can pick them up.

If the command to work with FM radio is transferred, controller being a subprogram issues a command to the radio and reads the frequency at which station is find. When working with fixed settings, it loads the appropriate frequency from EEPROM to the radio and coincides the number of setting. FM tuner uses the three wires (DATA, Clock, Write Enable), plus the mono/stereo. Commands used here can be found in TEA5757H PDF. It is important that for loading the tuner you have to use the "real" frequency which is +10.7 MHz.

About the choice of microcontrollers and other devices

Controller ATmega32 is selected because spectrum analysis requires about 1.6 kB of SRAM. Spectrum analyzer is based on Fast Fourier Transform and is somewhere between the Audio Spectrum Monitor (http://elm-chan.org/works/akilcd/report_e.html) and FFT AVR (http://www.apetech.de/article.php?artId=7&nnId=17).

For getting data from two LPT ports 20 free ports were required. That's why I used ATmega16. It has a built-in TWI interface and differs from ATmega8515, for example, which doesn't have it.

Originally I thought about obtaining data from computers via USB, but .... First, I made 2 USB devices : IgorPlugUSB (http://www.rifer.narod.ru/usblcd.html) and USB LowCostEdition (http://www.modding-faq.de/index.php?artid=615). The first difficulty is that Igor-PlugUSB was often lost by the Windows and I had to seek "for new equipment". USB LowCostEdition was stable but it works only with one Windows program STLCD (www.stlcd.de). STLCD can collect all computer data, except computer load. That was bad. Also there was no economy "in chips" since USB device must be always on and I can't connect 2 USB port to one controller and switch between them. So I used LPT.

Selecting of LCDsmartie 5.2 was not random. The analysis of data issued to HD44780 based LCD by a variety of programs (JALCDS, LCDMONITOR, LCDHYPE, LCDSTUDIO etc.) revealed that only LCDsmartie 5.2 sends them in compact and correct way. Other program's flow structure was very big and irrational.

Minimum was required to service the servomotor and other sensors, i.e. ATtiny2313.

Galvanic isolation. Most quick isolation of times the signal rise/fall about 70 ns is on the fans. A little slower isolation was used on LPT ports. Even slower isolation was used to enter data of the HDDs activity.

Radio tuner is build on TEA5757H chip. It was used FM tuner card for PC, unnecessary components (SoundBlaster and embedded processor for transforming commands from PCI chipset) were removed.

 











Used literature:
1. TDA9859
2. TEA5757
3. MAX297
4. MAX4618
5. OP Amps for every one. Ron Manchini. //Texas Instruments, 2002
6. ATMEL.com

© 2006-2007 Vladislav Shapovalov

E-mail: 3dfilm@mail.ru.

Hosted by uCoz