An Arduino Uno talking to a TP-Link WR1043ND

Inspired by blog posts by two other people (Arduino and OpenWRT and Arduino + WR703N) I decided to experiment with having my own Arduino Uno R3 talk via the USB port to a TP-Link WR1043ND wireless Access Point running OpenWRT.  So far I have the Uno R3 visible as /dev/ttyACM0 inside the OpenWRT-powered WR1043ND. The key is to “opkg install kmod-usb-acm” under OpenWRT to provide serial-over-USB support to match the Arduino Uno R3’s USB chip.

My TP-Link WR1043ND is currently running Attitude Adjustment (r29537) version of OpenWRT ( a 2.6.39.4 linux kernel, built with the DIFFUSE for OpenWRT project’s VirtualBox image dev environment). Since the current (June 2012) OpenWRT repositories have modules built for later kernels, I built the necessary kmod-usb-acm package on my dev box and rsync’d it across the WR1043ND. No problem. Installation is then easy:

 root@OpenWrtDisplayLink:/# opkg install kmod-usb-acm_2.6.39.4-1_ar71xx.ipk
 Multiple packages (kmod-usb-acm and kmod-usb-acm) providing same name marked HOLD or PREFER. Using latest.
 Installing kmod-usb-acm (2.6.39.4-1) to root...
 Multiple packages (kmod-usb-core and kmod-usb-core) providing same name marked HOLD or PREFER. Using latest.
 Configuring kmod-usb-acm.
 [ 1649.470000] usbcore: registered new interface driver cdc_acm
 [ 1649.470000] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
 root@OpenWrtDisplayLink:/#

Having installed the required USB driver, I plugged my Uno R3 into my WR1043ND and saw the following on console:

 root@OpenWrtDisplayLink:/# [ 1708.920000] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
  [ 1708.930000] ar71xx-ehci ar71xx-ehci: GetStatus port:1 status 001803 0  ACK POWER sig=j CSC CONNECT
  [ 1708.940000] hub 1-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
  [ 1709.100000] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
  [ 1709.160000] ar71xx-ehci ar71xx-ehci: port 1 high speed
  [ 1709.160000] ar71xx-ehci ar71xx-ehci: GetStatus port:1 status 001805 0  ACK POWER sig=j PE CONNECT
  [ 1709.230000] usb 1-1: new full speed USB device number 3 using ar71xx-ehci
  [ 1709.290000] ar71xx-ehci ar71xx-ehci: port 1 high speed
  [ 1709.290000] ar71xx-ehci ar71xx-ehci: GetStatus port:1 status 001805 0  ACK POWER sig=j PE CONNECT
  [ 1709.390000] usb 1-1: ep0 maxpacket = 8
  [ 1709.390000] usb 1-1: skipped 3 descriptors after interface
  [ 1709.400000] usb 1-1: default language 0x0409
  [ 1709.410000] usb 1-1: udev 3, busnum 1, minor = 2
  [ 1709.410000] usb 1-1: New USB device found, idVendor=2341, idProduct=0043
  [ 1709.420000] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=220
  [ 1709.430000] usb 1-1: Manufacturer: Arduino (www.arduino.cc)
  [ 1709.430000] usb 1-1: SerialNumber: 649353435333518082B0
  [ 1709.440000] usb 1-1: usb_probe_device
  [ 1709.440000] usb 1-1: configuration #1 chosen from 1 choice
  [ 1709.450000] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
  [ 1709.460000] cdc_acm 1-1:1.0: usb_probe_interface
  [ 1709.460000] cdc_acm 1-1:1.0: usb_probe_interface - got id
  [ 1709.470000] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
  [ 1709.480000] usb 1-1: adding 1-1:1.1 (config #1, interface 1)
  [ 1709.480000] drivers/usb/core/inode.c: creating file '003'

  root@OpenWrtDisplayLink:/#

Yay! We now have a relevant tty!

root@OpenWrtDisplayLink:/# ls -alt /dev/tty*
          [..]
crw-rw-rw- 1 root root 166, 0 Jun 2 17:52 /dev/ttyACM0
          [..]
root@OpenWrtDisplayLink:/#

Now, fire up the AnalogReadSerial example program on the Arduino (see this blog post), which continuously sends out decimal numbers to the Uno’s serial port representing the analogue voltage on pin A0. I can now read this output stream simply by using:

root@OpenWrtDisplayLink:/# cat /dev/ttyACM0

[...lines of numbers which track the voltage on pin A0..]

Yay again!

Advertisements

6 comments

  1. Respect!

  2. Thank you so much for this – after spending hours trying to get kmod-usb-serial to install on dd-wrt (had to copy functions.sh from openwrt) and fix it up so that varoius paths pointed to /opt/.. equivalents so that modules would load, I still couldn’t get it to work. I’d forgotten about the acm.

  3. Que tal,
    Es verdad que es la primera ocasion que he leido este sitio y tengo que
    comentar que no esta mal y posiblemente me tendras mas a
    menudo por tu blog.
    Un saludo!

  4. Thanks for sharing your thoughts about tv software.
    Regards

  5. At this time I am ready to do my breakfast, afterward having my
    breakfast coming over again to read more news.

  6. Great info. Lucky me I found your site by accident (stumbleupon).
    I have book-marked it for later!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: