softusbduino is a Python package and Arduino firmware library. They can be used together to control the Arduino board over USB in Python.
- Links:
- home: https://github.com/ponty/softusbduino
- documentation: http://ponty.github.com/softusbduino
- Hierarchy:
- Python Application -> softusbduino python library -> PyUSB -> libusb -> USB cable -> V-USB hardware -> Arduino -> V-USB library -> softusbduino firmware
- Features:
- Possible usage: prototyping or creating simple low speed USB devices.
- firmware should be load only once to the Arduino board.
- 1 low level call takes 2 ms in tests
- python library functions:
- read or write all registers
- call arduino functions
- read many defines (example: F_CPU)
- Python USB back-end: PyUSB library (0.4 API)
- Arduino USB back-end: V-USB library
- It would be possible to create libraries for other programming languages (Java, C, ..) using the same firmware.
- Known problems:
- tested only on Linux + arduino 0022 + ATmega88,8 boards
- pull-up read is not implemented
- PWM read is not implemented
- PWM config is hardcoded
- similar projects:
from softusbduino.protoapi import * def setup(): pinMode(13, OUTPUT); def loop(): digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); sketch = Sketch(setup, loop) sketch.run()
install Python
install pip
install arduino
install libusb
- install SoftUsb subdirectory as arduino library
- Manual installation: http://arduino.cc/en/Guide/Environment#libraries
- Automatic installation:
- install confduino
- install the library:
python -m confduino.libinstall https://github.com/ponty/softusbduino/zipball/master
install python package:
# as root pip install https://github.com/ponty/softusbduino/zipball/master
sudo apt-get install arduino python-pip libusb-1.0-0 python-usb sudo pip install confduino sudo pip install https://github.com/ponty/softusbduino/zipball/master sudo python -m confduino.libinstall https://github.com/ponty/softusbduino/zipball/master # optional for examples sudo apt-get install python-matplotlib python-traitsui python-traits sudo pip install http://github.com/petervizi/python-eeml/zipball/master
- start Arduino
- open examples > SoftUsb > Simple
- upload to board
The permission should be changed:
$sudo nano /etc/udev/rules.d/60-objdev.rules
add this line:
ATTRS{idVendor}=="16c0", GROUP="users", MODE="0666"
update rules:
$sudo udevadm trigger