Tag Archives: Sensor

Get Sensor Data From Arduino To Smartphone Via Bluetooth

Hariharan Mathavan at allaboutcircuits.com designed a project on using Bluetooth to communicate with an Arduino. Bluetooth is one of the most popular wireless communication technologies because of its low power consumption, low cost and a light stack but provides a good range. In this project, data from a DHT-11 sensor is collected by an Arduino and then transmitted to a smartphone via Bluetooth.

Required Parts

  • An Arduino. Any model can be used, but all code and schematics in this article will be for the Uno.
  • An Android Smartphone that has Bluetooth.
  • HC-05 Bluetooth Module
  • Android Studio (To develop the required Android app)
  • USB cable for programming and powering the Arduino
  • DHT-11 temperature and humidity sensor

Connecting The Bluetooth Module

To use the HC-05 Bluetooth module, simply connect the VCC to the 5V output on the Arduino, GND to Ground, RX to TX pin of the Arduino, and TX to RX pin of the Arduino. If the module is being used for the first time, you’ll want to change the name, passcode etc. To do this the module should be set to command mode. Connect the Key pin to any pin on the Arduino and set it to high to allow the module to be programmed.

Circuit to connect HC-05 with Arduino
Circuit to connect HC-05 with Arduino

To program the module, a set of commands known as AT commands are used. Here are some of them:

AT Check connection status.
AT+NAME =”ModuleName” Set a name for the device
AT+ADDR Check MAC Address
AT+UART Check Baudrate
AT+UART=”9600″ Sets Baudrate to 9600
AT+PSWD Check Default Passcode
AT+PSWD=”1234″ Sets Passcode to 1234

The Arduino code to send data using Bluetooth module:

//If youre not using a BTBee connect set the pin connected to the KEY pin high
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(4,5); 
void setup() {
 String setName = String("AT+NAME=MyBTBee\r\n"); //Setting name as 'MyBTBee'
 Serial.begin(9600);
 BTSerial.begin(38400);
 BTSerial.print("AT\r\n"); //Check Status
 delay(500);
 while (BTSerial.available()) {
 Serial.write(BTSerial.read());
 }
 BTSerial.print(setName); //Send Command to change the name
 delay(500);
 while (BTSerial.available()) {
 Serial.write(BTSerial.read());
 }}
void loop() {}

Connecting The DHT-11 Sensor

To use the DHT-11, the DHT library by Adafruit is used. Go here to download the library. When the letter “t” is received, the temperature, humidity, and heat index will be transmitted back via Bluetooth.

circuit to connect DHT-11 with Arduino
circuit to connect DHT-11 with Arduino

The code used to read data from the DHT sensor, process it and send it via Bluetooth:

#include "DHT.h"
#define DHTPIN 2 
#define DHTTYPE DHT11 
DHT dht(DHTPIN, DHTTYPE);
void setup() {
 Serial.begin(9600);
 dht.begin();}

void loop()
{ char c; 
if(Serial.available()) 
 { 
 c = Serial.read(); 
 if(c=='t')
 readSensor();
 }}
void readSensor() {
 float h = dht.readHumidity();
 float t = dht.readTemperature();
 if (isnan(h) || isnan(t)) {
 Serial.println("Failed to read from DHT sensor!");
 return;
 }
 float hic = dht.computeHeatIndex(t, h, false);
 Serial.print("Humidity: ");
 Serial.print(h);
 Serial.print(" %\t");
 Serial.print("Temperature: ");
 Serial.print(t);
 Serial.print(" *C ");
 Serial.print("Heat index: ");
 Serial.print(hic);
 Serial.print(" *C ");
}

Developing The Android App

The flow diagram of the Android app is illustrated below,

Flow diagram of the Android app
Flow diagram of the Android app

As this app will be using the onboard Bluetooth adapter, it will have to be mentioned in the Manifest.

uses-permission android:name="android.permission.BLUETOOTH"

Use the following code to test if Bluetooth adapter is present or not,

BluetoothAdapter bluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter == null) {
Toast.makeText(getApplicationContext(),"Device doesnt Support Bluetooth",Toast.LENGTH_SHORT).show();
}

The following part of the code deals with reading the data,

int byteCount = inputStream.available();
 if(byteCount > 0)
 {
 byte[] rawBytes = new byte[byteCount];
 inputStream.read(rawBytes);
 final String string=new String(rawBytes,"UTF-8");
 handler.post(new Runnable() {
 public void run()
 {
 textView.append(string);
 }
 });
 }

