{"id":25,"date":"2019-06-29T12:32:24","date_gmt":"2019-06-29T10:32:24","guid":{"rendered":"https:\/\/petr.maxbox.cz\/?p=25"},"modified":"2019-08-02T23:17:34","modified_gmt":"2019-08-02T21:17:34","slug":"prvni-post","status":"publish","type":"post","link":"https:\/\/petr.maxbox.cz\/index.php\/2019\/06\/29\/prvni-post\/","title":{"rendered":"PSF B01 inching ESP-01S relay"},"content":{"rendered":"\n<p>I have purchased 2 different WiFi relay modules on Aliexpress, you can find description of my experiments and experiences in this article<br><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/mkhcXt4Bva8vtnBqa0s83Iwtmvl7DpiZVEKooHrTplZjUf7B4JGVCmMCEj9gBrNA7rwp6yscN1-lxymVYC7od44yo1KXCuAZJPKhjW1exJG71zKO30iYUAzVsoPce4TUAtJN1Y9l\" alt=\"\" width=\"262\" height=\"290\"\/><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/lLKiIyTFnYZ5BVOJDAexHMrCeAQVcnikFxrFQFs4VJRK4ZnMj-ieUYudDikFTQqLbmK7eXUI04L-GEHqPpT7Bq1JssCnTAyeH8H_Vtw7EdK84p78K0uNlRZevoVAjlPDWaa52MIV\" alt=\"\" width=\"282\" height=\"296\"\/><\/figure>\n\n\n\n<p><strong>5V One Channel Inching \/self-locking PSF B01 5V relay using module <\/strong><a href=\"https:\/\/drive.google.com\/open?id=1gKCwAy8RP96DCQKcoOpqNDfaTEPpbZiO\"><strong>PSF-B01<\/strong><\/a><strong>&nbsp; (letter B indicates there is WiFi antenna soldered directly on the board (see small white rectangle in the top left corner)<\/strong><br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/K3_JxShyGE2Klfe0QsTEwyAM7JxsJKPcULnNc8gzC9uOQa6mF8eOd7dALSiGY-J9OAu-HkEi7dw1PEnj_vkxTE8QoWtKliI4WCNVS-4SnOYbHUZPnkjN0QOfzkZ0FeijCo09Qxb_\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>I have found description for ITEAD <\/strong><a href=\"https:\/\/www.itead.cc\/wiki\/PSF-B85\"><strong>PSF-B85<\/strong><\/a><strong> only, there is ESP8285 1MB integrated inside the module<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>!!! WARNING !!!<\/strong> you can see many wrong \/ confusing photos on the internet describing 4 PIN pinholes as Tx, Rx pins<\/li><li>!!! WARNING !!! THERE ARE MANY VISUALLY SIMILAR BOARDS TO THIS but different module on the board and different schematics<\/li><li>There is another chip\/processor yet on this board, called&nbsp; <a href=\"http:\/\/tinkerman.cat\/the-mysterious-ic\/\">\u00e2\u20ac\u0153Misterious CHIP\u00e2\u20ac\u009d&nbsp;<\/a><\/li><li>Itead is offering such a device as \u00e2\u20ac\u0153<em>1 Channel <\/em><strong><em>Inching<\/em><\/strong><em> \/self-locking WiFi Wireless Switch 5V 12V<\/em>\u00e2\u20ac\u009d<\/li><li>I did buy it on Aliexpress, it came with original Itead SW; <a href=\"https:\/\/www.youtube.com\/watch?v=8OPK850Snxw\">Sonoff <\/a>app eWelink was communicate with the device without any single issue<\/li><li>it was possible to update original software using build in OTA to the version 3.0.<br><br><\/li><\/ul>\n\n\n\n<p><strong>Flashing firmware:<\/strong><\/p>\n\n\n\n<p>I have found this <a href=\"https:\/\/www.hackster.io\/alex-corvis-84\/diy-virtual-alike-nest-thermostat-with-node-red-04e6f4#\">beautiful article about how to flash similar raley board to ESPruna firmware<\/a>&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Solder wires to the pins 22 (TX) and 21 (RX), 20 (GND) (don&#8217;t be confused by the Tx Rx description of pinholes in the article). Some people do not solder Tx and Rx and are using POGO pins or wires instead and holding them <a href=\"https:\/\/www.youtube.com\/watch?v=vzoM4op60jo\">by hand during the flashing procedure<\/a><\/li><li>connect them to the Tx, Rx, GND on your USB programmer (ESP Tx &lt;=&gt; USB Rx, ESP Rx &lt;=&gt; USB Tx)&nbsp;<\/li><li>press and hold button B2 (button closer to the green screw terminal)<\/li><li>connect the 5V USB power supply<\/li><li>release B2 (both red LEDs should to light)<\/li><li>now the ESP should be in the programming mode<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>First, I was trying to flash Tasmota firmware (the relay original firmware <a href=\"https:\/\/drive.google.com\/open?id=1do8WmXYI7LsglmkiZkNQ1y32wZqh2PqX\">here<\/a> ), but the relay was <a href=\"https:\/\/github.com\/arendst\/Sonoff-Tasmota\/issues\/453\">not stable<\/a> and I didn&#8217;t find the way how to set it up properly using \u00e2\u20ac\u0153tasmota generic module options\u00e2\u20ac\u009d&nbsp; (see below my setting for ESP 01S relay)\u00e2\u20ac\u009d&nbsp;<\/li><li>in the article mentioned above, there is great description how to build the custom ESPurna firmware using Atom+PlatformIO &#8211; in my case the first try was returning many errors during compilation<\/li><li>The reason was the the ArduinoJson library version 6 was not supported by ESPurna in the time of writing this article (March 2019) . Thanks to the ESPurna forum <a href=\"https:\/\/github.com\/xoseperez\/espurna\/issues\/1613\">I have found the solution relatively fast<\/a>. It was necessary to modify platformio.ini by replacing<\/li><\/ul>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>lib_deps = ArduinoJson<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>by<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><a href=\"https:\/\/github.com\/bblanchon\/ArduinoJson#v5.13.5\">lib_deps = https:\/\/github.com\/bblanchon\/ArduinoJson#v5.13.5<\/a><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>As I wanted to use the DS18B20 to monitor temperature, it was necessary to change the \/config\/sensors.h&nbsp; as well and solder wires according to the pictures below&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/r_oeQimLTP_TnuhEZEhNKFyEBQuwRzj64f-KBuDno-Bh0tx8J35RQAKxph6rvdfbWNvDcfM6DFwYVzKVcnMVdSx1VvCA9Z2BdzotJmGW_DlrG-WxQ6au1DPtHuBfo8D-JrIAjHfz\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/xP9DBRbNClgdNc9xncmMYxfEMkbQK72SgDGaIYbeWqkE7ive9hXNb5k8nMx_sLc1ajAHPXKDGMjhmY6gUoW4Cw41xYgcK0Q_0qPGTsx-8CMudAwkGetNnjo93ofhWh_AlHtsZWbC\" alt=\"\"\/><\/figure>\n\n\n\n<p>For ESPurna configuration see the detailed description mentioned in the article <a href=\"https:\/\/github.com\/xoseperez\/espurna\/wiki\/Configuration\">or ESPurna wiki<\/a>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Flashing binary<br>esptool.py &#8211;port \/dev\/ttyUSB0 flash_id is showing ESP8285 on the board<\/p>\n\n\n\n<p><strong>ESP-01S relay (ESP8266 5V WiFi relay module)<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/-hM5T_orGAQA3-kUcbVUPGylswWi9wE_DA3Alt7_392AjCj-UNxFt7j4z8zsEclcyXTIMqiSVUZn9-8SqhJLza_-Z1WmrPnyw7vKLBpq20HspKjDAC4iAmTxn24x0SPAk0kaoUWS\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/rp_kOlyIU3pNpzgmr_KMrPx99OoiKvbXee7Ln8xes0iHFUahNjKGA7EDsk4hYp8gE0Q51uTuGcYfOuC9y0A8PY8riB8B74QhADueE_TbgJOFRbGuVvPrBGrlquzLcqfxLQ3CLrRg\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/ePyIlg54k1ptpFD2oI-uZiFnyLvPQECwLfjMXS8oRgRe4lFYmmGSdSoAdwt9h4XhOKlZdnlbQ-nRq3JP3lAQWFd6WOX2vCSAGLwV6DLaVULLYdTjaSR0Ik_Y6_ICuEW_I_ciI55K\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/aQ81MYcsbF3xNoAJ-pov65XhEBTYXq3x8eXlW8DnyOK62c0AzRfyojH77dFM8AKm3YJdkINWBlGnRD4v727lIRPqUvfL6om7hYR-a2duGbmenNeIg0XRk5FYdqQbkK6SO7DwPxf3\" alt=\"\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>!!! WARNING !!! THERE ARE MANY VISUALLY SIMILAR BOARDS TO THIS RELAY BOARD but different schematics<\/li><li>when I have received it from Aliexpress (US $2.09 including ESP-01S), module was not working (I have found other people <a href=\"http:\/\/www.steinhorst.org\/esp8266-esp-01s-relay-modul\">had the same issue<\/a>)<\/li><li>There are two culprits of this:<ul><li>&#8220;CH_PD&#8221; is not set to HI (3.3V) as actually required. Usually this is done with a 10K resistor or directly to 3.3V, I have connected CH_PD pin directly to the 3.3V<\/li><li>The resistor <a href=\"https:\/\/drive.google.com\/open?id=1peWYhHlUWjlD4owrWrUeBbovrW58Iarq\">R2 (10k)<\/a> which is connected between the terminal GPIO0 to ground. This ensures that the GPIO0 is always pulled to ground, which actually places the ESP-01 in program mode (flashing). After soldering out (removing) R2, the module ran smoothly.<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/mX_uyhw50kpcgZhtVNiX_tIhMW9zDIJUvv4Xde3plfvFKKdEx2Cckz-9t8YrhksaNNVSj_l4MJBk-7aNeatF6yQD_LmpnEZtOkcWarBF9KfPajqmmU1O40NzNuh2saI-9c6z66qM\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/C0UvdhcbFD7q--f2J7ObPmTDPiODHLKUKYWlvHBav4ojlWE4ae2PoSts-Qj8KcBmAHEPR5g7pXjRKg0Wn0crSyPmw7pcpg_QOlg0pfdaeVZQ-00orDvrljzHb2FODxpiKRv4ixXy\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/9Z32obNUoNeNFIjBIlvir783cIxE0DxXIDINM-BzUHAjAyV5DgDTnChs4LWeRCbGn9rMLFqbWUhu1AupBSCX-6VsY3ouFGuFKTgXsjhHtAOsFkXvrtkFnn8ZG-OosQMGkAtIAsit\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>I was trying to play with <a href=\"https:\/\/github.com\/xoseperez\/espurna\">ESPurna last (2.0) firmwarel<\/a> and <a href=\"https:\/\/www.letscontrolit.com\/wiki\/index.php\/ESP_Easy_web_interface\">ESP Easy<\/a> (<a href=\"https:\/\/www.youtube.com\/watch?v=i_CnBcQgdGk\">nice video here<\/a>),&nbsp; but I have found it too complex for my purposes comparing to Tasmota (<a href=\"https:\/\/lobradov.github.io\/FOSS-Firmware-comparison-overview\/\">Tasmota vs ESPurna vs ESPEasy &#8211; overview<\/a>). So I have downloaded the latest <a href=\"https:\/\/github.com\/arendst\/Sonoff-Tasmota\/releases\/tag\/v6.5.0\">Sonoff-Tasmota v6.5.0<\/a> firmware and easily flashed to the ESP-01S (see diagram below how to connect your USB FTDI UART )&nbsp;<\/li><\/ul>\n\n\n\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp; esptool.py &#8211;port \/dev\/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 sonoff.bin<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>After flashing firmware, I have connected DS18B20 to the GPIO2 as well (see the diagram)<\/li><li>Than it was necessary to set up Tasmota as generic module, GPIO0 as Relay1 (21), GPIO2 as DS18x20(4)&nbsp;<\/li><li>OTA upgrade works flawlessly as well&nbsp;<\/li><\/ul>\n\n\n\n<p><strong>Retrieving the temperature via HTTP<\/strong> <br>http:\/\/sonoff-ip\/cm?user=&lt;USER>&amp;password=&lt;PASS>&amp;cmnd=status%2010<\/p>\n\n\n\n<p>The temperature information will put published by MQTT to the<\/p>\n\n\n\n<p>tele\/&lt;SONOFFDEVICE&gt;\/SENSOR in the format of:<\/p>\n\n\n\n<p style=\"text-align:left\">&#8220;Time&#8221;:&#8221;2018-06-14T07:56:34&#8243;,&#8221;DS18B20&#8243;:{&#8220;Temperature&#8221;:21.9},&#8221;TempUnit&#8221;:&#8221;C&#8221;}<\/p>\n\n\n\n<p>Setting interval at which the sonoff will report it&#8217;s status:&nbsp;<\/p>\n\n\n\n<p>Display current interval: TelePeriod<\/p>\n\n\n\n<p>Set interval: TelePeriod &lt;seconds&gt;<\/p>\n\n\n\n<p>You can change PulseTime by typing &#8220;PulseTime 30&#8221; in the Console at the Webinterface.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have purchased 2 different WiFi relay modules on Aliexpress, you can find description of my experiments and experiences in this article 5V One Channel Inching \/self-locking PSF B01 5V relay using module PSF-B01&nbsp; (letter B indicates there is WiFi antenna soldered directly on the board (see small white rectangle in the top left corner)<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; PSF B01 inching ESP-01S relay<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/petr.maxbox.cz\/index.php\/2019\/06\/29\/prvni-post\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-nezarazene"],"_links":{"self":[{"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":7,"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":38,"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/posts\/25\/revisions\/38"}],"wp:attachment":[{"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/petr.maxbox.cz\/index.php\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}