Can Android be woken up from sleep by a peripheral device such as an arduino microcontroller?
Additional details:
I am looking to save power by putting the Android device to sleep and having the low-power peripheral device wake up the Android device only when an "interesting event" occurs (e.g. abnormal sensor reading)
The device probably cannot be woken from true CPU sleep (which is a level beyond having the screen off) by ordinary software/signalling means.
However, enabling a 5v power source to the USB jack probably will wake up the majority of devices which can charge via USB.
If they are connected to an actual USB host (vs a simple power supply/charger) my suspicion is that they would not enter CPU sleep at all. Both the android accessory kit and IOIO schemes have the external microcontroller functioning as a USB host and providing power, so it's likely sleep would not be an issue. Or if you need to save power, you could probably make the externally sourced power switchable.
Two additional possibilities to consider are using a partial wakelock to prevent CPU sleep, or setting alarms to wake the device periodically so that background code can check for some event.
Just tested this. I have some USB thumb drive OTG adapters and when I connect the adapter without thumbdrive, the phone woke up. I think it has something to do with two pins on the micro USB socket, pin 5 and pin 4 tight up together.
Adapter I am talking about:
Pins:
Related
Android 4.3 added new 'software' feature that keeps Wifi get scan results even if Wifi is off. It says that this mode consumes very low power.
My question is how this technically done, and how much power saved compared to just enabling Wifi?
The logic is simple: driver and wpa_supplicant is never unloaded from the memory, unless scan-only mode is disabled in WiFi advanced menu via Scanning always available option.
In terms of power consumption - the numbers will differ for every WiFi solution, but according to my experience (being an WiFi engineer for one of the Android OEM's for last 4 years), the difference is minor. Below is an example of some average consumption numbers:
Phone is awake, WiFi disabled: ~220mA (depends on many factors, just an example)
Phone sleeps, WiFi disabled: ~5mA
Phone sleeps, WiFi enabled (sure, applies to Scan-Only mode as well): +5mA
So, if you are an active user, turning Scan-Only off will not give you huge power savings. On the other hand, if the phone usage is somewhat passive, turning this option off could give some extra battery life.
Personally, I keep this option on, since I prefer immediate WiFi availability when I enable it over that minor battery win.
I have an app which is running on an android device which has no battery. It's just charging all the time and the app is running. But sometimes the device is not charging and logical to that the phone will turn off.
When it's charging again the device should start from itself and boot. The user shouldn't press the power button. That's the requirement.
Is this possible anyway?
Can I achieve this when I root the device?
Has anybody experiences with that case?
in short: No.
ADB is not running when the phone is powered off, and as #langerhans said, wake on alarm is proprietary
You could do a hardware solution where you hijack the battery pins to a power station or modified charger. (make sure you do not feed any power through usb at the same time)
It should be cheap and quite easy to build.
Generally, this is not possible. It is highly device dependant. Some devices allow alarms turning on the phone to ring as an alarm clock even if they are turned off. But this is a proprietary feature and therefore not easily accesible to custom applications.
I have basically the same problem running an Odroid device which luckily turns itself on after power loss, but if I shut it down manually, I can only turn back on with pulling the power.
The only thing I could think off would be an extra watchdog device, but I have no idea if something like that exists. Maybe you'd need to build it yourself.
I'm working on a hardware/firmware/Android app project where the Android (in this case a Nexus 7 tablet) connects to a custom hardware platform via USB. The Android is in Accessory mode, which means the other end of the wire (the Host) supplies power to the Android. The hardware has a dedicated 5V 2A switching supply for the USB connector so there is plenty of current available for the tablet.
When the Android is plugged in to the hardware, it reports that the battery is charging and it requests 500mA from the USB connection (for those who don't know, the USB protocol requires the device to inform the host of its current requirements). The hardware easily provides this current and the 5V stays rock-solid.
Despite this, the charge level never changes as long as the device remains in use. This application uses the tablet in what is basically a kiosk mode - the display stays on at full brightness continuously. Sleep the tablet and the battery charges, but leave it on and there is no reported change in the battery level.
The only explanation I can think of is that the Android's power supply circuitry cannot simultaneously handle the current requirements of both full operation and battery charging. But I wonder if this is a conscious decision based on expected power availability, and if there may be some sort of configuration option in the OS that would inform the OS that more current is, indeed, available. Perhaps then the OS would request more current from the Host and have enough to both charge the battery and run the device at the same time.
Anyone have any data on this? Thanks!
When I started a company that designed battery chargers for cell phones and the like, I didn't realize that it took more than providing a voltage source to a USB connector. At first we encountered having to provide different voltages on the data pins to tell the connected device how much current it could expect to draw. Now there are several manufacturers of USB interface ICs that do all the dirty work of handshaking and act as current limiters as well. Most smartphones today draw an average of 1A from the 5V USB bus. Some can, and will (especially Apple products) draw up to 2.1A if allowed. Most tablets run in the range of 1.5A to 2.1A. Any of the above will run in a mode drawing lesser current, if the device finds the charger unable to supply the full current. This will sometimes, as in your case, allow the device to either run or charge, but not both. In some cases, the available current isn't enough to maintain a charge level , and the device's battery slowly discharges, even though it's connected to a charger. If you Google "USB charger data pin voltages" you can see how to tell your device it can draw more current. The proper method though would be to use a controller IC something like TI's TPS2511 "USB Dedicated Charging Port Controller and Current Limiting Power Switch". Hope this helps and isn't too too late.
I'm Developing an Android Application where it's constantly required to keep the App up an running at all time. with the phone connected to a power outlet at all time, Is it possible that if the phone's battery died to Auto-start up the app with no user intervention . *i.e to power up the phone automatically without hitting any power button and start up android since charger is connected. *
then start up my app with android.intent.action.BOOT_COMPLETED and RECEIVE_BOOT_COMPLETED permission
PS: I have tried android.intent.action.ACTION_POWER_CONNECTED but it only works if the phone is already powered up.
I have exactly same requirement as yours.
Can we plan a solution like this:
The Android device is always connected to charger's output.
Charger's power supply is connected to a custom made hardware device which controls power supply to charger.
This hardware device puts charger off until battery is getting low. i.e. 20% remaining.
Once battery is less than 20%, that device automatically switch on the charger.
The "custom made hardware" gets it input from android device itself via USB/WiFi/Bluetooth.
Just a thought. May not be practically possible.
No way doing it if you do not root your device and add reboot scripts to the programs running to show battery charging pictures when device is turned off and charging.for Samsung s2 here is an answer
Maybe you can make an additional app that waits for the BOOT_COMPLETED with its BroadcastReceiver and then check wether the power is connected and start as a new Intent your application?
Just a quick thought..
I have the same problem.
The solution that i will to implement:
1.- get out two(here is my doubt, ¿what two wires?, because i see three, i will use my multimeter for see continuity between wires when i push the button) wires from the power button phone.(when you push that button, it just connect two poles like a switch).
2.- When you have the two wires, so, we build a little circuit with a timer like a 555(integrated circuit). The purpose of the circuit will connect the two wires(from power button phone) by a 5 seconds period every 15minutes.
Obviously this circuit will be running always.
i have been reading about proximity security devices through bluetooth, but i am wondering how it works in reality. As far as i have been reading, there are two techniques:
constant scanning from a master. The central device scans the target device every x minutes. When the target is into range, it gives back MAC bluetooth address and RSSI. The negative side is that being constantly into discoverable mode drains the battery, so does the master device that has to be constantly scanning for devices.
Paired and connected. As some product details: "Your laptop locks itself down when you step a certain distance away, and opens again once you're in range". It means that after paring and connected processes, the master can have information when the slave device is out of range, or get inside range again. In bluetooth 4, is going to be even as a profile.
Regarding to the second option, which feature is this? how it works? i mean, maybe you can code a sequence number counter that counts everytime the slave sends a packet through RFCOMM every x milisecs (android or ios), but what i dont understand is how a slave can connect to master again in a transparent way, when normally two bluetooth devices disconnect when they are out of range each other (so you cant send information again from the same bluetooth socket RFCOMM connection).
How proximity devices works in reality? how can you code it?
Bluetooth 4.0 (BT Low Energy) is a whole other animal than traditional Bluetooth. It is designed from the ground up to be good at things like the Proximity profile you describe. Basically a computer and a fob create a connection to periodically communicate at a slow interval, say once every 5 seconds. When you go out of range the connection drops due to a timeout and the PC knows the fob is gone. The PC side isn't power constrained, so it can constantly or periodically scan for the fob when connections are dropped. The fob can advertise its presence using infrequent advertisement packets, which costs only a small amount of power.
Note that there is no RFCOMM in BT LE. Android and other BT stacks currently lack BT LE support because it is too new. Only a few devices exist which actually use BT LE, so getting much real info is hard right now. In a few years this will be much bigger. The new iPhone 4S and new macbooks have the 4.0 BT chips, so you can expect more usage soon.