First of all, it is important to understand how the Arduino Accelerometer sensor works. The Accelerometer sensor is measuring the change in gravity in 3 dimensions which are X, Y, and Z. Each axis has a string then it measures how stretched is that string by the gravitational force and then returns the Acceleration on that axis.
To get more information about the Accelermoter sensor inside your smartphone and how it works. Please check out this amazing short video:
Now that we know how an Arduino Accelerometer sensor works, let’s use the Arduino Accelerometer shield by downloading 1Sheeld library, to access its functions.
1Sheeld Arduino Accelerometer shield functions
The first 3 functions: getX, getY, and getZ
These are the 3 main functions of the Arduino Accelerometer shield, they get the acceleration of your smartphone on each axis so you are able to get the smartphone position.
Hence, you realize it has no parameters and 1 return value which is the Acceleration on the X, Y, and Z axis and the returned values are floats.
The syntax for these functions are:
So, it will be a perfect match for a gesture control project like the one Adham made using 1Sheeld to unlock his door lock with the Arduino Accelerometer Shield.
Adham has made here a certain pattern with the Arduino Accelerometer Shield readings so he will move the smartphone on the x-axis then he will move it again but in the y-axis and as a result of that the lock will be freed.
Linear Acceleration option
As a result, of checking the linear acceleration inside the Arduino Accelerometer Shield, the returned values will exclude the value of gravitational force. So it will give you the exact linear acceleration on each axis (X-Y-Z).
Finally, the setOnValueChange function
This is a default function in all 1Sheeld Arduino shields, it indicates a change in any of the values of a certain sensor shield, which in this case: The Arduino Accelerometer shield.
This function triggers a function written by the user to run once there is a change in the X, Y or Z-axis value.The syntax for this function is:
/* Print x-y-z axis values on the Terminal Shield. */
Finally, I hope I have covered all the Arduino Accelerometer Shield functions very clearly. And if you have any query, please let me know down in the comments.
And of course, don’t forget to check out lots of Arduino Projects made using 1Sheeld. Especially, that many of them have used the Arduino Accelerometer shield.
Welcome to our home automation hacks series #3, for so many times I had problems with watering my plants while traveling abroad and I have always needed a way to control it remotely, then I decided to do it with one of the fanciest ways you may ever hear off, cause I’m gonna water my …
Adding motion as an input for your project is going to be so much fun! You can do this by using an Accelerometer Module that measures acceleration in three linear axes (X, Y, Z) and then you can translate it into actions. Today, our topic is all about Arduino Accelerometer projects. In fact, Arduino Accelerometer …
Whenever it’s time to get off the office, I always check the traffic status to choose the best time to go home. But I couldn’t find a way to do that autonomously. So then …. I was up to make a system that shows me the current traffic status with the help of a simple tool that is used …
The newer version of 1Sheeld (1Sheeld+) built to support both iOS and Android devices,but not just that …! There’s another secret feature supported to solve the problem of using extra shield/board over 1Sheeld+, and this shield/board have the same way of communication used by 1Sheeld+ (The hardware UART serial pins pin0&pin1) with your Arduino. Exactly …
Nowadays people started integrating stuff with the internet for their daily uses, and fortunately, it’s not hard to do so..! as there are a lot of hardware/software tools that ease the development of such applications. One of these tools is the 1Sheeld’s Internet shield, which allows your arduino board to connect to a mobile application …
It’s now the age were the word “Hack” is a relevant word we see and hear everywhere, and i don’t mean the software cyber hacks,I am talking about DIY hacks 😀 . We made this Home Automation Hacks series to help you add fun features to your home stuff by doing it yourself 😉 . …