Intro: Telnet to Your Arduino/AVR!
To see the video better, click twice and bring it up in its own window and enlarge. Otherwise, squint and you can see what's being typed.
So, I ended up modifying the AVR Terminal serial connection application that I had already written, and I added TCP/IP support to it. To go along with it, I wrote some firmware that provides something like a UNIX shell, giving me remote access to all the pins, fuse settings, etc. You can turn on LED's and all that stuff remotely. It even supports adjusting the clock speed in real-time and has a pseudo-password system that gives the framework for Access Control Lists or authentication for root-level commands (like powering down subsystems, etc). Here are some of the things it can do:
- Display your cpu frequency
- Set any pin to input or output
- Read the state of any pin
- Send logic 1 and 0 to any pin to turn on LED's, etc
- Power down and power up the SPI, TWI, USART, and ADC peripherals
- Read the lower fuse, higher fuse, external fuse and lock bits in real-time
- Start timers for automatically timing events and things.
- A framework for an authentication system into EEPROM
- Establish any available clock prescaler in real-time
- Written in C++ and compiled for an ATmega328P
Step 1: What You'll Need
- An stand-alone AVR or Arduino/clone (for detailed instructions on how to make your own, fairly complete stand-alone AVR system including an external crystal, decoupling capacitors, and a regulated power source, see my other instructable).
- A serial or USB connection to your host PC
- The AVR Terminal version that has the embedded TCP/IP server
- Optionally, the AVR Shell (avrsh) if you want to run firmware on your target AVR/Arduino to get access to your peripherals.
Step 2: Download and Install the AVR Terminal and TCP/IP Server
The AVR Terminal is a windows application that I introduced in earlier instructables. It can talk to your AVR via the RS232 USART as well as listen for inbound TCP/IP connections and relaying them across the RS232 connection for response from your waiting AVR. It isn't feature-complete but offers an initial tour of features detailed here and in my other instructables. The most recent version can be downloaded here.
The software doesn't take a full install; you can just run the software from it's directory. The text box in the tool bar that says ANY is the IP address to be bound for listening. ANY will bind any and all IP addresses, or optionally you may list one to bind to particularly.
The text box to the right of the IP address is the IP port to which the server will be bound. Default is 23232 but you can change this to whatever you like.
Step 3: Install Your Shell
Step 4: Telnet and Enjoy
So, if you have kept it at defaults, you can access your AVR/Arduino from your TCP/IP network with:
or if you're on the same box:
telnet localhost 23232
Just remember to use the configuration you changed it to, if you changed it.
That should be it. The source code for both the telnet server and the AVR firmware are freely available as open source and should provide you with enough good info to let you modify it or write your own versions of either. Next step might be to write a Java or Qt implementation of the TCP/IP server so that Mac and Linux users could benefit.