Arduino USB Driver - c#

I want to make a program to interface with my Arduino through an USB port. I am already quite experienced with C# (which is the language I want to use), but I cannot find a way to install the Arduino USB driver without also installing the IDE. Can I download them somewhere? Or is there a better way to use USB (I do not need to upload any code to the board with the program)?
I know that there are a lot of tutorials on making the program, but they all seem to use the SerialPortclass which I assume is not the actual USB port but just a serial port made by the driver.
In short:
Q1: Where can I download the Arduino USB driver?
Q2: If I can't, what is the best way to do communicate using USB (maybe another driver or library)?
(Please tell me if my question does not make sense, this is the first time I am doing something with USB)

The "original" Arduinos that have build-in chip for serial communication are using FTDI's FT232RL chip. Here's the driver for these: http://www.ftdichip.com/Drivers/VCP.htm
The most cheap clones of those Arduino boards (from eBay, Aliexpress, etc) are using the CH340 chip for serial communication. Driver for these: http://www.wch.cn/download/CH341SER_EXE.html

Related

C# interfacing between pc and Omron servopack sgdh

I need help to write code c# interfacing between PC and Omron Servopack by rs232 to USB connection enter image description hereto drive ac servomotor
Using RS232 (CN3) to control this servo is not the best practice as it is not immune to EMC interference and is a port for driver setup (you will not be able to take graphics, and adjust the servo tuning while controlling through this port).
Consider researching the driver model you have and, if you have a fieldbus (Mecatrolink, DeviceNet, Profibus...), you could check how to use these protocols in a software (which I'll warn you, it's not trivial).
It all depends on your purpose, which could have been better explained in the question, as there are countless other approaches we can take...

Query A Device Attached to USB - Windows

Well, I've looked all over the internet, and it appears that what I want to do is near impossible without writing my own driver.
I have a device attached to a USB port, and - unfortunately for this situation - it uses a USB to UART driver to emulate a serial port which streams the device output.
However, in order to validate a license for the software, I want to ensure that I know which device is attached to the USB port - not just the make and model, but (hopefully) the actual serial number. If not the serial number, at least some unique identifier.
But I'm not sure where or how to get that.
The UART Bridge has a PNPDeviceID, but that doesn't seem to change, regardless of which device is plugged into the port.
I'm working in C#, which, from what I've read, is also a limitation.
So my question is this: How can I get a unique identifier from a USB-attached device while using a UART Bridge driver in C#?
Thanks in advance.
You might try this library. There's some sample code in this MSDN question as well.
The PnpDeviceID actually is what I was looking for. It's just that the EEPROM has to be updated, which is demonstrated in one of the sample applications from Silicon Labs. The PnpDeviceID consists of the Vendor ID, Product ID, and Serial Number, all of which are customizable via the method demonstrated. The Serial Number on my particular set of devices defaults to 0001, which makes it appear that the PnpDeviceID doesn't change.
Reference here.

Getting video with USB SPI from device with FTDI

I need to implement Device manager for some card with FTDI chip.
We are looking into JAVA or C#, and we need to use it for transferring vedio using SPI.
Do we need to use FTDI DLL for java or C#?
Can we encounter serious problems implementing this in java ?
I have used the direct connection with the FTDI DLL using both Java and C#. For Java I have used ftd2xxj, even contributed some extensions to that. Works very and seems actively being maintained. I switched to C# 2 years ago and I'm using the wrapper provided by FTDI FTDI C# Wrapper. This also works perfectly, and I would say using one of these libraries is the recommended way to connect to your device instead of using a serial port connection. You can tune a lot of things such as the latency on the USB port and packet buffer sizes and such. I can imagine this can come in handy with video.
The Java option is fully open-source and business friendly, the C# version is provided as is without any restrictions to redistribute etc.
I have an app that uses ftdi. The solution I selected is to use a C DLL and call the c routines with JNI.
There's also the libftdi/libusb approach if you want a more open source approach. I'm not to sure what interfaces to these exist for Java and c# though.
I have tested multiple FTDI chips in C and C# to do USB to SPI/I2C from Windows.
For Video generally SPI with an extra pin called D/C (data command ) is what is supported by displays devices.
Here is a video with an FT232H board + an OLED 128x64 display in SPI
I used the default ftdi windows C SPI library. The FT232H can deliver up to 3M byte/S in SPI in theory.
The device Nusbio (based on the FT232RL) also support I2C/SPI at a smaller transfer speed and works with the OLED 128x64 display in SPI.
Nusbio can deliver up to 20 K byte/S in SPI for display. The Nusbio library is written in C#.
I am currently experimenting with the FT4222 chip in I2C or SPI using the FTDI C library on top of which I wrote a C# library. The FT4222 can deliver up to 500 K byte/S.
In conclusion you have to pick your chip and if your OS target is Windows C + C#
would be my advice. FTDI does not provide a lot of support/samples for C#, but that is what I do.

