10

Problem

I'm looking for a motion detector that can be set up to wake a rooted Android (4.3) tablet and turn the screen on when someone passes by it in a radius of maybe 2-3m.

Ideas

I'm definitely willing to get an external device for this and invest a (reasonable) amount of money, it would just have to be one that I can somehow connect to the tablet.

Are there maybe any proximity detectors from the home automation field with a decent detection quality (good angle and configurable distance) that can send Android push notifications? I'm able to write some code from scratch if necessary, but I'm very clueless and unexperienced in the hardware field, so I wouldn't know how to hold a soldering iron, for example. ;)

Background

The idea here is to transform an old tablet into some kind of stationary dashboard screen, so I'm not particularly worried about battery wear (it's end-of-life now and will from now on be used with the power cable plugged in until it dies) or intense usage (unless we're talking about 100% CPU 24/7, which would probably kill it in a few days).

Previous research

I investigated a little bit whether this could be done with the existing sensors in the device and I believe that is not possible.

The problem with using the proximity sensor is that it really only returns whether something (assumed to be your ear while in a call) is right next to it (a few centimeteres away). But I'm looking for something in the 2-3m area.

The other idea would be the front-facing camera, but the problem seems to be that a) the camera in many devices automatically shuts off when the screen is off and b) only foreground apps can access the camera, but I want the tablet to show another app on detection.

I had a quick look regarding waking up the screen in response to push notifications and that doesn't seem too hard using the PowerManager API. Not sure how quickly the device would respond to a push when in deep sleep, but that's a secondary problem.

7
  • Why not use Bluetooth or NFC using a custom script? Have seen a similar proof-of-concept elsewhere, using bluetooth on PC, and a bluetooth device worn around neck, leave the PC desk and PC locks up, arrive back in vicinity of PC, PC unlocks itself.
    – t0mm13b
    Feb 28, 2014 at 13:27
  • @t0mm13b I don't really want to wear anything. This is intended as a permanent setup and I don't want to wear a BT device for the rest of my life. ;) NFC would mean that this is no longer hands-free, which I would also prefer it to be. But keep them coming, that's the kind of creative ideas I was hoping for. :) Feb 28, 2014 at 14:25
  • In apps there is the "home automation" and alarm control type of apps and hardware. That might be a way to get an infrared human detector sending info back to the device.
    – Psycogeek
    Mar 3, 2014 at 6:25
  • @Psycogeek Yeah, do you a decent motion sensor from the 'home automation' field? Mar 3, 2014 at 8:33
  • I do not know of a specific one.
    – Psycogeek
    Mar 3, 2014 at 10:38

7 Answers 7

7

Just to let you know I have some up with a simple solution it combines an app from the app store called Motion Detector by jastrzab: https://play.google.com/store/apps/details?id=org.motion.detector Then install a plugin called Turn Screen: https://play.google.com/store/apps/details?id=org.jastrzab.plugin.screen

  1. Install both apps.
  2. Open the Motion Detector app and turn on "Send" at the bottom of settings. Click on motion detector (at the top) and then scroll down to "camera" and select "front".
  3. Open the Turn Screen app. click the only button to make it active.
  4. Open android settings, Turn off the lock screen or select "none".
  5. Change the sleep settings to time out in the desired time.
  6. Turn off Daydream.
  7. Open the app (or home screen) you want to have displayed on the screen when the tablet wakes, and you're all set! Wait for the screen to go to sleep and walk by or wave at your camera and it will wake it up.

Works great during the day or with the lights on. I'm currently working on an external PIR motion sensor that will allow the tablet to wake in darkness. Simple design so far just uses a cheap PIR sensor and a small led light mounted below the camera. When I walk by the PIR triggers the LED light allowing the camera to see, which triggers motion. Hoping to figure out how to eliminate the LED and just run the PIR directly into the tablet using the headphone jack or USB on the tablet. Suggestions welcomed.

