Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post

Asurino - an Arduino library for the ASURO

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

What is needed


To get advantage of all Arduino features (flashing, terminal)

  • ATmega168 processor
  • ISP programmer for flashing the modified bootloader
  • Arduino Bootloader for the ASURO from Sourceforge
  • An Arduino board and a modified ASURO

ASURO changes

No changes are needed if you use the Arduino IDE only for compiling your sketches. The Arduino terminal and flash functionality does not work with the IR transceiver because the control lines of the serial port are initialised to wrong values.

Windows: You can flash the generated Hex file with the ASURO Flash tool and the IR transceiver. For terminal I/O Hyperterminal is needed.

Mac OS X: You can flash the generated Hex file with the ASURO McFlash tool and the IR transceiver. Terminal I/O is included in that program.

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 has been attached at the ASURO. Alternative modules like USB/UART or Bluetooth/UART are possible. See full article at AsuroWiki (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 '/hardware/arduino/avr' folder inside the Arduino application. 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=0x3F
 asuro8.bootloader.lock_bits=0x0F
 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=0x00
 asuro168.bootloader.path=atmega168asuro
 asuro168.bootloader.file=ATmegaBOOT_168_asuro.hex
 asuro168.bootloader.unlock_bits=0x3F
 asuro168.bootloader.lock_bits=0x0F
 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 test
   Switches = asuro.readSwitches();
   if (Switches)                     // at least one switch was pressed
   {
     Serial.print("Switches pressed: ");
     Serial.println(Switches, BIN);  // send value in binary so one can identify the switches
     asuro.setStatusLED(RED); 
     delay(1000);                    // wait 1 sec
   }
   asuro.setStatusLED(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