Polling Arduinos on LAN for Data

This is the place for queries that don't fit in any of the other categories.

Polling Arduinos on LAN for Data

Postby jogl8 » Fri Feb 08, 2013 6:00 pm

Last fall, when I didn't even know how to spell Piethon, I was working on a little program to read data via usb from an Arduino and writing that data to an Sqlite3 database. Thanks to the guys that helped I was able to get that going very nicely.

Since then I have hung a few more data collecting Arduinos on my LAN using Ethernet shields. They are crudely set up as servers.

Now I want to write a Python program to read the incoming data and write it into the database. Since I already have the data base part working all that I would like to find are some good (ie.: short, simple and not obfuscate) examples of code for reading incoming data from fixed IP adresses.

Eventually I will want to change my Arduino and Python coding so that the Python program polls the Arduino's, but for now just reading the regularly sent data via the LAN would be a big step forward for me.

Can anybody direct me to some good examples?

Posts: 34
Joined: Fri Feb 08, 2013 4:46 pm
Location: SW Ontario, Canada

Re: Polling Arduinos on LAN for Data

Postby stranac » Fri Feb 08, 2013 6:27 pm

Well, I know next to nothing about arduinos(never even saw one), but I think I can help with the python bits.

You need to connect to it over a socket.
You can do this either by using the stdlib socket module, or a higher-level networking library(recommended), which will take care of the painful/complicated bits, such as twisted.

For raw sockets, there are a few examples in the official documentation.
For twisted, this is a nice place to start. Also, don't be afraid of their docs.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 5 guests