Friday 5 May 2017

Weather page

I've had a weather station at our summer house for some time now, but I never got around to publishing the the data. Now I had some time and made a Spring Boot application to show the data.

Station consists of 1-Wire sensors from Hobby-Boards. Temperature, barometer, wind speed and direction and rain sensors. I'll probably add a relative humidity sensor sometime so I can calculate the heat index also, currently only wind chill is calculated.

Since the weather station is located at our summer house with a somewhat flaky internet connection I can't just directly save data to my home servers database. I first save it locally and then replicate it home by reading MySQL's binary log. https://github.com/mika-koivusaari/replicate_mysql_postgresql Machines are connected with an SSH tunnel, I use autossh to make sure the tunnel is always open.

Weather page is https://weather.khyron.dy.fi/weather (in finnish), and code in https://github.com/mika-koivusaari/weather.

Friday 17 March 2017

Solar heat

Our garage currently has no heating, sometimes when it's cold for a long time I put a electric heater there to make sure it doesn't go below freezing. For some time now I have thought about making a solar heater there and now I had some time to do it. One of the outside walls faces south and there is already an air intake, so that's a good starting point. I decided to only heat the incoming air and not make a full blown solar heat system with water circulation, it's cheaper and also I like to start small.

Collector

A house near us had it's windows replaced so I got one of the old ones for free. It was about the right size which reduced the work needed. Basically it's just a wooden box with polyurethane insulation I found in a dumpster, with the window put in front. Just behind the window is a tin foil paper with the paper side painted black and facing the window and sun. That way space where air heats and comes inside is covered with aluminium and there is no paint that might give out some fumes when heated. I ran out of paint so the collector isn't painted as black as it should, I'll probably paint it better in the summer as I have to take it out anyway so our garage wont heat too much. But I thought it would be good to get it installed and making heat, I can make it better later when I have some more data on how it works.

Controller

The controller needs foremost to control the flap on the air intake, because there are usually no people in the garage there is no need to get fresh air all the time, so the flap can be closed when there is no heat coming. Generally when air is hotter inside the collector we open the flap more, and when it's colder we close the flap some more. For operation there's only need for two temperature sensors, heated air and inside air, but I also want to monitor cold air coming to the collector so I have three sensors. That way I can monitor how much air heats and whats the temperature difference between north and south sides of our house. There is no fan, air is only moved by convection.

I also had a small solar cell from a Ikea garden lamp, which I added to get some reference to compare to when I make changes to the collector or controller. I put some resistors and diodes as a load, and scaled the voltage to 0 - 1 volts with a voltage divider.

All the values, temperatures, solar cell voltage and servo position are sent out with MQTT and then logged to a database so I can monitor how it works. And when I make changes I can see if it was a good or bad change.

On the left the protoboard version, and on the right the final veroboard version. Power supply is just some generic psu I had lying around as I use two dc-dc converters to make the needed 5 (LCD and servo) and 3.3 (ESP8266 and DS18B20 sensors) volts.


Controller in it's "final" installation. After one day I lowered the position of the servo some. It only opened the flap a few centimeters, now it opens some more.



Source and fritzing files can be found in github https://github.com/mika-koivusaari/solar_air_heat_controller

Thursday 26 January 2017

MQTT MySQL gateway

Previously I've made a couple of sensors that send data with MQTT. Of course that data should be stored in a database. Considering that I'm probably going to make more wireless sensors that send data for example from our heating system it's best to write a easily configurable MQTT to database gateway. This gateway should also be able to send new values from database to MQTT nodes for displaying, as some data is gathered in other ways and inserted directly to db, for example OWFS(1-wire) or homegrown pulse counters.

So the basic functionality would be:
  • Recieve data from MQTT, process and save it to MySQL
  • Follow MySQL binlog and send saved data to MQTT
For input I need to have a table that stores:
  • Subscribed topic.
  • How to get raw sensorid from topic, maybe regexp.
  • How to parse data from message.
  • Small script that processes the data so it's ready to store.
And a second table that's used to convert raw sensorid's to db sensorid's:
  • Rawid
  • Sensorid
For output I need a table that stores:
  • Sensorid
  • Topic to push data to
  • How to process data before sending
There are still some features to implement, like outputting data from db to MQTT, need to think how this should be done with some kind of plugin system, MySql will probably use binlog to read data, but other databases have other mechanisms.

There are depencies for Paho-MQTT clientpep3143daemon and SQLAlchemy. More detailed dependencies in requirements.txt

Code in GitHub https://github.com/mika-koivusaari/mqtt_db_gateway.

Tuesday 17 January 2017

Wooden urn

We had a death in the family and I wanted to make an urn for the ashes, before they are scattered.

For material I used birch and heat treated birch. I wanted to make the sides at an angle, and I found a nice calculator for compound miter angles. Sides are only at a 5 degree angle so the bevel is almost 45 degrees. Before I sawed bevels I routed a slot for bottom with my old adjustable jig(in finnish).


For the 5 degree angle I made a jig and tilted the saw blade for bevel.






Top was glued from four pieces, and one piece in the bottom to hold it in place, and cut to size with bottom. Finished with wax.