I am looking for a device that reads wiring voltages via a USB interface and returns the data. How would I go about programming something to interpret this data and what language would I use?
edit:If it helps, this project is to develop a digital tachometre for older engines that don't support a comprehensive ODB2 data port. Therefore, it will read voltages on a DC circuit and have an accurate graphical interface. I have absolutely no idea where to start with all this but am determined to make it work! it's for windows.
USBASP PROGRAMMER ON Port_#0001.Hub_#0003 NOT SERIAL PORT XX? I have installed the USBASP driver and it shows up in the devices list on port #001.Hub #003 type libusb-win32. Arduino needs a port number, so does not upload. And Arduino IDE claims to have uploaded successfully to the usbasp whether it is plugged into the usb port or not.
12 Answers
Cheat and use libusb. I did this for a project I've been working on for a while and wrote a C++/wxWidgets app to handle the data.
I've been thinking recently of re-writing the app on the PC in wxPython though as it's much faster for GUI development.
How you want to display / log the data? There are a lot of options available. You can do some pretty cool stuff (easily) with the OpenGL capabilities of wxWidgets whether it's 2D or 3D data representation.
Jon CageJon CageIf you can I would suggest using a library like libusb, as kris and Jon Cage have suggested.
Driver Little Programmer Usb Port Driver
If libusb isn't going to suit your needs and you're developing for Windows you should have a look at the software that Jungo provides. Again, this moves the usb software into user space rather than requiring Windows kernel development.(edit 3: Ilya points out in the comment that Jungo is also available for Linux)
If you must do some kernel development (either Windows or Linux) then C is pretty well the only option you have. Investigate this book by Rubini for linux development. For windows driver development I can recommend this book by Oney.But I'd investigate the libusb option in preference to the driver development in both cases.
Btw. If all you are interested in is being able to measure voltages on a usb device (and writing the code isn't important) there are many products out there that will do that for you. Take a look at some of the offerings from National Instruments. These will deal with the hard work of usb and the data acquisition and give you a nice programming interface to use in your application.
(edit 2)There are also some usb-serial chips (eg. these) that can be interfaced directly to an embedded processor usig only a uart. Typically these come with drivers.
Andrew EdgecombeAndrew EdgecombeHave a look at libusb. It is available for both Linux and Windows.
Since you're still looking for a device that converts voltages into information, I suggest you take a look at devices that implement a USB-HID (Human Interface Device) interface, such as those found here.
They have the benefit of not requiring any device driver development to be made, or drivers to be installed. They are as plug and play as a mouse, keyboard or flash drive. The interface is pretty generic, and most manufacturers also provide the necessary libraries to read the information from the device, be notified when a device is plugged in/out, discover devices, and so on.
In addition, have a look at this article that explains how to use a HID device in C#, for example.
Dave
Dave Van den EyndeDave Van den EyndeSeems to me that if you want to read wiring voltages then you need an A/D converter. Are you making your own A/D converter? If so, you've got some nice firmware programming to do on the device side, more than the host-side driver that you're asking about here. Otherwise you're going to buy an A/D converter, and you should just use the driver that the vendor supplies with it.
Unless you're bit-banging your own USB driver on the firmware side, your chip will probably come with a driver for the PC. For example, PIC microcontrollers from Microchip come not only with firmware for the PIC, but with a Windows driver. I expect that other USB-enabled chips would also come with their own drivers.
Remember that while you interact with the USB port directly on the firmware side, on the PC side all you actually interact with is the driver for the host controller.
MrZebraMrZebraYour easiest option is probably to buy some kind of off-the-shelf data acquisition device. Lots of companies make that kind of thing, but they're sometimes frighteningly expensive:
You could also build your own from a kit, although I can't find any links for you just now.
If you want something more custom you could use an EZ-USB or a PIC. They provide USB drivers (for Windows, at least) that allow you to interact with the device without writing drivers.
With most of these you have a fairly wide choice of programming languages, I've written software to communicate with EZ-USB devices from Visual Basic 6 in the past.
Most microcontrollers have built in ADC, and a ton of these also have a built in usb subsystem. Cypress, PIC, AVR come to mind. Whenever I am doing USB work for my own projects, I use pyusb and wxPython. They make it damn easy to get the job done, although there is quite a harsh initial learning curve.
Shameless self plug aside, I wrote a small python driver with pyusb for a USB-LCD device. You can check out my source code here.
jeremyDriver Little Programmer Usb Ports
jeremyI'm, personally, using Microchip PICs - they have AD/DA converters, USB ports, free drivers and boot loaders - and all this for under $4. After you plug in such a device you're getting one extra COM port - the rest is trivial.
IgorMIgorMYou don't say what platform you're looking at. If you're targeting Windows, USB Revealed is an awesome reference.
plinthplinthDownload Driver For Usb Port
For hardware, take a look at FTDI products.
If you have hardware and want to access it in Windows, I recently discovered WinUSB. If that's what you need, take a look at this white paper.
dardadardaIn addition to WinUSB, libusb and Jungo, there is another option for programming USB devices from user-mode - User-Mode Driver Framework (UMDF).
Writing a UMDF driver is basically creating an in-process COM component with your favorite tools.
Comments are closed.