Loading...
  Show Posts
Pages: 1 [2]
16  Products / Arduino Due / Re: Due and ethernet processing speed on: January 11, 2013, 10:30:51 pm
firstone,

All of the Ethernet shields from Arduino, including the latest R3 shield use the WIZnet 5100.  This chip is quite old and due to the way it was constructed the SPI speed is very slow resulting in what I would describe as just utterly terrible performance.

One of my first sketches was to output a JPEG over http stored on a SD card plugged into the Arduino Ethernet R3.  A 62 KB JPEG took over 3 seconds for the Arduino UNO with the shield to send the data to the browser which I timed using a Firefox add-on called Firebug.  The performance was very slow, it almost reminded me of dialup days or when I first used an ISDN line.

It's going to take quite some time for another Due compatible board to come out that breaks out the SAM3X8E pins and allows you to hook up an external PHY and additional time for someone to develop the code to run a TCP/IP stack.

mantoui,

I have several WIZnet 5200 and even some WIZnet 5300 chips in the mail as well as the integrated WIZ820io which contains a MagJack and the W5200 chip.  Once I receive them, I would be happy to run your benchmarks posted and confirm your findings.  If what your benchmarks show is true, we may finally be able to get acceptable Ethernet performance out of an Arduino platform running these newer chips from WIZnet.
17  Products / Arduino Due / Re: OneWire in Due on: January 11, 2013, 03:39:10 pm
I've been running the OneWire code that I posted in the ZIP file in a previous post for over 12 hours with no errors pulling data from three DS18B20's.

I have not been able to incorporate mantoui's updated read_bit function but I will do that later tonight when I'm home.

Code:
ROM = 28 A0 CE 49 3 0 0 55
  Chip = DS18B20
  Data = 1 A3 1 4B 46 7F FF D 10 CE  CRC=CE
  Temperature = 26.19 Celsius, 79.14 Fahrenheit
ROM = 28 F6 C3 49 3 0 0 25
  Chip = DS18B20
  Data = 1 A2 1 4B 46 7F FF E 10 D8  CRC=D8
  Temperature = 26.12 Celsius, 79.03 Fahrenheit
ROM = 28 6B C7 49 3 0 0 C1
  Chip = DS18B20
  Data = 1 A3 1 4B 46 7F FF D 10 CE  CRC=CE
  Temperature = 26.19 Celsius, 79.14 Fahrenheit
No more addresses.

I noticed in the Examples folder there is also a sketch for a DS2408 which is an 8 channel addressable switch.  I have a number of those lying around so I may be able to test the sketch later against one and let you know the results.
18  Products / Arduino Due / Re: OneWire in Due on: January 10, 2013, 09:53:23 pm
Great job gentlemen!

I combined mantoui's updated OneWire::write_bit function along with the changes made by alvesjc and I'm now able to run the DS18x20_Temperature right out of the box.

This effort should go a long way in getting other people moved over to the Due because so many projects have requirements to read temperatures and interact with other one wire devices.

Thanks for all your help in getting this working.

I've put all the stuff in a zip file for others to test without having to edit the files.
19  Products / Arduino Due / Re: OneWire in Due on: January 09, 2013, 12:35:16 am
alvesjc,

I'm running my Due with arduino-1.5.1r2 on Windows.

I modified the OneWire.h file like you said it seems to work now.  I'm getting the following in the serial window:

Code:
0.00
24.94
24.94
24.94
24.94
26.87
26.87
30.19
30.19
31.44
31.44
32.06
32.06

Those numbers are when I was just touching the DS18B20 with my finger so they look about right to me.

I did notice I wasn't able to get valid temps from the example that I'm using below.  It's from the examples folder in the library you uploaded, any idea why?

Code:
#include <OneWire.h>

// OneWire DS18S20, DS18B20, DS1822 Temperature Example
//
// http://www.pjrc.com/teensy/td_libs_OneWire.html
//
// The DallasTemperature library can do all this work for you!
// http://milesburton.com/Dallas_Temperature_Control_Library

OneWire  ds(54);  // on pin 54 which is A0 for the Arduino Due

void setup(void) {
  Serial.begin(9600);
}