To send data, pass the String to the OutputStream.

outputStream.write(string.getBytes());

The complete source code of the Android application can be downloaded from here.

Testing

Power up the Arduino and turn on the Bluetooth from your mobile. Pair with the HC-05 module by providing the correct passcode – 0000 is the default one. Now, when “t” is sent to the Arduino, it replies with the Temperature, Humidity, and Heat Index.

the application screen
the application screen

Researchers Developed Hybrid 3D Printing Method To Make Flexible Wearable Devices

Wearable electronic devices that intend to track and measure the body’s movements must be soft enough to flex and stretch to accommodate every body-movement. But, integrating rigid electronics on skin-like flexible materials has proven to be challenging. Clearly, Such components cannot stretch like soft materials can, and this mismatch frequently causes wearable devices to fail. Recently scientists solved this problem by developing a new method called hybrid 3D printing.

Making wearble devices using Hybrid 3D Printing method
Making wearable devices using Hybrid 3D Printing method

A collaboration between the Wyss Institute, Harvard’s John A. Paulson School of Engineering and Applied Sciences, and the Air Force Research Laboratory, has resulted in developing hybrid 3D printing method. It combines soft, electrically conductive inks, and matrix materials with rigid electronics into a uniformly stretchable device. Alex Valentine, a Staff Engineer at the Wyss Institute says,

With this technique, we can print the electronic sensor directly onto the material, digitally pick-and-place electronic components, and print the conductive interconnects that complete the electronic circuitry required to ‘read’ the sensor’s data signal in one fell swoop.

To make the circuits and the flexible layers, the researchers use thermoplastic polyurethane (TPU), both pure and with silver flakes. The method is quite easy to understand. As both the substrate and the electrodes contain TPU, they firmly adhere to one another while they are co-printed layer-by-layer. After the solvent evaporates completely, both of the inks harden, forming an integrated system that is both flexible and stretchable.

As the ink and substrate are 3D-printed, the scientists have complete control over where and how the conductive features are patterned. Thus they can design circuits to create soft electronic devices of nearly every size and shape. The hybrid 3D printing method enables development of flexible, durable wearable devices that move with the body.

A ring that is made using flexible conductingmaterial
A ring that is made using flexible conducting materials

Conductive materials exhibit changes in their electrical conductivity when stretched. Soft sensors, that detect movements, are made of those materials and are coupled with a programmable microcontroller to process those data. The microcontroller also transmits the data to communicate in a human-understandable way. As a proof-of-concept, the team created two devices – a wearable device that indicates how much the wearer’s arm is bending and a pressure sensor in the shape of a person’s left foot.

Watch the video to know about them,

Researchers Develop Long Range Backscatter Sensors That Consume Almost No Power

Researchers at the University of Washington developed a new backscatter sensors that can operate over long ranges with very little power. The researchers demonstrated for the first time that the device runs on almost zero power and can transmit data across distances of up to 2.8 kilometers.

The long-range backscatter system developed by UW researchers
The long-range backscatter system developed by UW researchers

Backscatter communication works by emitting a radio signal and then monitoring the reflections of that signal from sensors. As the transmitter generates the signal, the sensors themselves require very little power. But this kind of system badly suffers from noise. Noise can be added anywhere – on the transmitter side, on the channel or on the sensor array. The key to solving this problem is a new type of signal modulation called chirp spread spectrum.

By using the chirp spread spectrum modulation technique, the team was able to transmit data up to 2.8 kilometers while the sensors themselves consumed only a few microwatts of power. Such extremely low power consumption lets them run by harvested ambient energy and very small printed batteries. The cost is surprisingly cheap too. The sensors would cost just 10 to 20 cents per unit if bulk purchased.

Today’s flexible electronics and other sensors need to operate with very low power typically can’t communicate with other devices more than a few feet or meters away. By contrast, the University of Washinton’s long-range backscatter system achieved pretty strong coverage throughout a 4800-square-foot house, an office area including 41 rooms, and a one-acre vegetable farm at extremely low power and low cost.

Shyam Gollakota, the lead faculty and associate professor in the Paul G. Allen School of Computer Science & Engineering, said,

Until now, devices that can communicate over long distances have consumed a lot of power. The tradeoff in a low-power device that consumes microwatts of power is that its communication range is short. Now we’ve shown that we can offer both, which will be pretty game-changing for a lot of different industries and applications.

