A13 Android - send to sleep from exeternal input

Started by timgray, February 12, 2013, 07:28:22 PM

Previous topic - Next topic

timgray

I am using the A13 board with the LCD board to make a double din Android Car stereo.  Problem is I cant see how to make the board "go to sleep" when the car is turned off.

I can give it solid power and switched power,  Id there a trace on the board I can cut that will make the board think it lost power and is running on battery?   I cant interface to the battery input as it is limited in what it can do, plus making a power supply that will send 3.7 volts instead of 12 and not blow up the charging circuit is going to be a problem.

Basically, I need to be able to "fake out"  the android to think that external power was lost and it's running on battery, to go into sleep mode. while it is still being powered from the power input jack.

Or should I look at using a GPIO?  is there a way to make android look at a GPIO and go to sleep or wake up based on the state of that pin?

JohnS

How much power (well, current) does it draw in sleep (suspend)?

If it's more than some value you'll need it fully off instead, else you'll flatten the car battery.

Maybe use a relay similar to the engine run one?

John

mb

You will probably need to make sure that Android shuts down in a controlled manner in order not to cause flash image corruption.

I think I saw a thread on this forum discussing how to access GPIOs from Android, should be a viable route in combination with an Android background service that shuts down the system if the monitored pin is in the "switch off" state.

/Martin

timgray

#3
I dont want it to shut down.  I want it to do what happens when you touch the "power button"  or let it time out.  At full draw it's 6 watts,  car battery can handle a week at that.   Standard car stereos draw 3 watts while just sitting there off and I am sure when in android "sleep" mode this draws at least  that low of power.  I'll have to measure the states when I get room on my lab bench.

The problem is that the power switch is a toggle so I cant use that.  I want it to wake up and turn on the 7inch LCD and be ready to be used when I give it an input and then go into sleep mode when I remove that input or even give it another input.  I am running in Dev mode and set the timeout to never when power is applied.  so what I want to do is give it power, but make it THINK power was removed so that it will go to sleep.

That way at 2am it can download all my new podcasts off of the wifi it can see in the driveway just like an android phone can do.

I guess I need to start hacking the Android kernel and make it ignore the current "power" status and make it look at a GPIO pin.  Anyone know if that is possible?

Looking at the schematic, the power button is connected to pin 47 of the AXP209.  I cant find any data sheets in english on that chip to see if any of it's GPIO can be used as ON/OFF instead of using the power pin as a toggle.

I could wire up a pic to look at the power line of the LCD to detect state and pulse the power pin to simulate a discreete WAKE/SLEEP  but that would be awfully "hackish"   I am hoping for a proper solution.

I am guessing if I could find an english version of the AXP209 technical details I might find what I am looking for.  Anyone have any links to this?

mb

Quote from: timgray on February 13, 2013, 10:58:31 PM
I dont want it to shut down.  I want it to do what happens when you touch the "power button"  or let it time out.

Umm... why not have the Android background service do just that then instead? I'm not an Android expert (yet :-)) but this API seems to be able to what you want:

http://developer.android.com/reference/android/os/PowerManager.html

/Martin

Hakx

So did you ever figure out how to send it to sleep mode? I've been working on the same type of project and so far that's been my problem, I've tried to hook up the lipo battery and when car turns off to then go to sleep on lipo but that doesn't last long. My other thought was to run a circuit from the car battery to the battery terminal on the board so then it would run off the car battery during sleep mode but I haven't really spent much time on it.