Pages: [1]   Go Down
Author Topic: Arduino and logging over network with Node.js  (Read 3079 times)
0 Members and 1 Guest are viewing this topic.
Slovenia
Offline Offline
Newbie
*
Karma: 1
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys.

I've made a tutorial on how to use arduino with ethernet shield and Node.js server to make remote logging.

On Arduino I have a sketch which reads from analog port and sends udp packets to desired ip and port.
On the other side I have a computer with Node.js and udp server to listen to udp traffic.



I would really like to hear from you if tutorial is ok to improve on next. smiley
Tutorial is here: http://frenki.net/2012/10/remote-logging-with-arduino-and-node-js/
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1899
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
First of all. I think this is really interesting for remote debugging. I havn't tried it out yet but I probably will when I need something like this.

My comments on the text:

I read a bad advice in the first paragraph:
Quote
Connect arduino to your computer with usb cable and plug in additional 9V power adapter to make sure that shield will have enough power.
Put the ethernet shield on the arduino and plug in the ethernet cable from your network.
That should be
Quote
Put the ethernet shield on the arduino and plug in the ethernet cable from your network.
Connect arduino to your computer with usb cable and plug in additional 9V power adapter to make sure that shield will have enough power.
As far as I understand this runs on "Windows (XP or newer), Mac OS X (10.5 or newer), and Linux systems that use IA-32, x64, or ARM processors."
I think you should state that somewhere.

On the other hand you use a .bat file which is very windowish. Maybe you should say something like in windows you cane use a .bat file. In other os use the equivalent.

Best  regards
Jantje
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Slovenia
Offline Offline
Newbie
*
Karma: 1
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you. I will fix it.

Just one more thing...
More advanced users could leave out byte to int conversion in node.js code:

if you change:
fs.appendFile('mydata.txt', msg.readUInt16LE(0) + crlf, encoding='utf8');//write the value to file and add CRLF for line break

into:

fs.appendFile('mydata.txt', msg, encoding='utf8');

You will be saving bytes in ascii characters and logging file will be much smaller...
One of my next projects will be to use arduino as an oscilloscope to send a lot of data quickly over UDP to browser.
In that case udp packets will be 512 bytes long instead of 2 bytes as in this example.
« Last Edit: October 06, 2012, 07:10:50 am by Frenki_ » Logged

Dallas, TX
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Great work! thanks for sharing this. I was able to follow your tutorial and get it working.

Thank you,
Chris
Logged

Pages: [1]   Go Up
Jump to: