mrrrk.net

Yet another narcissistic load of old cobblers that no-one will ever read.

Chacmool Pi

Here's a quick and general precis of the computer hardware and software I intend to use for my weather project.

The Actual Computer

I want a computer that consumes little power and that I can connect lots of interesting little weather sensors to.  An Arduino board might work but I want to serve web pages from it and that might be asking too much from one of those.  At this point, the choice of a Raspberry Pi seems pretty much of a no-brainer.  There are other similar tiny computers (Beaglebone, etc.) but the Pi is well known, well supported and to top it off, it's British.  It's even made in Britain.

So that's easy.  The next choice is what operating system and programming framework I should use. 

Operating System and Programming

The basic requirements are:

  • Needs to poll data from several sensors
  • Needs to support a database of some form to store these readings
  • Needs to serve up web pages

My usual weapon of choice at work is Microsoft's ASP.NET with SQL Server.  As it happens, there is a version of Windows 10 that runs on the Pi: the Windows 10 IOT (Internet of Things) Edition - and it's free.  However it's not entirely clear that you can run ASP.NET on it.  I think it's possible - but not what the OS is intended for.  Also, polling the sensors with C# code would be tricky (but possible.)  And I'm pretty sure running SQL Server will be asking too much.  So in the end, I've decided on the default Raspbian operating system, which is a version of Linux designed specifically for the Pi.

With Raspbian, I could have still gone for Microsoft's ASP.NET because the new ASP.NET Core version will run on Mac OS and Linux - including the Pi - but I'm doing this for fun so I might as well chose a language and framework I don't use at work!  So I'll be doing the programming in Python.

There seem to be a number of options when it comes to Python libraries for serving up web pages and in the end I settled on something called Flask.  It looks pretty similar to the ASP.NET MVC way I know.

Fun fact:  Python is named after Monty Python's Flying Circus.  Written by a Dutch bloke who I suppose was (is) a fan.  And in turn, the Raspberry Pi is so named because of Python (it seems to me it should really be Raspberry Py on that basis, but that's quibbling).

Database

I'm also going to use Sqlite to store all the good stuff coming from my sensors.  Sqlite was apparently designed originally as a light-weight SQL database for use on US Navy guided missile destroyers!  It's used pretty much everywhere now, from storing browser settings in Firefox to storing who-knows-what on your smartphone.


Web Front-End

As mentioned, I'm using Python + Flask for the back end and as well as the usual HTML5 for the web stuff, I'll be using Typescript to do the programming around that.  I'll be using a similar approach to the one I use at work where the HTML is essentially a static shell and the clever stuff happens via client-side scripts which call APIs on the back-end and manipulate the browser view.  I'll also be using Knockout.JS to do data-binding.

Typescipt was designed by Anders Hejlsberg, the American Dane that the geeks out there will know for things such as Turbo Pascal, Delphi and C#.  He's genius but he pronounces Delphi as "delf-eye" and everyone knows it's "delf-ee" - so he's also an idiot.  No, sorry, he's not a real idiot - he's just lives in the US.

Displaying it All

The idea is to use a 7" (Nexus 7) tablet I've got (and rarely use) to display the weather data in the house.  Maybe I'll need to write an app to show the page that the Pi is sending out in "kiosk mode".  Or maybe not.  More on that later.


Chacmool Power

Today, I installed a solar panel on the shed.  It's rated 100 W but will generate but a fraction of that because of next-door's tree.



My initial idea was that I ought to be able to get, say, 10% of the quoted 100 W on a dull day, possibly for a third of the 24h period during winter, giving an average of 10 W x (8 h / 24 h) = 3 W, give or take.  As long as my panel pumps out 10 W during daylight hours and my Pi (plus all the weather gubbins) uses 3 W or less on average, I'll be fine!

According to this, https://www.pidramble.com/wiki/benchmarks/power-consumption, 2.5 W sounds about right - plus whatever my sensors consume.  Actually, thinking about it, my charge controller must consume a fair bit by itself.  Hmmm...

So anyway, I've attached the solar panel (as you can see above) and wired it up to the aforementioned, rather fancy charging controller I'd bought for a previous project:

And to an old, knackered (possibly) car battery I rescued from the garage:

All the wiring's a bit temporary for now.  I just wanted to get it hooked up to see if the panel and charger would work.  And they do!  The panel showed 20 V across its terminals, open circuit.  When connected up, that dropped to about 13 V.  As you can see, the panel is supplying a tidy charging current of about an Amp here:

That's about 12 W.  It's a bit sunny, but the panel's not in direct sunlight.  And I'm not sure if the charging circuit is throttling things back a bit for my old, neglected and no-doubt shagged battery.

Time will tell if this will be good for keeping the Pi going through winter!

Later...

Okay, now it's about 15:44, it's cloudy and starting to get dark (sun sets in half an hour.)  The charging controller is reporting barely a tenth of an Amp now.  About one Watt.  Dunno if the battery having maybe charged up (I doubt it - but did I mention it's probably shagged) is having a bearing on that but that sounds a bit thin.  We'll see.

To do?

I need to test how much the Pi will draw and maybe run a test load in the shed that uses a similar or greater amount of power (e.g. a 12 V lamp or something) for a week or so to see if it works.  Or I could just install the Pi and see if it crashes...

Actually, sod that - the first thing I need to do first is disconnect this setup becuase, like an idiot,  I haven't used any fuses!!!  I'm pretty confident that my wiring is as sound as it could be - but still, the potential for a battery that can supply 100s of Amps to burn down a wooden shed should not be underestimated!  I think I also need to add a fuse for the solar panel - just in case.

Wind?

It's a couple of days since putting the panel up (and starting to write this post) and the average power capability of my solar panel has been weighing on my mind.  Since my over-specced charge controller includes wind-turbine capability, I've now ordered a little wind turbine!  It's coming from China so I'm not holding my breath.


Chacmool

Chacmool is the name of my new weather project.  This is to keep me off the streets since I'm not doing an Open University degree anymore.  The idea (long term) is to make automated weather observations and use "artificial intelligence" to try and predict the weather.

This project will live in the garden shed, run on solar power and be controlled using a Raspberry Pi computer.

I've already done a lot of the fun stuff, i.e., buying various parts off Ebay and Aliexpress but I intend to keep some sort of log of my progress from here on in.

Why is it called Chacmool?

I saw a chacmool statue in Merida, Mexico a few years ago and thought it was sort of cool.  And according to Wikipedia, "Aztec chacmools bore water imagery and were associated with Tlaloc, the rain god."  That's all the excuse I need.


Why an AI weather station?

I've read "Make Your Own Neural Network" by Tariq Rashid and it was an excellent book - I'd recommend it to anyone who wants to know how things like 'deep learning' (or whatever it's called this year) work.  That got me idly wondering what I could use a neural network for, other than reading hand-written digits (the classic 'hello world' application of AI).  On the hardware side, I'd already got some bits from an abandoned shed-based project to use a Raspberry Pi for "off-site backup".   That gave me the idea then that I could build a shed-bound neural network and feed it with sheddy weather data - and see what happens...


No Physics

I'm not writing anymore physics posts - probably!  At least for the foreseeable future.  I imagine.