Posts with «gy-80» label

Garage Door Monitor with Cayenne


 

Description

Using the HMC5883L magnetometer sensor of the GY-80 module from ICStation to monitor a garage door and notify when it has been opened or closed. The Cayenne service provides much of the monitoring and notifying functionality. A major feature of this project. Cayenne takes care of all of the complicated work behind the scenes, making it easy to connect your Arduino to the cloud and allow you to monitor your garage from virtually anywhere.
 
This project was created specifically to monitor a garage, but you will soon discover that this project could be used to monitor a whole host of other things. Monitor your front door, your back door, your bag, your chair, your cookie jar.
 
Monitor for peace of mind, or catch someone in the act of stealing your stuff. This project has got you covered. Let's see how:


 

 
 

HMC5883L DataSheet:

You can find the datasheet for the HMC5883L pretty easily by searching on the internet.
HMC5883L datasheet - Sparkfun


 

Arduino Libraries and IDE

Here is a link to the Arduino IDE download. The IDE is required to upload code to the Seeeduino Cloud.

You need the Cayenne Library installed in your Arduino IDE.
You can find the Cayenne library here:
Cayenne Libarary
 
There are libraries on the internet for the GY-80 module, however, it is relatively easy to use the magnetometer on this module. And therefore no libraries are required for the sensor. If you would like some more information about using the magnetometer sensor, and how to get the most out of it, then please have a look at my previous tutorial which goes into much more detail.


 

ARDUINO CODE:


 

You need to make sure to insert your OWN Cayenne token into the sketch above. You will get this token when connecting your Arduino to the Cayenne service. Watch the video for further explanation.


 

Fritzing diagram

Cayenne Widgets

Please make sure to watch the video to see how to connect the Seeeduino Cloud to Cayenne and how to create the Cayenne widgets. Cayenne widgets are necessary to create the dashboard on your phone or browser. They will also interact with the Arduino sketch, and will also be involved in creating the notification system. The following links will take you to the relevant part of the video:

The Master switch button is used to switch monitoring from OFF to ON (and vice versa). Therefore you can choose when to monitor the garage and when to stop monitoring. When first installing the project onto your garage door, and turning the Seeeduino Cloud on, it will automatically calibrate each sensor to a value of 1000.
 
If you experience any drift away from 1000 for whatever reason, simply press the Request calibration button, and each sensor will be recalibrated back to 1000. The x,y and z axis widgets are there so that you can see the readings coming from the magnetometer sensor. And when any of the axis variables breach the threshold away from 1000, it will trigger the Door Status widget. This is how we can tell if the door is open or closed.
 
We also use the Door Status widget to help with the notification system. When the Door status changes from "Closed" to "Open", a notification trigger will be activated, and a message will be sent via email or SMS. This notification is useful for monitoring when the door was opened. If you happen to recalibrate when the door is open. You will get a notification when the garage door closes.


 

Concluding comments

This project is relatively simple, and quite easy to set up. What I liked about this project was the versatility and alternate uses. You can use the same setup to monitor many different things. It is not just limited to monitoring a garage door. But being able to tell whether my garage door is opened or closed, especially after I have driven away from my house , is really cool. Now I don't have to drive all the way back home to check. Let me know if you have replicated this project, and also what kinds of things you decided to monitor with this project.

Garage Door Monitor with Cayenne


 

Description

Using the HMC5883L magnetometer sensor of the GY-80 module from ICStation to monitor a garage door and notify when it has been opened or closed. The Cayenne service provides much of the monitoring and notifying functionality. A major feature of this project. Cayenne takes care of all of the complicated work behind the scenes, making it easy to connect your Arduino to the cloud and allow you to monitor your garage from virtually anywhere.
 
This project was created specifically to monitor a garage, but you will soon discover that this project could be used to monitor a whole host of other things. Monitor your front door, your back door, your bag, your chair, your cookie jar.
 
Monitor for peace of mind, or catch someone in the act of stealing your stuff. This project has got you covered. Let's see how:


 

 
 

HMC5883L DataSheet:

You can find the datasheet for the HMC5883L pretty easily by searching on the internet.
HMC5883L datasheet - Sparkfun


 

Arduino Libraries and IDE

