Pages: [1]   Go Down
Author Topic: 2 arduinos 1 shield  (Read 1916 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Arduino pals

I am wondering if I can use 2 different arduinos to access the same sd card on a Ethernet shield, I am working on a web server logger but while Accessing to to the data via web browser the logging is not done, I am think on implement the logger in one UNO ant the web server in other UNO.

Best,
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 642
Posts: 50362
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am working on a web server logger but while Accessing to to the data via web browser the logging is not done, I am think on implement the logger in one UNO ant the web server in other UNO.
While the web server has the file open for read, the logger can't open it for write. So, it really doesn't matter how many Arduinos you throw at the problem. You need to redesign your application so that the web server can serve up the file in between the times that logging occurs.
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 223
Posts: 13910
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


You can have one webserver arduino that serves pages from its local SD card, and logging messages are send (e.g. over I2C) to a second arduino that has only an SD Card (cheaper) to log them.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks,

Do you think that using a faster Arduino, as the Due, can make the application work better?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 642
Posts: 50362
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do you think that using a faster Arduino, as the Due, can make the application work better?
Probably not. But, without seeing your code/having any idea WHAT you are logging, that's only a guess.
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks,

Do you think that using a faster Arduino, as the Due, can make the application work better?
It depends.  I suspect in general you will be limited by network speeds on the web server, the speed of writing data to/from one Arduino to the other, and the speed that the SD card can write on the logger.  If those are your bottlenecks, then putting a faster processor in won't help at all.

It may be the Due/Mega might be useful in that they would have more memory, and you could do both the logging and the web stuff in one processor.  However, that probably requires you to be real careful so that each thread (web serving, writing to the SD card) doesn't interfere with the other.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 642
Posts: 50362
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
However, that probably requires you to be real careful so that each thread (web serving, writing to the SD card) doesn't interfere with the other.
Since the Arduino isn't running a multi-threaded operating system, that shouldn't be a problem.
Logged

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1857
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
However, that probably requires you to be real careful so that each thread (web serving, writing to the SD card) doesn't interfere with the other.
Since the Arduino isn't running a multi-threaded operating system, that shouldn't be a problem.
I was thinking more  that since you have two logical threads, but no threading infrastructure, that instead of doing blocking reads and delays, you have to do polling, and use techniques like blink without delay so that both threads will be done.  It isn't rocket science, but it is attention to detail.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 642
Posts: 50362
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It isn't rocket science, but it is attention to detail.
That I'll agree with. And, it's the point I was alluding to when I said that the web server needed to access the file only when the logger wasn't trying to write to it.
Logged

Pages: [1]   Go Up
Jump to: