<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Matronix.de]]></title><description><![CDATA[Hobby electronics and other geeky stuff]]></description><link>https://matronix.de/</link><image><url>https://matronix.de/favicon.png</url><title>Matronix.de</title><link>https://matronix.de/</link></image><generator>Ghost 4.39</generator><lastBuildDate>Wed, 16 Jul 2025 15:24:04 GMT</lastBuildDate><atom:link href="https://matronix.de/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[How to get a PC integrated into your HomeAutomation]]></title><description><![CDATA[In my constant effort to integrate more stuff into my home automation setup, one thing was bugging my for some time: The A/V stuff as well as the ambient lighting in my living room was already integrated, but not the damn PC.]]></description><link>https://matronix.de/how-to-get-a-pc-integrated-into-your-homeautomation/</link><guid isPermaLink="false">623217cd596119028aad88da</guid><category><![CDATA[IoT]]></category><category><![CDATA[HomeAutomation]]></category><category><![CDATA[OpenHAB]]></category><category><![CDATA[ESP8266]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Mon, 12 Nov 2018 19:50:00 GMT</pubDate><media:content url="https://matronix.de/content/images/2018/11/pc_ctrl_preview_image.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2018/11/pc_ctrl_preview_image.jpg" alt="How to get a PC integrated into your HomeAutomation"><p>In my constant effort to integrate more stuff into my home automation setup, one thing was bugging my for some time: The A/V stuff as well as the ambient lighting in my living room was already integrated, but not the damn PC. I even got the projector with its proprietary connector and an ESP8266 integrated.</p>
<p>Once the PC is on, I can control it thanks to OpenHAB&apos;s Kodi binding. But turning the PC on was a problem, because it only has WiFi: Goodbye WakeOnLAN. I already had something in mind: use an ESP8266 to &quot;press&quot; the power and reset buttons.</p>
<p>Last weekend I had my final break through: why not hack my own RGB LED strip controller? I had some boards lying around and they have three FETs. Two to push the buttons and with some trace cutting and rewiring I can even monitor the power LED to stay in sync in case the real buttons are pushed. Its powered by the standby power rail of the ATX power supply.</p>
<p><img src="https://matronix.de/content/images/2018/11/pc_ctrl_installed.jpg" alt="How to get a PC integrated into your HomeAutomation" loading="lazy"></p>
<p>I published the LED strip controller board on <a href="https://oshpark.com/shared_projects/CJdI33ct">OSHpark</a>. If you are interested in the changes I made, please let me know.</p>
<p>I was a bit lazy on the software side. Usually I prefer my own custom-fit firmware, but this time I tried tasmota and ESPEasy. In the end, I went with ESPEasy, because it worked better in this scenario (at least for me).</p>
<p>Integration into OpenHAB was another experiment: I wanted to use the Jython rule engine. All my other customizations are running with the internal rule language, but I find that a bit inflexible at times due to the lack of encapsulation. Jython was a good fit: the integration is fully encapsulated within its own class. The control and status items that link the rules to the hardware are passed in on initialization.</p>
<p>Here&apos;s the Jython code. It is running on OpenHAB 2.2; I think the trigger creation has slightly changed on newer versions, but I haven&apos;t had time to update yet.</p>
<pre><code>scriptExtension.importPreset(&quot;RuleSupport&quot;)
scriptExtension.importPreset(&quot;RuleSimple&quot;)

from org.slf4j import Logger, LoggerFactory
log = LoggerFactory.getLogger(&quot;org.eclipse.smarthome.automation.pc_ctrl&quot;)

log.info(&quot;Loading pc_ctrl rules.&quot;)

from org.eclipse.smarthome.automation import Rule as SmarthomeRule
from org.eclipse.smarthome.core.types import UnDefType
from org.eclipse.smarthome.core.library.types import IncreaseDecreaseType, NextPreviousType, OnOffType, OpenClosedType, PlayPauseType, RewindFastforwardType, StopMoveType, UpDownType, DecimalType

import time

