Triface is a generic development board designed by Develer. The board mounts an AVR ATmega128/ATmega1281 processor and provides 8 digital input ports, 4 analogic input ports, 8 output ports connected to relays (able to commutate a current of 5A) and 2 RS232 UART port.
The purpose of this project is to implement an interactive shell on the UART port to manage all the devices present on the board.
The user will be able to attach a terminal on the UART port and issue specific commands to read and change the state of the various devices.
Hardware Requirements
- a Triface board
Software Requirements
BeRTOS components used for this project:
- Device drivers: UART, ADC, BUZZER
Implementation
The application implements a simple protocol over the UART port to parse the supported commands and issue the opportune action, all in a main loop.
The supported commands are the following:
- ver: print the firmware version
- sleep N: sleep N milliseconds
- ping: dummy command to check the availability of the board
- dout N: set the output of the digital ports according to the bitmask represented by the number N, passed as argument
- rdout: read the state of the digital output ports
- reset: perform a software reset
- din: read the state of the digital input ports
- ain: read the state of the analogic input ports
- beep N: beep for N milliseconds
Real-life application
As a practical example, the Triface board has been used to implement an automatic door opener. A Promag(TM) GP20 RFID reader is connected to a UART port and the other UART is connected to a PC server (see diagram below).
Data read from the RFID reader are converted into strings (using the BeRTOS keytag module) and sent to the server, that hosts the database of all the allowed IDs that can open the door.
Whenever an allowed ID is detected, the PC sends back to the Triface a commands over the other UART to configure the relays so that the door can be opened.
The full hardware schematic is ready to download in the sidebar on the right.
Future work
In the future version of the Triface door opener the database is not hosted anymore to an external PC, but both database and the logic to match the allowed IDs has been moved to the board.
Download BeRTOS SDK!
- With BeRTOS SDK you can generate and edit directly a sample project and setup your work environment in a few click! Download it now!
