Sunday, 11 June 2017

Can I control voltage of USB data pins?


I just bought a 5 volt dual relay module for my arduino. But now that I have it I was wondering if there is any way that I could control it directly from USB.



The pinout of the module is GND ONE TWO VOC This would make it really easy to just connect a USB cable to it.
Assuming I did that is there any way to send 5 volt through the USB Data+ and Data-?


Thank you



Answer



Basically, NO. USB is a complex protocol, and there is no direct way to control the D+ and D- lines (your ONE and TWO) from software. You can only cause the USB stack to send certain messages, embedded somewhere in a stream of other messages.


But you MIGHT be able to switch the power to the USB port (your GND and VOC)off and on under software control. Most laptops can do this in some power down mode, so there might be a way. Don't ask me how, I am not a PC guru. The catch will probably be that you switch the power to ALL USB ports, including your mouse and keyboard...


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...