I use a Raspberry Pi (or any other Linux based computer) to make the USB based PixelInvaders network enabled. This should work for any Arduino based project.
All you need is ser2net an Raspberry Pi and an Arduino board with an USB connector. Please note that the lastest ser2net (v2.8rc3) has a bug which is already fixed upstream. To workaround the bug, simply insert the ipv6 module:
1 | $ sudo modprobe ipv6 |
or compile the latest master branch yourself.
Connect the Arduino board via USB cable to the Arduino. Use dmesg to find out where the Arduino board is connected:
1 2 3 4 5 6 7 8 9 10 11 | $ dmesg ... 2426630.070084] usb 1-1.2: USB disconnect, device number 5 [2426733.745534] usb 1-1.2: new full-speed USB device number 6 using dwc_otg [2426733.848698] usb 1-1.2: New USB device found, idVendor=16c0, idProduct=0483 [2426733.848728] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [2426733.848744] usb 1-1.2: Product: USB Serial [2426733.848758] usb 1-1.2: Manufacturer: Teensyduino [2426733.848771] usb 1-1.2: SerialNumber: 12345 [2426733.857437] cdc_acm 1-1.2:1.0: This device cannot do calls on its own. It is not a modem. [2426733.857563] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device |
My Teensy board is connected to /dev/ttyACM0. Now edit the ser2net config file
1 | $ sudo nano /etc/ser2net.conf |
and define the listening port (5333), the timeout in ms (500), the output device (/dev/ttyACM0), the serial speed (115200) and the remaining serial options (8DATABITS NONE 1STOPBIT):
1 | 5333:raw:500:/dev/ttyACM0:115200 8DATABITS NONE 1STOPBIT |
save the config file and restart ser2net:
1 | $ sudo /etc/init.d/ser2net restart |
Thats all. Now all you need to do is adapt your client code. I did this with my PixelController driver, which is quite straightforward.