The view from the Engine Room
Friday afternoon SPARKFUN
Mike Pogue mentioned he was considering using a USB-connected PIC controller to drive some stepper motors from a PC. He'd ordered out a USB Bit Wacker , which plugs right into a USB port and looks like a serial port to the host OS, and gives you 14 ports that can either be digital in, out or analog in. The host sends simple ASCII commands down, and the Bit Whacker sends back status/port data. Cool! Earlier this afternoon, he brought it in and we plugged it into my Tyan whitebox running Nevada 64a using a mini-USB cable. I was running a tail -f on /var/adm/messages, and saw:
Jun 1 15:29:34 cyber usba: [ID 912658 kern.info] USB 2.0 device (usb4d8,a) operating at full speed (USB 1.x) on USB 1.10 root hub: communications@1, usb_mid6 at bus address 3
Jun 1 15:29:34 cyber usba: [ID 349649 kern.info] Microchip Technology Inc. CDC RS-232 Emulation Demo
Jun 1 15:29:34 cyber genunix: [ID 936769 kern.info] usb_mid6 is /pci@0,0/pci1022,7460@6/pci1022,7464@0/communications@1
Jun 1 15:29:34 cyber genunix: [ID 408114 kern.info] /pci@0,0/pci1022,7460@6/pci1022,7464@0/communications@1 (usb_mid6) online
Jun 1 15:29:34 cyber usba: [ID 349649 kern.info] usba: no driver found for interface 1 (nodename: 'data') of Microchip Technology Inc. CDC RS-232 Emulation Demo
Jun 1 15:29:34 cyber usba: [ID 912658 kern.info] USB 2.0 interface (usbif4d8,a.config1.0) operating at full speed (USB 1.x) on USB 1.10 root hub: modem@0, usbsacm3 at bus address 3
Jun 1 15:29:34 cyber usba: [ID 349649 kern.info] Microchip Technology Inc. CDC RS-232 Emulation Demo
Jun 1 15:29:34 cyber genunix: [ID 936769 kern.info] usbsacm3 is /pci@0,0/pci1022,7460@6/pci1022,7464@0/communications@1/modem@0
Jun 1 15:29:34 cyber genunix: [ID 408114 kern.info] /pci@0,0/pci1022,7460@6/pci1022,7464@0/communications@1/modem@0 (usbsacm3) online
Well, that looked promising! Sure enough,
% ls -l /dev/term
total 6
lrwxrwxrwx 1 root root 78 Jun 1 15:29 0 ->
../../devices/pci@0,0/pci1022,7460@6/pci1022,7464@0/communications@1/modem@0:0
lrwxrwxrwx 1 root root 29 Dec 21 14:43 a -> ../../devices/isa/asy@1,3f8:a
lrwxrwxrwx 1 root root 29 Dec 21 14:43 b -> ../../devices/isa/asy@1,2f8:b
%
Ok. I added a quick entry to /etc/remote:
sparkfun:\
:dv=/dev/term/0:br#38400:el=^C^S^Q^U^D:ie=%$:oe=^D:
# tip sparkfun
connected
UBW FW D Version 1.4.1
At this point I used various commands to read the inputs/buttons, flash the LED, etc. If needed, one can also write and download alternate firmware directly to the on-board PIC18F2455; there's a built-in bootloader that cannot be flashed over, so a PIC programmer is never needed. This unit seems ideally suited to wiring up coffee makers, sprinkler systems, etc, so they can be connected to a host computer. Looks like I could write some firmware to directly drive servo motors using the Bit Whacker to count encoder pulses and close the velocity loop; the host computer would read say 100Hz update of position and update the desired velocity of the motor... and w/o any firmware work at all, it seems directly applicable to our next Burning Man project, which will have an OpenSolaris computer controlling things for the first time on the playa AFAIK... more about that later.
Here's a picture of the device:

(The picture was taken w/ my Razr 3i and uploaded using Solaris as well.... )
Posted at 06:31PM Jun 01, 2007 by barts in General |
Friday Jun 01, 2007