Showing posts with label electricity usage. Show all posts
Showing posts with label electricity usage. Show all posts

Thursday, 8 September 2016

You have mail 2

After having done the hardware for checking mail I had to make some kind of user interface to show that data. I had previously used an old IPhone to display temperature and power usage, so it was an easy choice to continue using it.

Previously I had just used a simple php script to fetch and display data, now I wanted to try python and Flask. I used a tutorial found here to get started.

Code is pretty simple, temperature and electricity usage is fetched every time from database, but this page is usually only open on the extra phone that displays this data so there shouldn't be any reason to cache that data. That data is also updated to database every minute so it should be refreshed every time. Mail status is received over mqtt and it's sent only when it changes so it has to be cached.


I also made a couple of changes to the hardware/firmware section, for the firmware I set the retain flag in the mqtt message so that when clients connect they get the last know value of mail. For the hardware I added a bigger antenna because I have some trouble with the wifi reception. Reception is still not as good as I would like, I have to think about it. Maybe second wifi ap, I'm also thinking if I should build a separate network for IoT-devices, currently there is only one wifi device, but that could easily change. I also changed the psu to one that outputs more current and has a lower quiescent current as I thought that the wifi problem might be because the ESP8266 is not getting enough current to transmit, but that didn't solve the problem. Before I had a cheap chinese buck/boost converter, and now I have https://www.pololu.com/product/2830 which can ouput more current, but is only a buck converter and needs at least 4 volts to output 3.3 volts. So I had to replace the three aaa batteries with four aa batteries to get enough voltage.

Also there is a problem with the mailbox itself:) It let's sunlight through somewhere and that's enough so we can't see if the led is on or not. I'll have to think how to put some seals there.

Future improvements

Hardware
  • Monitor battery state.
  • Don't turn radio on on wake up, only when we need to send. NodeMCU bug might prevent this currently.
Software
  • Move temperature and electricity to mqtt also.
  • Add today's forecast.

Thursday, 9 June 2016

Arduino counter

I needed a way to read pulses from our house and geothermal heat pumps electricity meters. Of course there are many pulse counters all ready, but I had make my own:) Just a simple sketch that counts pulses from pins 2 and 3 reports them on the usb serial when asked.


Main meter is read optically with a TSL257 and the geothermal pump meter is directly connect to the meter.

Code in github https://github.com/mika-koivusaari/read_kwh_pulse

I use a python daemon to relay the data to MySql, code again in github https://github.com/mika-koivusaari/read_pulse_mysql

Thursday, 26 May 2016

Outside temperature and electricity usage

Our living room/kitchen is on the south side of our house, wireless outside thermometers can't reach it from the north side. But I have a server recording outside temperatures, and maybe a whole weather station in the future. So I only had to display the temperature I already had. We also had an old IPhone and a radio with IPhone dock. So I only had to write a small script that displays the current temperature in a web page and automatically updates. Then use the IPhone to display the page.


It also displays the electricity consumption in the last minute.

Maybe in the future I'll build a better app with more information, todays forecast or something. Data could be sent with mqtt maybe.