Main Site Documentation

Need help with analog to USB


Hello, I’m new to this forum and to using Fez devices however I am hoping for help developing, what I assume, will be a fairly straight forward application.
I need to get a bunch of analog/pot values into Windows via USB, with a stand alone device.
I have have bought a couple of Mini Fez’s as the product description sounds about right.
My biggest problem is a fairly tight time constraint, so I’m hoping that someone can point me in the direction of a project that somebody might have previously developed that might give me a jump start :’(
Has anyone out there made a usb joystick or analog input device using a Mini Fez who could offer any suggestions?
Thanks in advance.



Now what do You want to do?

Read the usb joystick? I’m afraid USB host only available in biger FEZes. At least Domino.

Make Your own joystick from bunch of potentiometers?

You can try to look at the beginers eBook You will find alot of useful stuff there. Including Analog input (chapter 14.1, page 34) and Virtual serial port over USB (chapter 28.5, page 78).


You can easily do that, create a CDC (virtual serial) device on USB and then you can send whatever data you like to the PC, including data from analog inputs.


for the analog side, do a search for potentiometer.


here are a few links that might help you getting start with your project.

sample project to use potentiometers,

Here is the link to one of my project that simply use two pots and four buttons that act like a joystick.
i.e move the cursor, select the menu, etc…

for the virtual serial port just follow what Rimvis suggested!

hope this help!


WoW, thanks everyone for the great suggestions!
Yes, my hope is to make a joystick-like analog input device (hand control) to control parameters within a Windows based application (Autodesk, Motion Builder).
This will allow us to control CG characters with analog hand controls.
At the moment we just use a plug and play style usb gaming controller, which is fine, however it offers only three axis of analog control and a few digi buttons.
I am hoping to expand the control a lot further into a lot more analog channels.
Thanks again.


If you are adventurous, then you can implement a Custom USB device. As far as I know, it is possible to tell your board to look like a USB joystick. The upside is that you can tell windows that your joystick has as many axes(axeses? Axees?) as you like.

I have only done this once with a PIC and I told windows that it has 10 buttons and no axis. It worked just fine…


You should be able to do this using USBC_Device class to create a joystick as Errol said.


Thanks again to everyone for your support so far.
I am very slowly stumbling my way through this project and have so far managed to load the Fez Pot code into my project and into my FezMini, however I am still unsure as to exactly how I allocate pins as Analog In’s.
Also, as to Gus’ suggestion to “easily create a CDC (virtual serial) device on USB and then you can send whatever data you like to the PC”, I am still very hazy.
Can anyone point to to any previously complied code in which a Fez has been set up as an analog input device via USB?
Any further advice would be hugely appreciated ;D
Thanks again.


Most of the micro controller pins have multiple functions. All of them are capable to be just a digital pin. Meaning pin is on or off (1 or 0, true or false). Some of the pins have secondary function. In native code you have to tell processor what function you want a pin to perform by writing a special value to a special address (register).

In managed code this choice is made by managed object you are using with that pin. So if you want the pin to be an analog input you have to create AnalogInput object, if you want that pin to be a digital out you create OutputPort object.

Device documentation tells what function a pin can do.

I hope this helps.


I suggest you separate your tests and your questions. Learn about analog inputs and ask here if you have problems…then after you are done, start new thread on the forum about CDC help.

When you mix things, you only get more lost :slight_smile:


I think thats probably good advice, thanks Gus.
I guess I was kinda hoping that maybe someone had written a Fez USB joystick script, and that I could more or less just jump on the back of it ???
My main problem with this project is having very little time to get the thing working and prove the tech is right for for the application.
It’s for a film project and time is always the the biggest enemy to R&d on a film.
Thanks again.