Adding analog and digital I/O to the serial port to the WAP54G web server with SDcard.
I have it working! Added 8 analog channels, 2 digital inputs, 2 digital outputs, a temperature controller with 2 programmable timers, a clock, and PWM output.
connected to the serial output of the WAP54G with SDcard.
The extra hardware in the WAP54G consists of a MAX232, a 78L05 voltage regulator, and some transistors.
The MAX232 is ONLY used to make + and - 8 V for the serial port, the serial interface is as in the wapserver, with transistors.
I replaced the female 9 pole connector by a male, as now the WAP54G is a computer, reversed the pins 2 and 3,
so if you want to connect it to another computer you need a so called null modem cable.
The thing that connects to the WAP54G serial port consists of a Microchip PIC 18F14K22, and a 78L05 voltage regulator, plus some resistors and capacitors.
And then there is software of course....
Just a quick hint of how I have dunnit:
On the [added] SDcard in the WAP54G in the startup initialisation file /linksys/setwap, I added the following lines after the command to start telnetd:
# start telnetd
./telnetd -l /bin/sh
# baudrate to 9600 for I/O PIC
/tmp/var/bon/stty -F /dev/console 9600
# no echo
/tmp/var/bon/stty -F /dev/console -echo
# 2 stop bits
/tmp/var/bon/stty -F /dev/console cstopb
# report new baudrate
/tmp/var/bon/stty -F /dev/console -a
# connect serial port to /dev/console.
/mnt/e2s -d /dev/console -p 8191
The file setwap is executed at power up, and starts the e2s program.
This e2s program starts a server on port 8191 that connects to the serial output of /dev/console.
/dev/console is what the serial output port on the Linksys WAP54G is connected to.
So now you can talk to the serial port with
You can download the e2s sources here,
a MIPS executable is included, the source is in C for Linux, the code is released under the GPL license.
Connected to the serial port is io_pic, it accepts serial commands to set it's output,
or responds to those commands with the values read from its input, the command syntax is very simple, there is a help menu too.
You can find a lot more info on the io_pic project here,
but I recommend you use these files ment for a PIC 18F14K22 with special features to work with the WAP54G:
Read the asm file for more info, make sure you always have the serial port startup delay active (option 'E').
When serial port delay is active io_pic will not respond until after about a minute or two have passed after power up.
This is so it does not get confused by things the Linksys WAP54G outputs on the serial port while it is booting,
as responding to some of that would interrupt the boot process.
As to the hardware, I think you can go even simpler, and mount the PIC in the WAP54G, with a big 25 pol female D connector on front.
Run the PIC on 3.3 V from the WAP, and use the internal reference.
Then the transistors and MAX232 chips are no longer needed.
Have not tried that yet, but made the hole in the front for the 25 pole connector.
return to the wapserver page