| Electronics > Beginners |
| Finally got my first project actually complete. |
| << < (2/2) |
| capt bullshot:
I second you opinion regarding open / closed protocols and home automation stuff. And I don't like the stuff one can buy today, there's always at least one point (mostly many points) that does not fit my ideas of how things shall work. Today my system is doing also some control on the central heating system, not at the individual radiators but at the central boiler. This is done by simulating higher or lower outdoor temperature to the otherwise unmodified central heating controller according to some profiles and indoor temperature in selected rooms. Still looking for a good way (in my sense) to control some of the radiators. A good way IMO would be "no batteries and no wireless involved". For a larger graphical display, there's no need to delve into GUI design. I did mine (on a Friendly ARM board, the RasPi wasn't invented then) with direct framebuffer access only, no X or other toolkits involved. If I had to build another display unit today, my choice would be either to use a microcontroller dev board with CAN bus and display (like one of the STM32 discovery kits) or a raspberry pi based one like yours with a larger display. |
| paulca:
So I was working on this today, having put it off for a while. Got a new BME280 sensor from China which highlighted an interesting development in the Arduino community. Spite. Adafruit do not understand how open source works. They are petty and possessive. They open source their hardware and software and then complain when people clone it. They have now seem to have started embedding product codes into their versions of things and having the libraries check these chip IDs and rejecting clones. Tut. Still the Raspberry PI library doesn't seem to care. The arduino finally read the sensor but only after I found code published by an ebay seller. Of course it might just be that Adafruit have an updated version of these chips and their libraries are checking for the latest version, but I doubt it. Anyway I had to improvise a bit of a "Vcc and Gnd rail" in the PI as I now have an I2C bus and a dallas 1wire bus running things and both require 3v3 and gnd. As this is an old PI 1B I only have 1 3v3 and 1 gnd. So I soldered 3 pin headers onto the end of a female jumper lead so I can plug up to three devices/buses in now. The net result is my sensor PI now has: Outdoor temp - waterproof Dallas One Wire temp sensor on the end of an Ethernet cable out the window. Indoor temp - waterproof Dallas One Wire temp sensor hanging on Dupont wires out the back of the PI Humidity - BME280 hanging out the back of the PI Air Pressure - " " Aux Temp - BME280 temp sensor I then modified my sensor_send.py to add those values. This is where the specifics of sensors ends as this is transcribed into CSV in the format: KEY:Value:Unit,KEY:Value:Unit,KEY:Value:Unit,KEY:Value:Unit and sent to the "Hub" heating_hub.py node where it is converted back into a Python dictionary: Key => ( value, units ) Key => ( value, units ) Key => ( value, units ) The lcd_heating_monitor.py process then iterates over this dictionary and displays them 2 at a time on the 16x2 display. Simple as: Key: value units Key: value units LINE_1 and LINE_2 simply toggle with each item. If switching from LINE_2 to LINE1 also delay 3 seconds. So the hub and display can now support any number of sensors all I need to do is add code specific to that sensor and send the CSV to the hub. The next planned bit of work is to make the RRD datasets just as dynamic, so that any key in that dictionary will generate a new Dataset RRD if one does not exist and otherwise insert data into it every minute. This will give me an *.rrd file for each individual key in the dictionary. A basic cron job can be used to generate daily graphs for a week, monthly graphs for the past year and yearly graphs for as far back as data goes. These can then be served from a very basic static Apache NG server on the Hub PI. I may need to implement a lock though as I will have quite few threads poking around with the hub's dictionary and I don't want to read any partially written float or double values. I could potentially already have that issue with sending data to the display node's TCP thread as it is being overwritten from the receive UDP thread in the hub. Also potentially multiple sensor PIs writing data at the same time to the Hub. Meh, concurrency programming is always a pain, but thankfully I can get away with a very simple RW Mutex in this case as performance is not an concern. I haven't actually got round to controlling the heating as the boiler is technically the landlords thing and I'm not sure I want to hook up my relay to the control signal in case something independantly goes wrong with the boiler and I get the blame. That said I think I can write the schedule and control software and just display, for now, when the PI thinks the heating should be on and I'll just monitor that. |
| Inverted18650:
Congratulations on the design and 1st assembly. Cool project. |
| paulca:
I also stepped up the dev environment by exporting the hub's home directory with NFS (Network File System) and mounting it on my main PC. Then I ran the "PyCharm" IDE and pointed it to the mounted remote folder to develop directly into the remote raspberry PI's filesystem. I also pushed the code up to GitLab to keep it safe and track changes. Also makes it easy to deploy to new PIs just by Git cloning the repo. Also means I can open source it later by setting the repo to public. The code was starting to get a little bit too big to get away with Vim or Nano on the console. Especially when it comes to things like moving generic functions into a library and importing it and replacing specific code in other files. A good IDE like PyCharm makes this refactoring so much easier. |
| paulca:
Just cross linking an update in the other related thread: https://www.eevblog.com/forum/projects/nodemcu-esp8266-rs485-epever-solar-monitor-diy/msg2543520/#msg2543520 I could merge them, maybe. |
| Navigation |
| Message Index |
| Previous page |