void loop(void) {
  byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];
  float celsius, fahrenheit;
 
  if ( !ds.search(addr)) {
    Serial.println("No more addresses.");
    Serial.println();
    ds.reset_search();
    delay(250);
    return;
  }
 
  Serial.print("ROM =");
  for( i = 0; i < 8; i++) {
    Serial.write(' ');
    Serial.print(addr[i], HEX);
  }

  if (OneWire::crc8(addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return;
  }
  Serial.println();
 
  // the first ROM byte indicates which chip
  switch (addr[0]) {
    case 0x10:
      Serial.println("  Chip = DS18S20");  // or old DS1820
      type_s = 1;
      break;
    case 0x28:
      Serial.println("  Chip = DS18B20");
      type_s = 0;
      break;
    case 0x22:
      Serial.println("  Chip = DS1822");
      type_s = 0;
      break;
    default:
      Serial.println("Device is not a DS18x20 family device.");
      return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44,1);         // start conversion, with parasite power on at the end
 
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.
 
  present = ds.reset();
  ds.select(addr);   
  ds.write(0xBE);         // Read Scratchpad

  Serial.print("  Data = ");
  Serial.print(present,HEX);
  Serial.print(" ");
  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
    Serial.print(data[i], HEX);
    Serial.print(" ");
  }
  Serial.print(" CRC=");
  Serial.print(OneWire::crc8(data, 8), HEX);
  Serial.println();

  // convert the data to actual temperature

  unsigned int raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      // count remain gives full 12 bit resolution
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    if (cfg == 0x00) raw = raw << 3;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw << 2; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw << 1; // 11 bit res, 375 ms
    // default is 12 bit resolution, 750 ms conversion time
  }
  celsius = (float)raw / 16.0;
  fahrenheit = celsius * 1.8 + 32.0;
  Serial.print("  Temperature = ");
  Serial.print(celsius);
  Serial.print(" Celsius, ");
  Serial.print(fahrenheit);
  Serial.println(" Fahrenheit");
}

In the serial output window I get the following:

Quote
ROM = 28 6B C7 49 3 0 0 C1
  Chip = DS18B20
  Data = 1 FF FF FF FF FF FF FF FF FF  CRC=C9
  Temperature = 4095.94 Celsius, 7404.69 Fahrenheit
No more addresses.

Touching the sensor doesn't do anything and the numbers for Celsius and Fahrenheit don't change - They look a little bit hot to me...  smiley-roll-sweat

Let me know, I can do more testing for you and hopefully we can get a working library that everyone can run.  Thanks for your help.
20  Products / Arduino Due / Re: OneWire in Due on: January 08, 2013, 12:05:17 am
alvesjc,

I tried the library but wasn't able to get it working with my DS18B20 and my Due.  In the serial monitor after dropping your library in the Arduino\Libraries folder I ran you sketch and get the following:

4095.94
4095.94
4095.94
4095.94

If I hold the temp sensor with my finger the numbers don't change a bit, which they obviously should.

I have it wired like the following on my Due but with the data line going to Due line A0 to the middle of the DS18B20 and a 4.7k resistor going from the middle pin to the 5v line.

Sorry bud, I really want this library to work because it's one of the only hold backs keeping me from using the Due instead of the Uno/Leonardo which I have verified good working code on.
21  Products / Arduino Due / Problem with OneWire library on: December 20, 2012, 07:44:51 pm
Hello,

I recently picked up a Due and I'm finding that the OneWire library is giving me some compile errors.

Just trying to run the example "DS18x20_Temperature" in theOneWire\examples\DS18x20_Temperature folder give me a bunch of errors.  Since this is a very commonly used library I was wondering, has anyone been able to get this working on their Arduino Due?

Here is the error that is coming up when compiling:
Code:
In file included from DS18x20_Temperature.pde:1:
C:\Users\KCORE\Documents\Arduino\libraries\OneWire/OneWire.h:77: error: #error "Please define I/O register types here"
C:\Users\KCORE\Documents\Arduino\libraries\OneWire/OneWire.h:84: error: 'IO_REG_TYPE' does not name a type
C:\Users\KCORE\Documents\Arduino\libraries\OneWire/OneWire.h:85: error: ISO C++ forbids declaration of 'IO_REG_TYPE' with no type
C:\Users\KCORE\Documents\Arduino\libraries\OneWire/OneWire.h:85: error: expected ';' before '*' token

The OneWire library I'm using is from this link:
http://www.pjrc.com/teensy/td_libs_OneWire.html

Thanks for any replies or help you can provide.
Pages: 1 [2]