Analog Input from Arduino to Android Studio - android

I am coding an application in Android Studio that uses analog inputs from an arduino. I am trying to send analog input from an Arduino Pro mini to an Android App. However, I cannot connect straight to the phone (USB port isn't available). The method I've thought of is to connect both the phone and Arduino to PC and read the Analog input using Android Studio and Use my phone to run the application instead of an emulator. Would this work in real time.
Is it possible to have the Android Studio run the app and the app still reads information from the Arduino real time? The application reacts to analog inputs from the Arduino. So I need to find a way to access the arduino in android studio and run the app through android studio in place of its emulator
I can't find any sources so if anyone has a clue please help me. Thank You!

You should post this to the Arduino StackExchange forum: http://arduino.stackexchange.com.
A couple things:
Android Studio is just for developing Android apps, it's not going to help you read data from the Arduino. You would need to write a separate app for the PC that would moderate between the Android and Arduino. Not fun.
When you say "USB port isn't available" I assume you mean the host port. Actually, many newer Android devices are able to be a USB host, so you would just need the right dongle to be able to connect the two. Then you would use the classes in package android.hardware.usb like UsbManager to connect to the Arduino.
Another thing you might think about is getting a BlueTooth shield for your Arduino and connecting to the Android with BlueTooth.
Hey! Wanna be a real Evil Genius(TM)? Write some code to flash the LED on the Arduino like Morse Code or Navy signaling, then write some Android code to read the video from the camera and turn the LED flashes back into data! Impress your friends! Put it on your resume!
Just some random ideas to get you going. I think the folks on the Arduino StackExchange forum can be more help.

Related

Which one do I have to use if I want to make bluetooth connection between Android app and Arduino nano 33 IOT? (BLE or Classic)

I am trying to make a android app which can make connection with Arduino nano 33 IOT device.
I realized that Arduino nano 33 IOT has BLE module on it, so I used <ArduinoBLE.h> to advertise the device.
When I was making android app which can make connection with Arduino nano 33 IOT, I tried two different ways. first one is use classic bluetooth(BluetoothAdapter), and the second is use BLE bluetooth(BluetoothLeScanner).
But it is a little confusing which one I have to use. If I use classic, the App can search device but connect. If I use BLE, the App cannot even Search devices.
I asked a question on stackoverflow one week ago, and a kind person answered me that I have to use BLE.
So I tried it, but it is still not working...
is it ok to use classic version to make connection with BLE? or not?
You can use either BLE or classic Bluetooth on the Arduino nano 33, however, my recommendation is to use BLE as well. This is because you'll find more resources online on how to develop and use BLE, and also your application will end up using less power (hence the name BLE).
I would start with the Arduino BLE page itself which you can find here:-
https://docs.arduino.cc/tutorials/nano-33-ble-sense/ble-device-to-device
The copy the peripheral example which you can find on the page above. After that, as a sanity check, I would use the nRF Connect app on Android or iOS to make sure that the peripheral example is working as ukBaZ suggested. If everything is working by then, then you're good to start developing the Android app.
The Android app isn't going to be straight-forward but luckily there are a lot of resources that can help you get started, including the following:-
The ultimate guide to Android BLE
BLE programming on Android tutourial
Making Android BLE work
After that you should hopefully be able to connect and talk to your Arduino nano from an Android app. Remember that your Android app has to be the central that connects and reads the data, while your Arduino nano has to be the peripheral that advertises and hosts the data.

Bluetooth to Android to Arduino communication: Is It possible?

I have mostly a general question, so I'm sorry if this is too broad. But I am working on plan for a robot and I wanna connect devices together.
Basically, I want to have an Android device connect to an Arduino Uno via Bluetooth, and then the Android Device connect to either another Android, or to a Bluetooth controller. The reason for this is that I want the main Android device to be used as a controller, and feed instructions to the Android device connected to the arduino, and that device to the arduino, and carry out that instruction. But is that even possible? If not, how can I work around it? And if it is possible, any examples?
Summary:
*Android Device to Android Device to Arduino via Bluetooth
*First device as a controller, second as a brain to arduino
*First communicates with second, second communicates with arduino
Yepp bro it's possible i did with some other development board other than arduino
but the important thing is concept and it's same for all developement boards.
In my project i created a connection between an android mobile & robot and then controlled its movement through an App like picking up an object using robotic arm and its motion.

Android App (Kivy or Ai) freezes when I try to connect BLE on Arduino Uno

Sorry for my English. This forum solved many times my problems just by reading some other questions.
I have a Grove BLE v1 on Base Shield v2 on an Arduino Uno. I am trying to send bytes over BT with my Galaxy Note (Android 4.4). Pairing is OK.
Some apps work correctly like BLE Scanner or HMBLEComAssistant. (Can connect and send some bytes). But, using an app created with App Inventor, or using an app created with Python Kivy like Link, my App freezes every times I try to connect to BT. The led of my BLE turns on continuously like it was connected.
In all my apps, I can see and get names or MAC addresses of paired devices.
Does someone get the same problem? Is my 4.4 Android having trouble with BLE?
Is there a problem with BTsocket.connect() like I read in this question?
LINK
Thanks for reading this question and for this forum.
Ok, its seems to be that BLE is not as a classic BT. Have to use connectGatt().
I can now connect whith my BLE whitout freezing in my Kivy App but can't send any data for now.
Will search for this.

Arduino not forming Bluetooth connection/sending sensordata from arduino to android

I'm using arduino Mega ADK and RedBear BLE shield.
The goal is to make arduino send sensordata to androidphone(nexus 7) via bluetooth. Sensor should be accelerometer/Gyro type.
I have used RedBears SimpleChat as a starting point to get understanding how this is suppose to work, but i'm having some problems. When i use RedBears own app from google play store and the examples that they distribute, everything works just fine. App finds arduino and i can connect to it that way.
But i can't connect to arduino without the app, it just... rejects it. I have tried changing my tablet settings anyway possible but that just doesn't seem possible.
Additionaly if i run any other code(not from the redbear i mean) to arduino, tablet cant find arduino from bluetooth connections anymore and neither can any app that has BT finding properties.
So what i'm trying to figure out is:
A way to connect my tablet to arduino without redBear app.
Does the redBear BLE shield somehow prevent other codes to be passable?
Does the redBear have some kind of BT method that is better than others?
Any help, examples or answers are much appreciated.
Sorry for the bad English -_-
Here is a SDK provided by RedBearLab for Android https://github.com/RedBearLab/Android. It also contains examples.

Real time Communication over 3g (PC -> Android Smartphone -> Arduino)

I'm developing an Arduino project (but this is not important). For this project I need to communicate (radio control) to my Arduino from my PC. The idea is to send the message or the instruction to my smartphone (cheap Android), which is connected to the internet over 3g. Then the phone will communicate to Arduino thank to the audio port (jack audio), sending a frequency controlled pulse, that is quite easy to do.
The problem is the communication between the PC and the smartphone.
Somebody has an idea of how to achieve that, eventually creating a simple application, or better, directly from the opened smartphone browser (android froyo 2.2)?
Which is the best server technology to use, and the faster, considering the tipical 3g ping?I haven`t found any source on the web, so I hope in your answers.
The microcontroller can be, with Wifly and this firmware https://dl.dropboxusercontent.com/u/101922388/WiflySanUSB.zip , a server (switching the led signal through 192.168.1.195/YT in adress bar) or also a client (the AD converter value is inserted in google databank).
I believe this could solve your problem: htpp://www.muzzley.com
Download C#/java sdk/nodejs and build your app in your computer (and connect it to arduino has you would like)
http://www.muzzley.com/downloads
Build your own widget to run on the side of the smartphone through this widget: http://www.muzzley.com/documentation/widgets/webview.html
note: you do not need to worry about the smartphone app. It's already done. Just build your own interface
How it will work
[SMARTPHONE 3g/4G] ---> [Computer with app] ---> arduino
I hope it helps.

Categories

Resources