class PcCtrlRule(SimpleRule):
    _pulse_cmd_pwr = &apos;Pulse,14,1,500&apos;
    _pulse_cmd_rst = &apos;Pulse,12,1,500&apos;
    _pulse_sleep = 0.5

    def __init__(self, name, cmd_item_name, on_state_item_name, ctrl_item_name):
        self._name = name
        self._cmd_item_name = cmd_item_name
        self._cmd_item = itemRegistry.getItem(cmd_item_name)
        self._on_state_item_name = on_state_item_name
        self._on_state_item = itemRegistry.getItem(on_state_item_name)
        self._ctrl_item_name = ctrl_item_name
        self._ctrl_item = itemRegistry.getItem(ctrl_item_name)

        # create the triggers
        trigger_on_state = Trigger(&apos;{}OnStateTrigger&apos;.format(name),
                                   &apos;core.ItemStateChangeTrigger&apos;,
                                   Configuration({&apos;itemName&apos;: on_state_item_name}))

        trigger_ctrl = Trigger(&apos;{}CtrlTrigger&apos;.format(name),
                                   &apos;core.ItemCommandTrigger&apos;,
                                   Configuration({&apos;itemName&apos;: ctrl_item_name}))

        # register them
        self.triggers = [trigger_on_state, trigger_ctrl]

    def execute(self, module, inputs):
        event = inputs.get(&apos;event&apos;)
        command = inputs.get(&apos;command&apos;)
        trig_item = itemRegistry.getItem(event.itemName)
        trig_item_state = trig_item.state

        log.debug(&apos;inputs=\n{}&apos;.format(inputs))

        if event.itemName == self._on_state_item_name:
            log.debug(&apos;on_state_item changed&apos;)
            log.debug(&apos;oldItemState={}, itemState={}&apos;.format(event.oldItemState, event.itemState))
            log.debug(&apos;trig_item_state={}&apos;.format(trig_item_state))

            if (event.oldItemState == UnDefType.UNDEF) or (event.itemState != event.oldItemState):
                if str(event.itemState) == str(ON):
                    log.debug(&apos;Going ON&apos;)
                    events.postUpdate(self._ctrl_item, ON)
                else:
                    log.debug(&apos;Going OFF&apos;)
                    events.postUpdate(self._ctrl_item, OFF)

        elif event.itemName == self._ctrl_item_name:
            log.debug(&apos;ctrl_item cmd received&apos;)

            on_item_state = self._on_state_item.state
            cmd_to_send = &apos;&apos;

            log.debug(&apos;currentState={}&apos;.format(on_item_state))
            log.debug(&apos;command={}&apos;.format(command))

            if (str(on_item_state) == str(OFF)) and (str(command) == str(ON)):
                log.debug(&apos;Switching ON&apos;)
                cmd_to_send = self._pulse_cmd_pwr
            elif (str(on_item_state) == str(ON)) and (str(command) == str(OFF)):
                log.debug(&apos;Switching OFF&apos;)
                cmd_to_send = self._pulse_cmd_pwr

            if cmd_to_send != &apos;&apos;:
                log.debug(&apos;Sending cmd: \&apos;{}\&apos;&apos;.format(cmd_to_send))
                events.sendCommand(self._cmd_item, cmd_to_send)
                time.sleep(self._pulse_sleep)
                events.sendCommand(self._cmd_item, &apos;&apos;)

