Random strange shed project. Day 2

I didn’t have a great deal of time last night so here’s a very quick update on the weird solar-powered shed / phone project. If you read the first post then you’ll know that I basically want to create some sort of home server which isn’t powered by mains electricity. I’m going to make use of an old smartphone and hopefully keep it powered on, all the time, by topping up the battery with a foldable solar charger. It’s all detailed here and it’s going to live in my shed.

So, I installed a load of apps on the phone. A web server, a MySQL server and an SSH server so that I could connect to the phone and move files onto it, perhaps update a little home website on there or something. To be honest I’m still not overly sure what I could host or put on the phone yet.

I installed a PHP / HTML / MySQL server to begin with..

However, I’m a geek, so first I wanted to find out if any of this was going to work at all. If it’s not going to stay alive with the gloomy and rapidly-reducing late-summer daylight then there’s no real point. So, I need to keep an eye on the battery percentage and I want to know if it’s receiving charge from that solar panel. However, I don’t want to keep going up to the shed every day to check the thing because, well, I’m lazy.

It was 8 o’clock last night when I was messing around with this, so it was going dark already. Plus, as is my style, I’d not charged the phone fully off the mains to start with. Preparation? Pah!!

It was about 75% when I took it into the shed and balanced it, rather carefully, on the lawn mower.

Oh yes, that’s how I roll people.

I plugged it into the solar charger and, rather unsurprisingly, nothing happened. There was no daylight though so, no surprise there.

The REST API app in action

Before all that, I’d downloaded something called REST API. I bloody love API’s I do. It gets my geek on. Basically you run the app on an Android phone and then, from anywhere else on your network, you can browse to a certain URL, which interacts with the phone to tell you what it’s doing. You can also do certain tasks, like take a picture on the phone, check the temperature, check the light sensor reading, look at the files, read the GPS location and more. Proper useful. You can even tell it to vibrate or send a notification. It’s all quite cool.

Locally I can get the battery charge by putting http://192.168.0.236:9427/OGi23r9T/battery into the browser on my laptop. It’ll give me this in return…

… but that’s no good for this project, so I did some network address translation gubbins and basically allowed the phone to be accessed on the t’internet. I’ll tell you more about network address translation and port address translation in the next piece as I’m a little short on time.

For the purposes of this test, I’m not going to reveal my home IP address here because last time I did that (when I detailed how to turn a phone into a web server), it killed my home connection after you lot kept swamping it. My own fault. Fail. 🙂

Here, I’ve set an automated job on the Coolsmartphone server which polls the specific home connection web address, and therefore the phone itself, every 5 minutes. Right now it just checks the battery percentage and whether it’s charging. If it is, this will be a sign that we’ve got enough light to make the solar panel work.

Here then, after a bit of late-night bash scripting which alters the information to be more descriptive, is a totally LIVE reading of the phone in my shed. I’ll add more information and a bit more “polish” to this over the next few days, so stay tuned for the next part!

Edit – I’ve just added this logging page, which lists each check so that I can have some basic historic metrics on when it’s charging and how the battery percentage performs throughout the day.

Edit – I’ve started messing with the light sensor now, so we can see how much light the phone is getting. However, this should be taken with a pinch of salt at the moment as the solar sensor is blocking the shed window and the phone isn’t getting a great deal of light anyways. This chart gives some information on how to read Lux readings. Generally, the higher the better. As an example, 0 is no light, 50 is expected in a living room, 100 on an overcast dark day and 400 or more for proper daylight / sunshine.

LIVE FROM THE SHED!