lbenson
Senior Member
This shows a proof-of-concept connection of a picaxe to the inter-/local net using an Asus WL-520gU router running the Linux openWrt operating system. The connection is made with a USB serial dongle plugged into the router. The router’s serial port could be used but it is not brought out of the box. Power (either 5 volt or 3.3 volt) could also be brought out of the router, but for this example 3-AAs are used to power the picaxe.
I chose the WL-520gU because it is an inexpensive router ($44US at Newegg, but with discounts and rebates often bringing it down to $30US), and it is easy to flash with openWrt, and hard to brick. The WL-520gU has a 240mHz MIPS processor, 4 megabytes of flash, 16 megabytes of ram, and a USB port. This router is definitely on the laggard end of the router selection nowadays, but it is very easy to use. I actually have brought both power and 3.3-volt serial out of the router, but this project doesn’t use them.
The hardware: WL-520gU router, USB-RS232 dongle, RadioShack solderboard (276-150), DB9 connector, PICAXE08M.
The USB-RS232 dongle is from ebay, here: http://cgi.ebay.com/USB-to-RS232-Serial-9-Pin-DB9-Adapter-PC-PDA-RS-232_W0QQitemZ280403235075QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item414955d103
The dongle was $2.38US including shipping, and is a PL2303 serial adaptor (same as my Rev-Ed USB-serial cable--and yes, it does work on my Vista laptop for programming a picaxe). OpenWrt supports this adaptor—many others work, but some may not.
I used the RadioShack board for the circuit because it’s easy to wire for the picaxe, and provides good breadboarding space. The schematic for the picaxe is attached below—it includes download connector and DB9 serial to pins 3 and 4. I soldered the DB9 female connector directly to the solderboard, and used the same resistor setup that the standard download circuit uses. The 20-pin socket on the board allows the use of an 08M, 14M, 18M2 (drool), 20M, or 20X2. The picaxe part is pretty straightforward. Aside from the serial circuitry on pins 3 and 4, no picaxe inputs or outputs were used except for the LED on pin 0. I look forward to playing with a 20x2.
I wrote a very simple program for the 08M which looks for input on pin 3 (a qualifier, “A”, and a 1-byte code), and then uses a select statement to execute code based on the value read. In this case I chose to let “A” mean “turn on LED”, and “B” to mean “turn off LED”. The command set could be about as elaborate as you liked. Data could be sent back to the router to build a web page, send an email, or communicate across the web.
I chose the WL-520gU because it is an inexpensive router ($44US at Newegg, but with discounts and rebates often bringing it down to $30US), and it is easy to flash with openWrt, and hard to brick. The WL-520gU has a 240mHz MIPS processor, 4 megabytes of flash, 16 megabytes of ram, and a USB port. This router is definitely on the laggard end of the router selection nowadays, but it is very easy to use. I actually have brought both power and 3.3-volt serial out of the router, but this project doesn’t use them.
The hardware: WL-520gU router, USB-RS232 dongle, RadioShack solderboard (276-150), DB9 connector, PICAXE08M.
The USB-RS232 dongle is from ebay, here: http://cgi.ebay.com/USB-to-RS232-Serial-9-Pin-DB9-Adapter-PC-PDA-RS-232_W0QQitemZ280403235075QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item414955d103
The dongle was $2.38US including shipping, and is a PL2303 serial adaptor (same as my Rev-Ed USB-serial cable--and yes, it does work on my Vista laptop for programming a picaxe). OpenWrt supports this adaptor—many others work, but some may not.
I used the RadioShack board for the circuit because it’s easy to wire for the picaxe, and provides good breadboarding space. The schematic for the picaxe is attached below—it includes download connector and DB9 serial to pins 3 and 4. I soldered the DB9 female connector directly to the solderboard, and used the same resistor setup that the standard download circuit uses. The 20-pin socket on the board allows the use of an 08M, 14M, 18M2 (drool), 20M, or 20X2. The picaxe part is pretty straightforward. Aside from the serial circuitry on pins 3 and 4, no picaxe inputs or outputs were used except for the LED on pin 0. I look forward to playing with a 20x2.
I wrote a very simple program for the 08M which looks for input on pin 3 (a qualifier, “A”, and a 1-byte code), and then uses a select statement to execute code based on the value read. In this case I chose to let “A” mean “turn on LED”, and “B” to mean “turn off LED”. The command set could be about as elaborate as you liked. Data could be sent back to the router to build a web page, send an email, or communicate across the web.
Code:
'08SrIn3B.BAS reads serial in on pin3 & echos to sertxd
#picaxe 08M ' leg 8: 0V; leg 7: O0, serout, infraout; leg 6: I1, O1, ADC1; leg
pause 2000
start:
sertxd ("Hello from 08M",13,10)
' serout 4,N2400_4,("Hello from wl60",13,10)
main:
do
serin 3,N2400_4,("A"),b13
sertxd(b13)
serout 4,N2400_4,("Ack ",b13,LF) 'or " "
select b13
case "A" ' turn on led
high 0
case "B" ' turn off led
low 0
endselect
loop
Last edited: