Arduinosaurus

As I managed to make the Arduino software work under linux, I did this week Make weekend project : “Intro to the Arduino”.

It’s really simple. When you push a button connected to pin 2, a led connected on pin 9 will fade in and out.
Easy isn’t it? Unfortunately I’m pretty bad in electronic. My first try made the led blink nervously. After several unsuccessful attempts, I decided to make things work step by step.

  1. The breadboard
    How does this thing work? After looking at this tutorial, it appears that my breadboard is separated by the center gap in 2 independent parts. Each part has 16 rows and 5 columns of contacts. All the contacts of a row are connected together.
  2. The led
    I put the led on the breadboard and connected it on pin 9. I tested it with the blinking led example. As always it didn’t work on the firsts attempt. The led was connected the wrong way.
  3. The button
    I spent a lot of time on it. I first have to figure out how it was working. So I modified the previous setup and put the button between the pin and the led. Once I got it working, I connected it to pin 2. Then according to the original schematic, I had to connect the rest of the circuit to the power pins.

Ten minutes later it was finally working! Here’s a totally wonderful and awesome video (edited with Avidemux) to prove it 🙂

[flashvideo filename=wp-content/uploads/2008/04/arduino01.flv /]

The road will be long and hard before I get the backup thingie for pc-engine done…

Arduinosferatu

Months ago, I bought an Arduino. It comes with a nice ide but I always used it under Windows. This summer I decided to stop using Windows and I haven’t played with the Arduino since then.

Some days ago I purchased some stuffs from Sparkfun (some dataflash, resistors, etc…) in order to make some kind of backup device for the pc-engine. So I decided to install the Arduino softwares on my box. I’m currently running a Fedora core 7 for amd64. There are instructions for Fedora core 6 on Arduino site. But as I’m running on an amd64 I had to recompile some stuffs.

  1. Java
    There’s no official package for sun’s java on Fedora. Just follow the instructions from Jan K. Labanowski of the Computational Chemistry List, Ltd and you are done in less than 10 minutes.
  2. AVR tools
    It’s the easiest part. Fedora core 7 includes all you need. You’ll have to install the following packages:

    • avr-binutils.x86_64
    • avr-gcc.x86_64
    • avr-libc.noarch
    • avr-gcc-c++.x86_64
    • avr-libc-docs.noarch
    • avr-gdb.x86_64
    • avrdude.x86_64
  3. RXTX
    Arduino comes with a precompiled version of RXTX. Unfortunately it’s a 32bits version. You’ll have to recompile it or you’ll have some nasty messages when trying to run Arduino. Well, it won’t crash immediately. You’ll be able to set the program directory. But once you press OK, it will crash and you’ll get a nice error message.
    After trying to compile the CVS version of RXTX, I went for a release vesion. The latest one is 2.1-7r2. According to the INSTALL file, all I had to do was the standard “./configure; make; make install” combo.

    Unfortunatelly, the kernel headers test from the configure script failed. It’s trying to compile some piece of C code but. Here’s the error : error: 'UTS_RELEASE' undeclared (first use in this function) It seems that all distros are patching RXTX to remove the use of this variable. In fact it’s only used for a sanity check. If the current kernel version is different from the one RXTX was compiled for it will prompt some error message. If you really want to use it you’ll have to add the right header in the configure script (check_kernel_headers) and some various C files.

    I went the dirty way and simply removed it. Hopefully there’s a patch from the nslu2-linux project which will do the work for you on the sources. But you’ll still have to remove the check_kernel_headers() from the configure script.

    But that’s not the end of your problems! make install won’t work. You’ll have the following error :
    make all-am
    make[1]: Entering directory `//rxtx-2.1-7r2'
    make[1]: Nothing to be done for `all-am'.
    make[1]: Leaving directory `//rxtx-2.1-7r2'
    libtool: install: `x86_64-unknown-linux-gnu/librxtxRS485.la' is not a directory
    Try `libtool --help --mode=install' for more information.
    make: *** [install] Error 1

    Hopefully this issue is addressed in the RXTX faq.

    After installing RXTX, edit /usr/java/jdk1.6.0_02/jre/lib/javax.comm.properties (create the file if it’s missing) and add the following line :
    Driver=gnu.io.RXTXCommDriver

    We are now ready to run the Arduino software!

  4. Arduino
    The latest version is Arduino 0009. Install it wherever you want. Let’s say ~/arduino. When you are done go to ~/arduino/lib. Remove RXTXcomm.jar and librxtxSerial.so. Then edit ~/arduino/arduino and modify both CLASSPATH and LD_LIBRARY_PATH to point to the directory containing RXTXcomm.jar and librxtxSerial.so. Here’s what it looks like on my system :
    CLASSPATH=java/lib/rt.jar:lib:lib/build:lib/pde.jar:lib/core.jar:lib/antlr.jar:lib/oro.jar:lib/registr
    y.jar:lib/mrj.jar:/usr/java/jdk1.6.0_02/jre/lib/ext/RXTXcomm.jar

    LD_LIBRARY_PATH=`pwd`/lib:${LD_LIBRARY_PATH}:/usr/java/jdk1.6.0_02/jre/lib/amd64:/usr/lib:/usr/local/l
    ib

    At this point we are nearly done. Don’t forget to give your user the permission to the usb device (/dev/ttyUSB0 in my case). Plug the Arduino board and launch the ide. There’ll be some gcc warnings. Don’t pay attention to them.

    First set the serial port. Go to Tool > Serial Port and choose the correct interface. If you don’t know it, leave the menu and unplug the board. Go to the Serial Port menu and note the currently listed interface. Replug the board. And return to the Serial Port menu. A new usb interface may have appeared. It’s the interface the board is connected to.

    You’ll have to check if the ide is set to the microcontroller. If it’s not the case when you’ll want to upload your code to board, you’ll have the following error:
    avrdude: Expected signature for ATMEGA168 is 1E 94 06
    Take your board and look for the chip type. You can’t miss it, it’s written on it 🙂 To change the microcontroller go to Tools > Microcontroller (MCU) and choose your chip (ther’s an ATMEGA8 on my board).

    At this point everything should be alright.

8bitranger! Tornado blast!

Some months (nearly a year) ago, i made a post about etripator. It’s a pc-engine rom disassembler… At that time the code was pretty ugly. Except the csv file reading and other utility functions, all the work was made in a single C file and (worst of all) in the main function. Well some people started to test it and asked for new features.
You can easily imagine that as soon as i added new features, the all code became a real mess. If i didn’t want it to become unmaintainable and buggy as hell, i had to clean it up and start thinking seriously about its design. That’s what i did during my summer vacation. After a week of mad coding and testing, what first started as a toy looks more like a real usable program now.

Ladies and gentlemen! I’m pleased to announce the first official release of etripator!

The previous test releases can be found here.

I would like to thank tomaitheous, Charles MacDonald, B.T Garner, David Shadoff, all the punks on #utopiasoft and necstasy.

Expect more releases. Mainly because it was not heavily tested and it needs some polishing (especially the documentation. The ReadMe file I wrote sucks.).