Wednesday 14 October 2020

Phoniebox - Homemade kids jukebox.

 Phoniebox - Homemade kids jukebox.

Some projects are just too much fun to not do.  Phoniebox is a Raspberry PI based kids jukebox that uses RFID tags to play audio files in a folder.  This simple idea allows for a lot of creativity building and filling the box with content.


Inside there is a Raspberry PI 3, USB RFID Reader, USB Powered Speakers,  USB sound card and USB power-bank.  So wring is mostly plugging in.  The optional arcade buttons are wired to the GPIO pins for push button control.

 The case is a mix of repurposed materials and 3D printed parts. The software is mostly scripts on top of Mopidy / MPD / ALSA so it is very customizable and flexible.


Wednesday 13 May 2020

Solar Power Home Automation Bus

Originally published here: https://openforce.com/blog/2020/05/13/solar-openhab/  this is an example of DIY Solar Automation with openHAB

The stars align

There are various hot topics at the moment that are undergoing massive transformation and development.
  • Electric cars
  • Renewable energy
  • Home batteries
  • Smart homes
  • Cloud data
  • Smart electric grids
  • The environmental crisis
Combining these evolving themes has the potential to provide environmental and financial benefits that will transform our lives.
We have the challenges of fluctuating renewable energy production as well as consumption. Energy storage needs to be managed intelligently to make it cost effective. Smart decisions may require information like the weather forecast and the current market price of electricity. How can we master these new complex systems?
No doubt forward looking companies will be working on products to take advantage of the new opportunities created by this disruption. This article looks at a DIY approach to managing and automating home systems.

openHAB the open Home Automation Bus

openHAB is an open source project that aims to reduce all things to a number or state so that they can be modeled, monitored and controlled across products, protocols and contexts. It has bindings to many “things” and it can run on a Raspberry PI.
Using the openHAB bindings various devices can be combined to build smart systems. Here we use the openHAB Fronious binding to get data from the inverter and MQTT messages to communicate with remote devices. Grafana can be used to monitor the systems with dynamic charts.
If you want to play along at home, here is a dockerized openHAB example with a mysql database and grafana charts. It models a house with Solar Panels. You will need a Fronious inverter with smart meter running on your network.

git clone https://github.com/dougculnane/openHAB_solar.git

Smart Solar Power

To get the best return on investment from a domestic solar power system you have to shift your electric consumption to use the energy your system produces.
Changing personal behaviour to run dishwashers and washing machines when the sun shines helps a great deal but we can also automate systems.

Use PV power to heat water.

Heating a hot water tank requires a few kilowatts hours of energy. They are a kind of large energy store that is very simple and cheap. Hot water can also be a useful luxury in a modern home. Obviously we want to heat the water with the energy we produce rather than the expensive electricity we buy from the grid.
By controlling the thermostat using openHAB and developing rules that automatically adjust the thermostat temperature based on the current electric grid meter value, we can soak up some energy rather than exporting it to the grid.




Here you can see a good sunny day where the hot water tank stored about 3kWh between 12:00 and 13:00. We can also see that manually putting on the dishwasher, washing machine and cooking during the day helps to match production with consumption. The trigger for the hot water tank needs to be on the grid power measurement so it does not turn on while the oven is on etc.

Some days the production and consumption curves are not as predictable and so averaging out the measurements over a few minutes is needed in the rules to add a bit of stability to control decisions.

Electric car charging

Electric cars bring a huge battery to these connected systems. Most of these mobile batteries are idle more than 90% of the time, and so slow charging could be used to soak up excess PV power. With vehicle to grid technologies the night time consumption can be shifted to the day.
A mobile battery project is in my task back catalogue so hopefully I will be able to report on that soon.

The future

Hopefully this article has shown the potential for this smart approach. Rules can be developed to balance the electrical grid, make money and/or increase comfort. We all have different priorities that also evolve and change as new systems develop. Maybe this DIY approach is not for everyone but becoming master of your domain can be a lot of technical fun.


Tuesday 4 February 2020

The Home Automatization Platform openHAB

The main reasons for automating your home will be efficiency, convenience and security.  It also allows you to implement intelligent designs that automate systems that would otherwise not be at all practical.

