0

I am trying to make my own mouse/keyboard from an attiny (it doesn't have to be attiny102 as the title suggests). I have read many articles on this subject: some are using v-usb library.But I understand this is for arduino uno/leonardo.I want to use an attiny with the least amount of electronic parts attached to it(no external oscillator-only the internal one..etc.). All the articles I read said that arduino can't be used as a host usb device but this applies only for it's built-in micro-usb. Can't I just emulate the HID device using digital pins on my attiny? If this is possible where can you provide some well-documented source for the protocol used when communicating with the pc?

3
  • 1
    Everything is documented on the V-USB website
    – Gerben
    Apr 30, 2017 at 20:23
  • Atmel Appnote AVR 309 is also a good read on the topic, though v-usb should get you there. And yes, emulating a HID device using GPIO is exactly the thing. And no, this is not about the AVR being a USB host. As posted now the question seems to be a little broad, i.e. there is no specific question here besides "please guide me to some documentation". IMO such questions are not well suited for good StackExchange answers. Maybe it would be better if you research the topic a little more and post more distinct questions along the way.
    – Ghanima
    May 1, 2017 at 22:34
  • Don't know anything about the '102 but this is likely achievable in ideal cases with software USB on an ATtiny85. However, the implementation is unlikely to fully comply with USB specifications so may not work everywhere. Devices with a dedicated USB host interface and phy should fix that. Mar 3, 2018 at 17:38

2 Answers 2

1

I have build a HID midi keyboard with the hiduino lib which is base on LUFA. http://code.google.com/p/hiduino/w/list

I know LUFA is also capable to build a HID mouse device. But you need to switch to a bigger controller (i think). I used a 8u2 from atmel.

I used AVR Studio 6 to compile hiduino. Currently i have no link to the LUFA because the git page is gone. Maybe you find a mirror or a other webpage.

0

the only USB option for AVR microcontrollers without embedded USB, is VUSB which is somehow rare in Arduino; despite some aged libraries around :

https://blog.petrockblock.com/2012/05/19/usb-keyboard-with-arduino-and-v-usb-library-an-example/ https://github.com/gloob/vusb-for-arduino

but if you can rely on atmel studio, the very rich examples of VUSB itself are enough. I made a HID presenter (just two keys to go back and forth on powerpoint slides) using only an attiny24 which is super cheap. the codeandlife blog is a good start for VUSB. it also has a HID mouse example explained :

http://codeandlife.com/2012/02/11/v-usb-tutorial-continued-hid-mouse/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.