LCD Ethernet SD with Arduino

Should I make an application to acquire two analog signals and 6 digital (all small band).
The system must be connected to the PC with Ethernet cable, it must have a small display and data storage to an SD.
Is it possible to do so with only one Arduino?
I know that in the Arduino Ethernet Shield the SD card is not supported
and also the Arduino Mega is not compatible with Arduino Ethernet Shield.
can you help me, Thank you

check out this one - it’s all there
and functions well with an Ethernet-shield

http://www.watterott.net/projects/arduino-s65

Site is in german, but the schema and the demos are for all.

thanks but the expansion port is for wireless-transreceiver isn’t for ethernet-port

May be worth looking at in lore detail as they say in the code package readme:

"Known issues

If using the Ethernet-Shield together with the S65-Shield,
this must be initialized before using the SD-Card."

Which sounds promising.

David

and also the Arduino Mega is not compatible with Arduino Ethernet Shield.

With a (small?) hardware modification the Mega is AFAIK compatible with the Ethernet Shield.

–Phil.

Actually it takes a small hardware hack and also a small change to the ethernet library - both easily done. See below:

Hack to get the Ethernet shield to work with the Arduino Mega.

(see http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/ - April 2009 update
 towards the bottom of the page.)
 
The problem: The ethernet shield uses the MISO, MOSI, SCK, and SS pins which
are digital pins 13, 12, 11 and 10 on the Arduino Diecimila/Duemilanove or 
compatible boards like freeduino and seeeduino.

But on the Arduino Mega pins 50,51,52, & 53 are used for these functions.

The fix:

Bend out pins 13, 12,& 11 slightly 
so they won't plug into the Mega board.

Connect:
MEGA pin 50 (MISO) ==> Shield pin 12.
MEGA pin 51 (MOSI) ==> Shield pin 11.
MEGA pin 52 (SCK) ==> Shield pin 13.

In the Arduino_0xx\hardware\libraries\Ethernet\utility folder locate spi.h
Make a copy of the file and rename the copy to spi.h.old

Edit spi.h - Locate each of the following lines and make the changes shown:

#define SPI0_SS_BIT    BIT2    changes to:   #define SPI0_SS_BIT    BIT4
#define SPI0_SCLK_BIT  BIT5    changes to:   #define SPI0_SCLK_BIT  BIT1
#define SPI0_MOSI_BIT  BIT3    changes to:   #define SPI0_MOSI_BIT  BIT2
#define SPI0_MISO_BIT  BIT4    changes to:   #define SPI0_MISO_BIT  BIT3

PORTB |= SPI0_SS_BIT; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);\
changes to:
PORTB |= SPI0_SS_BIT | BIT0; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);
                    ^^^^^^^
          (Add the " | BIT0" as shown above)
        
And finally:

#define IINCHIP_CS_BIT  BIT2    changes to:  #define IINCHIP_CS_BIT BIT4   

