Introduction: Particle Core - Motion Sensor Using Internet Button

Picture of Particle Core - Motion Sensor Using Internet Button

In this instructable I'm going to show you how to build a motion sensor using a Particle core or Photon and an Internet button. This uses the on board 3 axis accelerometer of the Internet button and changes the color of the LEDs with respect to the motion.

In my previous tutorials I have showed you how to get started with the Particle Core which serves as a basics to get started with today's project, so I recommend to try that out first.

So let's get started....

Step 1: Tools and Components

Picture of Tools and Components

All that you need for this instructable is -

  • Particle Core
  • Internet Button

You can also get a photon which is cheaper than the particle core.

Note: The internet button comes with a photon, so you don't have to buy a separate one.

Step 2: Getting Started

Picture of Getting Started

If you have followed my previous instructables you already have set up your core and have it connected to the internet.

If you are here first, then you can check the step two of any of the previous instructables in the series for steps on how to get started.

The steps involve -

  • Creating an account at Particle.io
  • Getting it connected to the internet.
  • Claiming a Core
  • Trying out Tinker
  • Trying out my previous instructables

If you have gone through all of these steps, then you are good to proceed to the next step.

Step 3: Hardware

Picture of Hardware

There are no circuit, connections nor is there a need to learn any soldering skills. All that you need is check out my previous instructables on how to get started. The project is quite simple and all it does is changes the color of all the LEDs.

Note- I'm using an older version of the internet button, the newer version has a protective case and a buzzer.

Step 4: Code

Picture of Code

The code to be uploaded to core can be found below, it is really simple. Also, feel free to make any modification to the code and leave a comment below if you encounter any error.

If you are using an older version of the internet button (as I am), make sure you change

b.begin();

to

b.begin(1);
<p>#include "InternetButton/InternetButton.h"<br>#include "math.h"</p><p>InternetButton b = InternetButton();</p><p>void setup() {
    //Tell b to get everything ready to go
    // Use b.begin(1); if you have the original SparkButton, which does not have a buzzer or a plastic enclosure
    // to use, just add a '1' between the parentheses in the code below.
    b.begin(1);
}</p><p>void loop(){</p><p>    //How much are you moving in the x direction? (look at the white text on the board)
    int xValue = b.readX();</p><p>    //How about in the y direction?
    int yValue = b.readY();</p><p>    //And the z!
    int zValue = b.readZ();</p><p>    //This will make the color of the Button change with what direction you shake it
    //The abs() part takes the absolute value, because negatives don't work well
    b.allLedsOn(abs(xValue), abs(yValue), abs(zValue));</p><p>    //Wait a mo'
    delay(50);
}</p>

Comments

dtburford (author)2015-08-11

Those ring LEDs look like they could be a good basis for an iron man arc reactor.

kredilla (author)2015-08-10

Forgive me if this is not the place for this inquiry, I don't visit instructables as much as I would like! I'll apologize again for my lack of programming/microprocessor-y/Arduino-ish things (if either of those is even accurate in the present case) however I have been very interested in these technologies for a while now.

I'm curious.. can the characteristics/variables of the motion, such as velocity, be collected and sent to another device somehow?

Thanks!

About This Instructable

5,235views

95favorites

License:

Bio: Hi, I just launched an Indigogo campaign support my projects by backing it. https://www.indiegogo.com/projects/tinker-usb-a-wifi-based-badusb#/
More by ThisIsSteve:Linkit One Text to SpeechLinkit One Kitchen TimerIntel Edison Talks to Linkit One
Add instructable to: