Turn on PC with USB-device - usb

I want to be able to turn my PC on and off using an IR-remote sensor that is connected via USB to the PC. The sensor is a custom PCB implemented with an AVR microprocessor and V-USB software USB-implementation.
Now, turning off the PC is no problem with software, but is there any way to turn ON the PC using USB?
(Please note, I'm not talking about booting from USB-stick or USB-power supply ...)

There seem to be two problems:
keeping the USB powered on while the PC is off. It seems that most mainboard have a jumper for this functionality.
bringing the PC back to life. There seems to be no standard functionality for this. The solution is to "press" the PCs power button through the AVR on the USB board. I know, this means extra cable from the USB to the PC, but it seems to be the easiest solution.
Another workaround could be to send the power-on signal to the PC over ethernet. But I guess this will be more complicated than the power button solution and it involves extra cables too.

This Microsoft knowledgebase article describes how to enable "wake on USB" for a USB mouse. I just checked, and my keyboard device entry (on Windows Vista) has the same choice, already checked.
So, if your AVR is emulating a USB keyboard or mouse, it should be possible to wake the computer by sending the proper data.

there must be a way to do this with USB, since some PCs can be switched on with the keyboard. I think this will be some looking whether your mainboard/BIOS support it (it may be you need to turn it on in BIOS, this will probably also ensure your device gets power from USB although the PC is switched off), and whether that V-USB (unknown to me) can send the "wakeup"-signal.
good luck !

How "off" does the PC need to be? Is waking from sleep/suspend enough? The USB standard describes "remote wake-up".
Aside from enabling remote-wakeup, like unwind mentions, software on the PC is not involved in making this work.

Related

How to change USB device manufacturer name and type

I want to change the name and type of a wireless USB dongle, so the OS (Windows in this case) recognize it as a keyboard for example but work as a wireless USB dongle, I know about USB mass production tools for USB removable devices but my devices is a wireless USB dongle, is it possible?
I want to hide the device from some reporting software, the software is sensitive to some USB devices and with this trick, so I am looking for the software sees it as a keyboard, so won't give an alert.
How to change USB device manufacturer name and type
By replacing the firmware of the device.
In other words, that's impossible for you.
I want to hide the device from some reporting software, the software is sensitive to some USB devices and with this trick, so I am looking for the software sees it as a keyboard, so won't give an alert.
Is your device a keyboard? Otherwise, presenting it to the operating system as keyboard will mean it does nothing useful. Even if that were possible, you would hide a device, but make it useless. Nothing works like this.
You try to convince parts of windows that something isn't there. That means: You want to write a rootkit for Windows. Good luck! This is an old field, and a lot of people with experience in writing malware are playing it. You need to be smarter than the next windows update, potential virus scanners and the software you're trying to trick.

How to detect, when a juul started charging? Over ubs (vb.net)

I have a juul, a charger, and a pc. The pc has usb ports. Thats clear.
When i plug a mouse, keyboard or any HID device, the pc can recognise these, but when i plug the charger, nothing happened.
I'm try to watch the connected usb devices, with the "USBDeview" by NirSoft. The software cant list the charger.
How can I detect, when any specified stuff connected via usb? Now the "stuff" is the juul charger.
Thanks for any help, I tried to make it simple.
If it's just a charger, it has nothing to do with the USB bus aside from drawing 5V from its power. I.e. it may only have DC power pins (+, -), without the data pins (D+, D-). In which case, your OS won't notice anything was plugged in.
Image from Wikipedia

How to program the microcontroller?

I have a microcontroller STM32F051 and I want to program it. I looked for IDE that I would be able to use and I found TRUESTUDIO that I'm using. I wanted to know how should I do to send the program I made into the microcontroller. Do I need any specific programmer (like an electronic device for Microchip Pics) ? When I clic the button debug, I get an error
"Error in initializing ST-Link device. Reason: Failed to connect to device. Please check power and cabling to target."
I'm not sure if I misunderstood something. I download the software and I selected my specific version of microcontroller, but it seems that it doesn't recognize it...
Yes, no matter what the mcu you will need some interface, be it as simple as a usb connector tied to the chip, or a debug header using some other device or electronics. For an stm32 chip many of the discovery boards and the nucleo boards (in particular the ones with a breakaway end, you dont have to break it off, just remove some jumpers to use it on other devices (not necessarily ST devices)). These parts also have a serial bootloader inside that you cant change so it is always there, and can sometimes use one of the nucleo stlink debuggers (do some research as to ones that offer a virtual uart, not all of them do, cheaper than the dedicated stlink dongles) or say an ftdi usb breakout board (under $2 on ebay).
There are numerous options for programming these parts as in writing software, can just use gnu tools and roll your own drivers (pretty easy the documentation is pretty good), get one of the ST libraries that they offer (for free) or if you have a Nucleo you might be able to use mbed or arduino to develop.
We really need to know more about the board you have this part on, is it just a breakout board or as asked in the comments did you buy a nucleo board or a discovery board? Are you running linux, windows or mac or other or are flexible on what host?

Controlling simple relay switch via USB

I'm looking to control a mains powered light from a simple relay switch connected via USB to the computer.
The relay switch isn't even a USB device, it's just a simple switch that requires the USB voltage to turn it on. When the voltage drops below a threshold, the switch will turn the light off.
My problem is that I can't control the power output of a USB port. I'm happy to do it using any language on Windows or Linux (but preferably Java because I'm used to it).
Unfortunately, in most cases you cannot control the power supply to the USB port. The power supply is usually hardwired through, and not switchable in software. You can send a reset to a USB device, but that won't work in your case.
There are a number of projects on instructables that do similar to what you describe, but unfortunately they seem to either be quite complicated or require expensive parts.
EDIT: There is actually a product currently in the news which would do want you want, but it doesn't appear to be shipping yet: http://www.pwrusb.com/
EDIT (again): Apparently you can do this with some usb hubs. This post sugggests the Linksys USB2HUB4 is one that works.
EDIT (and again): Apparently there are a number of similar questions, but there don't seem to be any more useful answers:
https://stackoverflow.com/questions/405269/custom-usb-device-that-disables-power-to-usb-devices-plugged-into-it
Power off an USB device in software on Windows
Is there software or code to alter USB power output
Can I write a program that swiches USB on/off
Most of the USB to Serial or USB to RS232 $10 converters support hardware handshaking. Use one of those as a single channel digital io.
Connect your transistor that will drive the relay to DTR on the converter board and command DTR ON/OFF with the converters driver.
A 2N7002 is a good transistor to use (FET actually) since it will work from 3V and doesnt need any resistors anywhere.
Here is a complete solution.
It uses an Arduino board, with a USB connection, (and Uno for example) to control the relay and combines this with pfod (Protocol for Operation Discovery) www.pfod.com.au which will let you control the board/relay from either the Arduino IDE SerialMonitor, or a terminal window (TeraTerm) or a Java program. The message protocol encloses commands in { }, think simplified html for micros, and provides numerous screens, menus, sliders, text and numeric inputs, etc. A detailed protocol spec is available
See Garage Door Remote for a detailed example, with full Arduino code and an example of controlling the relay from TeraTerm as well as the Arduino IDE SerialMonitor.
There is also an Android app, pfodApp, which will do general purpose control via bluetooth, or wifi/internet with 128 bit security. The pfodApp does all the Android stuff, you only need to code some simple strings in your Arduino code to get any menu system you want. See www.pfod.com.au for numerous examples.
You need a USB-GPIO microcontroller:
Adafruit FT232H (about $15)
Arduino Nano ATmega328 (about $7)
See this answer
I would suggest placing a separate Raspberry Pi unit with a wake-on-lan feature activated so you can ping it off and on.
You could do it by combining these two products from Pololu, for about $25:
Micro Maestro (assembled)
Basic SPDT Relay Carrier with 5VDC Relay (Assembled)
The Maestro is mainly a servo controller but you can set any of its channels to be simple digital outputs instead. The output can be controlled from the Maestro Control Center software or you can write your own software. A digital output from a Maestro is suitable to turn on the relay on the relay carrier. The relay could be powered from USB through the Maestro; I think it draws about 100 mA of current so that probably will not be a problem for most USB ports, though it would not be USB-compliant because the total current drawn by the Maestro and the relay would be over 100 mA. You could supply your own power source for the relay if you are worried about that.

Is USB power always enabled ? And if not, how to write a driver

I have a device that came with an AC power adapter where the connector is a mini USB plug. The device however doesn't seem to power itself from a computer's USB port (using a standard USB-mini USB cable) unless a specific driver is installed. The driver is only available for Windows. I would like to charge the device from USB plugs on different platforms.
My question is: why isn't power getting to the device without the driver? Is a driver always required for a USB port to start giving power? Or is it this device that's specifically made not to take a charge unless some software routine triggers it to do so?
I guess my question can be summarized as: Is power not present on the USB cable or is it present but the device ignoring it. If the answer is the former, I'll be trying to figure out how to write software that will enable the voltage to always be present.
Thanks
Why isn't power getting to the device without the driver?
USB ports are always powered when the computer is on and the USB control software hasn't detected current overdraw.
Is a driver always required for a USB port to start giving power?
No, the USB port is always required to start off providing power to the device, otherwise the device could never initiate a connection.
Or is it this device that's specifically made not to take a charge unless some software routine triggers it to do so?
This can be complex. To meet the USB spec a device cannot pull more than a few mA until it's registered with the computer.
However, nearly every computer allows the USB port to pull the full 500mA (and more) before it'll shut the power off.
The device you're charging is being nice by not pulling any significant power until the computer gives permission.
Writing software won't help, the device has to register with the USB bus, which will best be done with the driver.
However, the plug in charger doesn't do that. It likely has shorted the two data lines of the USB plug together, which signals the USB device that it's not connected to a computer and can pull the full 500mA without waiting.
Take a USB extension cable, cut off the jacket, and short the data lines (green and yellow, sometimes) together on the end going to the USB device, and leave them cut without touching anything on the end going to the PC, and leave the read and black power wires connected through.
It might work. If not, take the wall charger apart and find out what it's doing with each of the four USB wires, and see if you can duplicate that.
This might be helpful if you are targeting a linux system.
This seems to be platform-specific. In Linux, USB ports are always energized, while on Windows they don't. Thumbdrives with LEDs turn off when unmounted in windows, but in Linux they stay lit. My cellphone's manual says that it can't be charged by a PC, but I regularly do on my linux machine, I guess that's because they don't have a driver and windows won't power up without one.
Have you tried plugging it into a 'dumb' USB port - like the one on a car charger? Those ports are pure power and don't create a USB network. I think.
Unless you have the hardware specs from the manufacturer, I think you are out of luck. You could try reverse engineering the driver to see what it does, but I'd expect it would be cheaper and easier just to buy one with cross platform drivers or charges without the driver.