Android Phone and IoT - the Perfect Sense HAT for Raspberry Pi

Android Phone development is not just based on the Operating System, the things are the hardware and its improvement over the years.

More likely the Powerful Hardware and its compatible software that enables the growth of these phones.

Just the sensors and a combination of its usage made life better for Android Eco-system.

Obviously, we don't even need the Android Operating system to access these sensors which made a new product line of Raspberry pi.

We need software and hardware integration to do a job which we intend. But, is that's the end.

Definitely not, we create a new intelligence following the patterns of these sensor values, creating habits and play with data.

Two things we ponder here are very simple - Hardware and Data powered on it with Software.

Now, let's get under the skin - Sensors available in today's mobile phone.

Smartphones are not getting big with Android versions and play store, they hit a new standard with the help of sensors introduced.

1. Accelerometer - detects acceleration, vibration, and tilt to determine movement and exact orientation along the three axes. Determine whether the phone is in portrait or landscape orientation.
It can also detect how fast your phone is moving in any linear direction.

2. Gyroscope - provides orientation details and direction like up/down and left/right but with greater precision like how much the device is tilted. This is where it differs from accelerometer — gyroscope can measure rotation too but the former cannot.

3. Magnetometer -  compass. It can detect magnetic fields, so the compass app in phones uses this smartphone sensor to point at the planet’s north pole.

The absolute orientation of a phone is represented in angles yaw, pitch, and roll. It is detected by a combination of the accelerometer, compass, and gyroscope.

4. GPS - Global Positioning System (GPS) units in smartphone communicate with the satellites to determine our precise location on Earth. The GPS technology doesn’t actually use internet data this is why we can find our location on maps even after losing the signals, but the map itself is blurry as it requires internet to load the details — this is how offline map works. GPS is used in all location-based apps like Uber and Google Maps.

The accelerometer, gyroscope, magnetometer, and GPS work together to create the perfect navigation system in your smartphone.

5. Proximity Sensor - makes use of an infrared LED and IR light detector to find out how close the phone is to an outside object. It used while making calls and when the phone is held to the face to make or receive a call, the sensor detects it and disables the touchscreen display to avoid unintended input through the skin and also used for metal detection.

6. Ambient Light Sensor - detects the lighting levels in the vicinity to adjust the display brightness accordingly. It is used in Automatic Brightness Adjuster to decrease or increase the brightness of the smartphone screen based on the availability of light.

7. Microphone - basically a sound sensor that detects and measures the loudness of sound. While there are different types of microphone sensors available, smartphones generally use micro-sized electret microphones.

Apart from making and receiving calls, it is used for voice search and voice commands for digital assistant apps like Google Assistant, Siri, Cortana, etc.

8. Touchscreen Sensors -  have an electrical current passing through them at all times and touching the screen causes a change in the signals. This change acts as input for the device. But nowadays, the capacitive screen is used in almost all smartphones.

9. Fingerprint Sensor - Gone are the days of memorizing passwords and patterns to unlock your phone as many users prefer using the fingerprint scanner these days. Fingerprint sensor enables biometric verification to secure many smartphones today. It is a capacitive scanner that records your fingerprint electrically.

Also helps in the usage of Biometric devices.

10. Pedometer - used for counting steps, and fitness tracker makes use of this sensor to count the number of steps you take. Pedometers generally use the values generated by the accelerometer to monitor your movements like running or walking.

11. Barcode/QR Code sensors - can read a barcode by detecting the reflected light from the code. It generates an analog signal with a varying voltage that represents the barcode. This analog signal is then converted to a digital one and decoded to reveal the information in it. Barcode sensors are useful in scanning the barcodes products or QR codes.

12. Barometer - measures the air pressure, so it is quite useful in detecting weather changes and in calculating the altitude you’re at.

13. Heart Rate Sensor -  The LED emits light towards the skin, and this smartphone sensor looks for the light waves reflected by it.

There is a difference in the light intensity when there is a pulse. The heartbeat is measured by counting the changes in light intensity between the minute pulsations of the blood vessels. Many fitness and health apps use this method to calculate the heart rate.

14. Thermometer - for monitoring the temperature inside the device and battery. In case a component starts overheating, the system shuts down itself to prevent any damage.
It can be used by apps to detect your room temperature.

15. Air Humidity Sensor - could measure the humidity in the air, and the data collected by it would tell the user whether the given air temperature and humidity are optimum or not.

16. Geiger Counter - can measure the current radiation level in the area.

Around 16 - 20 sensors as the camera being used as a sensor nowadays can also be used as a featured one, All these data can easily emulate into decision making scope.

Now, let's see how to get these data for developers.

There are many kinds of communication protocols available on a mobile phone.

SMS, VoIP, SOS, OTG, Wifi, Bluetooth, Infrared.

For Android phone, we use its sensor data via Network (Socket programming) as a featured communication.

Because it is wireless and also the bridge between then them can be a simple as most programming languages support networking.

Python in this way makes a strong case, Qpython app for android can get data using Androidhelper library in python.
To know more on Androidhelper check this link

Internet of things is thus a possible feature inside our phone which is still under several security threats.
Some Android apps allow you to share the sensors via the network:

  • PhonePi (using WebSockets)
  • Sensor Node (via MQTT)
  • IP Webcam (can be used as a web API by accessing http://SMARTPHONE_IP:8080/sensors.json)
  • Tasker publisher


All these data can be sent to a PC or raspberry pi to get processed and also report back to make a new decision.

Thus, Baremetal android as a Sensorhub is a possible feature that we are not considering in mainstream usage.

Google Lens - a Machine Learning Android App detects objects but using phone camera with raspberry pi we can even make a decision on the objects detected.

For example, in the field of agriculture, we can use an android phone camera to detect infected vegetables and sort them using an additional actuator in combination with Raspberry pi can be a featured next level of devices rather than creating a new stream of hardware and programming languages.

Sound Detection can be an extremely viable feature in the case of running a buzzer against animals.

All these are ideas but the usage of the Android phone as a Sensor HAT for pi is highly recommended with respect to the cost of investment.





Post a Comment

0 Comments