I bet as a child you tried at least once if you can move objects with your thoughts and hand movements like a Jedi knight... Well, I tried but of course with no success. My followers probably know that I am a huge Star Wars fan, and the Star Wars universe or the SW Saga inspired a few projects that I shared with you. This time we are going to build a home automation system that is working only with hand gestures.

You will be able to control your TV, your house lights, your toaster, your charger... Everything, just like a Jedi knight (or a Sith, I don't know which side do you prefer).

And now you are probably thinking how is this even possible but don't worry I am here to explain you all that you need to build this project. If you think it is interesting just read each step carefully and then you can start your own project. Don't worry if you are a beginner I am sharing schematics, codes and full explanation on how to build it. We will learn to code in JavaScript and Arduino and some C language.

I am going to show you how to make applications on a Pebble smartwatch, it is very simpe... I hope will also teach you some new tricks in Arduino. We will use an Arduino like microcontroller, the Particle Photon that has an on-board WiFi module. I found some great insipration in TVMillers's project.

Now let's get started!

Step 1: Video

In this short video I am going to show you how this device actually works. I am not a native speaker sorry for my very accent, but I hope you like it. I explain the theory behind my device and how to make it yourself. Don't forget to watch it in 1080p.

Step 2: The Idea - Being Able to Use the Force

I think that even those who don't really like the Star Wars series like the idea of moving objects only with your thoughts. I wanted so bad to make this real and then I started thinking then one day the idea came in like a lightning. I could use my smartwatch as a gesture sensor...

But what is the Force?

After Wookipedia: "The Force was an energy field that connected all living things in the galaxy. The power of the Force could be used by individuals who were sensitive to it, a power that was tapped through the midi-chlorians." You can give your girlfriend fruits and move warships with the Force, but for me is the most majestic and beautiful movie element ever used. Let me explain why. It made my childhood richer and I think if you read this as a Star Wars fan you can say the same thing. Fighting with wooden rods thinking they are lightsabers is one of the the best things in my life. I bet you have memories like this. This is why we all love this mysterious thing... The "Force" gave us so many good experiences.

"It’s an energy field created by all living things. It surrounds us and penetrates us; it binds the galaxy together." - Ben Kenobi
Read more here: http://www.starwars.com/news/6-great-quotes-about-...

Now that we now more about the Force, it's time to learn some science.

Step 3: How It Works?

In JavaScript programming language I made a relatively simple application on my Pebble smartwatch, that I bought last year and really like to use it. It is probably one of the most elegant smartwatches no the market and it is programmable so you can make any application on it. And also made a program on my Particle micro-controller that actually controls our home.

To make it clear:

  1. The Accelorometer in the Pebble Smartwatch detects special hand gestures.
  2. Via Bluetooth the watch transmits signals to the phone.
  3. The phone sends signals to a web address.
  4. The Particle Photon reads signals with its WiFi module.
  5. Depending on what signal he gets controls the TV, lights , toaster...

Why do we need home automation?

For me one of the most annoying thing is when I have to walk to the other corner of my room just to turn off the lights before I sleep. It is comfortable, make things easier. :)

How easy is to make it?

It is not a beginner's project but I am going to explain how the codes and the circuits work. It is not that hard, we will learn some JavaScript and Arduino.

How easy is to use it? What is so special about it?

I designed a SmartPlug basically. (That is smarter than usual) All you have to do is plug in your device in a wallplug then wait until it is connected and make hand gestures. You will be able to turn on your TV or lights and switch channels, then turn them off. It is so simple to use. Don't worry it will never happen that you accidentally control something, because I made a build-in filter in the code.

Why do I use Particle Photon?

The Particle Photon is an Arduino-like microcontroller with about the same price, with the size of an Arduino Mini Pro but has an on-board WiFi module that makes everything so much easier. You can choose: a Particle or Arduino + WiFi modules.

If you make it please be very careful, we have to work, with high voltages.

Step 4: What Is Pebble?

