Author Topic: Help with the accelerometer (mcMod120)  (Read 158 times)

Junkboy

  • Newbie
  • *
  • Posts: 11
    • View Profile
Help with the accelerometer (mcMod120)
« on: May 28, 2018, 10:50:08 pm »
Hello, I just started using mcthings, I just bought my kit and the only example I could find that has served me is to take the temperature and voltage of the battery and send the data to Losant.

Now .. I am developing a project in which I need to obtain the accelerometer data, I need to know the inclination in all the axes, all this info I need to send it using MQTT, continue using Losant could be a good option.

Therefore I would like someone to help me in my search for information since I really have more than 2 days looking for examples and I can not find anything about the accelerometer, I would even like to know how to use the reef sensor.

I would be infinitely grateful for the help because I am stopped because I do not know how to obtain this information from the sensor.

Beforehand thank you very much.

Share on Facebook Share on Twitter Share on Google+


mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #1 on: May 29, 2018, 11:52:23 am »
Hi Junkboy -
to help you out, i need some additional info:

1) What devices do you have? mcMod110 or mcMod120 devices?

The devices do have an accelerometer and we do have some examples and libraries for the mcMod120 devices (which i can direct you to after you confirm what devices you are working with).

NOTE - We are moving to the new system (with mcCloud - http://mcthings.createaforum.com/general/http-requests/msg2227/#msg2227) we are not able to support the older version at this time. I am happy to direct you to information that is available however, since we are in transition, new examples and libraries will need to wait until we are complete and have the new system available for everyone to use.
Let us know about the above question so we can try to help you out
Thanks
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB

Junkboy

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #2 on: May 29, 2018, 06:49:20 pm »
I have the mcMod120 please help me  ;D.

mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #3 on: May 30, 2018, 09:30:05 am »
Hey Junkboy

Ok good that you have mcMod120's - Check out this post that talks about using the accelerometer on the mcMod120 (including an initial downloadable library): http://mcthings.createaforum.com/support/module-120-accelerometer-communications/msg1187/#msg1187

You can also check out this github example: https://github.com/mcThings/mcScript-examples/tree/develop/examples/Accelerometer

As mentioned, when mcCloud is released, there is a new accelerometer example that will be included in the latest version of mcStudio as well. Thanks for the patience and hopefully the above info helps you to get going.
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB

Junkboy

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #4 on: May 30, 2018, 08:18:33 pm »
I am trying to do my best to understand how the code that you send me as an example works, but is there a way to always be sending the current orientation of the device? I want to know at all times or as soon as possible the location, let me put you in context, for example, at the start I have: X = 0 Y = 0 Z = 0 in that case the device would be on the floor with all axes at "0" but let's say I start walking with the device at my leg, in that case let's say that we would have X = 12 Y = 8 Z = 15 that data I want to be taking for example every second or every 500 ms to keep a continuous tracking of the information, right now idk how to send that info by MQTT but.. I use an example that I found at internet that send the temp and batteryVoltaje to Losant and I'm using Losant until I learn how to send that data to my own server.

Junkboy

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #5 on: June 09, 2018, 12:07:35 pm »
In addition to the previous question, I would like to know if there is any instruction that gives me the acceleration in each axis, because the example that you shared with me shows the following:

'set accelerometer to cause interrupt if accelation is > 1.4Gs for longer than 5ms (any axis)
        dev.ConfigureShockInterrupt(1.4F, 5)

but .. it is in any axis, I am interested in obtaining the acceleration in each of the axes.

mc-T2

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
  • mc-Things! The opportunities are endless!
  • Location: Canada
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #6 on: June 11, 2018, 11:26:18 am »
Hi Junkboy,

Sorry for the delay.

1) How quickly are you expecting to transmit the acclerometer data? If you are trying to transmit any less than every 30 seconds, you will likely start to run into issues as the system is designed for low-power. It is not designed for continuous transmission of data due to the low-power and design of the platform. We do have many users who are using the accelerometer and either sending a sample every 30 seconds (or at a longer interval) or programming logic onto the device where you can do some computing to send out a particular value on an acceptable interval.

For your uses, you'll need to work on you code and programming to get what you need - since there are not a lot of available examples on using the accelerometer yet, you'll need to put in the time and effort on your own code at this time. as mentioned, in the new system there is some more accelerometer examples that might help you out but that wont be accessible until the new system is available to everyone (in the next month or two). There are users here on the forum that have done some fancy things with the accelerometer and might be able to provide you code and help. I do not have permission from our users and clients to share those examples at this time.

My recommendation would be to look at the library for the accelerometer within mcStudio to understand it a fully and you can also search around online for others using the same sensor of other hardware - you can then take those examples and work on moving them into the mcStudio environment for your own use.

Hope that helps!
Need more mc-Modules, mc-Gateways or other mc-Things? Check out our product page: www.mcthings.com/products. mc-Development kits are available too!
Check out a live Dashboard using mcThings and Losant! Click here: https://goo.gl/ST43hB

Nick_W

  • Full Member
  • ***
  • Posts: 214
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #7 on: June 29, 2018, 12:40:10 pm »
JunkBoy,

I have lots of examples and libraries for the accelerometer, check them out here https://github.com/NickWaterton/mcScript

Hope this helps.
Winner Winner x 1 View List

Junkboy

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Help with the accelerometer (mcMod120)
« Reply #8 on: July 05, 2018, 04:38:06 pm »
Thank you Nick_W, that help me a lot, I will send you a message, check it out please :D!