Android basic usb interaction - android

I am working on a very small project, where I have to send a signal via usb to some kind of micro-controller board.
I am completely new to this, although have enough android experience, so just need answers to few questions for now:
1.) Is it correct that I will need some kind of Arduino kit to get even started ?
2.) Isn't there any way by which I can test this using day to day devices or simulator, rather than purchasing the kit itself ?
Please forgive if the question looks silly.
Thanks

Sure! you can communicate with your Android or any other languages like (C#, Java, Php, Python...) with Arduino or other micro controller by USB.
Arduino is very easy to start and you can send signal and perform
the required task.
As you code Android, check this you get clear idea.
Yah! Arduino emulator where you can check or
test. check here
Get to know about Arduino Here
Start with this program (Hello World of Arduino)
Hope it helps

You cannot send a signal out of the Android USB port. You will need to communicate with another device via bluetooth or WiFi, and have that device communicate via USB to the microcontroller.
If you want to avoid purchasing anything, you could write a small web service that runs on a computer hooked to your microcontroller. When your android app runs, it would communicate to that web server, which would in turn communicate with the microcontroller.
Then, when you are ready to purchase an intermediary device, if you design your code well, you'd be able to repurpose the code to communicate via that device instead of the web service.

Related

Android app that connects to a coin collector

I am trying to find a way to develop an Android app that connects to a coin connector. How would I get the Android app to recognize that a coin was inserted into the hardware?
Similar to the setup in this link
https://www.youtube.com/watch?v=p7FowiQbNVA
I can give you a general view about what you have to do,
First of all, you have to receive data from your coin device. Therefore you have to talk to a hardware specialist who can change this event to data, maybe using a USB cable communication or a BlueTooth or Wifi connection.
Then you can received this event data from Android OS and use it on your device. You may also require to use NDK and some C development.
I hope it helps :)

Send data between two Android devices on same network

I'm new to android programming and have a question about networking. I am creating a chess app where two players can play a game against each other on separate devices. My goal is to set this up so it works locally (the devices are near each other or on the same wifi network).
I noticed when trying to work through WiFi P2P (which thoroughly confused me) that the end goal was to get the MAC filter and IP address of the device you are connecting to. If I already have these (i.e. the user inputs them on the client device knowing these values externally) can I simply create the connection without using P2P?
In essence, can I simply start a networked android app with creating and connecting to a serversocket rather than dealing with P2P or NSD?
Thanks and sorry for any confusion,
Scott
you can use the alljyon sdk https://www.alljoyn.org/docs-and-downloads ,i had work with it and it work correctly ,you can find a sample demos one for chat in the same wirless without need the internet connection

find all devices in a network

In my local network there are several devices (running linux, c++) and an Android Smartphone.
Now I want to find and display all devices in the network on the Android Smartphone. Later i want to pair the android smart phone with the device for communication.
What's a good way to implement this?
My first ideas are:
sending a udp broadcast from the android smartphone, and handle these requests on each device and return a udp packet with more informations about the device.
or
When a device is active it periodically sends heartbeats as broadcast which the android smartphone can detect.
i also read about upnp, but i think this is kinda overkill.
Can you give me any hints how to implement this kind of task?
ty
You may want to have a look at nmap. It is a network scanner that can look through the network and find devices on it. Parse the output from it and display on the phone.

Getting started with Bluetooth development for Android: Suggestions for test application

I have a task to integrate a Bluetooth device into my application. Now my requirement is very specific. The device has a specific communication protocol which relies on certain ACKs but I figured it would make my development much easier if there was a program that let me test communication with the device.
I was wondering if there was a program for Linux, or perhaps a simple Android program which let me communicate with any Bluetooth device with a series of pings using data I enter and simply log the responses.
EDIT: I might not have been clear enough in my question.
I have a scale that I need to integrate into my application, and the scale has a protocol similar to this:
Get a specific byte string from device
Transfer data
Transfer packet for disconnection
Receive acknowledgement for disconnect packet
Disconnect
Now when I have to issue a POST request from my application, I usually build a test script online so I can test if the POST works properly.
I was wondering if there was something similar I could do with the device.
Thanks
Your question is not clear enough. To communicate with a BT device, you need to know what profile your device supports. Depending on that, you can find a way in Android or Linux or windows to communicate with the device.
The simplest way is to open an RFCOMM channel from android/PC and transfer data to and from the device. For this the device has to support the serial port profile (SPP). If you want to do this in Android, look for the BluetoothChat example from google.
If you want to use a PC/mac/linux look at the Bluez python module. It's really simple to use. There are plenty of other options too..
I was looking for something like SENA BTerm. It lets me connect to any device and send whatever data I wish.
It is an extremely useful tool for testing my code.
http://www.sena.com/download/manual_bterm/overview.html is where you can find it.

Bluetooth + simulating mouse

anyone know if its posible to make an application to simulate a touchscreen mouse or trackpad by bluetooth??
How can I make that the PC (or MAC) knows me as a mouse device?
Regards,
Juan
You should have a look at the Bluetooth HID specification. It may be possible, depending on the stack of the device that you are using to emulate a mouse/trackpad. I'm not familiar with the stack on Android (assuming that's the platform you're using from the tag on your question) so I don't know if it's possible from there.
Essentially, you create a HID service on the L2CAP protocol. The service record specifies the HID descriptors which describe the data being sent from emulating device. The HID driver on the host computer should be able to interpret that data.
It might be useful to try to connect to another Bluetooth mouse/trackpad from the desktop (Bluecove on a stack other than Microsoft is a good way to hack around in Bluetooth). Have a look at the service record for the HID service on the mouse/trackpad. Also, look at the data coming from the mouse/trackpad for an idea of what needs to be sent and when.
Alternatively, you could write a server application on your computer that communicates via another Bluetooth protocol (e.g., RFCOMM/SPP) to the input-device emulator app running on your phone. The server application would simulate the input device (e.g., move the mouse pointer around on the screen, etc).
Instead of creating your own project why dont you contribute to the remotedroid project?
I'm assuming you know your bluetooth api's well. Remote droid uses Wifi and OSC messaging to communicate with the PC.
Yes you may use GlovePie with the wiimote connected to BlueSoeil, It will alow you to do anything with you computer with the wiimote. It also has a Language it uses
I think you want this:
Serverless Bluetooth Keyboard & Mouse for PC/Phone
It's even open-source!
Unfortunately it is not open source, it just has a GitHub readme for some reason.
But still the app is quite good!

Categories

Resources