Offline
Newbie
Karma: 0
Posts: 13
|
 |
« on: November 29, 2012, 09:45:42 am » |
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
Brattain Member
Karma: 335
Posts: 36462
Seattle, WA USA
|
 |
« Reply #1 on: November 29, 2012, 02:00:21 pm » |
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
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 101
Posts: 9551
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #2 on: November 29, 2012, 02:33:54 pm » |
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
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 13
|
 |
« Reply #3 on: November 29, 2012, 04:18:04 pm » |
Thanks,
Do you think that using a faster Arduino, as the Due, can make the application work better?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 335
Posts: 36462
Seattle, WA USA
|
 |
« Reply #4 on: November 29, 2012, 06:10:32 pm » |
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
Edison Member
Karma: 28
Posts: 1147
|
 |
« Reply #5 on: November 29, 2012, 07:18:22 pm » |
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
Brattain Member
Karma: 335
Posts: 36462
Seattle, WA USA
|
 |
« Reply #6 on: November 29, 2012, 07:25:27 pm » |
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
Edison Member
Karma: 28
Posts: 1147
|
 |
« Reply #7 on: November 29, 2012, 11:12:54 pm » |
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
Brattain Member
Karma: 335
Posts: 36462
Seattle, WA USA
|
 |
« Reply #8 on: November 30, 2012, 12:26:04 am » |
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
|
|
|
|
|
|