3
  • Oh and don't forget to turn on the motion detector by clicking the blue circle on the top of the main page of the app (next to "motion Detector"). Enjoy Aug 20, 2014 at 1:42
  • This worked great for me, thanks! Using android 4.4 kitkat Oct 30, 2014 at 11:15
  • The link you provided to Google Drive is broken. :(
    – Whit
    Nov 16, 2016 at 0:25
5

As mentioned by Dallas Partin here, there is a free app called Motion Detector. I've been using it for a while, and can tell you it will work with other apps in the foreground and with the screen locked. This will detect motion using the built-in camera, so it's free. Also, you don't have to root your device for this.

You said that you didn't know how to solder, but there is a very simple way of making your own external sensor for this. Out of two methods that I'm aware of, I've mentioned one below:

Method #1. Using built-in camera

  1. Download Motion Detector.

  2. Download Tasker.

  3. Download AutoStart

  4. Launch Tasker app and tap the three dots in the top right corner.

  5. Tap PreferencesUI (at the top), uncheck Beginner Mode.

  6. Exit out of that, and tap the Vars tab at the top.

  7. Tap + and name it %DISPLAYSTATE.

  8. Go to the Profiles tab, and tap + → select EventDisplayDisplay On.

  9. Tap Back key/button. Tap New Task, name it Display On.

  10. Tap +VariablesVariable Set. Tap the pencil icon next to Name.

  11. Tap %DISPLAYSTATE and where it says To, make it 1.

  12. Repeat "step 11" except that change everything to Display Off and change where we put 1 to 0.

  13. Go to the Scenes tab at the top.

  14. Tap + and name it something.

  15. Hold down and drag on the dashed line and make it the size of your screen.

  16. Tap the gear icon in the upper left corner to go back.

  17. Tap on Profiles, and create a new one by using the + button.

  18. Tap on EventSystemIntent Received.

  19. You can ignore everything except where it says Action. Here you need to enter org.jastrzab.move.ACTION_GLOBAL_BROADCAST (caps are important). If this doesn't work for you try the following instead org.motion.detector.ACTION_GLOBAL_BROADCAST.

  20. Tap the gear icon (back) in the top left corner. It will pop up with a menu.

  21. Tap New task and name it something.

  22. Within that task, tap the + again and hit SceneShow Scene.

  23. Where it says Name, tap the magnifying glass icon (not the pencil) and tap on your scenes name.

  24. Now where it says Display As, "Activity, Full Display, No Bar".

  25. Scroll to the bottom and it will say if. Tap the pencil icon and select %DISPLAYSTATE.

  26. Tap the button in the middle and change it to Equals. On the right box, type 0.

  27. Tap + and do TaskWait.

  28. Change MS to somewhere between 25 to 100.

  29. Tap +SceneDestroy Scene and hit the magnifying glass icon on Name. Select your scene.

  30. Now go back to the main screen of Tasker app.

  31. Go into the Motion Detector app, and make sure it is turned off. If not, tap the blue circle.

  32. Go to the bottom and where it says Send, make sure it is On.

  33. Go back to the top and tap the blue circle again to make it turn on.

  34. Open Auto Start and make sure it says On.

  35. Tap AddShow all applicationsMotion Detector.

  36. Check "go to home screen after auto start" and change "start delay" to 5.

This has been working flawlessly for me!

Also, do note that in Motion Detector there are settings you can change when Motion Detector is off. One of the most important is Camera. If you are experiencing problems, please make sure that Camera is set to Front.

You did say you wanted an external sensor that could sense distance within 2-3cm, but if your fine settling for a farther sensing solution, this is very reliable and relatively easy to set up! But if you still have your heart set on a external sensor, I would be more than happy to give you some instructions for that as well!

Good luck, and I hope this helps you!

10
  • Thanks for your answer, I'll give this a try eventually! (But currently don't have time for this project, unfortunately.) I believe I read that whether the camera works in the background is device-specific, but I'll see if my device can do it. May 6, 2015 at 9:55
  • Note that I didn't say I wanted a sensor that senses motion within "2-3cm", but rather I said "2-3m", i.e. when a person passes through the room the device is in. May 6, 2015 at 9:57
  • note that I didn't say I wanted a sensor that senses motion within "2-3cm", but rather I said "2-3m" Ok, I was thinking that seemed a little close:) I've read that most devices will work with the camera in the background, but yes, that does mean that not all will. If it doesn't work on your specific device and you still want a solution, making a external sensor is not that hard to do for under $10. However, this method is much simpler and more configurable. Good luck with this whenever you have time to work on it! May 6, 2015 at 16:11
  • UPDATE: The intent package has been renamed to org.motion.detector.ACTION_GLOBAL_BROADCAST. See documentation here: programy.jastrzab.com/… and discussion here: reddit.com/r/tasker/comments/27bvf8/help_motion_detector_app/… The above still works; just switch out the package name with the new one in this comment. Dec 3, 2015 at 23:33
  • @AndréChristofferAndersen Good to know! Thank you for pointing that out; I'll add it to the answer to prevent confusion. Dec 5, 2015 at 1:05
