I am new to this topic and did a lot of research but could not find a solution to my question.
What I want to do: I want to attach something directly (I do not want to add a microcontroller) to the micro usb slot of my phone to power and control it (I want to use my phones power to power something else). I will use the 5V voltage that usb can give me (as far as I know I will have to use a USB OTG compatible device, but that is not the issue). So far so good. What I additionally want to do are the following two things:
- I want to control the power.
1.a) Is there a way (Writing app or ...) to get my phone to output usb pwm?
1.b) I dont necessarily need the fast rate of pwm. So is there any way (Writing app or ....) to turn on and off the power of the usb output?
- Can I read incoming data while powering and can they be outside of the usb protocol? This is supposed to mean: Once my Phone has done its work I want to give a signal onto the D- and/or D+ of the usb cable to tell the phone that it should stop giving power. That signal will not be in the usb protocol but will rather just be some voltage. For that I would need to be able to directly read the usb income and control my phone based on that. Is that possible? In Short: When I want to be done powering I put a Voltage of e.g. 3.3V onto D-/D+ and the phone notices this and turns of the power. So the questions are:
2.a) can I power something and read data over the same usb at the same time?
2.b) can I directly read the D-and D+ pins and use them to control my program?
Thank you very much.