Internet of Things, (IoT) is one of the popular topics on the planet right now. And, it is growing swiftly day by day with the Internet. The Internet of Things is changing simple homes into smart homes, where everything from your lights to your locks can be controlled from your smartphone or desktop. This is the luxury everyone wants to own.
We always play with the tools we got and keep working on going to the next step of our limits. We try to give our customers a vision of the latest technologies and ideas. So, that you can turn your home into smart homes and enjoy the taste of luxury without many efforts.
Today, we think of working on one of the most important topics in IoT – Digital Map Orientation.
We will build a web server through which we can monitor the movements of any device or thing (Its up to you, whom you wanna spy 😉 ). You can always think about upgrading this project to the next level with some modifications and do not forget to tell us in the comments below.
Let’s start then.. !!
Step 1: Equipment We Need.. !!
The 3-in-1 sensor manufactured by STMicroelectronics, the LSM9DS0 is a system-in-package featuring a 3D digital linear acceleration sensor, a 3D digital angular rate sensor, and a 3D digital magnetic sensor. The LSM9DS0 has a linear acceleration full scale of ±2g/±4g/±6g/±8g/±16g, a magnetic field full-scale of ±2/±4/±8/±12 gauss and an angular rate of ±245/±500/±2000 dps.
2. Adafruit Huzzah ESP8266
The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well. The ESP8266 is an incredible platform for IoT application development. The ESP8266 provides a mature platform for monitoring and control applications using the Arduino Wire Language and the Arduino IDE.
his ESP8266 host adapter was designed specifically by Control Everything for the Adafruit Huzzah version of the ESP8266, allowing the I²C interface.
5. Mini USB Cable
The mini USB cable Power supply is an ideal choice for powering the Adafruit Huzzah ESP8266.
Step 2: Hardware Connections
In general, making connections is the easiest part in this project. Follow the instructions and images, and you should have no problems.
First of all take the Adafruit Huzzah ESP8266 and place the USB Programmer (with Inward Facing I²C Port) on it. Press the USB Programmer gently and we are done with this step as easy as pie (See the picture above).
Connection of the Sensor and Adafruit Huzzah ESP8266
Take the sensor and Connect the I²C Cable with it. For proper operation of this cable, please remember I²C Output ALWAYS connects to the I²C Input. The same had to be followed for the Adafruit Huzzah ESP8266 with the USB Programmer mounted over it (See the picture above).
With the help of the ESP8266 USB Programmer, it is very easy to program ESP. All you need to do is plug the sensor into the USB Programmer and you are good to go. We prefer to use this adapter because it makes it a lot easier to connect the hardware. No worrying about soldering the pins of ESP to the sensor or reading the pin diagrams and datasheets. We can use and work on multiple sensors simultaneously, you just need to make a chain. Without this plug and play USB Programmer there is a lot of risk of making a wrong connection. Bad wiring can kill your wifi as well as your sensor.
Note: The brown wire should always follow the Ground (GND) connection between the output of one device and the input of another device.
Powering of the Circuit
Plugin the Mini USB cable into the power jack of Adafruit Huzzah ESP8266. Light it up and voila, we are good to go!
Step 3: Code
The ESP Code for the Adafruit Huzzah ESP8266 and LSM9DS0 Sensor is available on our GitHub repository.
Before going on to the code, make sure you read the instructions given in the Readme file and setup your Adafruit Huzzah ESP8266 according to it. It will take just 5 minutes to set up the ESP.
The code is lengthy but it is in the simplest form that you can imagine of and you will have no difficulty in understanding it.
Step 4: Working of Code
Now, download (or git pull) the code and open it in the Arduino IDE.
Compile and upload the code and see the output on the Serial Monitor.
Note: Before uploading, make sure you enter your SSID network and password in the code.
Copy the IP address of ESP8266 from the Serial Monitor and paste it in your web browser. You will see a web page with axis of rotation, acceleration and magnetic field reading in the 3-axis.
The output of the sensor on Serial Monitor and Web Server are shown in the picture above.
Step 5: Applications and Features
The LSM9DS0 is a system-in-package featuring a 3D digital linear acceleration sensor, a 3D digital angular rate sensor, and a 3D digital magnetic sensor. By measuring these three properties, you can gain a great deal of knowledge about an object’s movement. Measuring the force and direction of Earth’s magnetic field with a magnetometer, you can approximate your heading. An accelerometer in your phone can measure the direction of the force of gravity, and estimate orientation(portrait, landscape, flat, etc.). Quadcopters with built-in gyroscopes can look out for sudden rolls or pitches. We can use this in Global Positioning System(GPS).
Some more applications include Indoor navigation, Smart user interfaces, Advanced gesture recognition, Gaming and virtual reality input devices, etc.
With the help of ESP8266, we can increase its capacity to a greater length. We can control our appliances and monitor there performance form our desktops and mobile devices. We can store and manage the data online and study them anytime for modifications. More applications include Home Automation, Mesh Network, Industrial Wireless Control, Baby Monitors, Sensor Networks, Wearable Electronics, Wi-Fi Location-aware Devices, Wi-Fi Position System Beacons.