Here is a link to the Arduino IDE download. The IDE is required to upload code to the Seeeduino Cloud.

You need the Cayenne Library installed in your Arduino IDE.
You can find the Cayenne library here:
Cayenne Libarary
 
There are libraries on the internet for the GY-80 module, however, it is relatively easy to use the magnetometer on this module. And therefore no libraries are required for the sensor. If you would like some more information about using the magnetometer sensor, and how to get the most out of it, then please have a look at my previous tutorial which goes into much more detail.


 

ARDUINO CODE:


 

You need to make sure to insert your OWN Cayenne token into the sketch above. You will get this token when connecting your Arduino to the Cayenne service. Watch the video for further explanation.


 

Fritzing diagram

Cayenne Widgets

Please make sure to watch the video to see how to connect the Seeeduino Cloud to Cayenne and how to create the Cayenne widgets. Cayenne widgets are necessary to create the dashboard on your phone or browser. They will also interact with the Arduino sketch, and will also be involved in creating the notification system. The following links will take you to the relevant part of the video:

The Master switch button is used to switch monitoring from OFF to ON (and vice versa). Therefore you can choose when to monitor the garage and when to stop monitoring. When first installing the project onto your garage door, and turning the Seeeduino Cloud on, it will automatically calibrate each sensor to a value of 1000.
 
If you experience any drift away from 1000 for whatever reason, simply press the Request calibration button, and each sensor will be recalibrated back to 1000. The x,y and z axis widgets are there so that you can see the readings coming from the magnetometer sensor. And when any of the axis variables breach the threshold away from 1000, it will trigger the Door Status widget. This is how we can tell if the door is open or closed.
 
We also use the Door Status widget to help with the notification system. When the Door status changes from "Closed" to "Open", a notification trigger will be activated, and a message will be sent via email or SMS. This notification is useful for monitoring when the door was opened. If you happen to recalibrate when the door is open. You will get a notification when the garage door closes.


 

Concluding comments

This project is relatively simple, and quite easy to set up. What I liked about this project was the versatility and alternate uses. You can use the same setup to monitor many different things. It is not just limited to monitoring a garage door. But being able to tell whether my garage door is opened or closed, especially after I have driven away from my house , is really cool. Now I don't have to drive all the way back home to check. Let me know if you have replicated this project, and also what kinds of things you decided to monitor with this project.

HMC5883L on the GY-80 module

Description

In this tutorial, I will show you how to configure and extract data from the magnetometer (HMC5883L) sensor on the GY-80 10DOF module from ICStation. While there are some very good libraries on the internet which will give you full access to this sensor, I will show you what you need to know without using a library. This means that it may get a bit technical at times, but I will hold your hand along the way and provide explanations as required. I would also recommend that you watch the complete video from start to finish - as the video provides really useful information.


 

HMC5883L Magnetometer Datasheet:

You can find the datasheet for the HMC5883L pretty easily by searching on the internet. Here are a couple of sources:


 

Arduino Libraries

This tutorial does not use any external libraries.
It does use the Wire library for I2C communication.
However, there is no extra download required to access the Wire library.
If you are looking for a library specific for the HMC5883L sensor, then I would recommend one of these:

Like I said - you do not need an HMC5883L library for this tutorial. The libraries above are listed for those who wish to learn more about this particular sensor.

Arduino IDE

The Arduino IDE can be downloaded from the Arduino website. Visit the Arduino IDE download page.

I generally use the ZIP file for Windows and never seem to have any issues.
There are downloads available for all the major operating systems.


 

ARDUINO CODE:

I have created a Gist for the Arduino code to configure and extract data from the HMC5883L sensor. However, I also have a GitHub repository which aims to capture the code for all of the sensors on the GY-80 module. Code for the other sensors will become available in due time. Meanwhile, have a look at the code below for the HMC5883L sensor:

This code will set all axis values to 1000 upon startup. Moving the GY-80 module around will result in a value greater or less than 1000, however, returning the sensor back to it's original position, should result in values very close to 1000 on each axis. I chose to introduce this calibration in order to avoid negative values, and I liked the fact that I could set a heading with values that were easy to remember.
 
The magSetting function was created to easily configure the magnetometer.
Make sure to look at the video and also the datasheet for further information about calibrating the magnetometer.
 