How can I determine the speed of a USB port?

Is there an easy way to programmatically determine the speed (or version) of a USB port? I'm looking to control the speed of data sent to a usb port based its maximum bandwidth.
If you need a solution for Windows this should be a good start:
http://msdn.microsoft.com/en-us/library/ms793313.aspx
Basically you should try this:
Enumerate the USB devices and the symbolic names to their drivers
Open a handle to the USB device driver through its symbolic name via CreateFile
Perform a DeviceIoControl on the driver handle with the control code IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX. This will have you returned the structure USB_NODE_CONNECTION_INFORMATION_EX. There you have a member there called Speed of the type USB_DEVICE_SPEED.
(Close the driver handle)
This could also be interesting for you: CodeProject: Enumerate Properties of an Installed Device
To answer your question, I'm sure that there are ways of getting the information you need. I don't know the answer for windows, but Linux has files you can read within the sysfs directory structure.
Speed control is usually taken care of by the drivers and the hardware controlling the bus. Most modern USB controllers really have 2 controllers per port connected. 1 for the slower speed 12Mbps USB 1.0, and another for the higher pseed 480Mbps USB 2.0. There is a magic switch inside that connects it properly. The driver itself makes sure that everything is enumerated properly, controls the flow, etc. A higher level "user-space" application typically doesn't need to worry about these things.
Also, if you have a device that is capable of running at faster than 12Mbps, and you plug it into a 12Mbps port, it'll get dragged down to 12Mbps whether you like it or not. Is it that you want to know that is got dragged down?

Need a Switch component controlled via USB port

I need device switch component which an be controlled by code(.net,C# Or vb) ON/OFF state is enough..
I have code knowledge in C#, .net window application, I need to make a switch that can be controlled using code via USB port ... so that using that switch I will turn on/off electrical devices (fan,light) for a specific time interval.. For my MINI Project
Note: I need the brief note regarding components needed and how to assemble it.
If you know any link which resembles this type of project pls refer me.
thanks.
You'll probably want to look into using an FTDI chip for this purpose. They do have a .NET interface available as well as traditional C DLLs.
FTDI offers two types of drivers - one emulates a simple COM port (Virtual COM Port, which is probably enough for you), and the other is more of a direct USB control (D2XX), although it still shows up as a COM port when the USB device is connected.
On the other hand, if you really only need on/off support, you could probably just use the .net serial port drivers for the most basic communication. Of course, the serial port drivers don't let you tie a serial port pin high or low, so you will need some method of reading the data coming from the PC. Many microcontrollers have freely available UART libraries exactly for this purpose, but you will need to also obtain an RS232 level shifting IC for this because the serial port from the PC outputs +/- 6V IIRC (might be +/- 12V), while most microcontrollers run off of and accept signals at 0/5V or 0/3.3V.
You could try something like the Arduino or one of its clones like the Sanguino. It's probably a bit overkill for your project, but they come pre-assembled and have a large support base.
You would also (for any low voltage switching circuit) need some form of relay board to switch electrical appliances that run on mains power. See here for some ideas.
Are you sure you have to do this with the USB port?
You'd need a device that implements a whole USB interface. This isn't as simple as using a line on the COM port (RTS/DSR etc...) or using the parallel port.
A quick search found this...

Categories

Resources