Questions about connecting a passive infra-red sensor to the USB port

driverhardwaresoftwareusb

So, we are linking a sensor to a computer via USB, using a female USB connector and male USB wires. The sensor is connected to a circuit with 3 pins, vcc, ground, output signal. If I would want the signal to be processed by the computer to output " I sense someone" when ever the sensor fires, what would I need to do? basic questions to answer are:

  • How would the computer understand the signal from the usb? Using a device driver? or something else(please specify)

  • I read that the usb can burnout if you are careless about the energy you input on it, so what is this healthy energy( Vcc , Amps) range? ( and how do I achieve this?)

P.S.: my professor told me that the device driver is only used for driving a certain device… idk if he is right or not :\ this totally contradicts my knowledge about device drivers, I know that everything you insert to a computer that has an input to be understand needs a device driver( ei, mouse, keyboard) it's hard for me to believe that the computer controls the mouse since, it can't because that is senseless(because the standard mouse is only for input 🙂

P.S.: the sensor is a Passive infrared sensor, with 2 jumper modes, to fire only once every X time while their is movement. and to fire constantly which there is movement.

Best Answer

You will need to use a device that has USB controller capability, or you can use an external chip. The actual device I would recommend depends on what kind of output the sensor has. Is this output On or off? If it's something so simple, I highly recommend using an ATTINY device like this. ATTiny simulates USB and works nicely without too much complexity.

However, if your IR sensor needs an ADC and some processing, you can use an MSP430, PIC, Cortex M3/M4 and many others depending on whether you need some processing of that signal.

Lets assume that you have the USB connectivity. In reality you need to choose a class for your USB device and for this I recommend CDC since it basically opens a COM port on the computer and you can send data as it arrives, then process it with any kind of program you like.