These low-power sensors have endless potential applications. They can be used for everything from wearable health monitors to scientific data collection devices. Though there are no confirmed products yet, the team has created few prototypes in the form of flexible sensors worn on the skin, smart contact lenses, and more.

Open Board for 3D Gesture Control, Motion Capturing, Tracking and Robotics

Next Industries show off The Tactigon: the perfect link between humans or objects and the digital world, with its IMU 3D features, environmental sensors and Bluetooth 4.0 technology.

The Tactigon is a unique platform, programmable with Arduino IDE and expandable with GPS, LoRa or SIGFOX communication add on; it’s made for unlimited applications both in the industrial  and in the consumer IoT worlds.  Action, gesture, motion, and  robots can be kept under control through a  wearable,  small but powerful electronic board. It is small, rectangular, with a lot of sensors inside, wireless, low power consumption and also wearable. With the above mentioned six features, this device is the perfect tool to test ideas and bring projects to life. The Tactigon measures linear and angular motion through 3 axis gyroscope and 3 axis accelerometer; an extra 3 axis magnetic sensor is included to provide more precision. Environmental sensors are on board, so temperature and barometric pressure data recording can be easily provided, like also out of the box communication through low energy Bluetooth 4.0, and optional available GPS, SIGFOX and LoRa.

Open Board for 3D Gesture Control, Motion Capturing, Tracking and Robotics – [Link]

Tri-axis sensor embeds pedometer

Susan Nordyk @ edn.com discuss about the Kionix’s accelerometer with integrated pedometer.

The K126 16-bit tri-axis digital accelerometer from Kionix integrates a step detector and step counter, yet minimizes power consumption. Housed in a tiny 2×2×0.9-mm LGA package, the K126 offers user-selectable g ranges of ±2 g, ±4 g, and ±8 g and output data rates of up to 25.6 kHz.

Tri-axis sensor embeds pedometer – [Link]

Air Quality Sensors on tindie.com

Pesky Products @ tindie.com writes:

This is a small (17.9 mm x 10.3 mm) breakout board with Bosch’s BME280 pressure, temperature, and humidity sensor as well as AMS’ CCS811 digital gas sensor. The sensors work in concert to provide a complete measurement via I2C register reads of indoor air quality including temperature- and humidity-compensated estimates of equivalent CO2 concentration in parts per million (400 – 8192 ppm) and volatile organic chemical concentration in parts per billion (0 – 1187 ppb).

Air Quality Sensors on tindie.com – [Link]

Twiz – Tiny Wireless IMUs

Tiny Wireless IMUs – 100% open & autonomous 9DoF motion sensor using BLE to control anything from your [objects] motion ! by Drix @ hackaday.io:

We looked for tiny, autonomous, easy to use, and 9 Degrees of Freedom IMU, but none of the available wireless motion sensors were affordable enough to really unlock creativity, so we built one.

Twiz – Tiny Wireless IMUs – [Link]

Dual die, Hall effect, latch and switch sensor is accurate & redundant

Graham Prophet @ eedesignnewseurope.com discuss about Melexis magnetic latch and switch sensors. He writes:

Melexis (Tessenderlo, Belgium) has introduced a range of new magnetic latch and switch sensors that feature two silicon dice in the same package, yielding highly reliable devices, which are aimed at automotive applications including transmission, power steering, braking and locks/latches.

Dual die, Hall effect, latch and switch sensor is accurate & redundant – [Link]

LoRa IOT Home Environment Monitoring System

RodNewHampshire @ instructables.com writes:

The LoRa IOT Home Environmental Monitoring System consists of an Arduino Mega based IOT-to-Internet gateway and Arduino Feather based remote stations with environmental sensors. The remote stations communicate wirelessly with the gateway using LoRa radios.

LoRa IOT Home Environment Monitoring System – [Link]

Easy IoT Weather Station With Multiple Sensors

Ingenerare @ instructables.com show us an easy to build IoT weather station able to measure temperature, dew point, humidity, pressure, light index, and rain. He writes:

A weather station is a fun project that teaches you a ton about electronics with the added benefit being an actually useful little device. The project requires a bunch of cheap parts and sensors totaling less than $15, and the whole thing ends up fitting in your hand. The station creates a web site that monitors temperature, dew point, humidity, pressure, light index, and rain (Thingspeak channel). It’s a pretty easy set up, and you’ll just need some basic electronics skills to get it going.

Easy IoT Weather Station With Multiple Sensors – [Link]