How would android app receive data from external sensor

Hi everybody

I need a high level technology advice on how an android app would communicate with external sensor.I am android programmer but totally new in hardware technologies.

What i want to accomplish
I want to create an Android app that would receive data from a sensor located at least 100 ft away.This sensor is supposed to detect an object or person near-by it(1 or 2 ft away) and send that info to my android app.

First question
What type of pieces/tools do i need to collect to accomplish this? Like do i need Arduino board?If so what type? and how the sensor is attached to the board .And if somebody can explain in high level how is the data flow between all these pieces/devices go about to the android app.

Second Question
Based on what i need to accomplish what kind of sensor do i need and where can i buy it?

Thank you in advance. Forgive my ignorance :confused:

Well.. you need to figure out what sensors you want to use specifically for your project..

but a PIR sensor something would work..


your sensor (PIR?) a Bluetooth module and an Arduino is all you would need.

Since your an Android programmer.. connecting/pairing with a BT device.. shouldnt be an issue.

the most used (cheap) BT modules for Arduino are just serial based. (very easy to work with)..

You can read up on how to use EACH individually... once you have those worked out.. you can work toward merging both sketches (code) together..

Its not that difficult of a project.. but it seems like you have zero Arduino experience.. so you have some work/reading ahead of you.

the easiest Arduino board to work with in the UNO, IMHO.. most libraries are for it.. tons of support..

where/what is the end product supposed to be/go?

Uno's are nice for quickly prototyping, and easy set-up.. but they are not the smallest form factor out there..

An Arduino Pro-Mini is a nice drop-in replacement when your are done with code.. and has a very tiny footprint.

I’m going to second everything that @xl97 went over - but I am also going to let you know about another option for your external board:

It’s called an ESP8266.

There are several different variants of it - but at the core, it’s a specialized embedded microcontroller with on-board wifi, and it is very, very cheap (as little as $3.00 USD per).

There does exist an Arduino IDE target for it:

You can also use the ESP8266 with an Arduino - depending on your needs; in such a case, the ESP8266 acts as a “bridge” to give the Arduino (or whatever else you hook up to it) wifi access. But for the smallest and cheapest solution for an diy IOT project - the ESP8266 used alone (with your sensor) is a nice kit. With the built in wifi, it is easy to set it up to communicate with the network, the internet, and devices beyond (like your phone).

Note though, that it does have some limitations - namely only one ADC pin; however, it does have a few digital GPIO pins, which could be used to measure an analog voltage (basically by using a capacitor drain timing system - like the old IBM PC joysticks used). Alternatively, you can hook up a analog multiplexer chip to give you more pins, and select between them using the digital GPIO.

It is also a 3.3 volt part only - so you need to keep that in mind if you use it with the Arduino (since normally it runs on 5 volts and uses 5 volt TTL signals - it is possible, though, to run the Arduino at 3.3 volts, although only at 8 MHz).

Please note I am not trying to confuse you; in fact, just keep the above in the back of your head, and work with the solution (or something similar) that @xl97 described. I just wanted to let you know of another option out there that is fairly popular, due to its low cost, mainly. It isn’t, though, what I would call a beginner’s part for embedded development (though it is rapidly getting there - it was only a little over year ago that the only way to play with the ESP8266 was via bad translations of Chinese-language only datasheets!)…

Thank you both @xI97 and @cr0sh for your insights.So i get it now i need sensor(definitely PIR looks something that i would need), BT module and arduino board. But my question is based on what i need to accomplish what would be the main purpose of the arduino in this case? And where i can find some materials/tutorials to get started specifically for my project?

If i understood you correctly, is ESP8266 supposed to replace the BT module in my case?

quick and dirty:

Arduino is the 'brain' more or less..

it connects to the PIR sensor.. and 'detects' when something is 'in range'..
it then tells the connected BT module to broadcast 'whatever' it is you want broadcasted.

your app will be connected/paired with this BT module.. so you get this 'broadcasted' message to do with whatever it is you want your Android app to do with it.

So the TL;DR of it is,.. The Arduino is the bridge. connecting all these devices together, and controlling them.

For crOsh's suggestion, yes, in one scenario he proposed, it would replace the BT module...

but in another scenario he outlines.. it could -ALSO- replace the Arduino as well..

Awesome :slight_smile: Thank you very much. That was very helpful