Easy ways to interface a smartphone via usb ?

semar

Active Member
Licensed User
Longtime User
Dear all,
which ways are there available to interface an Handy via usb in order, for example, to control some relais or switches ?

Say I want to develop a B4A app which should move a small auto using step motors or something like that.

The first idea that I would consider is the use of a Raspberry or Arduino, and interface it with the smartphone via usb.

Other ideas ?

Thanks in advance,
Sergio
 

sorex

Expert
Licensed User
Longtime User
there was IOIO which was a board designed by Google especially for Android devices and controlled over the (micro) USB cable.

it's hard to find these days and more than double the price of what is was years ago.

RaspberryPi & Arduino will give you more options and controlling over wifi or radio signal so you don't really need the additional phone.

Also check for thes ESP8266(?) boards. Cheap and should be easy to control via B4R.
 

semar

Active Member
Licensed User
Longtime User
Thanks sorex for your reply.

I see that perhaps the WeMos D1 R2 WiFi ESP8266 could be a good choice, since it's programmable using B4R.

Are there examples here about connection between Smartphone and WeMos board using just an Usb cable ?

What I'm finding are examples using Wi-Fi, but I don't want to use a WLAN.

Regards,
Sergio
 

semar

Active Member
Licensed User
Longtime User
Thanks a lot Klaus.
Now searching for the usb connection examples.
I find the Bluetooth connection someway better, because no cable is required.
Anyway, some questions arises:

- in the first HC-05 example, a password for the Bluetooth connection between Android and Arduino is required. In the example, the string "1234" should be provided. Is that the default value for a HC-05 module ? How to set another password for it ?

- Would be possible for the B4R program on the Arduino to read/save a file from/to the Eprom ? Is there enough capacity on the ESP8266, as far as you know ?
 

klaus

Expert
Licensed User
Longtime User

Beja

Expert
Licensed User
Longtime User
In the example, the string "1234" should be provided. Is that the default value for a HC-05 module ?

Yes.. in rare cases it's 0000, so the default password is either 0000 or 1234. It can be changed, and the HC-5 can also be changed from master to slave.. both by AT commands. Search for "HC-5 Bluetooth module AT commands".
 

avalle

Active Member
Licensed User
Longtime User
Hi all,
for connecting and interacting with USB peripherals from an Android smartphone you have to refer to ADK.
Google used to have an ADK board working in connection to an Arduino Mega. This is currently end of life.
There's also an Arduino Mega ADK board, having an additional USB host port on it.
There are also USB Host shields for Arduino, to convert a Uno into the equivalent of a Mega ADK board.

In the B4A domain you can also find an old thread from Andy Graham about Arduino ADK with a lot of information:
https://www.b4x.com/android/forum/threads/arduino-adk-introduction.27510/

I've played with it long time ago and it's nice. For example you can launch an Android app automatically when the corresponding USB peripheral is connected to the smartphone. However it's definitely not easy compared to cheaper and easier Bluetooth to connect custom hardware to an Android phone.

HC-05 and HC-06 are a classic choice for Bluetooth, but more recently also the ESP-32 boards are a great choice at very low cost. They include not only Bluetooth hardware but also a powerful microcontroller and WiFi. On recent Android phones the ESP-32 can also work with Bluetooth LE with some advantages over classic Bluetooth, like reduced power requirements and no need for pairing the device to the phone, for better user experience.

Regards
Andrea
 

semar

Active Member
Licensed User
Longtime User
Hi all,
for connecting and interacting with USB peripherals from an Android smartphone you have to refer to ADK.
Google used to have an ADK board working in connection to an Arduino Mega. This is currently end of life.
There's also an Arduino Mega ADK board, having an additional USB host port on it.
There are also USB Host shields for Arduino, to convert a Uno into the equivalent of a Mega ADK board.

In the B4A domain you can also find an old thread from Andy Graham about Arduino ADK with a lot of information:
https://www.b4x.com/android/forum/threads/arduino-adk-introduction.27510/

I've played with it long time ago and it's nice. For example you can launch an Android app automatically when the corresponding USB peripheral is connected to the smartphone. However it's definitely not easy compared to cheaper and easier Bluetooth to connect custom hardware to an Android phone.

HC-05 and HC-06 are a classic choice for Bluetooth, but more recently also the ESP-32 boards are a great choice at very low cost. They include not only Bluetooth hardware but also a powerful microcontroller and WiFi. On recent Android phones the ESP-32 can also work with Bluetooth LE with some advantages over classic Bluetooth, like reduced power requirements and no need for pairing the device to the phone, for better user experience.

Regards
Andrea
Thank you Andrea !
 
Top