05/27/2016 at 11:23 •
Finally got the ESP8266 code and wiring sorted. I used a board schematic I made a while back as a breakout for the ESP8266-12E so I could use it to control some neopixels (one pin has a 2n7000 as a level converter). I've modified it a bit to include some additions for this board (most notably the header for a jumper to enable deep sleep mode).
I also created an IO board out of perf board to handle a 5v regulator (your bog standard LM7805) as the HC-SR04 needs 5v to take all the incoming devices, ground and power them and to handle the voltage divider for the battery level reading (it was easier than designing and etching a totally new board). Only issue with this setup is there are a heap of wiring back and forth from the ESP board to the IO board. I'll design one and upload the schematics when I haven't got a heap of deadlines to meet!
This certainly is more reliable than the 433mhz version, probably due library used in python, or maybe the amount of threads (btw I'm testing this on a Raspberry Pi B rev 2 board to ensure its compatible with ll Pis). I was actually tempted to use an ATTINY85 as a 433mhz proxy, with software serial to communicate with the pi and connect the radio devices to that instead, but I thought I was getting way to complicated for that.
Oh and I fixed the weather issue, apparently Yahoo changed their API so the library I was using (which hasn't been updated in some time) couldn't communicate with it. I've also added a python script to change the location of the weather report in the setup script. Completely forgot it was set to my locale in the script!
Next job is to resize the screen contents according to the resolution of the screen attached. I'm thinking I might get a 800x600 5inch screen just to test, but that wont be for another month or so before it arrives.
Oh and I'm thinking maybe of adding to the project to include it in the next round of the Hackaday contest (citizen scientist), maybe add MySQL or MariaDB to the Pi and logging everything from the amount of Oil used compared to the amount of minutes the heating is on. Maybe throw that together with the temperature difference between outside and inside the house and plot the whole thing as an efficiency thing or maybe output the CO2 produced. Not sure - worth a think I think!
Onward and Upward.
05/19/2016 at 15:57 •
OK my ESP8266 ESP-07 arrived. Signal with the onboard ceramic antenna wasn't enough so I made a bi-quad antenna (using this site as a basis for it http://martybugs.net/wireless/biquad/) only I took an old antenna from a laptop and desoldered the antenna from that. Not exactly part of the project but I might throw up some images of what it looks like. I've been kept busy with other things so I should have time to throw the OilSensor together based on this device. I've already etched out a board from a schematic I put together in Eagle, so I'll put that up next week, and hopefully I'll have some code to go with it.
04/25/2016 at 13:29 •
Added a few updates and bug fixes for various issues. I've put in an oil sensor node for a horizontal cylinder shaped Kerosene tank. At the moment I've only included the ASK radio method of data transmission using 433mhz modules, but I've an ESP8266-07 on the way (the one with the external antenna), so hopefully that will be able to reach the wifi router and send the data via TCP (which should make it much more reliable).
One of the main improvements is adding a separate thread for screen control, which gets rid of the bug that prevented any changes while the screen was in Timed mode. I've also added headless modes so the heating system can be controlled by HTML only with no need for a touchscreen at all (which I still have to test properly).
I've added an extra OK box in the Timed screen that's easier to click and set up the weather feeds as individual try and except methods to pull the data, so if one piece of information isn't available the rest can still be displayed. I've also included a python script to re calibrate the touchscreen if necessary.
To the html I've added readouts for the oil sensor and fixed a bug when saving the times via HTML as the json was not reloaded in the running thread, meaning that the user had to click on the Timed button on the screen or reboot before it was reloaded.
Sources of the code has been added along with a list of the libraries for the arduino sketches that are necessary for that part of the system and a licence.txt file.
I've added a couple of other bug fixes and performance improvements and cleaned up the code a little. I'm aware it's still a little messy (especially where the HTML is concerned) but the whole system is a work in progress! When I'm happy with it and I have an enclosure for the devices I'll install it at home (finally!) and maybe clean the code up and comment some more so it's a little clearer.
One thing to note I will still have to modify the screen display so that the buttons and display are variable based on the width and height of the screen (a percentage size of the screen maybe?). I've already added this for the Timed button display, will still have to do it for the main screen display - next version perhaps. Lots done, lots more to do.
04/15/2016 at 08:58 •
I got started on the code shortly after receiving the raspberry pi and the touchscreen in late 2013 but got side tracked when my first child came along. Then a little over a year later our second came along. So my hands were kept very busy. I decided to revisit it in late 2015 when I found the time as the project had been running around my head every now and again with new ideas and methods. When I had a (mostly) working beta I was reading about the Adafruit pi zero contest and decided to publish what I had to Hackaday as an entry.
I've been programming for quite a while but I hadn't done much with python so as a learning experience I thought I'd give it a whirl. I also hadn't used json before so I thought I'd throw some of that in and see how it worked.
About a year after I started the project the valve controllers (Myson MPE222) broke, so I thought it would be a good idea to try to set up some stepper motors in their place and use the same Raspberry Pi to control it.
I also got very sick of running out in the cold and wet weather with a bamboo cane and dipping it into the Kerosene to check how much we had left every couple of weeks (or forgetting to do it and ending up with an airlock to bleed), so I thought it might be worthwhile trying to set up something to read the level and send that data to the Pi. I had used cheap 433mhz modules before to control some Lidl power sockets and though that it might be a cheap way of transmitting data into the house. Not long after that I bought my first ESP8266-12E module and started messing with that and came to the conclusion to try both. I could just about pick up the WiFi at home using my smart phone where the tank is situated outside, but the ESP couldn't get any signal. I have since ordered one without the on-board antenna to give that a whirl but in the meantime I have been working on the 433mhz transmission method, which seemed fine from Arduino to Arduino but I've had a bit of an issue with it from Arduino to Raspberry Pi and back, particularly in a code that uses 3 threads already. I've uploaded two instances of the code one for TCP and one for 433 mhz transmission for both scenarios. I'll include the module schematics and program for the 433 mhz method shortly and the TCP when the ESP arrives.