automationManager.addRule(PcCtrlRule(&apos;WZ_Watt_control_&apos;, &apos;WZ_Watt_control_cmd&apos;, &apos;WZ_Watt_control_pwr_state&apos;, &apos;WZ_Watt_Power&apos;))
</code></pre>
<p>And the corresponding item definitions:</p>
<pre><code>Switch WZ_Watt_Power &quot;watt&quot; &lt;player&gt; (gWZ)
String WZ_Watt_control_cmd &quot;watt control command&quot; (gInternal) { mqtt=&quot;&gt;[home:whan/pc_ctrl/xxxxxxxx/cmd:command:*:default]&quot; }
String WZ_Watt_control_pwr_state &quot;watt control power state&quot; (gInternal) { mqtt=&quot;&lt;[home:whan/pc_ctrl/xxxxxxxx/pc_on/state:state:MAP(ONOFF_to_01.map)]&quot; }
</code></pre>
<p>Please note that I changed the topic structure a bit from the defaults. It matches my other devices better this way.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[IoP - Control logic details - and a Raspberry Pi]]></title><description><![CDATA[The control logic is implemented in the IrrigationController class. Because it usually is hard to describe program flow details in text form, I created some flow charts.]]></description><link>https://matronix.de/iop-control-logic-details/</link><guid isPermaLink="false">623217cd596119028aad88d9</guid><category><![CDATA[IoP]]></category><category><![CDATA[IoT]]></category><category><![CDATA[HomeAutomation]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Sat, 17 Mar 2018 21:26:22 GMT</pubDate><media:content url="https://matronix.de/content/images/2018/03/irrigation_control_raspi_logger.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2018/03/irrigation_control_raspi_logger.jpg" alt="IoP - Control logic details - and a Raspberry Pi"><p>The control logic is implemented in the IrrigationController class. Because it usually is hard to describe program flow details in text form, I created some flow charts. They are not 100% accurate, i.e. they leave out some details and are drawn a little different than actually implemented for better &quot;readability&quot;.</p>
<p>The logic is implemented within a (FreeRTOS) task. I chose using a task to have the flexibility to keep the controller running all the time (e.g. in the development and configuration phase) or run the task just once every &quot;now and then&quot; and put the processor into deep sleep most of the time.</p>
<p>The following flow chart shows the initialization phase of the task. There is nothing special there: It basically waits for WiFi and the system time being set. Both waiting times do have a timeout. That is to ensure the controller tasks comes up without a network connection.</p>
<p><img src="https://matronix.de/content/images/2018/03/IrrigationController_taskFunc.png" alt="IoP - Control logic details - and a Raspberry Pi" loading="lazy"></p>
<p>After initialization the task enters its task loop. It doesn&apos;t explicitly exit it ever. The only time it &quot;exits&quot; is when the processor enters deep sleep, because a wakeup from this state will reboot the system right from the very beginning.</p>
<p><img src="https://matronix.de/content/images/2018/03/IrrigationController_taskLoop.png" alt="IoP - Control logic details - and a Raspberry Pi" loading="lazy"></p>
<p>In essence, the task loop does the following:</p>
<ul>
<li>Collect (internal and external) sensor data.</li>
<li>Check for critical conditions (and disable an active irrigation if detected).</li>
<li>Process all irrigation events that (may have) occurred since the last loop run. This ensures that no event will be missed, even if the task loop run gets scheduled a little too late by the OS.</li>
<li>Publish the current state (i.e. sensor data and irrigation event info) via MQTT (if a network connection has been established).</li>
<li>Decide whether to deep sleep or to &quot;lightly&quot; sleep by a task delay/yield.</li>
</ul>
<h1 id="testingthecontrollogic">Testing the control logic</h1>
<p>To test the control logic over several days, I setup a data logger on a Raspberry Pi Zero-W board. It&apos;s hooked up via its GPIOs to the relay outputs of my board.</p>
<p><img src="https://matronix.de/content/images/2018/03/irrigation_control_raspi_logger-1.jpg" alt="IoP - Control logic details - and a Raspberry Pi" loading="lazy"></p>
<p>I&apos;m using a slightly modified version of the gpio-monitor found on the <a href="https://www.raspberrypi.org/forums/viewtopic.php?f=37&amp;t=19346">Raspberry Pi community forum</a>. Other than that, a serial monitor connected to the debug console is logging the debug output of the controller itself as well. That should give some insight in case something goes wrong.</p>
<p>Here&apos;s an example of logged events (time is displayed in UTC):</p>
<pre><code class="language-plaintext">2018-03-11@06:00:00.59 010
2018-03-11@06:00:15.62 110
2018-03-11@06:00:20.65 111
2018-03-11@06:01:00.74 011
2018-03-11@06:01:15.78 001
2018-03-11@06:01:20.80 000
</code></pre>
<p>The start of each line displays the date and time the monitored GPIOs have changed. The next three digits show the current state of the three monitored GPIOs. They represent the state of the MAIN, AUX0 and AUX1 relay outputs (left to right).</p>
<h1 id="mqttinfo">MQTT info</h1>
<p>Each control loop run will publish a state info via MQTT to a configured MQTT broker. The info is published in JSON format and currently looks like that:</p>
<pre><code class="language-JSON">{
    &quot;batteryVoltage&quot;: 12958,
    &quot;batteryState&quot;: 1,
    &quot;batteryStateStr&quot;: &quot;OK&quot;,
    &quot;reservoirFillLevel&quot;: -2,
    &quot;reservoirState&quot;: 3,
    &quot;reservoirStateStr&quot;: &quot;DISABLED&quot;,
    &quot;activeOutputs&quot;: [],
    &quot;activeOutputsStr&quot;: [],
    &quot;nextIrrigationEvent&quot;: &quot;2018-01-01 07:00:00&quot;
}
</code></pre>
<p>The state info contains internal and external sensor data as well as system state data:</p>
<ul>
<li>The battery voltage in mV and a state representation (as an integer value and a string, i.e. CRITICAL, LOW, OK, FULL and DISABLED)</li>
<li>The reservoir fill level in percent multiplied by 10 and a state representation (as an integer value and string, i.e. CRITICAL, LOW, OK and DISABLED).</li>
<li>Information about currently active outputs (as integer values and strings).</li>
<li>Date and time of the next occurring irrigation event based on the currently set date and time.</li>
</ul>
<p>I have chosen to publish the voltage and reservoir fill level in mV and &quot;percent multiplied 10&quot; to prevent the usage of floating point variables as much as possible.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[IoP - Problems with the reservoir fill level sensor and SNTP]]></title><description><![CDATA[Sadly, the reservoir fill level sensor has proven to be unreliable. I was planning to use a voltage measurement over a voltage divider, which is influenced by the number of gold contacts covered in water. It's starting to go crazy when the pump is turned on...]]></description><link>https://matronix.de/iop-problems-with-the-reservoir-fill-level-sensor-and-sntp/</link><guid isPermaLink="false">623217cd596119028aad88d8</guid><category><![CDATA[IoP]]></category><category><![CDATA[IoT]]></category><category><![CDATA[HomeAutomation]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Sat, 17 Mar 2018 21:15:11 GMT</pubDate><media:content url="https://matronix.de/content/images/2018/03/fill_level_sensor_parts.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2018/03/fill_level_sensor_parts.jpg" alt="IoP - Problems with the reservoir fill level sensor and SNTP"><p>Sadly, the reservoir fill level sensor has proven to be unreliable. I was planning to use a voltage measurement over a voltage divider, which is influenced by the number of gold contacts covered in water. It&apos;s starting to go crazy when the pump is turned on.</p>
<p>That&apos;s the reason why I implemented configuration options to disable battery monitoring and/or reservoir fill level monitoring. If one is disabled, it will not take part in the decision if an irrigation should take place or not. This not only allows continuing with the development regardless of the fill level sensor, but it also adds more flexibility in the hardware setup.</p>
<p>One other missing piece in the software is proper SNTP handling. The control logic requires to be notified of changes in the system time to work properly. Manually setting the time through the debug console is no problem at all, because I have all the software under my control. But the SNTP implementation is part of the lwIP stack used in the ESP-IDF. It doesn&apos;t signalize any state changes at all. According to a <a href="https://github.com/espressif/esp-idf/pull/1668">discussion on Github</a>, I&apos;m not the only one needing such a feature and it looks like it&apos;s already in development. I hope it will go public soon. Otherwise, I would have to patch the ESP-IDF sources, which would not be publicly available.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[IoP - Software progress and hardware installation]]></title><description><![CDATA[The software is progressing, maybe a little slower than I planned. But that's mainly a problem of finding some free time to work on it. But this weekend I got some time to populate all needed hardware components in the IP67 enclosure!]]></description><link>https://matronix.de/iop-software-progress-and-hardware-installation/</link><guid isPermaLink="false">623217cd596119028aad88d7</guid><category><![CDATA[IoP]]></category><category><![CDATA[IoT]]></category><category><![CDATA[HomeAutomation]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Sun, 25 Feb 2018 19:43:44 GMT</pubDate><media:content url="https://matronix.de/content/images/2018/02/20180225_003620_small.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2018/02/20180225_003620_small.jpg" alt="IoP - Software progress and hardware installation"><p>The software is progressing, maybe a little slower than I planned. But that&apos;s mainly a problem of finding some free time to work on it. The current github checkins update the main controlling loop that keeps track of upcoming events.</p>
<p>The events are represented by a separate class (IrrigationEvent), which are managed by the IrrigationPlanner. The planner is being periodically polled by the main controller task. The planner is still missing a query method for the actual tasks to perform. It also uses only hard-coded events, but that will suffice for now.</p>
<p>The hardware is also starting to take shape. I mounted the board in the IP67 enclosure. I ordered a buck+boost converter plus a switching AC/DC power supply. The buck+boost converter combo is used to later power the device by solar (+ battery backup), which varies widely in the input voltage, i.e. it can be below or over the needed voltage of the connected pump (approximately 14VDC).</p>
<p>The image shows the initial cabling within the IP67 enclosure. The controller and power supply isn&apos;t mounted yet.</p>
<p><img src="https://matronix.de/content/images/2018/02/irrigation_control_ip67_initial_cabling.jpg" alt="IoP - Software progress and hardware installation" loading="lazy"></p>
<p>All the components have now been properly mounted within the enclosure, including fuses on the primary (mains) side and both secondary power rails. Only the connections to the pump and the water reservoir sensor are missing.</p>
<p><img src="https://matronix.de/content/images/2018/02/irrigation_control_ip67_annotated.jpg" alt="IoP - Software progress and hardware installation" loading="lazy"></p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[IoP - Current status & ESP32 Design Contest 2018]]></title><description><![CDATA[This post is just a quick status update. It's mostly about the software side, because that's what I have mostly been working on the last weeks. I already mentioned some of the things, but I try to give a full view of the current state this time.]]></description><link>https://matronix.de/iop-current-status-0118/</link><guid isPermaLink="false">623217cd596119028aad88d6</guid><category><![CDATA[IoP]]></category><category><![CDATA[IoT]]></category><category><![CDATA[HomeAutomation]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Wed, 24 Jan 2018 21:27:20 GMT</pubDate><media:content url="https://matronix.de/content/images/2018/01/iop_status_update_0118_schem.png" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2018/01/iop_status_update_0118_schem.png" alt="IoP - Current status &amp; ESP32 Design Contest 2018"><p>This post is just a quick status update. It&apos;s mostly about the software side, because that&apos;s what I have mostly been working on the last weeks. I already mentioned some of the things, but I try to give a full view of the current state this time.</p>
<p>Hardware-wise, most of the board is tested:</p>
<ul>
<li>The switching regulators are working. The second regulator can be switched on and off on demand.</li>
<li>The ESP is flashable and executes code.</li>
<li>The relays can be controlled by the ESP.</li>
<li>The battery voltage can be measured.</li>
</ul>
<p>I still haven&apos;t tested the UART connections yet, but that&apos;s what I plan to do next (hardware-wise).</p>
<p>The software is also starting to take shape:</p>
<ul>
<li>A command console via the debug/programming UART is implemented for testing purposes.</li>
<li>The fill level sensor protocol handler is implemented, but mostly untested.</li>
<li>WiFi connects properly to my home WLAN. I&apos;m planning to implement a WiFi manager class to encapsulated it better.</li>
<li>An MQTT client connects to my local broker. This will be used later for status information and alerts. I&apos;m currently working on the implementation of an MQTT manager class to handle multi-threading properly.</li>
<li>The real time clock of the ESP is keeping the time, when the ESP is in deep sleep to preserve power. The time system is able to sync with an SNTP server. But the time can also be set via the command console.</li>
<li>A rough plan to implement the control logic for the fixed irrigation plan is written down as comments within the IrrigationController class.</li>
</ul>
<p>The configuration of the WiFi and other services is currently hardcoded in a config file. I&apos;m planning to change the configuration mechanism either by providing console commands or by implementing a webserver.</p>
<p>Besides working on the software implementation, I worked on getting the code and documentation in a good shape. This ultimately resulted in publishing both the hardware documents and the software itself on Github:</p>
<ul>
<li><a href="https://github.com/mwick83/irrigation_ctrl">The software repository</a>, which is also the main place for documentation.</li>
<li><a href="https://github.com/mwick83/irrigation_ctrl_hw">The hardware repository</a>, which contains the KiCAD schematics and board files. The schematic is also available as a <a href="https://github.com/mwick83/irrigation_ctrl_hw/raw/master/main_board/irrigation_ctrl_main_board_1217_schem.pdf">PDF</a> and <a href="https://github.com/mwick83/irrigation_ctrl_hw/raw/master/main_board/irrigation_ctrl_main_board_1217_schem.png">PNG</a>.</li>
</ul>
<p>Well, getting the documentation into a good shape also was a result of registering the whole project at <a href="https://www.elektormagazine.com/labs/contest/esp32-design-contest-2018">Elektor&apos;s ESP32 Design Contest</a>! You can also check out <a href="https://www.elektormagazine.com/labs/irrigation-controller">my project page there</a>. Wish me luck!</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[IoP - Bringing up the Irrigation Controller board]]></title><description><![CDATA[In the last article I talked about my motivation and some thoughts and design goals of the Irrigation Controller. In this article I will talk about bringing up the board for the first time - hardware- and software-wise.]]></description><link>https://matronix.de/iop-bringing-up-the-irrigation-controller-board/</link><guid isPermaLink="false">623217cd596119028aad88d5</guid><category><![CDATA[IoP]]></category><category><![CDATA[IoT]]></category><category><![CDATA[HomeAutomation]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Wed, 13 Dec 2017 22:23:51 GMT</pubDate><media:content url="https://matronix.de/content/images/2017/12/20171213_211119-1.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2017/12/20171213_211119-1.jpg" alt="IoP - Bringing up the Irrigation Controller board"><p>In the last article I talked about my motivation and some thoughts and design goals of the Irrigation Controller. In this article I will talk about about bringing up the board for the first time.</p>
<h1 id="thehardware">The hardware</h1>
<p>Many of my early projects taught me a lesson: don&apos;t populate all components of the board at once. Something will fail!</p>
<p>So, the first step was to populate the two switching power supplies of the board. Nothing more, nothing less. The first one&apos;s task is to power the main 3.3V rail of the board. It is always powered. Lo and behold, it worked in the first place!</p>
<p>The second switcher is normally turned off and will be enabled by the main controller, the ESP32. I didn&apos;t populate the logic around that yet, so the default of the switcher was to power up, too. This one is used for the auxiliary power to the relays and external sensors. It came up as well! The nominal voltage would have been 12V due to the relays, but I designed the switcher for ~10.4V to be able to provide power even when the controller will be powered by an nearly empty battery supply. 10.4V are enough to safely activate the relay coils.</p>
<p>Encouraged by this success, I went ahead and populated all other components. I decided to do this, because most parts are supporting stuff around the ESP32 itself, so I felt save populating it at once.</p>
<p>So, the time was right to connect the USB-to-UART bridge to the ESP32. The esptool did detect the device without a hitch! So I flashed some initial test code, which I developed on a simple breakout board before I even started to design the PCB. It came up as well!</p>
<p>What didn&apos;t work auto as expected was the &quot;auto programming&quot; circuit, which is able to bring the ESP into programming mode and reset it. When entering the schematic, I missed the fact that one of the bipolar transistors (which I replaced with MOSFETs) was flipped in the original schematic. So I ended up with wrong Drain and Source connections. I spotted the error, because my reset and and prog buttons didn&apos;t work when the UART-bridge was connected. The solution was to rotate the FET by 45&#xB0; and add a flying wire for the now landing-pad-less pin. Problem solved.</p>
<p>This is an excerpt from schematic showing the correct auto programming circuit:<br>
<img src="https://matronix.de/content/images/2017/12/irrigation_control_schematic_correct_auto_program-1.png" alt="IoP - Bringing up the Irrigation Controller board" loading="lazy"></p>
<p>And this is how I fixed it on the board:<br>
<img src="https://matronix.de/content/images/2017/12/20171213_211119.jpg" alt="IoP - Bringing up the Irrigation Controller board" loading="lazy"></p>
<p>There was another mistake on the board: The drill diameter of the footprint for the pluggable connectors was too small. I didn&apos;t read all of the recommendations in the datasheet. I ended up rasping the connectors&apos; pins down. I did that because I didn&apos;t have a drill with the correct diameter at hand. It also saved the copper to connect the upper and lower layers within the holes/pads.</p>
<p>All hardware problems have been fixed in the schematic and layout - just in case I should need to order the PCB again. I am planning on posting the schematic and layout on github, but I need to clean some stuff up and come up with a fitting license. <em>Update: The  <a href="https://github.com/mwick83/irrigationctrlhw">hardware repository</a> is online.</em></p>
<h1 id="andthesoftware">And the software</h1>
<p>My initial test code didn&apos;t have any means to test the IOs of the ESP32, so that got pretty urgent once the board was assembled. I implemented very basic getter and setter routines for the IOs. I can now call them with a serial command console on the debug and programming UART. The console is a modified and ported version of <a href="https://github.com/eleciawhite/reusable/">Elecia White&apos;s command console</a>, which is released in the public domain. You can find her and the <a href="http://embedded.fm/">embedded.fm</a> podcast at <a href="https://twitter.com/logicalelegance">@logicalelegance</a>. I can highly recommend the podcast when you are interested in embedded development!</p>
<p>With that code implemented I was able to test the relays and the shutdown-mechanism of the second switcher. Here&apos;s a screenshot of a short session in the command console:<br>
<img src="https://matronix.de/content/images/2017/12/irrigation_control_bringup_console.png" alt="IoP - Bringing up the Irrigation Controller board" loading="lazy"></p>
<p>You can&apos;t see the commands I&apos;m entering, because I missed to configure the terminal to send CR+LR instead of just the CR line ending. What I did was:</p>
<blockquote>
<p>help<br>
io_dir 2 1<br>
io_set 2 1<br>
exit</p>
</blockquote>
<p>What you can see, is that I already got some MQTT test code in the build and a time keeping task, which gets the time from an NTP server.</p>
<p><em>Update: The <a href="https://github.com/mwick83/irrigation_ctrl">software repository</a> is online. It&apos;s also the main point of documentation for the project as a whole.</em></p>
<h1 id="whatsnext">What&apos;s next</h1>
<p>What&apos;s still missing to be tested are the two UART connections for external sensors. One of them will be connected to a fill level sensor that I&apos;m currently building and trying to finish. The software is basically in place, but I need to finish the hardware and give it a test drive!</p>
<p>There&apos;s also an additional IDC connector bringing out an SPI interface. It has no planned use right now, but I wanted to be prepared to install additional sensors or other extension boards within the same enclosure as the main board. Obviously this hasn&apos;t been tested as well. I will do that when I have a use for the interface.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[IoP - Internet of Plants]]></title><description><![CDATA[Let's face it: I'm a poor gardener. My main problem: Forgetting to water the plants.  I'm thinking about this problem for many years now. Many ideas came to my mind, but I didn't actually start something in this regard. Until now!]]></description><link>https://matronix.de/iop-internet-of-plants/</link><guid isPermaLink="false">623217cd596119028aad88d4</guid><category><![CDATA[IoP]]></category><category><![CDATA[HomeAutomation]]></category><category><![CDATA[IoT]]></category><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Sat, 25 Nov 2017 14:06:00 GMT</pubDate><media:content url="https://matronix.de/content/images/2017/11/irrigation_ctrl_article-1.jpg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2017/11/irrigation_ctrl_article-1.jpg" alt="IoP - Internet of Plants"><p>Let&apos;s face it: I&apos;m a poor gardener. My main problem: Forgetting to water the plants.  I&apos;m thinking about this problem for many years now. Many ideas came to my mind, but I didn&apos;t actually start something in this regard.</p>
<p>But this year, sometime between spring and summer, I stumbled across the Gardena MicroDrip system. It&apos;s a starter-kit that uses a (indeed very very small) pump within some sort of water reservoir. The last part was pretty important, because my balcony has no direct water tap. The kit came with some pipe, some drippers, the water pump and a very basic controller. The controller is able to do some fixed-interval programs, but you can&apos;t freely program it. It has a connection for either a rain sensor or a moisture sensor, but that&apos;s all.</p>
<p>I used the controller over the summer and autumn and it worked pretty good. The plants were happy even when we were on vacation. The system didn&apos;t account for rainy days, but basically it worked fine.</p>
<p>What didn&apos;t work was: me - again. Because I tend to forget to fill up the reservoir. And that&apos;s one of the main issues I want to address with my own controller. The idea of my own &quot;Internet of Plants&quot; was born.</p>
<p>I&apos;m also aiming at more flexibility in regard to watering the plants. The basic idea is still to use fixed intervals, but drop waterings in case of rain or extend the watering time if the sun was shining heavily.</p>
<p>My hardware platform is based on an ESP32. I designed a base board with some relays, power supply, UART interfaces (for sensors, e.g. the fill level sensor for the reservoir) and the ESP-WROOM-32 module.</p>
<p><img src="https://matronix.de/content/images/2017/11/irrigation_ctrl_article.jpg" alt="IoP - Internet of Plants" loading="lazy"></p>
<p>Did you notice the color of the board? It&apos;s from <a href="https://oshpark.com">OSH Park</a> and they seem to like purple ;) I do like their board quality and price, even though the shipment takes a bit longer. They are producing in the US.</p>
<p>The image shows my first assembled prototype of the board. I assembled it by hand (as I always do), but this time I got myself a cheap hot-air gun (thanks Simon for your <a href="http://fishpepper.de/2017/09/06/the-best-hot-air-gun-for-your-quadcopter-hobby-35-to-the-rescue/">blog article</a>! I got a Kaleep-branded version on eBay). I needed it because of the exposed pads of the switching regulators I designed in. It worked perfectly and I was really impressed how easy and fast I got it assembled!</p>
<p>The ESP-WROOM-32 also has an exposed pad, but I used a different approach there: I placed a fairly big via within the pad, so that I could solder it from below. The hot-air gun wouldn&apos;t have worked too well because the ESP-WROOM-32 is a fully assembled PCB (with RF shielding!) by itself.</p>
<p>On the top edge of the board are connectors for power, the relay outputs and the UARTs. The connectors are screw terminals which can be disconnected without loosening the screws, which might be handy when installing the hardware in its IP67 enclosure.</p>
<p>As of now, I just did some basic tests of the board. The ESP32 comes up fine and I&apos;m able to flash it. The two switching regulators also work fine. But I do have to write some more debug and bring-up code (e.g. to stimulate the GPIOs the relays are connected to).</p>
<p>In case you wonder why there are two switching regulators: The first one is the main regulator for the 3.3V I use to power the ESP32 and all other digital stuff on the board. The second regulator is used to power the relays and external sensors. This regulator is normally off and can be activated via a GPIO of the ESP32. The UART level-shifters are also held in standby by default and can be powered up by the ESP32 on demand. I did this to reduce the power consumption as much as possible. I plan on driving the whole system on solar power sometime in the future. That&apos;s also the reason why I connected an ADC channel to the power input for voltage monitoring.</p>
<p>Despite the fact that I came up with the &quot;Internet of Plants&quot;, I&apos;m planning the software to be basically autonomous. I plan on using weather forecasts from the internet, but I also want to use local environmental sensors. If there is no forecast available (e.g. the internet is down), the fixed interval schedule will ensure the plants stay happy ;)</p>
<p>That&apos;s a quick overview of the project&apos;s state right now. Much coding to be done, more testing of the hardware and the fill level sensor needs to be tested (I plan to  write another post about that sub-project as well).</p>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[A new start]]></title><description><![CDATA[My website got pretty outdated over the last ten years, I guess. I didn't only use it to show some of my projects, hobbies and interests, but also to try out PHP, MySQL and web technologies. That has changed now! Here I explain why I'm doing a different approach now.]]></description><link>https://matronix.de/a-new-start/</link><guid isPermaLink="false">623217cd596119028aad88d3</guid><dc:creator><![CDATA[Manuel Wick]]></dc:creator><pubDate>Tue, 31 Oct 2017 17:47:43 GMT</pubDate><media:content url="https://matronix.de/content/images/2017/11/pexels-photo-221027-new-start-small.jpeg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><img src="https://matronix.de/content/images/2017/11/pexels-photo-221027-new-start-small.jpeg" alt="A new start"><p>My website got pretty outdated over the last ten years, I guess. I didn&apos;t only use it to show some of my projects, hobbies and interests, but also to try out PHP, MySQL and web technologies. That meant I did all the programming myself. <a href="http://www.yaml.de">YAML</a> was the only CSS framework I used on the previous incarnation of the site.</p>
<p>But my free time got more and more limited, so I had no chance on keeping all that up. So, I decided to try out something new. The site is now powered by <a href="https://ghost.org">Ghost</a>. Not only the technical aspect changed with that decision, but also the format: Previously, I hand-crafted static, categorized pages for my projects. And now it is a blog!</p>
<p>The idea isn&apos;t new, not even for technical and electronic sites out there. More and more of the sites I come across are blogs or they are written in an article-like style. So, that&apos;s what I&apos;m going to try, too! I hope to find the time to move some of my old - but interesting - projects over, but I should try to focus on new things first ;)</p>
<p>If you are interested in my old page (German only), check out the <a href="https://archiv.matronix.de">archived version</a>.</p>
<!--kg-card-end: markdown-->]]></content:encoded></item></channel></rss>