(I used #ifdefs so it would be easier to switch back and forth between board types)

Finally save spi.h. Then locate and delete all files with ".o" extensions in the 
libraries\Ethernet folder and the Libraries\Ethernet\utility folder. They will be recreated
the next time you open the Arduino IDE ( or compile/upload a sketch).

Here’s my modified spi.h
Since the libraries automatically recompile when you change board types in the Arduino IDE you can just use this header file and things will be correct when you change boards.

//-----------------------------------------------------------------------------
//AVR Mega168 SPI HAL
// MODIFIED by Roy Kniskern to handle the Mega pins 7/19/09

#define BIT0                                          0x01
#define BIT1                                          0x02
#define BIT2                                          0x04
#define BIT3                                          0x08
#define BIT4                                          0x10
#define BIT5                                          0x20
#define BIT6                                          0x40
#define BIT7                                          0x80


// __AVR_ATmega1280__ will be automatically #defined if the Arduino Mega board is selected
// the ATmega1280 is the chip used in the Mega
#ifdef __AVR_ATmega1280__
                  // use this to use Ethernet Shield with Arduino Mega
            #define SPI0_SS_BIT                                    BIT4  
            #define SPI0_SCLK_BIT                              BIT1
            #define      SPI0_MOSI_BIT                              BIT2
            #define      SPI0_MISO_BIT                              BIT3
#else
                  // use this for smaller Arduinos (Original version)
            #define SPI0_SS_BIT                                    BIT2      
            #define SPI0_SCLK_BIT                              BIT5
            #define      SPI0_MOSI_BIT                              BIT3
            #define      SPI0_MISO_BIT                              BIT4
#endif

#define SPI0_SS_DDR                                    DDRB
#define SPI0_SS_PORT                              PORTB

#define SPI0_SCLK_DDR                              DDRB
#define SPI0_SCLK_PORT                        PORTB

#define SPI0_MOSI_DDR                              DDRB
#define SPI0_MOSI_PORT                        PORTB

#define SPI0_MISO_DDR                              DDRB
#define SPI0_MISO_PORT                              PORTB


#define SPI0_WaitForReceive()                        
#define SPI0_RxData()                               (SPDR)

#define SPI0_TxData(Data)                        (SPDR = Data)
#define SPI0_WaitForSend()                        while( (SPSR & 0x80)==0x00 )

#define SPI0_SendByte(Data)                        SPI0_TxData(Data);SPI0_WaitForSend()
#define SPI0_RecvBute()                              SPI0_RxData()

// PB4(MISO), PB3(MOSI), PB5(SCK), PB2(/SS)         // CS=1, waiting for SPI start // SPI mode 0, 4MHz

//#ifdef MEGA_HACK
#ifdef __AVR_ATmega1280__
                  // use this to use Ethernet Shield with Arduino Mega

  #define SPI0_Init()                  DDRB  |= SPI0_SS_BIT|SPI0_SCLK_BIT|SPI0_MOSI_BIT;\
                                                                        PORTB |= SPI0_SS_BIT | BIT0; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);\
                                                                        SPCR  = 0x50  
#else
                  // use this for smaller Arduinos (Original version)
  #define SPI0_Init()                  DDRB  |= SPI0_SS_BIT|SPI0_SCLK_BIT|SPI0_MOSI_BIT;\
                                                                        PORTB |= SPI0_SS_BIT; PORTB &= ~(SPI0_SCLK_BIT|SPI0_MOSI_BIT);\
                                                                        SPCR  = 0x50  
#endif                                                                        
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
//IInChip SPI HAL
#define IINCHIP_SpiInit                              SPI0_Init
#define IINCHIP_SpiSendData                        SPI0_SendByte      
#define IINCHIP_SpiRecvData                        SPI0_RxData

//#ifdef MEGA_HACK
#ifdef __AVR_ATmega1280__
                  // use this to use Ethernet Shield with Arduino Mega
      #define IINCHIP_CS_BIT                              BIT4
                  // use this for smaller Arduinos (Original version)
#else
      #define IINCHIP_CS_BIT                              BIT2
#endif

#define IINCHIP_CS_DDR                              DDRB
#define IINCHIP_CS_PORT                              PORTB

#define IINCHIP_CSInit()                              (IINCHIP_CS_DDR |= IINCHIP_CS_BIT)
#define IINCHIP_CSon()                              (IINCHIP_CS_PORT |= IINCHIP_CS_BIT)
#define IINCHIP_CSoff()                              (IINCHIP_CS_PORT &= ~IINCHIP_CS_BIT)
//-----------------------------------------------------------------------------

May be worth looking at in lore detail as they say in the code package readme:

"Known issues

If using the Ethernet-Shield together with the S65-Shield,
this must be initialized before using the SD-Card."

Which sounds promising.

David

Yes, the S65-Shield works together with the Ethernet-Shield.

Here is an Arduino based monitor system for Nagios and Icinga
http://blog.fupps.com/2009/05/11/naguino-an-arduino-based-lcd-monitor-for-nagios-and-icinga/

Regards,
Andreas