Ethernet UDP or TCPIP examples

Hi,

Looking for help getting to the next step ...

It wasn't easy (for me) to get all the parameters right but I now have my arduino on the internet with its own IP that I can ping.
I am using an official arduino ethernet shield and a TP-Link 702n router running in client mode like described here: http://www.lucadentella.it/en/2012/12/09/enc28j60-e-arduino-11/

Now, I am looking for an example sketch that (probably) uses the Arduino Ethernet library to repeatedly send a data packet (something like: $HCHDM,287.2,M*26) in order to provide data to an app that I am running on my ipad: InavX, described here: Instruments. This app has an option of displaying data that is provided via a wireless TCPIP (preferred) or UDP connection.

Question #1: Is the router's client mode even the right mode to use? I also have available on the TP-Link router: AP, Router, Repeater, Bridge)

Question #2: As far as I can tell, the ethernet library doesn't include an appropriate example sketch showing data being delivered to an app via TCPIP or UDP. A pointer to a simple example (or any hints) would be appreciated.

I'd be grateful for any insights.

David

The TCP/IP example is named "TelnetClient" and the UDP example is "UDPSendReceiveString".

It wasn't easy (for me) to get all the parameters right but I now have my arduino on the internet with its own IP that I can ping.

If the TP-Link router is in client mode I guess you're not connected to the Internet but to your local LAN. You probably can ping the Arduino on the LAN but not from the Internet. I guess that's enough for your project, I pointed it out just in case you expect it to be used remotely.

If you want to send packets to your iPad, how do you get it's IP number? Maybe you have to look for an mDNS client (in the Apple world this is called "Bonjour") too.

Thanks for your thoughts Pylon,

You could be right ... I am a bit fuzzy on how all this works but I am slowly clawing my way up the learning curve.

Here is what I did: I connected my arduino to the ethernet card and ran the DHCPaddressprinter example sketch to get the IP address assigned to my arduino. I then used this IP # to ping the arduino from my laptop and it responded (using the ping-- so, yes, I guess it was all on my home network. I also used the webserver example and successfully read the voltages at the analog pins on from my lap top. I'll have to try it from someplace other than home to see if it is just LAN (which might not be such a bad thing for this project) but that seems unlikely to me.

What (think) I have working: Arduino ->ethernet card->tp-Link (in client mode) -> "wireless communication" -> home modem ->laptop

What I need is:

Arduino->ethernetcard->TP-Link modem (what mode?) ->"wireless communication" -> iPad.

The app on the iPad asks for the IP # of the data source and, of course, the iPad allows you to choose the wifi ssid that you want to use.

or in more detail: NMEA instrument talks serially to Arduino (done) then sends the data to the ethernet card and via a cat 5 cable to the TP-Link router directly and wirelessly to the IPad via TCPIP or UDP (both are options with this app).

Thanks!

If you want to connect the Arduino/TP-Link to your home router that's what you use the Client mode for. Then you can control the Arduino through your home router. If you want to connect from an IPad directly to the TP-Link router you need to put it into AP mode.

What application are you using on the iPad ?

Thanks Headroom, I was just looking into that so your confirmation is helpfull. The app I'm using is called iNavx with details here: Instruments

So, thinking out loud here, I'll put the TP-Link router into in AP mode, connect the Arduino/ethernet to the TP-link, arbitrarily (since this is a LAN) assign an IP # in an arduino sketch that sends data via TCP/IP wirelessly though the TP-Link router to ... my IPad. Somehow I will need the sketch to also send the TP-Link's SSID so I can manually join the IPad to the LAN network and then also provide to the IPad the arduino IP #. Hmmm, that'll take a bit of figuring out ... An example sketch would be great (if none are available, I'll post my efforts here if it works out).

David

Leave the TP-Link router configured as it is, you don't want to have two separate WiFi networks in your home.

The app on the iPad asks for the IP # of the data source

This sound to me like your iPad application is not a server but needs a server as it's data source. This means you have to install server software on your Arduino. So might have to have a look at the ChatServer example, maybe the WebServer example also give you some insights.