I think the WIZ library assumes CS=D10 but that's used by the RFM69 transceiver.
You can use any pin that is not used, please study the pinout to avoid confusion: moteino.com/#pinout
Keep away from D9, it's the onboard LED.
moteino.com/#pinout
Wiznet is a module that I would also avoid, from experience - it will hang and the libraries are very heavy for the atmega328p.
www.moteino.com/#pinoutMEGA
That is library dependent not arduino variant/core dependent. You will have to check with the library.
The Motieno has the same pin assignments as the Arduino UNO. There is no arduino based on the atmega1284 so I don't know if the ethernet library will work with it.
#include <SPI.h>
#include <Ethernet.h> // modified to support alternate SS pin. See http://bit.ly/1xNy2rP
#include <TextFinder.h> // http://playground.arduino.cc/Code/TextFinder
// Slave Select Pins
const byte SS_PIN_ETHERNET = 12;
const byte SS_PIN_MICROSD = 13;
const byte SS_PIN_RADIO = 10;
char server[] = "api.wunderground.com";
byte g_mac[] = { 0xDE, 0xAD, 0xBD, 0xAA, 0xAB, 0xA5 };
byte g_ip[] = { 192, 168, 216, 40 };
EthernetClient client;
void setup()
{
pinMode(SS_PIN_ETHERNET, OUTPUT);
pinMode(SS_PIN_RADIO, OUTPUT);
pinMode(SS_PIN_MICROSD, OUTPUT);
digitalWrite(SS_PIN_ETHERNET, HIGH);
digitalWrite(SS_PIN_RADIO, HIGH);
digitalWrite(SS_PIN_MICROSD, HIGH);
Serial.begin(9600);
delay(6000);
Serial.println("MoteniMega Ethernet Test");
// start the Ethernet connection:
Ethernet.select(SS_PIN_ETHERNET); // Set slave select pin - requires modified Ethernet.h library
Ethernet.begin(g_mac, g_ip);
Serial.println(Ethernet.localIP());
// give the Ethernet shield a second to initialize:
delay(2000);
}
void loop()
{
Serial.print(F("Wind speed: "));
Serial.print(getWind());
Serial.println();
delay(10000);
}
byte getWind()
{
TextFinder finder( client );
float windDir = 0;
if (client.connect(server, 80))
{
// Make a HTTP request:
client.println(F("GET /api/cb0578a32efb0c50/conditions/q/pws:KVTWESTD3.json HTTP/1.1"));
client.println(F("Host: api.wunderground.com"));
client.println(F("Connection: close"));
client.println();
}
else
{ Serial.println(F("connection failed")); }
if (client.connected())
{
if(finder.find("wind_mph"))
{ windDir = finder.getFloat(','); }
}
else
{ Serial.println(F("not connected")); }
client.stop();
return windDir;
}
Hi Scott, I am interested to know, have you gotten the W5100 ethernet and RFM69 working on a single Moteino. I am planning on trying to build a Gateway running on a single Moteino.
I have also been doing some SPI investigation, and there are software issues with multiple devices on the SPI bus, especially where interrupts are involved. This is described here
http://dorkbotpdx.org/blog/paul/spi_transactions_in_arduino
This new SPI capability has been released in Arduino 1.5.8 (not 1.0.6), and the ethernet libraries updated to support this. The RFM69 libraries have not had such attention.
@Scott216, can you tell us how much memory you're consuming with this application using the Ethernet library?
Kiwi and I are both interested, but I'm concerned about consuming all of RAM to support Ethernet on a AtMega328P.
Tom
By the way, I looked at the code, the TextFinder library looks pretty sweet for HTTP clients...
Since you're down to that 'risky' level of available RAM, have you already moved your debug strings to Flash memory? Look on adafruit for F() macro - this helps a lot! I suppose I shouldn't be surprised that you're consuming 29K of memory, but, wow... I would have thought that the Ethernet library would over consume RAM rather than Flash storage. The good news is that using up Flash doesn't create 'instabilities' while not having quite enough RAM certainly does!@Scott216, can you tell us how much memory you're consuming with this application using the Ethernet library?
Kiwi and I are both interested, but I'm concerned about consuming all of RAM to support Ethernet on a AtMega328P.
Tom
By the way, I looked at the code, the TextFinder library looks pretty sweet for HTTP clients...
I'm compiling with IDE 1.0.5, but I want to try it with 1.5.8. Compiling my sketch (https://github.com/Scott216/Weather_Station_Data/blob/48640de1702af291b076fdea496a46ace528d126/Weather_Station/Weather_Station.ino) uses 29,780 bytes (of a 32,256 byte maximum). At the end of my setup function, I get the free RAM which is 445 bytes.
I did purchase a MoteinoMega and want to try that and see if it's more stable.