How to Use USB-Controller App


Smartphone connected through a USB-OTG hub to a USB to Parallel port cable

Smartphone controlling an electric motor

If you want to build your own controller device, you could leverage an Android device and the USB-Contrller app. For some background and how to build a phone usb controller, see Phone USB Controller.

To use USB-Controller, start by downloading the Android app to your Android smartphone that you think has USB-OTG support.

Link to USB-Controller for Android smartphones

The first thing you will want to do with USB-Controller is verify that your smartphone hardware supports USB-OTG or USB host mode. Determining if smartphone hardware supports USB-OTG or USB host is a little hard because you have to have a USB device attached to the Android device in order for the software to determine if USB-OTG is supported. However, if you have a USB-OTG adapter or hub plugged into your smartphone and any working USB device plugged into that, you can use USB-Controller to check if your smartphone recognizes the USB device. To check your hardware, select the USB Host check button.




This will tell you what USB devices were identified as being connected to your Android device, or it won't recognize any devices. If USB-Controller indicates 'USB Device List emptry' like the upper images above, then you don't have a USB device attached or your Android device doesn't support USB-OTG (aka USB-Host). If USB-Controller indicates a list of Names and Devices and/or Interfaces, then you have at least one USB device attached and your Android device does support USB-OTG. Finally, if the 'Send Data' and 'Run Program' buttons are enabled like the lower images above, then you have a USB parallel printer adapter attached that your Android device has recognized.

Assuming your smartphone supports USB-OTG you have two ways that you can use USB-Controller: immediate, or programmed.

How To:

1) use USB-Controller in immediate mode

Every time a byte is written to the data ports, the data is only present as long as the Busy line is high. However, the Strobe to Busy circuit described on Phone USB Controller regularly lowers the Busy line so that you can continue to send control bytes. Thus you need to continusouly send control bytes to the port in order to be able to change the state in the future. To configure how many times in a row USB-Controller will resend the data, go to the Settings menu item, under the button in the upper right corner, and set the Pulse Count. You can also set the data transfer timeout time and then number of times to retry if the USB hardware detects a failure from the Settings screen.



Once set, go back to the main USB-Controller view and set the bits you want to turn on and the select the Send Data button. The data will be held as long as a pulse count counter is running.



2) use USB-Controller in programmed mode

While functionally similar to the immediate mode, programmed mode allows for you to set multiple data states and pulse counts at one time and then run through the sequence of tasks you entered. For the free version of USB-Controller you can set four tasks and for USB-Controller (No Ads) version you can set eight tasks.

To create a program of tasks go to the Program menu item, under the button in the upper right corner, or just select the Program button. The task # is shown with the option of moving to the previous or next task by selecting one of the arrow buttons. Set the bits you want to turn on or off and the pulse count you would like the task state to be held for. You can then use the previous or next arrow buttons to program the next task. When you're done entering the program, select save to go back to the main USB-Controller view.



From the main USB-Controller view, select Run Program to execute the task sequence. The data will be held as long as a pulse count counter is running for each task. Once the pulse count counter is done, the program moves on to the next task.



Link to USB-Controller for Android smartphones

Copyright (C) 2017 R. J. Kuhn. Please note that you are not allowed to reproduce or rehost this page without written permission.