Arduino without GUI ?

Hello ,

This is my first post on this forum. I am a complete newbie with arduino.

This is my current config :

-Ubuntu 7.10 Gutsy Alternate version (pure commandline - no gui)
-Arduino USB board - Diecimila - V2474

The reason I want to try Arduino :
-Ability to contol led's (connected to the arduino board) trough shell or perl scripts from a headless Ubuntu system.

The question :
I only see in the installation documentation instructions for using arduino from java driven software.
Is there a way to use the arduino from shell or perl scripts ? And if yes ,does anyone got some doc on how to do this setup ?

Thanks in advance for your precious time ...

It is possible. See this thread for a Makefile (which in that case was being used for a TextMate bundle but which should work without it).

Tnx for the fast answer ... man, this forum never sleeps ... :o

Ok .. so this seems possible .
There is tough a thing which worries me in the explanation on how to use this :

....

7. Type "make upload", reset your Arduino board, and press enter to

upload your program to the Arduino board.

....

Does this mean that in order to make a the board do specific actions to the output (for example blinking led's) , one needs always to press the button on the arduino ? Or can a reset be called from the command line also ?

1 Like

Tnx for the fast answer ... man, this forum never sleeps ... :o

Ok .. so this seems possible .
There is tough a thing which worries me in the explanation on how to use this :

....

7. Type "make upload", reset your Arduino board, and press enter to

upload your program to the Arduino board.

....

Does this mean that in order to make a the board do specific actions to the output (for example blinking led's) , one needs always to press the button on the arduino ? Or can a reset be called from the command line also ?

It's called the RESET button for a reason:-) You only need to press it just before an upload, or if you want to restart your program for any reason.

If you had to press the button everytime you wanted the arduino to perform an action, we'd all be sitting around pushing it non-stop!

I managed to upload some stuff but seem to stumble on this :

...
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA8 is 1E 93 07
...
...
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x13 != 0xff
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

make: *** [upload] Error 1

It seems the device isn't recognized altough the connection perfectly works. (Device signature = 0x000000).

It seems I am not the only one having this : What Is Visual Programming and How Does It Work? | AppMaster
http://arduino.ning.com/forum/topic/show?id=673339%3ATopic%3A3341

Is this an open bug for arduino-0007-core.zip ? Or related specifically to the 2.6.22+ kernel ?
It appears that on the last link here above ,mentions a wrong version of avrdude ,as well an issue with a kernel version above 2.6.22+ ...

My version of avrdude :

tux@ubuntu:~$ avrdude -v

avrdude: Version 5.4, compiled on May 21 2007 at 21:35:45
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/tux/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping


avrdude: no programmer has been specified on the command line or the config file
         Specify a programmer using the -c option and try again
tux@ubuntu:~$ uname -r
2.6.22-14-generic

If you've got a decemilia, then you most likely have an AtMega168 in the arduino, not an AtMega8 as the programmer is currently expecting (3rd line of your quoted error message)...

Try changing the microcontroller type in the tools menu

It's called the RESET button for a reasonSmiley You only need to press it just before an upload, or if you want to restart your program for any reason.

Since I want to let the board ,make do different things -while sending the command each time from a shell or perl script - ,do I then need to make a fresh upload then every time ? Or are there other ways to get this done ?

If you've got a decemilia, then you most likely have an AtMega168 in the arduino, not an AtMega8 as the programmer is currently expecting (3rd line of your quoted error message)...

Euh :-? you're right about that one. ATMEGA168-20PU

Try changing the microcontroller type in the tools menu

Since I'm working with the command line method (core , make , makefile , make upload).
I changed this in the makefile :

MCU = atmega168

But it is the line : Device signature = 0x000000 ,which gives me the real problem I think.

Which version of avrdude are you using? The standard distribution gets the device signature in a way that's not supported by the Arduino bootloader (it's a "universal" command rather than the simple "get device signature" command). Try the Arduino version of avrdude: avrdude-5.4-arduino-0010-src.tgz.

Ok .. upload succeeds now . Cheers ,mr Mellis :slight_smile:

Although avrdude installation was a bit painful. Why don't people say which packages they need ,when making something ? This has always been frustrating in gpl source.

So here it is what I needed to compile the avrdude on Ubuntu 7.10 Gutsy - Alternate - Command line :

apt-get install gcc yum bison flex
wget http://www.arduino.cc/files/avrdude-5.4-arduino-0010-src.tgz
gunzip -c avrdude-5.4-arduino-0010-src.tgz | tar -xvf -
cd ./avrdude-5.4-arduino-src
./configure
make clean
make
sudo make install

So now the uploads work. But my first test fails :-/: the blinking led.

After upload nothing happens. When pressing the reset button on he board ,the LED very briefly lights up ,and then nothing. After de-connecting ,and re-connecting the usb cable ,same thing as pressing the button.

This was the trick : make clean

When you do another try for performing the make , you need do a clean before.
So for good practice ,you should ALWAYS do this.

make clean
make
make upload

Right ! Thanks for all your help. I did here below a little step by step how I managed to get it work.

Preface : Every line starting with 'tux@ubuntu:~$' ,means that this is a command excuted by the command line
Preface : Every reference to $HOME or /home/tux , can be changed to your own home directory.

1. Check if device is recognized by system

-connect usb device to system

tux@ubuntu~$ dmesg | tail | grep "FTDI USB Serial" | grep -c "now attached"

the result of this must be '1'

If it is 0 , then your device is not recognised.
You might then need to remove the package brltty.

tux@ubuntu~$ sudo apt-get remove brltty
  1. Prepare needed files ,and execute a little test
tux@ubuntu~$ cd $HOME

-install pre-requisites :

First the downloads out of the box :

tux@ubuntu~$ sudo apt-get install gcc-avr avr-libc unzip

Clean remove of standard avrdude if present on system :

tux@ubuntu~$ sudo apt-get remove --purge avrdude

Then install the avrdude ,from arduino itself :

tux@ubuntu~$ apt-get install gcc yum bison flex
tux@ubuntu~$ wget http://www.arduino.cc/files/avrdude-5.4-arduino-0010-src.tgz
tux@ubuntu~$ gunzip -c avrdude-5.4-arduino-0010-src.tgz | tar -xvf -
tux@ubuntu~$ cd ./avrdude-5.4-arduino-src
tux@ubuntu~$ ./configure
tux@ubuntu~$ make clean
tux@ubuntu~$ make
tux@ubuntu~$ sudo make install

-Download and unpack the core file in $HOME/arduino

tux@ubuntu~$ wget http://www.arduino.cc/en/uploads/Hacking/arduino-0007-core.zip
tux@ubuntu~$ unzip arduino-0007-core.zip

-Download and configure the Makefile

tux@ubuntu~$ mkdir $HOME/arduino_projects
tux@ubuntu~$ cd $HOME/arduino_projects
tux@ubuntu~$ wget http://www.arduino.cc/en/uploads/Hacking/Makefile
tux@ubuntu~$ cp -p $HOME/arduino_projects/Makefile $HOME/arduino_projects/Makefile.original

-Create you testproject file ,connect a led between GND and pin 13 :

tux@ubuntu~$ vi $HOME/arduino_projects/helloworld.cpp

And enter this :

#include <WProgram.h>
/* Blinking LED


  • turns on and off a light emitting diode(LED) connected to a digital

  • pin, in intervals of 2 seconds. Ideally we use pin 13 on the Arduino

  • board because it has a resistor attached to it, needing only an LED

  • Created 1 June 2005

  • copyleft 2005 DojoDave http://www.0j0.org

  • http://arduino.berlios.de

  • based on an orginal by H. Barragan for the Wiring i/o board
    */

int ledPin = 13; // LED connected to digital pin 13

void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}

