The usbmot device controls up to two small motors, 600 mA current each, 1.2 A peak each, with an atmel atmega microcontroller connected to some host device via USB. The speed of the motors can be controlled with PWM.
Both firmware and host software are in the software package at the end of this page. In order to recompile the firmware, you will need an avr build chain (for example avr-gcc and avrdude), which you probably have if you found this page. To compile the host software, you will need a c++-compiler and the qt development package.
To compile the firmware, change into the firmware folder. Then edit the makefile and adjust device type and programmer. In order to remake the hex file, type “make hex”, and to transfer it to the device, type “make flash” (jumper 1-1 needs to be set).
To compile the host software, change into the qusbmot folder. You will need qt and libusb with their respective tools and header files to successfully compile. If both are properly installed, typing “qmake && make” should compile the program, which can then be executed by typing “./qusbmot”.
Usable AVR Microcontrollers
So far I’ve used this board only with an atmega 168. Due to pin compatibility, it should work with at least an atmega 8, 48, 88, 168. Since 12 MHz speed are needed, the low-voltage versions will not work. The firmware size is about 2 kiB, so all are a bit oversized, but in low quantities this is no problem.
The PCB is based on the USBAsp Layout. It can still be used as a programmer, however the USBAsp Firmware has to be modified since I changed the USB port and pins to use the output compare pins for PWM.
- JP 1-1: Self programming: Needs to be set in order to program the device, and must not be set if the device is operating. Sorry, this is a bit inconvenient, a residue of the usbasp roots.
- JP 1-2: Programmer Power: Powers the device logic from the Programmers power source.
- JP 5: coupled power: Connects the motor and logic voltages. Might work for really small motors(take care that the current of the motor is much higher when under heavy load) or strong USB power sources.
Two red LEDs hack
When all that separated my board from completion were the two 3V6 Z-diodes, I asked for help in the mikrocontroller.net – chat, and Loetmichel told me the 3.6 V Zener diodes can be replaced by 2 red LEDs each. If incorporated into the PCB, this might even look really nice, and add some information.
in the pcb, some of the atmega’s pins are connected to pinheads, so the board can be extended. I’ve tested a rather crude servo control for PC2…PC5, but unfortunately, if there is activity on the usb bus, the timing will get disturbed and the servos will move without being told so. I guess one could use the two 8-bit timers with their pwm pins to avoid being disturbed by the high-level usb interrupt, maybe in the next version. If however you can live with a bad servo control, try the “trunk” package.
- JP 5 is too close to the power connector.
- The L293D is a bit old and can only power rather small motors. There are some nice automotive ICs, but unfortunately, those chips aren’t that easily available. Another Problem of the L293D is the low allowed pwm frequency – with 5 kHz in a region that is acoustically displeasing.
- The holes for screws are placed randomly.
- Setting the jumpers for programming is not that comfortable. I guess I will use a USB bootloader for the next version, saves some wires, too
- Probably a lot more.
License and warnings
The software for both the microcontroller and the host is available under the terms of the GPL, in the hope that it might be useful for someone out there. In Addition to the terms of the GPL, obdev, who provide the firmware-only usb driver, kindly ask and require additional terms that especially apply as long as the shared obdev vid/pid pair is used.
The atmega, especially if powered by 5 Volts as in this device, cannot comply to the electrical part of the USB standard. Nevertheless, it works well with a large range of computers. However, there is no guarantee that it will not destroy your USB controller or your entire computer, so keep in mind the last sentence of the GPL: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
usbmot_software.tar.bz2 (723.15 kiB, 2008-11-03)
usbmot_trunk.tar.bz2 (759.19 kiB, 2008-11-21)
usbmot_schematic.pdf (93.99 kiB, 2008-10-29)
usbmot_pcb.pdf (194.58 kiB, 2008-10-29)
usbmot_eagle_pcb.tar.bz2 (73.22 kiB, 2008-11-21)