1

I don't know if this suits you but what about a power plug with a movement sensor? When it detects movement, the tablet will get the power connected and the screen will turn on. Plus with Tasker you can configure much more things to do when it detects movement.

1

I hate to say it guys but all I did was attach my feed from my PIR in the ceiling (which already controls leds in the shower) to my android. When someone comes in the power switches on the phone and bob's your uncle.

1
  • Using the device's Screen on when Power On/Off feature. Nice.
    – cde
    Jan 10, 2016 at 12:23
1

I have been looking for a way to have the tablet screen on when I get close to the Tablet which is mounted on the wall to monitor my home. Just like the Nest thermostat. I recently purchased the Konnected alarm system board and the wifi module from Nate Clark He suggested me to use www.ozerov.de/fully-kiosk-browser/ There is a small licence fee. It works well for the intended purpose. I am using Actiontiles integrated with my Smartthings. My tablet is wall mounted with continuous power supply.

           Nate Clark <[email protected]>
0

You might want to check out Wimoto. They are small, and cheap, bluetooth sensors that come in a few flavours (temperature, motion sensing, liquid detection etc). They say that there is an Android app incoming, and that there is going to be an SDK released in the near future for it.

Then again, if you want something more simple (and your tablet has a front facing camera) you could simply use an app. For example (just after a quick search so haven't used it) Camera Trigger.

Hope this helps.

4
  • Wimoto sounds like the kind of devices I was thinking of, but I couldn't find a motion sensor. Do they have one? Mar 3, 2014 at 8:28
  • Camera Trigger has the same problems mentioned above, it doesn't work with the screen off or when having another app in the foreground. Mar 3, 2014 at 8:32
  • Yeah, they call it the Wimoto Sentry. I've also come accross Twine that is also a micro sensor with a couple of features
    – Hrafn
    Mar 3, 2014 at 8:38
  • You're right. I got confused because on Amazon it's (incorrectly, I guess) listed as a "Bluetooth Smart Water Sensor". Looks good, but apparently it's gonna be a few more months until we can get one. Mar 3, 2014 at 8:44
0

The only affordable and reasonably accessible motion sensor I could find is the Belkin WeMo Motion.

Ian McCracken created an inofficial SDK for the WeMo called Ouimeaux (docs, PyPi).

My current plan is to write a tiny application running on a Raspberry Pi that uses Ouimeaux to respond to a signal from the WeMo Motion and send a push notification to the Android device. And then an even simpler Android app that responds to the push notification and wakes up the device and turns on the screen. (The latter might also be doable with Tasker instead.)

As a second step, the relevant parts of Ouimeaux could be rewritten in Java and then it would be possible to connect straight from the app to the WeMo, making the Raspberry Pi superfluous.

Improvement suggestions welcome, of course. In particular if you know an existing way to wake up an Android screen from a Python/shell script/otherwise trigger push notification. That sounds too trivial to require writing a new app.

5
  • If you disable the device lock, you can create a small application that takes input for action, and uses a Java ProcessBuilder to run an shell command for a key event, for instance 'shell input keyevent 26' (Power button press), that should in theory work. I'm currently running a shell command after a button press, to run the new 'screenrecord' feature in Android KitKat, in background for an app I'm creating so I can verify that running shell commands in this way works.
    – Hrafn
    Mar 4, 2014 at 12:42
  • @Hrafn I didn't quite understand: what's the intention behind doing that? Mar 4, 2014 at 14:25
  • You were asking for possible ways of waking the screen up. If you can get some kind of input, you can create a Java Process (as a part of an Android program that is running in the background) and make it run a power button click in the shell of the device. That should, if the device is configured to not lock, wake the screen up.
    – Hrafn
    Mar 4, 2014 at 15:24
  • @Hrafn I see, but then you can just use the PowerManager API that I already linked to in the question. It only requires about four lines of code. Although one possibility would be to keep the device connected with a cable and just trigger the waking up via adb with something like Wakey Droid. Mar 5, 2014 at 11:09
  • Sure. But to use the PowerManager API you need to manage the wake state your self (I think). So if you acquire a wakelock you'd want to send a power down signal after a certain time. With the keyevent call through a shell, you don't have to manage that, and can just let the system handle everything.
    – Hrafn
    Mar 5, 2014 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .