• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "automation". Back to normal view
    1. How standardised are Z-Wave/ZigBee device APIs? Can I directly control off-the-shelf hardware?

      I'm looking to get a couple of remote controlled dimmer sockets for a quite specific use case (heat lamps in a tortoise enclosure), and I'd like to control them directly from a Raspberry Pi. I've...

      I'm looking to get a couple of remote controlled dimmer sockets for a quite specific use case (heat lamps in a tortoise enclosure), and I'd like to control them directly from a Raspberry Pi. I've found a couple of decent looking fairly generic options - examples from Trust and TKB - and there seem to be several appropriate radio modules, either USB or GPIO.

      Detecting and pairing with devices seems (hopefully) straightforward. My sticking point is trying to figure out how standardised the actual messaging is; there seem to be several brands of hub and device that can be used interchangeably, but a few that can't. In my case, of course, the RasPi will be taking the position of the hub and speaking to the devices directly.

      I'm having trouble finding reliable info on whether a command like "dim to 70%", or "read output power" will be the same across all devices, whether it will follow some kind of standard but it may be one of several competing formats, or whether it's completely proprietary.

      Any insight on how easy it is to programatically talk to these things would be very much appreciated!

      6 votes
    2. Make Emacs write (part of) your git commit messages

      I was fed up with the chores of writing consistent git commit messages, so a while ago I started developing a hook in Emacs which I used with Magit (actually git-commit-mode) which uses some crude...

      I was fed up with the chores of writing consistent git commit messages, so a while ago I started developing a hook in Emacs which I used with Magit (actually git-commit-mode) which uses some crude heuristics to fill out the COMMIT_EDITMSG buffer for me. Here is what it does (| stands for the cursor):

      • If only a single file modified, insert <filename>: |

        • If can figure out function name, insert <filename> (<functionname>): |
      • If only a single file added, insert Add <filename>|

      • If a TODO added to Readme.org, insert ; TODO <headline>|

      • If a TODO was DONE, insert ; DONE <headline>|

      • If the files are Readme.org and Readme.org_archive, and no new TODO's were added anywhere, insert ; Archive DONE|

      • If the file is .gitignore, insert ; Ignore |

      • If the file is TAGS, insert ; Update TAGS|

      I extend this when I find new cases where I repeatedly do the same thing. The code is below. It's probably a good idea to use it as a starting point and personalise it because this reflects how I like to write my commit messages (and I like pretending how they do it over at Emacs git repo). It is sloppy and probably buggy, but I don't think it can be destructive.

      Final note: I can't figure out how to set this up so that after this takes effect, the buffer is marked as modified. I want to flip the modified bit so that in some cases I can just hit C-c C-c and go. But I need to modify the buffer somehow to commit in some cases (I just type C-o to open a new line in those cases). Here is the function:

      (defun gk-git-commit-mode-hook ()
        "Set up git commit buffer."
        ;; If a single file is modified, prefix the message w/ it.
        (let ((modified-re "^#	modified:")
              (new-re "^#	new file:")
              (issue-re "^[+\\- ]\\*+ \\(TODO\\|DONE\\) ")
              current-defun filename addp onlyp issuep)
          (save-excursion
            (with-current-buffer "COMMIT_EDITMSG"
              (goto-char (point-min))
              (re-search-forward "^# Changes to be committed:" nil t)
              (forward-line)
              (beginning-of-line)
              (cond ((looking-at modified-re)
                     (re-search-forward ":   " nil t)
                     (setf filename (thing-at-point 'filename t)))
                    ((looking-at new-re)
                     (re-search-forward ":   " nil t)
                     (setf filename (thing-at-point 'filename t)
                           addp t)))
              (setq onlyp (progn
                            (forward-line)
                            (not (or (looking-at modified-re)
                                     (looking-at new-re)))))
              (when (and onlyp (equal filename "Readme.org"))
                (goto-char (point-min))
                (when-let* ((pos (re-search-forward issue-re nil t)))
                  (setq issuep (progn
                                 (re-search-backward "\\*" nil t)
                                 (buffer-substring (1+ (point))
                                                   (line-end-position))))))
              ;; Try to set ‘current-defun’.
              (when onlyp
                (save-excursion
                  (goto-char (point-min))
                  ;; Error if not found, means verbose diffs
                  ;; not enabled.
                  (re-search-forward "^diff --git")
                  (goto-char (line-beginning-position))
                  (let ((str (buffer-substring (point) (point-max)))
                        (default-directory (expand-file-name "..")))
                    (with-temp-buffer
                      (insert str)
                      (diff-mode)
                      (goto-char (point-min))
                      (setq current-defun (diff-current-defun))))))))
          (if onlyp
              (cond
               ((and issuep (not addp))
                (goto-char (point-min))
                (insert ";" issuep))
               ((equal filename "TAGS")
                (goto-char (point-min))
                (insert "; Update TAGS"))
               ((equal filename ".gitignore")
                (goto-char (point-min))
                (insert "; Ignore "))
               (filename
                (goto-char (point-min))
                (if addp
                    (insert "Add " filename)
                  (insert
                   filename
                   (if (and current-defun)
                       (format " (%s)" current-defun)
                     "")
                   ": "))))
            (when (and (equal filename "Readme.org")
                       (save-excursion
                         (goto-char (point-min))
                         (re-search-forward (concat modified-re " +Readme.org_archive")
                                            nil t))
                       (save-excursion
                         (goto-char (point-min))
                         (re-search-forward "\\-\\*+ DONE" nil t))
                       (not
                        (save-excursion
                          (goto-char (point-min))
                          (re-search-forward "\\+\\*[\\+\\-] TODO" nil t))))
              (goto-char (point-min))
              (insert "; Archive DONE")))))
      
      (add-hook 'git-commit-mode-hook #'gk-git-commit-mode-hook)
      

      Hope you find it useful.

      12 votes
    3. My indoor garden setup

      A few people have expressed interest in my indoor, semi-automated growing setup so here's the lowdown.. In a corner of my workshop is a cupboard with a footprint of 1.6x1.2m, 2.2m high. This is...

      A few people have expressed interest in my indoor, semi-automated growing setup so here's the lowdown.. In a corner of my workshop is a cupboard with a footprint of 1.6x1.2m, 2.2m high. This is insulated with a mixture of glasswool, foam board and expanding foam (depending on what I could install where), and lined with diamond pattern aluminumised mylar (the diamond pattern provides diffuse reflection to avoid hotspots).

      Inside the cupboard I have 750W of full-spectrum LED lighting, a 500W oil-filled radiator, and a small fan to keep air moving around. There's a vent which pulls air from the outside and a extractor fan which also vents outside. Being able to pull cool air from the outside (even in summer) is extremely useful as the lights can put out quite a lot of heat.

      My main growsystem is an Amazon low-pressure aeroponics system, and I've also got some airpots to do some soil-based growing in. Aero on the right, pots on the left. If you're not familiar with aeroponics, it's a system where the plants roots hang in open space and nutrient-rich water is sprayed or misted over them. High-pressure aero uses mist and low pressure uses sprayers. High pressure aero is currently one of the best known ways to maximise plant growth but low-pressure is pretty good too and you don't need anywhere near as much gear like pressure vessels and solenoid and so on. I just have an aquarium pump which drives the sprayers. In my experience aero is considerably more efficient than soil, non-soil media or other hydroponics - but on the other hand it's very twitchy. If your nutrient balance is off or your pH is wrong or worse, you pump fails - things can go wrong very quickly.

      The airpots are totally new to me. People say they're good but I have no idea. I have a mixture of compost, perlite and coco coir to go into them so we'll see how that works out. I'm going to use organic nutrients only on them, I have some seaweed derived stuff which should be good throughout the entire grow process.

      So that's the hardware, now on to the fun bit - the automation...

      On top of the cabinet is a board hosting a Raspberry Pi model A - these days I'd use a Zero W but they didn't exist when I built this. In it's mostly-bare state the board looks like this. Quick explanation - the red board is mains-rated relays which let me switch the connections above it on and off using the Pi. This is where the lights, fan and heater are wired to. The small junction block left of the relays is connected to mains.

      The block up and left of the Pi is 5V, which drives the Pi, the relay control electronics and provides power to the junction block on the right. There are various sensors wired in to that block and connected back to the Pi.

      Wired up on my bench for testing it looks like this, and in situ it looks like this (this was on a previous iteration of the cupboard but it's basically the same now). The orange cables on the left are lights, fan and heater. The black cables top are the sensors.

      Temperature is monitored using five DS18B20 sensors, which are cheap and reasonably accurate serial devices so you can run a whole bunch of them off a single pin on the pi. I monitor my water temperature, the temperature at the plant stem, at the wall, inside my workshop (but outside the cupboard) and outside temperature. The wall/stem temperature is the important one, that determines whether heating or cooling is engaged. I monitor the exterior and interior temperatures to know how effective my insulation is being. If water temperature gets too high I might add an agent which protects against microbial infections that like warmer water.

      I do have a DHT22 humidity sensor but they're hella flaky and it's currently not working. I will replace it at some point but past experience suggests humidity is high whatever I do.

      The Pi has a python script which runs every five minutes. It reads all the sensors, decides what (if anything) to do, then logs everything in a sqlite database. If it's 'night' (which is actually day outside, for temperature management reasons) it turns the lights off, if it's 'day' it turns them on. If it's cold it turns the heater on, if it's hot the fan. There's a bit of smartness where it actually aims for a midpoint of temperature because otherwise it's always aiming for highest temperature then immediately cooling again, then heating and so on - a stable temperature is better for the plants. At 'night' I tend to run the fan to drop the temperature: plants often like it cooler during darkness, get some fresh air in and attempt to lower the humidity a bit.

      There is a web interface which lets me see what's going on - current temperature and status, plus some lovely lovely charts (who doesn't love a nice chart?). I can also turn the lights out from here in case I need to go in an do some maintenance for anything. 750W of LED light is painfully bright, it's much more comfortable (and safer!) to turn them off while topping up reservoirs or changing water or whatever.

      It would be relatively trivial to add sensors for moisture or pH to add an auto-watering or auto-adjusting nutrient systems, but I haven't felt the need to do that yet.

      Happy to do my best to answer any questions anyone has.

      26 votes
    4. Minor Voting System Suggestion

      A problem I've noticed on Reddit (and here sometimes) is that a thread will have a good subject and a good amount of replies, but less than half the upvotes/votes than there are replies, even...

      A problem I've noticed on Reddit (and here sometimes) is that a thread will have a good subject and a good amount of replies, but less than half the upvotes/votes than there are replies, even though people are clearly enjoying the discussion. So, I was wondering if we'd be able to implement a feature that automatically votes for a post if you comment on it. Or, instead of forcing it, have a checkbox near the post form specifying whether or not you'd like to vote the post up upon completion of the comment. That might give good discussion posts some visibility instead of just posts that are a shitshow in the comments section

      EDIT: I don't know what I'm talking about move along please

      3 votes
    5. Will creativity become valued more highly than STEM skills in the near-term future?

      I'm doubling down here folks :) My prior post was called-out for being click-baity and rightfully so. The title was especially poor. I'll try to do better moving forward. I'm starting a discussion...

      I'm doubling down here folks :) My prior post was called-out for being click-baity and rightfully so. The title was especially poor. I'll try to do better moving forward.

      I'm starting a discussion here because my hope is that we can talk about the ideas within the article, rather than the article itself.

      Here was the original post for those interested: https://tildes.net/~humanities/3y1/mark_cuban_says_the_ability_to_think_creatively_will_be_critical_in_10_years_and_elon_musk_agrees

      I posted the article because at it's core are several interesting observations/propositions from two billionaires, Mark Cuban and Elon Musk, that presumably know a lot about business, and in Musk's case, a lot about STEM, and have a history of making winning bets on the future.

      The article supposes that:

      • Many (most?) STEM jobs will become automated
      • This will happen very quickly; more quickly than we anticipate
      • Creative skills will soon become more highly valued than STEM skills

      There was a time when parents told their kids to "become a lawyer or a doctor" but after enough time we end up with too many people going into the same profession and there is more competition for those jobs as the market becomes flooded. I know anecdotally that's happened for lawyers (not sure about doctors).

      I can see this happening with STEM as well.

      Should parents encourage kids to pursue STEM but pair this with equal study in the humanities? Is STEM the next target of automation? Will creative skills be more highly valued? Will engineers find themselves in the bread line?

      18 votes
    6. Will automation affect society positively or negatively?

      Many occupations are set to be automated in the near future: truck(lorry) driving, cashiers, and various other service sector jobs. See the full paper here[PDF]. Will such a reallocation of labour...

      Many occupations are set to be automated in the near future: truck(lorry) driving, cashiers, and various other service sector jobs. See the full paper here[PDF].

      Will such a reallocation of labour be a net positive or net negative?

      Will societies around the world adapt by offering ways to retrain those that lost their jobs, or by providing temporary assistance in some manner?

      Or, perhaps, will those people who lose when the next automation wave comes just be ignored, as they would negatively affect the capitalists bottom line.

      26 votes
    7. Farm to table automation

      I think automation is coming quick and fast and think that a landmark event will be when food can be farmed, packaged, shipped and sold without requiring any humans to be involved. I see the...

      I think automation is coming quick and fast and think that a landmark event will be when food can be farmed, packaged, shipped and sold without requiring any humans to be involved. I see the foundations in place already with Amazon Go and autonomous vehicles and it doesn't seem like too much longer before this kind of automation could be possible in my mind.

      Anybody want to weigh in with thoughts/discussion? What effects might it bring? Will it lead to a sort of monopoly as the food could be sold so much cheaper? When might this scale of automation be plausible? Anything really, just looking to spark some discussion :)

      5 votes