edit the Makefile and change these lines :

tux@ubuntu~$ vi $HOME/arduino_projects/Makefile

#<<== First the port on which to connect to ==>>#
#<<== This port can be found in the message log ==>>#
To know the port :

tux@ubuntu~$ dmesg | tail | grep "FTDI USB Serial" | sed 's/to/\;/g' | awk -F";" '{ print $2 }' | tail -1 | sed 's/ //g'

[edit]From : PORT = /dev/tty.usbserial*
To : PORT = /dev/ttyUSB0[/edit]

#<<== Then change the location to the core files ==>>#
[edit]From : ARDUINO = /Applications/arduino-0007/lib/targets/arduino
To : ARDUINO = /home/tux/arduino[/edit]

#<<== Specify project loaction ==>>#
[edit]From : TARGET = foo
To : TARGET = /home/tux/arduino_projects/helloworld[/edit]

#<<== Change this line ,depending of the version of you arduino ATMEL chip ==>>#
#<<== Out of the box ,the makefile is made for the ATMEGA8 , so I needed to change it to ATMEGA168 ==>>#
[edit]From : MCU = atmega8
To : MCU = atmega168[/edit]

#<<== I also needed to change this line ,which I think is due to version of the board ==>>#
[edit]From : AVRDUDE_PROGRAMMER = stk500
To : AVRDUDE_PROGRAMMER = stk500v1[/edit]

