Tags: atmel, bascom avr, battery holder, circuit programming, demo kit, demo program, flash ram, flowchart, jtag connector, light sensor, piezo element, power switch, program registration, project hardware, pulse train, ram space, registration number, robot model, servos, stk500,
Registration Number AT3405
Project Title: Papilion
Abstract
Papilion (Latin for ,,butterfly") aims to demonstrate the relative ease of use of ATMEL's
demo kit for the ATMEGA169, called "Butterfly".
The project uses the Butterfly as a control device for a simple two-wheeled, differential-
steered robot model.
Some of the various features of the kit (LCD, temperature and light sensor, joystick and piezo
element) are shown.
For propulsion two modified servos are used which have to be controlled by a special pulse
train. For this purpose two of the pins of the JTAG connector are used as control lines.
Initializing and driving of these lines is also demonstrated.
The programming is done in BASCOM-AVR by MCSELEC, a simple to use but feature-rich
basic dialect which is well suited for the beginner as well as the advanced user of
microcontrollers.
The short and simple program takes up about 15% of the device's flash ram space and can be
used as a template for the reader's own projects.
The program is transferred into the kit by using ATMEL's STK500 which is compatible with
BASCOM. Other means of in-circuit programming can of course be used just as well.
The hardware consists of the butterfly, a chassis which is made of aluminum, the two servo
motors and a battery holder (providing 6V), a servo power switch and a little board for
connecting the butterfly to the motors. Apart from some connectors which were soldered into
the butterfly's PCB (Port B, Port D and JTAG connectors) the kit was left intact and
unchanged.
Registration Number AT3405
Fig. 1: Robot "Papilion" with the ATMEL Butterfly and the STK500
Fig.2: Flowchart of the Demo program
Registration Number AT3405
Fig.3: Block Diagram of the project hardware
Fig.4: Schematic
Registration Number AT3405
Source Code:
'*************************************************
'
' Simple Butterfly demo
'
'*************************************************
'
'
' Butterfly functions and ports:
' ------------------------------
' Dataflash:
' PB0 SS
' PB1 SCK
' PB2 SI
' PB3 SO
'
' Joystick:
' PB4 Center
' PB6 A
' PB7 B
' PE2 C
' PE3 D
'
' Piezo Element:
' PB5 speaker
'
' Temperature sensor:
' PF0 NTC
'
' Voltage Input:
' PF1 Vinp
'
' Light sensor:
' PF2 LDR
'
' Serial port:
' PE0 RxD
' PE1 TxD
'
' free pins:
' PF4-7 from JTAG-interface: disable it!
'
' PD used with the LCD, to use it disable LCD!
'
' ************************************************
'
'
'
' Caution : don't forget to check:
' - JTAG disabled (have a look at the fuse bits) ?
' - correct setting for internal oscillator (no clock divide)?
'
'
' ------------------------------------------------