Design help: V-USB or LUFA for serial mouse to USB project?

413 views
Skip to first unread message

rgm

unread,
Nov 12, 2012, 10:45:56 AM11/12/12
to atxhs-...@googlegroups.com
Good morning hackers.  It was great to see some of y'all at Showdown @ Unobtanium.
I'm hoping one of you guys has some advice for me.

I'm making a Microsoft Serial Mouse protocol -> USB HID adapter so that we can use a nostalgic mouse with modern equipment (and no drivers).  The mouse speaks 1200kbps RS232C 7N1 serial, and the packets it sends can be found online or easily observed / reverse engineered.  I learned about converting RS232 to TTL last week, so I'm getting close to interfacing with a microcontroller now.

I'm having trouble deciding which uC to use, and therefore which USB software stack to use.   I have little to no experience with either V-USB or LUFA, but I do have an AVR programmer and am comfortable with avrdude software to upload firmware.

I'd like your thoughts on V-USB vs LUFA if you have 'em, especially if you have personal experience.

Here's what I think I know (which is very little):

V-USB:
  Pro:  Small.  Works with cheap and tiny AVRs.  Mouse example on web already.
  Con:  Less "open"?  Can I customize my device strings?  I lack an ATtiny chip, crystal, and caps.  Which chip anyway?

LUFA:
  Pro:  Great library examples that could be adapted to my project.  Good forums.  Dean Camera is nice.  I currently own LUFA-compatible hardware (an Adafruit ATmega32u4 board).
  Con: overkill?  requires "big" AVRs with hardware USB.

I had the thought that I could put a potentiometer on the board to adjust the DPI / "step size" of each mouse report too (maybe 2, for X-Y independent control of that).

Thanks for listening / chiming in.

-Roland




Paul Bonser

unread,
Nov 12, 2012, 11:56:38 AM11/12/12
to atxhs-...@googlegroups.com
On Mon, Nov 12, 2012 at 9:45 AM, rgm <r...@rgm.nu> wrote:
Good morning hackers.  It was great to see some of y'all at Showdown @ Unobtanium.
I'm hoping one of you guys has some advice for me.

Yes! It was a good time!
 

I'm making a Microsoft Serial Mouse protocol -> USB HID adapter so that we can use a nostalgic mouse with modern equipment (and no drivers).  The mouse speaks 1200kbps RS232C 7N1 serial, and the packets it sends can be found online or easily observed / reverse engineered.  I learned about converting RS232 to TTL last week, so I'm getting close to interfacing with a microcontroller now.

Sounds fun! I am a big fan of interfacing old hardware with modern machines.
 

I'm having trouble deciding which uC to use, and therefore which USB software stack to use.   I have little to no experience with either V-USB or LUFA, but I do have an AVR programmer and am comfortable with avrdude software to upload firmware.

I'd like your thoughts on V-USB vs LUFA if you have 'em, especially if you have personal experience.

Here's what I think I know (which is very little):

V-USB:
  Pro:  Small.  Works with cheap and tiny AVRs.  Mouse example on web already.
  Con:  Less "open"?  Can I customize my device strings?  I lack an ATtiny chip, crystal, and caps.  Which chip anyway?

You don't actually need a crystal for V-USB, as long as the microcontroller can be run at 12.5MHz or 16.5MHz. I have some ATtiny85s that I have been running at 16.5MHz with the minimum of components. All you really need is: the ATtiny85, 3 resistors (two for the data lines, and one to pull one of the lines down), 2 zener diodes (somewhere between 2.8-3.6V), and 1 or 2 decoupling caps (I have a 10uF one on the USB side and a .1uF one on the AVR side).

You can definitely customize your device strings with V-USB. The other small advantage you might get is that I have been messing around with them, so I will have some extra experience to share. You may want to use somthing other than a tiny85 if you need more than 4 I/Os for your adapter, but if not, it may be just what you need. the t85 doesn't have a full, proper UART, though, so you may want to go with a cheaper ATmega which does. The mega8 is a popular one for V-USB, and one of the less expensive ones. To fully meet the USB spec, you'll also need to use one extra pin for the start condition signalling (I think that's what it is).
 

LUFA:
  Pro:  Great library examples that could be adapted to my project.  Good forums.  Dean Camera is nice.  I currently own LUFA-compatible hardware (an Adafruit ATmega32u4 board).
  Con: overkill?  requires "big" AVRs with hardware USB.

I have a few LUFA-compatible boards myself, and it is super-nice that they have an on-board bootloader (you can do that with V-USB, but it is possible to brick if you write firmware that self-programs, then you need a HVSP programmer).

It's really up to cost and whether or not the cheaper option can do what you want. I think either one is pretty easy to work with, programming-wise.
 

I had the thought that I could put a potentiometer on the board to adjust the DPI / "step size" of each mouse report too (maybe 2, for X-Y independent control of that).

If you only need 2 I/O pins for the actual serial part (not sure if you need more or not), then you can use the other 2 pins on a ATTiny85 to do ADC and read those pots, and you'd have one of the cheapest-possible solutions. Also, if your code ends up being less than 4K, you could even use the ATtiny45 and save a bit more :D
 

Thanks for listening / chiming in.

-Roland




--
You received this message because you are subscribed to the Google Groups "ATXHS Discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/atxhs-discuss/-/uCm4J12J0gYJ.
To post to this group, send email to atxhs-...@googlegroups.com.
To unsubscribe from this group, send email to atxhs-discus...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/atxhs-discuss?hl=en.



--
Paul Bonser | http://probablyprogramming.com | @pi
Reply all
Reply to author
Forward
0 new messages