Asurino - an Arduino library for the Asuro

Asurino is an Arduino library for the Asuro Robot. The library is based on the sketch for the Asuro. The name Asurino is a fusion of the words Asuro and Arduino.

What is needed

  • an Asuro
  • the newest Arduino IDE
  • the Asurino library form Sourceforge

To get advantage of all Arduino Features (Flashing, Terminal)

  • an ATmega168 processor
  • an ISP programmer. For flashing the modified bootloader
  • the Arduino Bootloader for the Asuro from Sourceforge,
  • an Arduino board and a modified Asuro,

Asuro changes

No changes are needed if you only use the Arduino IDE for compiling your sketches. You can flash the generated Hex File with the Asuro Flasher Tool and the IR Transceiver. For Terminal I/O Hyperterminal is needed. The Arduino terminal does not work with the IR Transceiver because the control lines of the serial port are initialised to wrong values.

If you want to flash the Asuro with the Arduino IDE and use the Arduino Terminal a modified Asuro is needed.

Another modification is shown here. For this modification, no Arduino Board is needed. A RS232/UART modul have been placed on the Asuro. Alternative modules like USB/UART or Bluetooth/UART are possible. See the full article at AsuroWiki (sorry it is written in german).


Asuro RS232-Modul This image at Flickr

Arduino IDE changes

A new board for the Arduino IDE needs to be created. This is done with some changes in the 'boards.txt' file in the 'Arduino-vvvv/hardware' folder. Just append the following lines to the boards.txt file.

For the unmodified Asuro with ATmega8:

 ##############################################################
 asuro8.name=Asuro w/ ATmega8
 asuro8.upload.protocol=stk500
 asuro8.upload.maximum_size=7168
 asuro8.upload.speed=2400
 asuro8.bootloader.low_fuses=0xdf
 asuro8.bootloader.high_fuses=0xca
 asuro8.bootloader.path=atmega8asuro
 asuro8.bootloader.file=ATmegaBOOT_8_asuro.hex
 asuro8.bootloader.unlock_bits=03F
 asuro8.bootloader.lock_bits=00F
 asuro8.build.mcu=atmega8
 asuro8.build.f_cpu=8000000L
 asuro8.build.core=arduino

For the modified Asuro:

 ##############################################################
 asuro168.name=Asuro w/ ATmega168
 asuro168.upload.protocol=stk500
 asuro168.upload.maximum_size=14336
 asuro168.upload.speed=9600
 asuro168.bootloader.low_fuses=0xff
 asuro168.bootloader.high_fuses=0xdd
 asuro168.bootloader.extended_fuses=000
 asuro168.bootloader.path=atmega168asuro
 asuro168.bootloader.file=ATmegaBOOT_168_asuro.hex
 asuro168.bootloader.unlock_bits=03F
 asuro168.bootloader.lock_bits=00F
 asuro168.build.mcu=atmega168
 asuro168.build.f_cpu=8000000L
 asuro168.build.core=arduino

Bootloader changes

The Arduino bootloader for the Arduino boards uses port in pb5 for the status LED. Unfortunately this port is connected to the right motor driver on the Asuro. So when entering the bootloader, the right motors begins spinning. In the modified bootloader for the Asuro port pin PB0 is used for the status LED, which is connected to the green status LED on the Asuro board.

 /* Onboard LED is connected to pin PB2 (e.g. Crumb8, Crumb168) */
 #define LED_DDR  DDRB
 #define LED_PORT PORTB
 #define LED_PIN  PINB
 /* 20060803: hacked by DojoCorp, LED pin is B5 in Arduino */
 /* 20080108: hacked by Pete62 LED pin is PB0 for Asuro
 /* #define LED      PINB2 */
 #ifdef ASURO
 #define LED      PINB0        
 #else
 #define LED      PINB5
 #endif
 #endif

For making the modified bootloader for the Asuro compatible to the original Arduino bootloader, the baudrate is reduced to 9600Baud. So an original Arduino bootloader can also be used with the Asurino library.

 /* set the UART baud rate */
 /* 20060803: hacked by DojoCorp */
 /* 20080108: hacked by Pete62, 9600 Baud for the Asuro */
 //#define BAUD_RATE   115200
 //#define BAUD_RATE   19200
 #define BAUD_RATE   9600

At least the makefile have been modified. The Asuro Board runs with an 8MHz oscillator.

 # enter the target CPU frequency
 AVR_FREQ   = 8000000L

A new target 'asuro' and the define 'ASURO' for the Asuro specific initialisation has been added to the 'Makefile'. To build the Asuro Bootloader invoke the command 'make asuro'.

 asuro: TARGET = asuro
 asuro: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=4' '-DASURO'
 asuro: $(PROGRAM)_asuro.hex 

Asuro example sketch

An example sketch for testing the obstacle switches of the Asuro. Other examples are included in the library.

 #include <Asuro.h>
 Asuro asuro = Asuro();
 void setup()
 {
   asuro.Init();
   Serial.begin(2400);
   asuro.setTimer2();                /* 36kHz for IR communication */

 }
 void loop()
 {
   int Switches;
   /* front switch check */
   Switches = asuro.readSwitches();
   if (Switches)                     /* Key pressed? */
   {
     Serial.println("switches pressed");
     Serial.println(Switches, BIN);  /* send key value in binary */
     asuro.setStatusLED(RED);        /* status led red */
     delay(1000);                    /* wait 1sec */
   }
   asuro.setStatusLED(GREEN);        /* status led green */
 }

For the modified Asuro the setup funktion is slightly different:

 #include <Asuro.h>
 Asuro asuro = Asuro();
 void setup()
 {
   asuro.Init();
   Serial.begin(9600);
 }

Downloads

Check the Sourceforge project page for Updates of the bootloader & library

Weblinks

Share