- Control board design

As mentioned earlier Krabos uses its own controller board. The heart of it is Atmel Tiny 2313 microcontroller (further referred to as MCU).

This MCU can be programmed via In-system programming (ISP) interface using very simple programming cable instead of relatively expensive programmer - as will be described later.

The MCU itself actually requires no other parts to run. However, the controller board provides some additional functionality which makes it little more complex. Feel free to omit any parts in the design you do not consider important. You can choose not to use the parts for RS 232 connection to PC if you want to experiment just with the autonomous robot without direct control from PC.


The board can be divided into the following parts:


Power supply (5V)


This uses standard 5V, 1A integrated voltage regulator 7805. 5V is the optimal voltage for most of the components, including the MCU. Also the servos are powered from the output of this regulator. It would be possible to power the servos directly from 4 NiMH or NiCd cells and use the regulator only for the electronics, but connecting the servos to stabilized 5V makes it easy to power the robot also from commonly available DC adapters (9 or 12 V), which would not be possible otherwise, as the maximum allowed voltage for servos is typically only 6V.

On the prototype no problems with noise from the servos in the power supply were noticed in this configuration.

Power from DC adapter is connected to the standard DC connector. Power from battery is connected to the pin header with 2 pins (2.5 mm distance) next to the DC jack. My LiPol battery has just the right connector to attach to this.




The MCU uses virtually no external parts. Its ISP pins are connected to a pin header on the board and programmer cable can be connected to this pinhead to update the program in the control board without removing the MCU or switching any jumpers.



Serial communication interface


To allow control from PC, serial interface (RS232) support was included using MAX 232 circuit to convert the voltage levels between MCU and the PC. The board uses standard 9-pin female connector so that is can be connected with PC using standard male-female serial cable. There is also pinhead output intended for communication with another MCU board which could contain another (more powerful) microcontroller to serve as the brain for autonomous operation. This is not used at this stage.




There are 2 touch sensors on front of the robot which are connected directly to the MCU pins INT0 and INT1. The pins have internal pull up resistors enabled and when the sensor it activated it pulls the MCU pin to the ground. The sensor itself is composed of a short conductive pipe and steel wire which is placed in the center of the pipe. The pipe is connected with the ground of the control board. The wire is connected with the input pin of the MCU. As the wire bends and moves when it touches an obstacle, it will come into contact with the pipe thus pulling the MCU pin low. Interrupt will be generated by the MCU and the program can respond to this situation (obstacle in front of the robot). Hints for design of such sensor can be found here [8].



Low voltage detector


The board is also equipped with detection of low supply voltage using analog comparator available in the MCU. This is useful if the robot is powered by LiPol or LiOn battery (as the prototype is). Those batteries are sensitive to deep discharge which may damage them. When the system detects that voltage of the power supply is below certain level, the robot stops and flashes LED to indicate this state.

Voltage from the power supply (before voltage regulator of course) is divided by resistor divider so that when it is low (e.g. 7V), the voltage on the AIN1 pin of the microcontroller is about 1.1 V. The other input of the comparer is connected to MCU’s internal reference which has nominal voltage 1.1V with tolerance +/- 0.1V. The exact voltage which will trigger the low power state of the robot is adjusted with trim R2. For battery of 2 LiPol cells I use 7V as the trigger level.



LEDs and switch


There is one push switch and two LEDs on the board to allow some degree of direct control without PC. In the included firmware the robot can be started and stopped by the switch and LEDs indicate obstacle detection, low voltage state etc.


Schematic for the board in Eagle [7] can be downloaded from the Downloads section as well as prototype PCB layout. Please note that the PCB on prototype was drawn by hand and the PCD design is adapted for this purpose. The connections are wide and lot of wire links is used. If you will be making the PCB using more sophisticated method or have it made somewhere, you can design the board much smaller and neat.

 Controller board schematics

Fig. 3.1 - Schematics of the controller board

To download the schematics and PCB design in Eagle format plus the image of the schematics in full size click here.

 Plan of the control board

Fig. 3.2 – Plan of the control board

 Photo of the control board

Fig. 3.3 - Control board attached to the robot



In the figure above you can see the sensors connected with blue, green and white cable to pinhead connector on the board. The signal wires for servos are also connected using pinhead connector on the board. Power cables of servos are connected with screw clamp (it’s the bunch of wires to the left of the DC power jack at the rear of the robot).

As mentioned above the board is really messy. It was just a prototype, you know...


Putting the board together is not too hard. The MCU should be in a socket rather than soldered to the PCB. You may want to put the MAX 232 into socket also.