Hardware


Microcontroller Board


My platform is a self made board (two sided printed circuit board) with an Atmel AVR ATMEGA16 and L293D motor controller ICs. Here is a view of the assembled and soldered controller board. You may click on the pictures to get an enlarged view of the picture.



Here are pictures of the board before parts placement and soldering, first the component side,



second the solder side:





Features of this board are:

Figure Caption: µC board ATMEGA16 (older version not including all described features)



Figure Caption: Eagle board view (latest version including all features) of µController Board ATMEGA16


If you would like to build this board, you may download the file ATMEGA.zip containing all necessary files (eagle schematics and board, *.eps with mask pattern for PCB film, bill of material list, *.doc with mask pattern for printing, placement view, pin assignment, example program template.c {with board specific setup} and makefile for use with WinAVR etc.).

ATMEGA.zip

It's a two-sided board with half Euro Card format (100mm x 80mm). Two of these boards fit on one Euro Card format (100 mm x 160 mm). Therefore, I recommend to produce two of these board at a time. With the *.zip file I provide a combined mask pattern for a single UV exposure of two ATMEGA16 boards on one Euro Card format.

There are 38 via's on this board. I used a technique inserting a short wire into the vias and soldering them on both sides. Also take care that all devices on the top layer (such as electrolytic capacitors), whose pads are connected to top layer routing, must also be soldered on the top side.


Figure Caption: Pin assignment of the digital port of the board ATMEGA16



Figure Caption: Pin assignment of the analog port of the board ATMEGA16



Figure Caption: Pin assignment of the motor port of the board ATMEGA16


The software may be coded in C and compiled using the GNU Compiler Collection GCC under WinAVR (free download). You may use my files "template.c" and "makefile" contained in "ATMEGA.zip" for a quick start. The compiled code (intel hex format) is then loaded into the Atmel microcontrollers flash memory using the sp12 programming hardware (self-made board connected to the computer’s parallel interface named Ken’s Dongle after its creator Ken Huntington) and software (download available) developed by Steven Bolt, the founder of Pitronics in the Netherlands. A further programming software, which is compatible to the sp12 hardware, is provided under the name TwinAVR by Roland Walter (Berlin, Germany).

I designed a board named "programmer" on the basis of Steven Bolt's description, which fits to the pin assignment of the RJ-45 western modular jack of my µ-controller board "ATMEGA16".


Figure Caption: Eagle board view of board "programmer"


If you would like to build this board, you may download the file programmer.zip containing all necessary files (eagle schematics and board, *.eps for PCB film, bill of material list etc.).

programmer.zip

Sensor Board with 2-Axis Accelerometer for Measurement of Tilt Angle


For tilt angle measurement I am using a two-axis accelerometer sensor board (single sided SMD board) built with Freescale MMA2260D for x-axis and MMA1260D for z-axis with a bandwidth of 50Hz, which should be fast enough. Here is a picture of the sensor board:



Here is a picture of the sensor board before component placement and soldering:




The ICs from Freescale are for 5V operation, MMA2260D (x-axis, orientation towards the electric connectors) and MMA1260 (z-axis, orientaion towards the top). The range is ±2g on each axis. Output are two analog voltages between 0 and 5V (one for each axis). These outputs can be directly used on an analog input line of the µC board ATMEGA16. The electrical connectors fit to the standard fischertechnik 2.6mm-plugs. Here you see a picture of the board. The size of the board is 28 mm x 49 mm.


Figure Caption: SMD Board for 2-axis acceleration or tilt measurement. Isolation between 2.6 mm jacks and ground signal is achieved with a transparent tape



Figure Caption: Eagle board view of board "TiltXZ" with 2-axis acceleration sensor


If you would like to build this board, you may download the file TiltXZ.zip containing all necessary files (eagle schematics and board, *.eps for PCB film, etc.).

TiltXZ.zip

Rate Gyroscope for Measurement of Angular Velocity


However, the most important part for determining the tilt angle is the rate gyro CRS03-02 (bandwidth 10 Hz) by Silicon Sensing / Atlantic Inertial Systems, see:

http://www.siliconsensing.com/CRS03packaged

The datasheet of CRS03 can be found here:

CRS03_Datasheet.pdf

On the right side is a picture of the used rate gyro. I am especially grateful to Eric Whitley from Silicon Sensing / BAE Systems for providing the sample for this project. This rate gyroscope proved to be very well suited for this kind of application. It gives a highly precise signal with very low noise which can be directly processed with AD conversion. Besides the Kalman filtering for bias control no other signal conditioning is required.

New Rate Gyroscopes by Silicon Sensing / Atlantic Inertial Systems providing SPI interface


The CRS03 with its analog output is doing a great job on my balancer. Nevertheless I was very curious on the new types offered by Silicon Sensing / Atlantic Intertial Systems which are accessed via SPI bus interface. So you do not need the ADC on the microcontroller anymore. Moreover, the gyro's internal ADC is with 12-bit conversion result much more precise than the 10-bit ADC of the Atmel AVR's. There are two new gyro types of special interest: I am currently working on a new microcontroller board using Atmel AVR AT90USB1287 and two STM VNH2SP30E H-Bridges for dc-motor control. The board will have SPI bus connections to both gyros and will of course be used for my balancer. For the CRG20 I plan to use its internal AD converter for the analog signal of my acceleration sensor. This might give better results for the acceleration sensor signal conversion too. I am curious which enhancements of the balancing characteristics will be possible due to the new gyros and their internal 12-bit ADC.

Remote Control


The controller board contains an infrared receiver SFH5110-38 connected to one pin (INT2) of the microcontroller. This receiver demodulates 38-kHz-modulated infrared signals typically used by commercial infrared remote controls. I am using an Audio HiFi remote control with REC80 coding. Use the following link to my web page on how to use these remote controls (C-code and header files for download).

RemoteControl.html

If you want to use other sources, there is an application note named AVR410 with assembler code by ATMEL for decoding RC5 signal transmission. Peter Danninger provides a C-code for the same purpose on mikrocontroller.net. In future the remote control will be used to superimpose power or velocity to the two drive motors in the control equations. Then the drive direction (forward, backward, turning) and drive velocity can be controlled via infrared remote control.

Top of Page