It is important to understand measure and monitor the systems you design and to own them. It is also important to turn everything into a number, state or command no matter what system or equipment you are modelling. 

The approach openHAB uses is perfect for creating cheap and fairly easy automated systems that are a mix of different DIY devices and products.

If you want to get started, get a Raspberry PI (old computer or docker runtime..) and set up openHAB.  You can use the PaperUI to install bindings and see if you can get them working with any smart devices you have in your home.  I like to use the HABPanel to make simple UIs for monitoring and controlling devices.  There is plenty documentation and if you have the determination and patience you can access your openHAB over the internet securely.

If you can do that you can build systems that, for example:
  • monitor temperature and humidity
  • turn on / off ventilation fans
  • detect when you are home
  • set your thermostat setting
  • get the current weather forecast
  • turn on heaters
  • open ventilation flaps
  • charge batteries
  • control lighting levels and hue
  • monitor energy consumption
  • mow your lawn
  • monitor solar power production
  • charge electric cars
  • collect and display calendar data 
  • pull in data from the cloud
  • turn on music
  • ...
The real power of this type of home automatization comes when you make rules across these different system. ie.:  "When the grid electric price is low and the home battery is below 20% turn on the irrigation system until I get home then play Led Zeppelin in the Living Room."

OK that might not be a useful rule but I hope you get the potential of these ideas.  I hope to demonstrate some more piractical examples of projects that I have done.

I believe

I wrote the below a few years ago (before the Paris Agreement, BREXIT and TRUMP).  Since then I have played, experimented, failed and had a little success. I hope to share what is worth sharing so i opened up my blog and found the below which is is good optimistic introduction so I am posting it.

I believe we have a problem.


I believe that humanity faces huge challenges if we are to sustain our species in large numbers (or even complex life on this planet) for the next few decades. A few decades is a long time for a mortal but having had the luxury of living in a few decades of growth I worry about a future of dramatic decline.

Politically these challenges seam impossible to address at anything like the required pace of change required. The current political tactic of confusing opinion and beliefs with science, fact and basic maths, does nothing other than paralyse the progress needed to address the existential threats we face.

The main problem we face is well explained here. I believe that to instigate rapid positive political change we need to be aspirational or (as history often documents) war and/or disaster will result in positive political change eventually (if it is not too late).

I believe there are solutions.

What ever happens I believe increasingly rapid change is unavoidable and we can individually choose in which direction we wish to contribute to that change.  Individually we can make a small but significant difference and collectively we will determine the fate of the species inhabiting this planet.

I do believe that there are technical solutions out there that are aspirational and elegant and empowering.  These solutions might conflict with some commercial and systemic interests but they can be personally enriching.  Nature gives us a well established blueprint for experimentation by embracing biodiversity, efficiency, cooperation and cyclic systems together with brutal honestly. Humans can use science, intelligent guess work and modern communication to accelerate system change without the slow messy process of evolution.

The political systems will quickly follow the popular opinion and the Paris Agreement gives us hope that a real framework for avoiding irreversible climate collapse will develop.


Belief is for bullshitters we need maths and science.

Above are my evolving beliefs and opinions. I might be wrong but I intend to play with some ideas to learn more and I thought I would share my projects here for anyone that is interested.

The motivation of these projects is based on the following criteria:
  1. Energy.
    Energy needs to be distributed equally per person if it is to be an equitable (and therefore a stable) system.  Total energy use must fit with the solar budget of the planet so anything that reduces total energy is probably good.
  2. C02
    Reducing total C02 emissions is essential.
  3. Cyclic Systems
    Building cyclic systems dramatically exposes environmental damage outsourcing and so should be a priority.
  4. Economic
    Costs are subjective but good value for money is important to me personally.
  5. Robust.
    Solutions need to be robust and empowering rather than create external dependencies.
  6. Fun and easy
    I like to have fun and I am lazy. 
I think tracking personal energy use and environmental complexity honestly is brutal and full of hypocrisy, and therefore it is often corrupted.  I think it is a fascinating technical challenge that I wish to investigate without corruption as best I can.