Pebble (https://www.pebble.com/) is one of the worlds best smartwatch brands. I think they are making the most elegant watches worldwide with amazing e-Paper screens and extra-long battery life. The reason why is my No. 1 smartwatch is that is fully open source so you can do many stuffs with it.

Step 5: Based on One Sensor - What Is an Accelerometer?

In this project we will learn how to use an accelerometer in a smartwatch. I made some research and on the Development Guide I found a good description about the accelerometer. Wikipedia says: An accelerometer is a device that measures proper acceleration; proper acceleration is not the same as coordinate acceleration (rate of change of velocity). For example, an accelerometer at rest on the surface of the Earth will measure an acceleration due to Earth's gravity, straight upwards (by definition) of g ≈ 9.81 m/s2. By contrast, accelerometers in free fall (falling toward the center of the Earth at a rate of about 9.81 m/s2) will measure zero.

Actually is a tiny chip that can send detect acceleration in 6 directions, this is more than enough for us to create this project, because we can detect a few special gestures this way. What makes a gesture detectable? If you take a look on how the Jedi knights move their hands you can figure out what physical forces affect on that. I just had to make a program for it.

Let me show what do you need for this project!

Step 6: Gathering Parts and Tools

I can't say that this is the cheapest project that I have ever made, but the truth is that I had all parts at home, and most of them is salvaged from old electronics. The Particle Photon costs $19 and the Pebble watch only $39.95 on the Amazon so I can say that is relatively cheap. You can use any version of Pebble watch, but I am using the basic model, that I like the most. Everything else is salvaged. You will also need some soldering and crafting tools.


  1. Soldering Iron
  2. Solder
  3. Third Hand
  4. Safety Gloves (optional)
  5. Rotary Tool
  6. Glue Gun


I gave Amazon purchase links for three components. Everything else is salvaged from old electronics but you can buy them from a local hobby shop. As you see the hardware parts in this project is simple, but we will have to suffer a little bit with progamming... (Well you don't, you just have to copy + paste, I had to suffer.)

Step 7: Using the Pebble Cloud IDE

Coding is easy on the Pebble Cloud IDE... In this step I teach you how to begin a project.

First download the Pebble phone app:

Then pair your smartwatch with it. (I am using Android) Go in the app settings, and enable Developer Connection. Voila, now sign in to your Pebble account here: https://cloudpebble.net/ide/. And create a new project. Go to the next step to find out how to make a project.

Step 8: Starting a Project

Press "Create" button to make a new project and you will be redirected to a page like me on the second picture. On the APP SOURCE part you can find the code. Copy-paste here the code that I will share in the next step. At the RESOURCES you can add pictures and icons to make your app look much better. I actually used a selfmade pixel Darth Vader.

See the project files in the next step.

Step 9: Project Files

Download the ZIP file below and import in your Cloud Pebble. Now you actually made an application. You can add other images or icons. See up there. If you want to, chech out the code. Feel free to use but don't forget to credit. Compile in JavaScript.

<p>//Project created by Tamas Imets for Jedi Home Automation Project</p><p>var Accel = require('ui/accel'); //enabling accelerometer
var UI = require('ui');
var ajax = require('ajax');
var Vector2 = require('vector2');</p><p>// Create Window
var main_window = new UI.Window();</p><p>// Open Button and Display
var txtOnLabel = new UI.Text({
    position: new Vector2(0, 60),
    size: new Vector2(144, 30),
    font: 'Gothic 28 Bold',
    text: 'USE THE FORCE',
    textAlign: 'center',						
    color: 'white'
});</p><p>//making text
var info = new UI.Text({
    position: new Vector2(2, 90),
    size: new Vector2(142, 60),
    font: 'Gothic 14',
    text: 'Move your hand like a Jedi to control objects, lights and your home...',
    textAlign: 'center',						
    color: 'white'
}); </p><p>//adding image
var image = new UI.Image({
  position: new Vector2(0, 8),
  size: new Vector2(144, 50),
  alignImage: 'center',
  image: 'images/negativevader.png'
});</p><p>// Display Main Window
main_window.show();</p><p>// URL To Particle Cloud
function Toggle(function_name,function_value){
  var URL = 'https://api.particle.io/v1/devices/your code/' + function_name +'?access_token=your token';</p><p>  ajax(	
      url: URL,
      method: 'post',	
      type: 'json',
      data: { "args": function_value}
}</p><p>// Accelerometer Poll and Function (Default 100Hz 25) 
//Different Gestures
Accel.on('data', function(e) {
  if (e.accel.z > 1200) { //if I make this gesture...
    if(e.accel.y > 200) {
      if(e.accel.x < 400) {
  Toggle('jedi','pull'); //send this signal
  }}}});</p><p>Accel.on('data', function(e) {
  if (e.accel.x > 700) {
  }});</p><p>Accel.on('data', function(e) {
  if (e.accel.y > 1200) {
    if(e.accel.z < -200) {
      if(e.accel.z < 100) {
  }}}});</p><p>// Button Function and Photon Parameters
main_window.on('click', 'up', function() {
});</p><p>main_window.on('click', 'select', function() {
});</p><p>main_window.on('click', 'down', function() {

Step 10: Particle Web IDE

In this project you can program from the internet. Isn't that awesome? All you have to do is to plug in your circuit, your Particle Photon in a 5v source and with the help of the Particle phone app (https://play.google.com/store/apps/details?id=io.p...) connect to your local WiFi. This is very easy... Create a Particel account here: https://build.particle.io/build/ and you can start coding. It is the same as Arduino but with a better user interface with online libraries and etc...

Step 11: Writing the Code

I am sharing the code with you here. Copy and paste to your project file then "Verify" and after this press "Flash". And you are actually done. Now your system should work. The Instructable did not allowed me to paste my code here so please download this .TXT file. I have used a SAMSUNG TV so the commands and those long numbers are only available for Samsung TV users. If you have a different TV just Google it: "xyz brand arduino tv remote codes".

Step 12: Testing the Codes - Making a Prototype

In this project we use digital pin D1, D7 and D6 on the Particle Photon. Build a circuit using LEDs to test if the code is working properly. At this point parts should connect to each other wirelessly with no problem. Make Force movemnts like I did in the video and if the relay switches on at D7 that means you did a good work. Congratulations! Now we have to make it useful and userfriendly.

Step 13: The Circuit

I made this circuit in Fritzing and I haven't found a normal AC adapter, but that Hi-Link module does the same thing that our salvaged phone charger does. Following this schematic and the next steps build the circuit.

Step 14: Soldering

As the schematics shows solder the wires to a piece of PCB that has two lines of header pins soldered to it. Plug in your Particle Photon to test if it fits correctly. After this you can solder a wallplug connector to the 5v adapter circuit, just like I did. Just take apart an old smartphone charger and you will find a circuit like this for free. This way you don't have to work so much with dangerous voltages. These are very well designed circuits, it is safe to use.

Step 15: Making a Case

I found this plastic case in project inventory and its size seemed to be perfect! Not too small and not too big. It is the same size like a laptop charger. I used my rotary tool to cut one hole for the 230v input voltage and one for the 230v output voltage on next to the input connector. Cut another 5MM hole for the IR LED that controls your TV.

Step 16: Final Product

With some glue gun I fixed all parts inside the project box so it is safe to use. You can open the plastic case anytime but if it is plugged in never try this! ONLY UNPOWERED! I can say that looks great and needs small space. From now just plug in your device to a connector and then wait until your Particle's LED has a light blue color.

Step 17: Testing

Plug in your gadget and connect a lamp to it for example. Make a hand movement and wait until switches ON or OFF. If everything works enjoy it!! From now you can enter your like a Sith or a Jedi. Just make a Force pull and your light will b turned on!

Step 18: Use the Force!

Enjoy your new ability! The smartwatch's battery lasts for about three days with intensive use and charges up in one hour. From now you can use your smart-plug with no external wires or other embarrassing things. You will have a simple and elegant system, I really like to use...

Step 19: Thank You Very Much for Watching!

I really hope you enjoyed my project tutorial, it would make me very happy if I succeeded to show you something mind-blowing. If you liked my project you can give me a kindly "Vote" in the Contest I entered. With this you can support more instrucatbles comnig. Follow my Instructables page for more projects like this. Huge thanks for Basa András who made the filming and the editing of this video.

If all goes well next time we will build intelliegent drones!

May the Force be with you!

<p>Run into the same problem as dkanenh10 am unable to verify the file with the same error.</p><p>Haven't found my TV-codes yet but just wanted to see how the programming of the photon works.</p><p>Had included the libraries IRREMOTE (0.0.1) AND IRTRANSMITTER (0.1.0) unfortunate this didn't help.</p><p>In your included images I see at the files section three filenames. Should we have all three open in our project? Or are these included in the fore mentioned libraries?</p><p>When I look for IRTRANSMITTER I can include it in the project but I don't see it as in your list as a legacy library.</p><p>Any clues?</p>
You have to use the correct syntax. :). Like in my code. To do this double click on the librar and look for the actual code. Don't worry it happened with me too...
<p>Sorry I can't follow you.<br>I copied your text file in a new project and try to verify. It is failing as it can not find IRremote.h. I looked for the library and clicked on include in project. after that I get the same error as dkanenh10 as described below my message.</p><p>/src/jedi-force-home-automation.cpp:11:17: error: no matching function for call to 'IRsend::IRsend(int)'<br> int Jedi(String force_cmd);</p>
<p>I removed the D1 in line 8 and than it verifies okay and I am able to flash the photon.</p><p>Now have to setup some leds to verify if things are working like this. After that I have to go on the hunt for the LG-codes (Have a Vizio TV but read that they use the same codes as LG)</p><p>But that will be continued another time because it is already way past bedtime ;)</p><p>Is there another way to monitor if things are happening? Did change the deviceID and AccessToken in the programming on PebbleCloud, just not sure if the '?' should be included or not in the AccessToken.</p>
<p>came a bit further I think, but still compile errors<br>I added irremote.cpp and irremote.h to my files and included libraries irremote and irtransmitter.</p><p>Am now getting an error about Spark being deprecated</p>
<p>Great project. Looks like you can a lot with the Particle Photon MicroController. But I need help. I can't get the code to compile. Probably something dumb on my part. Wrong library? Lot's of errors: /src/jediautomation.cpp:20:17: error: no matching function for call to 'IRsend::IRsend(int)'</p><pre> int Jedi(String force_cmd);<br> ^</pre><pre>/src/jediautomation.cpp:20:17: note: candidates are:<br>In file included from /src/jediautomation.cpp:2:0:<br>lib/IRremote/src/IRremote.h:93:3: note: IRsend::IRsend()<br> IRsend() {}<br> ^<br>lib/IRremote/src/IRremote.h:93:3: note: candidate expects 0 arguments, 1 provided<br>lib/IRremote/src/IRremote.h:90:7: note: constexpr IRsend::IRsend(const IRsend&amp;)<br> class IRsend<br> ^<br>lib/IRremote/src/IRremote.h:90:7: note: no known conversion for argument 1 from 'int' to 'const IRsend&amp;'<br>lib/IRremote/src/IRremote.h:90:7: note: constexpr IRsend::IRsend(IRsend&amp;&amp;)<br>lib/IRremote/src/IRremote.h:90:7: note: no known conversion for argument 1 from 'int' to 'IRsend&amp;&amp;'<br>/src/jediautomation.cpp: In function 'void setup()':<br>/src/jediautomation.cpp:35:1: warning: 'Spark' is deprecated (declared at ../wiring/inc/spark_wiring_cloud.h:357): Spark is now Particle. [-Wdeprecated-declarations]<br> <br> ^<br>/src/jediautomation.cpp: In function 'int Jedi(String)':<br>/src/jediautomation.cpp:109:1: warning: no return statement in function returning non-void [-Wreturn-type]<br> digitalWrite(light1, LOW);<br> ^<br>make[1]: *** [../build/target/user/platform-6src/jediautomation.o] Error 1<br>make: *** [user] Error 2</pre>
Can you provide a little more info on the code and setting up the photon in the pebble app? I can gather info from the photon in the browser via api, and see the pebble accelerometer moving on the pebble cloud log when i move the watch but can't get the photon to turn on the pins when the app is running on the watch. I think it has something to with this line 'https://api.particle.io/v1/devices/your code/' + function_name +'?access_token=your token';<p> ajax(<br> , my device code and access token are entered correctly. Any. Info would be great, thanks for sharing such a great project.</p>
<p>I cant find photon particle board near my store but there is arduino. Do you think you can suggest which board should i buy that is equivalent to yours? </p><p>Great project btw</p>
<p>Do you realize the huge market for this? I can see this being used in healthcare, worn by handicapped/ paralyzed people who can now control every aspect of their homes with a simple wave of the hand! You should really think of either developing this for sale to the public (with crowdfunding) or outright sell it to a manufacturer. </p>
<p>just awesome &lt;3<br>just 1 qus: can i use nodemcu in place of particle photon?<br></p>
<p>thanks :) </p>
wow that's all I have to say
<p>I wish that someone think of a way to signal my kitchen to make breakfast or other meals and then clean up afterwards. </p>
This is cool: I just started hacking the Neurosky chip in the Star Wars Force Trainer toy and am now controlling Arduino circuits with my mind. Never thought to extend that control to my Pebble.
<p>Do you know if this would work with the Moto 360 Smart Watch? I was thinking of using Android Studio and creating and Android Application for the Moto 360.</p>
<p>If it has an accelerometer you probably can make it. Try it out!</p>
<p>Okay, thanks for the quick response! :)</p>
<p>&Aacute;sz&ouml;m boy!! &lt;3</p>
<p>is that really your voice or do u have a really deep vocie </p>
<p>Yes, this is my real voice :)</p>
<p>but can the watch run crysis?</p><p>But in all seriousness sweet build.</p>
<p>I love this! I haven't tried to make it because I don't know anything about DYI projects or being an electrician. But this is still great!</p>
Awesome article <br>Lots of picture
Wonder if i can make it with apple watch?
<p>The truth is that I don't know, you can try it, but I am not familiar in programming on iOS or Apple platforms.</p>
The BEST project! I have a photon and an arduino, for sure Im going to make this project. Congratulations!!
<p>If you have any questions during work feel free to ask. Thank you!</p>
Sad but it seems the pebble is no longer in production.
<p>I read the news just now, this is sad.</p>
<p>Your English is great, and so is your work. ? Keep it up, great Instructable!</p>
<p>Please ignore that question mark between sentences...I had inserted a &quot;thumbs up&quot; emoji and the site apparently didn't know what to do with it. :D</p><p>Again, nice work!</p>
<p>Thank you for your interesting! :) No problem, this emoji problem happened with me too a few times. </p>
Awesome video.<br>Definitely voted.
<p>Thank you very much!</p>
<p>I absolutely loved this creation of yours! Voted and followed bro, keep making things that excite you and are lovely for mankind!!</p>
<p>Thank you!</p>
Epic work mate, looks awesome
<p>Thank you!</p>
<p>Great job on this. Awesome. Are there other Android Smart watches easy to program for? </p>
<p>Most of the Android smartwatches are programmable, but they run under a Java platform.</p>
<p>Unfortunately Pebble was bought out by Fitbit :'(</p>
Very nice.The pebble smartwatch is really expensive though its like 20 times my u80 smart watch.You should try amazon echo!it sounds almost like jarvis
Yes, I know the U8 but it is not programmable, Pebble is a bit smarter. Okay, I am going to do some research about the echo. Vote if you liked ? that could support me in more projects?

About This Instructable




Bio: Hi, I'm Tamas (Thomas), a 17 years old Hungarian guy. My hobby started more than 10 years ago. I learn electronics, physics, programming, IoT ... More »
More by Imetomi:Jedi Force Gestures Based Home Automation (with Smartwatch) FPV Virtual Reality Arduino Controlled Tracked Robot Solar Powered R/C Drone 
Add instructable to: