Show Posts
Pages: [1] 2
1  Development / Other Software Development / Kernel upgrades and USB-Serial-FTDI on: April 01, 2011, 08:10:30 am
The last couple of custom compiles of new kernels on my server have failed to get the attached Arduino up and running again, due to failure of configure to compile in the FTDI driver even though it was compiled in previous version.

My process is:
Download and untar the source.
make mrproper
copy .config from old kernel source (where ftdi was compiled in and working) to new
make menuconfig and lazily don't bother to check, just save, compile and install, reboot.
All seems good except that Arduino is not working.

Check USB devices in kernel and lo and behold FTDI driver is not compiled in.
Check it off, recompile and install, all good.

So problem resolved ok, but I must be missing something in the .config file - maybe that config param gets renamed every time and so is not recognized?
2  Using Arduino / Storage / Re: Arduino + official ethernet shield + SD -> all working together. on: March 15, 2011, 10:28:00 am
Here is my serial output from Gixxer latest version.

Code:
********************** Arduino Started **********************

Setting up SD card...

Initializing SD card...Card initialized.

 ***************** Failed to connect to client *****************

error opening datalog.txt

 ***************** Failed to connect to client *****************

error opening datalog.txt


Since aboshan has no problem this could be just my setup. SD files seem to be ok for my approach (see earlier in thread) so I'm not sure what is different. Using new UNO and Arduino0022. Only changes to code are to use fixed IP suitable for my subdomain, remove references to gateway since this will be correctly deduced by the system, and change MAC addr.

Since it is only a few days until Gixxer has his hardware in hand will wait and see what transpires at that time.
3  Using Arduino / Installation & Troubleshooting / Re: jumper wire.. on: March 09, 2011, 08:13:49 am
OK, this we can do. Just a matter of finding the right solution. Here are some ideas without prejudice to any. All depends on final result desired. I have never done any of these apart from #1 and 2.
the header is just a plastic tube which contains a metal spring.
The spring presses against the wire holding it in place.

1. hold the Arduino upside down and give it a tap. If the spring is weak the wire falls out. Really simple idea but had to be enunicated. I'm sure you tried that already.
2. Sometimes the metal spring can take two 24 AWG side by side. Maybe see if you can slide another piece alongside. Maybe with gentle pulling the friction between the wires will be greater than the friction between wires and metal sleeve.
3. If pulling out the helper wire leaves the old wire in place, try #1 again. Spring may have weakened.
4. If the wire is close to the top, find a way of removing the plastic of the header to expose enough of the wire to get a purchase and pull it out. Maybe a Dremel type tool and needle nose pliers.
5. Unsolder the entire header block and insert new one. (Soldering iron, vacuum pump)
6. Convert F pin header to M pin header with wire as per #2 and leave wire in.

Before doing any of these get second opinion and think through the alternatives and other solutions such as getting a new Arduino!
4  Using Arduino / Project Guidance / Re: Arduino and php serial class on: March 09, 2011, 07:39:10 am
It's possible that dio may help you. It is helpful for me in reading serial from Arduino.

http://pecl.php.net/package/dio
5  Using Arduino / Installation & Troubleshooting / Re: jumper wire.. on: March 09, 2011, 07:16:15 am
Need more info:
What size jumper wire is stuck inside, 22, 24 AWG?
What is your estimate of the length of wire stuck, and position inside the pin? (ie can you see the top of the broken wire, and does it extend right to the bottom of the pin).
6  Using Arduino / Project Guidance / Re: Status flashing sequences on: March 08, 2011, 04:50:15 am
Thanks for the suggestions. The BIOS POST codes led me to:

http://www.computerhope.com/beep.htm#06

which has interesting alternatives. Some of these are Morse-like in that they consist of 3 or 4 grouped shorts and longs.
I'm not overly impressed with the idea of say nine, ten, eleven shorts in a row, much room for error. I've no doubt Marconi considered a scheme with 1 spark for A and 26 sparks for Z. Also found other pages for different devices each with their own scheme, many based on Morse like sequences.

My application for this is a standalone UNO+SD - if in setup I can do my diagnostics and at the end of that ping out 3 short flashes for success then that will be enough to reassure me that it's doing its thing. After that I am confident it will keep on track. I have already found that pin 13 is bad for this signalling, as soon as the SD is initialized it seems that pin 13 is taken over since flashes become garbled. Pin 8 seems to be ok with its own LED+resistor.

I envision at least a few useful common codes:
three shorts for end of setup and successful launch into loop(),
continuous wide spaced single shorts (Morse E) for fatal error (the BIOS POST continuous tone is not a good idea unless it is warning of nuclear attack),
a long and two shorts (D) might indicate a disk error, plug in card, etc.

Yet another application-specific scheme I guess.
7  Using Arduino / General Electronics / Re: Current consumption UNO+Eth Shield on: March 07, 2011, 08:58:37 am
Thanks Hobbified: true, batteries are in series. Voltage when fresh was 6.7, which as you say fell quickly to 6.4 and then to 6.1+ where it seemed to hang for a long time but the logging kept going. Then much later I found no lights on the unit and 3V from the batteries.