FINAL STEP

Now clean out the make ,perform a make ,and upload it.

tux@ubuntu~$ cd $HOME/arduino_projects
tux@ubuntu~$ make clean
tux@ubuntu~$ make
tux@ubuntu~$ make upload

Now wait a few seconds and the led should start to blink. (If not check if polarity of the connected led is ok)

And voila , pfwoeih ... not straight forward. But hey ; IT never is (luckely for us)

Hi, I posted the below this morning, then searched for shell scripts to find it
and found your post. Hope this helps.

You may have heard of Simple Message System available from the archives.
I installed it. Then I developed a series of shell scripts to communicate with
it and harvest data. Target for data is OpenOffice calc spreadsheet. My
hardware
is Diecimila with USB port. Tested w/linux. Any OSX testers?

Please try it. It isn't perfect or finished. 'wait4pin' needs work. But the rest
works fine. Run 'wget http://207.14.167.161/SMS1.tgz' or visit my mini-
website for the tarball. Thanks.

$ ls
convert ideas ledOn-1 readIO-1 setup-Arduino writePin-1
gpl.txt ledOff-1 readAD-1 readme.txt wait4pin-1 writePWM-1

This thread seems a little dated, hopefully someone will check this bump and be able to help me out. I'm a new Ubuntu user, working with Gutsy Gibon. I'm trying to get the Arduino IDE installed on my machine by following the instructions in this post everything was going well untill I go to this part:

Then install the avrdude ,from arduino itself :

tux@ubuntu~$ apt-get install gcc yum bison flex

tux@ubuntu~$ wget http://www.arduino.cc/files/avrdude-5.4-arduino-0010-src.tgz
tux@ubuntu~$ gunzip -c avrdude-5.4-arduino-0010-src.tgz | tar -xvf -
tux@ubuntu~$ cd ./avrdude-5.4-arduino-src
tux@ubuntu~$ ./configure
tux@ubuntu~$ make clean
tux@ubuntu~$ make
tux@ubuntu~$ sudo make install


)

When I entered the tux@ubuntu~$ ./configure my terminal tells me

cmdowns@cmdowns-laptop:~/avrdude-5.4-arduino-src$ ./configure
checking build system type... i686-pc-linux-gnulibc1
checking host system type... i686-pc-linux-gnulibc1
checking target system type... i686-pc-linux-gnulibc1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

Can anyone tell me what my problem is (other than being a noob) and how I can fix it and get Arduino running on my machine?

Thanks in advance for the benevolence of the wise.

Are you running a 32-bit version of Linux? If so, you should be able to just download the IDE and use the included avrdude. If not, check config.log for more information about what's failing and post the messages here.

Thanks for the reply. I am totally embarrassed to admit that I don't know if I am running a 32 bit version of linux or not. I'm guessing that since I didn't actively go looking for a 64 bit version, that I probably am using the 32. So I'll try to install the IDE as is and see if that works.

I would search on this as well :

checking for gawk... no

Can you check if 'gawk' is installed ?

Just do :

type gawk

This should give you the path were 'gawk' is found.

Also you should check if the directory were you are creating this binary is actually writable (check permissions).