Network access without Ethernet shield? (PPP)

Hi all,

As the TCP/IP networking examples seem to require an Ethernet shield to work, I'm wondering whether anyone has tried to use PPP instead, so that you can connect to the Arduino over the serial port in the same way as connecting to the Internet with a dialup modem.

If not, would it be possible to write a PPP library and slot it in such that the existing examples (webserver etc.) can work with either PPP or Ethernet, depending on a variable in the final sketch? This would allow you to experiment with network access on the cheap, then you could purchase an Ethernet shield later on if you want your code to go 'standalone' and not require tethering to a PC.

I'm just thinking that this might be an interesting project to try out if nobody has done it already, and could bring Internet connectivity to even more Arduinos out there in the process.

Internet over serial is definitely possible. The early protocol was SLIP, which stands for Serial Line Internet Protocol.

PPP is really quite complex. There's an outer frame encapsulating one of many types of inner frames, and a checksum. Those inner frames are IP frames or otherwise. You'd need to write code to deal with all of that - something like PPPD probably wouldn't transfer over. Look at the Wikipedia page. If you were to do it, it'd be a big investment of time and a lot of effort. But it is at least technically possible.

I suspect you'd be better off writing a SLIP client - it's standard IP with a fancy character appended. Most OS's still support it, and it should work fine for your purposes.

Note that the official ethernet shield uses a chip that implements an entire internet stack, up through TCP, for you While connecting via SLIP or PPP is possible, you'd have to add the IP/TCP stack as well as SLIP or PPP. In general, if you're talking to a PC, you might as well use a simple protocol like firmata on the Arduino/PC link, and do the internet stuff on the PC side. If you're talking to a SLIP/PPP "server", or the idea is to support serial now and maybe ethernet later, that might make it justifiable...

SLIP isn't quite as simple RM implies (there's some character quoting to worry about as well), and PPP need not be as complicated as he says (you can get by with a pretty small subset of the various options that PPP supports), but SLIP is definitely simpler than PPP.

I was digging around in the Ethernet samples and yes, it seems the Ethernet shield is really an 'Ethernet connected TCP/IP shield' so I think implementing PPP or SLIP would be the easy bit, getting a TCP/IP stack on top of that would be the tricky part. It might not leave much space for your actual code :slight_smile:

To be fair, you can make an IP stack about as simple as you can get away with. Someone wrote an IP stack that fit into a Twitter post (admittedly, it only did ICMP ECHO).

There's definitely a hole in the Arduino market for a small-as-hell simple IP stack that can run on the board itself, without any shields. If one doesn't exist yet, it would be a great collaborative effort.

I didn't know the Ethernet shield implemented TCP/IP on the shield itself. That's very interesting...

Someone wrote an IP stack that fit into a Twitter post (admittedly, it only did ICMP ECHO).

It depends on what you want your IP stack to do. If all you want to do is answer an ICMP echo, you can cheat A LOT. You probably don't even need to recompute the IP checksum.
There are other ways to cheat, depending on application. For instance, see http://www.google.com/patents?id=ie2BAAAAEBAJ&printsec=abstract
The more general purpose the stack, the bigger it gets :frowning:

I've been thinking about this problem for a while. I think the solution is to let the TCP/IP stack in another computer (PC, Mac, Linux box) do all of the work.

Here's how it would work.

  1. There would be a program running on a PC with network access. This program would talk to the USB serial port connected to your Arduino.

  2. On the Arduino side, there would be a library that replaced the Ethernet library. Let's call it SoftEther, in honor of SoftSerial. This library would have the same functions as an Ethernet library.

  3. When your Arduino sketch did a function call, for example, SoftEther.begin(), the SoftEther library would send a request to the PC via the serial port. The request would just contain the parameters from the begin() call. The PC would execute the necessary function calls and return any status via the serial port.

There are a lot of advantages to this approach. Apart from a PC, no additional hardware is required. You wouldn't have to worry about assigning an IP address (or implementing DHCP), since it's all taken care of on the PC side. Routing to the Internet would also be taken care of automatically.

There are lots of precedents for this approach. Firmata and RPC come to mind.

Of course, there are some downsides. It would tie up the serial port, which always makes debugging harder (although, you could add a debug print function to the library which would display a message on the PC). It would probably be a bit slower than a real Ethernet shield, especially for large amounts of data. Besides the library, someone will have to write and maintain the PC-side programs for the different platforms, although you could probably write it in Java (or Processing) and make it portable.

Any volunteers? :slight_smile:

-Mike

If you were going to use that approach it would probably be more useful to actually write an RPC library, and then layer SoftEthernet on top of it. That way people could use the RPC library for other things as well. The big advantage of this method is that it could provide a slot-in replacement for the Ethernet library, by having the PC emulate the shield. Being able to develop code with SoftEthernet and then swap over to real Ethernet by changing a line or two would be good. If you wrote your host application in Java, then anyone able to run the Arduino IDE would also be able to run the host app.

On the other hand, I think there's something inherently cool about a tiny standalone device able to talk TCP/IP all by itself. It sounds like there are a few corners you can cut to get a small stack, so I'm certainly interested in investigating this approach.

this is my solution to this problem

http://code.google.com/p/serialxmpp/

G

Well in case anyone's interested I've pretty much ported the uIP stack and a couple of examples to the Arduino IDE. I've got one last issue to figure out before I post some code, but I can successfully ping the Arduino (18ms!), and have it send me an e-mail. All without any shields :smiley:

This is all under Linux though, where establishing a SLIP connection is one command. I'm not sure how you would accomplish this under Windows - maybe someone here will know.

For anyone following this thread I have now released the library.

1 Like

I'm currently working a little Mac app that act like a Web server. Maybe it can help somebody. The app send the received stream from an Internet connection to the Arduino board connected to a serial port. You can find more on my Web site at http://playwithmyled.com/insek. It is fairly simple to use for beginner. Actually it a one way communication but I'm working to make it both ways.