I'm trying to use my smartphone as power supply and communication protocol for Arduino
(I have Android based smartphone (LG g5) and I'm using Arduino-Uno).
Does it work?
Do I need to program the Arduino code for such a thing or it is just plug-n-play?
And what adaptations should I do for the power supply?
I mean in terms of voltage - does it safe? will it work?
PaulS:
The source of power is completely unrelated to the code.
I ask regarding the communication protocol - of course the power source does not relate to the code...
PaulS:
For what purpose?
I would like to form an Arduino-Smartphone mobile system (the Arduino will be powered on by the smartphone) which will be able to collect data (using the Arduino) and transmit it directly to the Smartphone
I mean in terms of voltage - does it safe? will it work?
Beats me. I'm not a voltmeter, and I don't have access to your phone. Surely, you have a voltmeter, or will before you risk f**king your phone up.
I ask regarding the communication protocol
Like the Arduino, your phone is dumb as a box of rocks UNTIL you write some code (or buy some). The communications protocol will be something that YOU invent, based on what you need to send from/receive on the phone, and what you expect the Arduino will do about the phone's (unrealistic) expectations.
I would like to form an Arduino-Smartphone mobile system (the Arduino will be powered on by the smartphone) which will be able to collect data (using the Arduino) and transmit it directly to the Smartphone
I would use a power bank or just a PC (through a usb hub) maybe for the moment if I were you. From what you wrote, you don't have a lot of experience with this sort of things. You need to gain enough experience using Arduino to not break your phone, or as PaulS put it in a less polite way.
An arduino has a serial port connected to the usb port. On one side of this serial connection is arduino. You need to write code for arduino to understand how to talk to sensors etc. it is connected to and send measurements over the serial connection. The other side is your phone (or PC for the moment). You need to write another program to receive measurements sent by your arduino code and do what you want with the measurements. Nothing except for getting power happens unless you make an effort by means of coding.
I've connected a wired keyboard to my Android phone via a USB OTG cable. This makes the phone act like the "host" side of the USB connection. The keyboard I used drew about 100mA without causing any problems on my phone (besides faster battery drainage), so I see no reason you couldn't connect an Arduino to your phone with the same method.
Making your phone actually talk to the Arduino is a different matter altogether. Android has native support for keyboards and mice, but I have no idea if it supports the USB-to-serial converter on the Arduino or how to make an app talk to it.
christop:
Making your phone actually talk to the Arduino is a different matter altogether. Android has native support for keyboards and mice, but I have no idea if it supports the USB-to-serial converter on the Arduino or how to make an app talk to it.
I once used a terminal app on a Sony Xperia to receive serial data from a barebones 328 using an FTDI adapter. So communication IS possible. You need to develop you own Android app to make sense of the data just like you would on a PC
olf2012:
You need to develop you own Android app to make sense of the data just like you would on a PC
This is nonsense. Feel free to re-invent the wheel if you must, but there are surely enough terminals out there already. The same applies to PC.
aviem:
Does it work?
You will need an FTDI device, and be sure the phone has USB OTG. I would have thought a Uno was a really bad choice of Arduino. One of those postage stamp Arduinos like perhaps a 3.3v Pro Mini would surely make more sense. I don't think you need any special programming, serial is serial.
liuzengqiang:
I would use a power bank or just a PC (through a usb hub) maybe for the moment if I were you. From what you wrote, you don't have a lot of experience with this sort of things. You need to gain enough experience using Arduino to not break your phone, or as PaulS put it in a less polite way.
An arduino has a serial port connected to the usb port. On one side of this serial connection is arduino. You need to write code for arduino to understand how to talk to sensors etc. it is connected to and send measurements over the serial connection. The other side is your phone (or PC for the moment). You need to write another program to receive measurements sent by your arduino code and do what you want with the measurements. Nothing except for getting power happens unless you make an effort by means of coding.
Well maybe I sounded a bit stupid (and that is since I'm not familiar with the terms) - but I do have already working prototype;
I wrote a native app which my laptop runs
The Arduino run, powered by the laptop
My app reading the USB serial
All works fine!
olf2012:
I once used a terminal app on a Sony Xperia to receive serial data from a barebones 328 using an FTDI adapter. So communication IS possible. You need to develop you own Android app to make sense of the data just like you would on a PC
The Arduino I use is Arduino Uno, and the connectivity to the laptop is a simple USB - so I thought I wouldn't need any additional bridge... does the USB connector of the phone (itself) using a simple serial?
Nick_Pyner:
This is nonsense. Feel free to re-invent the wheel if you must, but there are surely enough terminals out there already. The same applies to PC. You will need an FTDI device, and be sure the phone has USB OTG. I would have thought a Uno was a really bad choice of Arduino. One of those postage stamp Arduinos like perhaps a 3.3v Pro Mini would surely make more sense. I don't think you need any special programming, serial is serial.
As far as I checked, the ArduinoUNO has FT232RL which acts as FTDI, right? So why do I need another FTDI bridge?
MorganS:
I think Bluetooth will be easier for communication, even if the Arduino is drawing power from the phone's USB port.
I definitely thought about it. The phone app I just wrote will support it of course, but I thought of a more reliable communication protocol than a wireless one... (but surely not rule out this option)
Under normal circumstances the phone and the Arduino are USB slaves. They don't transmit any data on USB until they are plugged into a USB host, such as a PC. If you plug them together they don't talk amongst themselves.
Remember you usually need a driver on the PC each time you plug in a new type of USB device.
Now a modern phones can do many things that used to require large computers. They can run USB on host mode, often called USB OTG. It is still a problem getting the right drivers but there are some standard interfaces that you would expect to always work: the FTDI serial interface, for example.
I still say Bluetooth is easier, more reliable and more flexible.