They depleted surprisingly rapidly. 4 hours is not long enough for my application, will have to go with another power supply. At least I learn that when presented with low voltage the unit did not go into hysterics, on this occasion.
8  Using Arduino / Project Guidance / Status flashing sequences on: March 07, 2011, 07:25:36 am
Sometimes when working with standalone boards (ie you don't have the opportunity to read diagnostics written to serial) it is helpful to use LED flashing sequences to indicate status of setup, looping etc. Say two longs for file setup failed, or 3 short (ie Morse for "S") to indicate success  This is pretty easily programmed into the Arduino by getting the Digital pin 13 onboard LED to let you know what is going on.

Have there been any attempts to standardize particular flashing sequences? I would imagine that situations are pretty much unique calling for different patterns, but some individual signals might fall into a common category.
9  Using Arduino / General Electronics / Current consumption UNO+Eth Shield on: March 07, 2011, 06:38:34 am
My batteries powering my UNO+EthShield+LED+TMP36 did not last as long as anticipated. I am using the LED as a light detector. The batteries (5) are 2300 mAH NiMh loaded into a plastic box that came with my experimenter's kit. The setup lasted 4 hours, which is surprisingly low. My sketch takes analog readings from analog pins 4 and 5 and writes to microSD every 5 minutes.

My thoughts (using data from other threads, thanks):
UNO needs ~50 mA
Shield needs ~ 150 mA
LED+TMP36 need a little more.

With multimeter in series from battery pack I get readings of 220 mA while the logger is running, and 240 mA each time it writes to the microSD. At this rate I should be getting closer to 10 hours, not 4 from the batteries. My suspicion is that my charger is not fully charging the batteries. Are there any other factors I might not be taking into account?
10  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial communication with php on: March 07, 2011, 05:43:52 am
@Firegeek - looks like you are right, a resource var did not persist.

Following code produces

http://localhost/.....?action=start => Saved 61 and file pointer Resource id #3
http://localhost/.....?action=run => Found 61

Code:
<?php
session_start
(); /* enable session vars */
if (isset($_GET['action'])) {
  
$action $_GET['action'];
  switch (
$action) {
  case 
'start':
    
/* open the tty, configure the IO */
    
$fd 61;
    
$_SESSION['fd'] = $fd;
    
$fp fopen("index.html","r");
    
$_SESSION['fp'] = $fp;
    echo 
"Saved $fd ";
    if (
$fp) echo "and file pointer $fp";
    break;
  case 
'run':
    
$fd $_SESSION['fd'];
    
$fp $_SESSION['fp'];
    echo 
"Found $fd";
    if (
$fp) echo "and file pointer $fp";
    break;
  
/* other cases */
  
}
}
11  Using Arduino / Installation & Troubleshooting / Uploading to UNO on Linux - Resolved on: March 06, 2011, 11:35:46 am
I have a brand new UNO; upload a few sketches and all works fine.

Then I uploaded the DataLogger example from the Arduino0022 collection without editing. This was a big mistake. This example keeps the serial port so busy on my system that it prevents the uploader from working. I had run into this sort of thing before, and at that time following the advice to press the reset button during the upload resolved the issue.

However this time I tried many times (~50) to upload using this technique and it failed. My ttyACM0 (specified in arduino defaults file) would often disappear and not reappear on reset. Arduino software was sluggish and would not respond until after an unusual delay.

The procedure I followed this time was:

1. unplug UNO from USB
2. shut down all instances of Arduino GUI
3. start arduino GUI
4. load intended sketch
5. verify sketch compiles
6. press upload
7. wait 5 seconds
8. plug in Arduino USB
9. upload succeeded.

This may be of interest to others, including me when I fall into the same trap again.
Any point in changing the otherwise excellent example to be more upload friendly, or is this problem unique to my situation?
12  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial communication with php on: March 06, 2011, 07:24:05 am
As PaulS suggests, it might be best to check your session stuff separately from the dio.

Here is a session vars check derived from your code which works ok on my system.

Code:
<?php
session_start
(); /* enable session vars */
if (isset($_GET['action'])) {
  
$action $_GET['action'];
  switch (
$action) {
  case 
'start':
    
/* open the tty, configure the IO */
    
$fd 61;
    
$_SESSION['fd'] = $fd;
    echo 
"Saved $fd";
    break;
  case 
'run':
    
$fd $_SESSION['fd'];
    echo 
"Found $fd";
    break;
  
/* other cases */
  
}
}

When I do
http://localhost/.....?action=start => Saved 61
http://localhost/.....?action=run => Found 61

What is the result on your system? If ok, then we move on to other issues.
13  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial communication with php on: March 05, 2011, 06:09:54 am
DIO (latest beta version) works well for me with Arduino, not using Mac however, YMMV.
14  Using Arduino / Storage / Re: Arduino + official ethernet shield + SD -> all working together. on: March 03, 2011, 04:09:13 am
WillR - is this the one you read?

http://www.ladyada.net/learn/arduino/ethfiles.html

Even though a recent contribution and a good guide to server operation, this seems to be a bit out of date, the first thing you get in Arduino0022 is that include SPI.h is required since Ethernet.h needs it.

Also the example uses #include <SdFat.h> and #include <SdFatUtil.h>, whereas there is now an SD.h used in the examples in the Arduino package. If I understand correctly SD.h is simply derived from the others, however there may be some subtle overlaps and differences that we have not taken into account.
15  Using Arduino / Storage / Re: Arduino + official ethernet shield + SD -> all working together. on: March 02, 2011, 07:46:08 am
I am also trying to get this to work, but experiencing some problems. I have arduino0022 and official UNO and ethernet shield. Sorry Gixxer, I was going to try your code but it has some godaddy stuff which I did not want to get involved in.

Separately the microSD and ethernet work just fine, it is the mid-programme switch which does not work.

In the following code (borrowed heavily from the Ladyada tutorial), I make a call to the SD card to see if I can read the file, which works ok, then switch on the ethernet which starts responding ok. Then when I use the browser to open the root it just prints "Files" (good, that is all it is supposed to do) but when I specify a file in the url the code is supposed to drop the ethernet, switch to micro SD and print the file contents just as it did successfully in the setup, the file cannot open.

Code:

/*
  SD card read/write
 
 This example shows how to read and write data to and from an SD card file
 The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4
 
 created   Nov 2010
 by David A. Mellis
 updated 2 Dec 2010
 by Tom Igoe
 mods by Colin Beckingham 2011
 
 This example code is in the public domain.
 
 */
 
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>

/************ ETHERNET STUFF ************/
byte mac[] = { 0x... };
byte ip[] = { 192, ... };
Server server(80);

/************ SD STUFF ************/
File myFile;

/************ Various *************/
int goon = 1;

void setup()
{
  Serial.begin(9600);
  Serial.print("Initializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  //digitalWrite(10, HIGH); // turn off the W5100 chip!
  switch2microSD();
   
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
 
  runtest();
 
  if (goon == 1) {
    switch2eth();
    // Debugging complete, we start the server!
    Ethernet.begin(mac, ip);
    server.begin();
  }
 
}


void runtest() {
  // open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("Test opening test.txt:");
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
    goon = 1;
  } else {
    // if the file didn't open, print an error:
    Serial.println("Error opening test.txt");
    goon = 0;
  }
}

void switch2microSD() {
  //
  digitalWrite(10,HIGH);
  digitalWrite(4,LOW);
  delay(5);
}

void switch2eth() {
  //
  digitalWrite(10,LOW);
  digitalWrite(4,HIGH);
  delay(5);
}

#define BUFSIZ 100

void loop()
{
  char clientline[BUFSIZ];
  int index = 0;
  //
  Client client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // If it isn't a new line, add the character to the buffer
        if (c != '\n' && c != '\r') {
          clientline[index] = c;
          index++;
          // are we too big for the buffer? start tossing out data
          if (index >= BUFSIZ)
            index = BUFSIZ -1;
          // continue to read more data!
          continue;
        }
        // got a \n or \r new line, which means the string is done
        clientline[index] = 0;
        // Print it out for debugging
        Serial.println(clientline);
        // Look for substring such as a request to get the root file
        if (strstr(clientline, "GET / ") != 0) {
          Serial.print("1 - ");
          Serial.println(clientline);
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<h2>Files:</h2>");
        } else if (strstr(clientline, "GET /") != 0) {
          Serial.print("2 - ");
          Serial.println(clientline);
          // standard http response header + info
          char *filename;
          filename = clientline+5;
          (strstr(clientline, " HTTP"))[0] = 0;
          Serial.println(filename);
          //
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<h3>Specific file</h3>");
          client.println(filename);
          client.println("<hr />");
          // now get the file contents         
          switch2microSD();
          myFile = SD.open("test.txt");
          if (myFile) {
            Serial.println("Reopening test.txt:");
            // read from the file until there's nothing else in it:
            while (myFile.available()) {
        Serial.write(myFile.read());
            }
            myFile.close();
            switch2eth();
          } else {
            Serial.println("File open failed");
          }
          //
        } else {
          Serial.print("3 - ");
          Serial.println(clientline);
          // everything else is a 404
          client.println("HTTP/1.1 404 Not Found");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<h2>File Not Found!</h2>");
        }
        break;
      }
    }
    delay(1);
    client.stop();
  } else {
    // Serial.print(".");
  }
}


Here is the sample from the serial output:

Code:
InitInitializing SD card...initialization done.

Test opening test.txt:
testing 1, 2, 3.

testing 1, 2, 3.

testing 1, 2, 3.

testing 1, 2, 3.

testing 1, 2, 3.

GET / HTTP/1.1

1 - GET / HTTP/1.1

GET /fred HTTP/1.1

2 - GET /fred HTTP/1.1

fred

File open failed

GET /fred HTTP/1.1

2 - GET /fred HTTP/1.1

fred

File open failed

Pages: [1] 2