Hi,
I am designing a project that will sometimes be a USB device (connecting to a laptop) and sometimes be a USB host (connecting to an Android phone). I am using a Teensy 3.5, selected for its lower power consumption.
The project will operate in low power mode most of the time. The VUSB pin will be connected to an i/o pin (with resistors to lower the voltage to a safe level) so that USB power from the laptop can be detected, in which case the device will return to normal power mode and activate the USB in device mode (serial device).
The project will also have a momentary switch that the user presses to activate its user interface. This also brings the device out of low power mode and activates the USB in host mode, supplying 100mA at 4.5V (from the 3 AA batteries supplying the device) to VBUS. As a host, it only needs to support serial devices.
Clearly, the two key pieces are the circuit for supplying power to the USB VBUS and the software changes to allow switching between USB device/host modes.
I have attached a proposed circuit for supplying the VBUS power. I selected TPS22945 because it has built in current limiting to 100mA. The USB OTG specs indicate that it is acceptable to provide only 4.4V if the rated current is less than 100mA. I also added another MOSFET after the output capacitor to remove the output capacitor from the USB bus if my project is in USB device mode. I am not sure if that is really necessary, especially given the diode that protects the TPS22945 from the back current. I would appreciate any comments on the design.
For the software, I need to explore the USB host library before I know what LOE is required to enable software switching between host and client modes. I am hoping that it will not be too bad, since I do not need to support HNP for my application. I am very comfortable working in ISR code, but would appreciate any pointers in the right direction, and especially sanity checking my plans. (I did see the long thread on USB Host 3.0 with tutorials on getting Linux/Netbeans set up for library development, and do plan to contribute my software/hardware designs when they are tested.)
Context: the overall project is a location/activity tracker, that logs IMU, altitude, air pressure, temp, GPS data to the SDS card, keeps a running pose/location estimate and interfaces with the cell phone to give the user a nicer user interface. The device is intended to operate on 3 AAs for 4 days of hiking, used about 14 hrs/day, so I want to keep the power consumption low. I was originally planning to use Teensy LC, but the Teensy 3.5 came out just in time and the 32-bit architecture and FPU should mean more work done per clock to offset the higher power consumption per clock. I have an optimized real-time scheduler about ready to publish (fried my Teensy, so I cannot complete the testing until I get a replacement...) and have plans for publishing the data logging control library and hope to make enhancements to Snooze to allow an additional low power mode (high clock rate when using USB, moderate clock rate during pose estimation/activity recognition and VLP during routine data logging).
Regards,
-- Steven
I am designing a project that will sometimes be a USB device (connecting to a laptop) and sometimes be a USB host (connecting to an Android phone). I am using a Teensy 3.5, selected for its lower power consumption.
The project will operate in low power mode most of the time. The VUSB pin will be connected to an i/o pin (with resistors to lower the voltage to a safe level) so that USB power from the laptop can be detected, in which case the device will return to normal power mode and activate the USB in device mode (serial device).
The project will also have a momentary switch that the user presses to activate its user interface. This also brings the device out of low power mode and activates the USB in host mode, supplying 100mA at 4.5V (from the 3 AA batteries supplying the device) to VBUS. As a host, it only needs to support serial devices.
Clearly, the two key pieces are the circuit for supplying power to the USB VBUS and the software changes to allow switching between USB device/host modes.
I have attached a proposed circuit for supplying the VBUS power. I selected TPS22945 because it has built in current limiting to 100mA. The USB OTG specs indicate that it is acceptable to provide only 4.4V if the rated current is less than 100mA. I also added another MOSFET after the output capacitor to remove the output capacitor from the USB bus if my project is in USB device mode. I am not sure if that is really necessary, especially given the diode that protects the TPS22945 from the back current. I would appreciate any comments on the design.
For the software, I need to explore the USB host library before I know what LOE is required to enable software switching between host and client modes. I am hoping that it will not be too bad, since I do not need to support HNP for my application. I am very comfortable working in ISR code, but would appreciate any pointers in the right direction, and especially sanity checking my plans. (I did see the long thread on USB Host 3.0 with tutorials on getting Linux/Netbeans set up for library development, and do plan to contribute my software/hardware designs when they are tested.)
Context: the overall project is a location/activity tracker, that logs IMU, altitude, air pressure, temp, GPS data to the SDS card, keeps a running pose/location estimate and interfaces with the cell phone to give the user a nicer user interface. The device is intended to operate on 3 AAs for 4 days of hiking, used about 14 hrs/day, so I want to keep the power consumption low. I was originally planning to use Teensy LC, but the Teensy 3.5 came out just in time and the 32-bit architecture and FPU should mean more work done per clock to offset the higher power consumption per clock. I have an optimized real-time scheduler about ready to publish (fried my Teensy, so I cannot complete the testing until I get a replacement...) and have plans for publishing the data logging control library and hope to make enhancements to Snooze to allow an additional low power mode (high clock rate when using USB, moderate clock rate during pose estimation/activity recognition and VLP during routine data logging).
Regards,
-- Steven