The getReadings function was created to easily retrieve the magnetometer axis data. I chose to use Single measurement mode in this tutorial.


 
 

Hooking it up:

You can communicate with any of the sensors on the GY-80 module using I2C. The HMC5883L magnetometer sensor is no different. You will need four connections between the Arduino UNO and the GY-80 module. Have a look at the diagram below for the connection diagram and table.

Fritzing diagram



 
 

Project pictures












Concluding comments

The HMC5883L sensor on the GY-80 module is quite interesting and works relatively well. There are a number of other sensors on the GY-80 module which can provide complementary positional data. At some point, I plan to come back and explain some of the other sensors on this module, but first I would like to create a real-life project using the magnetometer. So stay tuned. You may want to subscribe to my social networks or to this blog to be notified of that project when I complete it.

I would like to thank ICStation for their collaborative efforts. Their contribution was invaluable to this tutorial's existence.

If you like this page, please do me a favour and show your appreciation :

 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
I can also be found on Pinterest and Instagram.
Have a look at my videos on my YouTube channel.

             
ScottC 06 Nov 16:20

HMC5883L on the GY-80 module

Description

In this tutorial, I will show you how to configure and extract data from the magnetometer (HMC5883L) sensor on the GY-80 10DOF module from ICStation. While there are some very good libraries on the internet which will give you full access to this sensor, I will show you what you need to know without using a library. This means that it may get a bit technical at times, but I will hold your hand along the way and provide explanations as required. I would also recommend that you watch the complete video from start to finish - as the video provides really useful information.


 

HMC5883L Magnetometer Datasheet:

You can find the datasheet for the HMC5883L pretty easily by searching on the internet. Here are a couple of sources:


 

Arduino Libraries

This tutorial does not use any external libraries.
It does use the Wire library for I2C communication.
However, there is no extra download required to access the Wire library.
If you are looking for a library specific for the HMC5883L sensor, then I would recommend one of these:

Like I said - you do not need an HMC5883L library for this tutorial. The libraries above are listed for those who wish to learn more about this particular sensor.

Arduino IDE

The Arduino IDE can be downloaded from the Arduino website. Visit the Arduino IDE download page.

I generally use the ZIP file for Windows and never seem to have any issues.
There are downloads available for all the major operating systems.


 

ARDUINO CODE:

I have created a Gist for the Arduino code to configure and extract data from the HMC5883L sensor. However, I also have a GitHub repository which aims to capture the code for all of the sensors on the GY-80 module. Code for the other sensors will become available in due time. Meanwhile, have a look at the code below for the HMC5883L sensor:

This code will set all axis values to 1000 upon startup. Moving the GY-80 module around will result in a value greater or less than 1000, however, returning the sensor back to it's original position, should result in values very close to 1000 on each axis. I chose to introduce this calibration in order to avoid negative values, and I liked the fact that I could set a heading with values that were easy to remember.
 
The magSetting function was created to easily configure the magnetometer.
Make sure to look at the video and also the datasheet for further information about calibrating the magnetometer.
 
The getReadings function was created to easily retrieve the magnetometer axis data. I chose to use Single measurement mode in this tutorial.


 
 

Hooking it up:

You can communicate with any of the sensors on the GY-80 module using I2C. The HMC5883L magnetometer sensor is no different. You will need four connections between the Arduino UNO and the GY-80 module. Have a look at the diagram below for the connection diagram and table.

Fritzing diagram



 
 

Project pictures












Concluding comments

The HMC5883L sensor on the GY-80 module is quite interesting and works relatively well. There are a number of other sensors on the GY-80 module which can provide complementary positional data. At some point, I plan to come back and explain some of the other sensors on this module, but first I would like to create a real-life project using the magnetometer. So stay tuned. You may want to subscribe to my social networks or to this blog to be notified of that project when I complete it.

I would like to thank ICStation for their collaborative efforts. Their contribution was invaluable to this tutorial's existence.

If you like this page, please do me a favour and show your appreciation :

 
Visit my ArduinoBasics Google + page.
Follow me on Twitter by looking for ScottC @ArduinoBasics.
I can also be found on Pinterest and Instagram.
Have a look at my videos on my YouTube channel.

             
ScottC 06 Nov 16:20