<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>esp8266 on The Lone Geek</title>
    <link>//www.thelonegeek.net/tags/esp8266/</link>
    <description>Recent content in esp8266 on The Lone Geek</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>Michael SanAngelo</copyright>
    <lastBuildDate>Sat, 02 Mar 2024 17:35:23 +0000</lastBuildDate><atom:link href="//www.thelonegeek.net/tags/esp8266/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Centralized Power Data for External Hard Drives</title>
      <link>//www.thelonegeek.net/blog/2024-03-02-centralized-power-data-for-external-hard-drives/</link>
      <pubDate>Sat, 02 Mar 2024 17:35:23 +0000</pubDate>
      
      <guid>//www.thelonegeek.net/blog/2024-03-02-centralized-power-data-for-external-hard-drives/</guid>
      <description>I have a set of external disks I use for backup purposes for my Plex box. In their next to second final state, where I setup something to turn them on and off with a script, I have them wired to a xbox 360 power supply and a 10 port powered usb hub. The hard drives connect to the hub, the hub to the server. As you do. The fun part, the hub isolates power to the devices from the host pc so I can simply turn off power to the hub and the usb things disconnect.</description>
      <content>&lt;p&gt;I have a set of external disks I use for backup purposes for my Plex box. In their next to second final state, where I setup something to turn them on and off with a script, I have them wired to a xbox 360 power supply and a 10 port powered usb hub. The hard drives connect to the hub, the hub to the server. As you do. The fun part, the hub isolates power to the devices from the host pc so I can simply turn off power to the hub and the usb things disconnect. The idea being, if the usb controllers in the drives don&amp;rsquo;t have power from the hub or pc, it&amp;rsquo;s as if they&amp;rsquo;re physically disconnected so I can get around any stability issues they may have.&lt;/p&gt;
&lt;p&gt;Is this a good solution? Probably not. A DAS box would be better but those aren&amp;rsquo;t cheap when I can get a whole used server for that price. starting at $200 usd and above for 8 bays. My goal is to reach 8 drives for the backup pool with simular capacity and quanity in the main pool. The Collection Must Grow.&lt;/p&gt;
&lt;p&gt;At present, there&amp;rsquo;s 5 backup drives and 8 main drives. One of the main drives isn&amp;rsquo;t part of the pool, it has a different purpose. I have to add more backups as drives in the main pool get upgraded.&lt;/p&gt;
&lt;h1 id=&#34;scripting-and-automation&#34;&gt;Scripting and automation&lt;/h1&gt;
&lt;p&gt;I have integrated a script and a esp8266 module with tasmota to turn on the power supply. The script is able to turn on tthe hard drive power, mount the filesystems, initiate the backup, then mount and power down the drives.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Using Software to Control Real World Things</title>
      <link>//www.thelonegeek.net/blog/2024-01-27-using-software-to-control-real-world-things/</link>
      <pubDate>Sat, 27 Jan 2024 17:43:13 +0000</pubDate>
      
      <guid>//www.thelonegeek.net/blog/2024-01-27-using-software-to-control-real-world-things/</guid>
      <description>Goals To produce a distributed logic system powered by a master pi to control slave nodes scattered about the house. The Master will take inputs from sensors and buttons to control real world objects. I want an API for all the things and a dashboard. As of 2024-02-17, it just controls a pair of led lights in my room. I want it to control power to other pis and fans. Maybe some other things.</description>
      <content>&lt;h1 id=&#34;goals&#34;&gt;Goals&lt;/h1&gt;
&lt;p&gt;To produce a distributed logic system powered by a master pi to control slave nodes scattered about the house. The Master will take inputs from sensors and buttons to control real world objects. I want an API for all the things and a dashboard. As of 2024-02-17, it just controls a pair of led lights in my room. I want it to control power to other pis and fans. Maybe some other things. Update on 2024-05-08, I&amp;rsquo;ve moved to using ESP32/8266 devkit boards flashed with tasmota for the controllers instead of the pis.&lt;/p&gt;
&lt;h1 id=&#34;the-project&#34;&gt;The Project&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;A Raspberry Pi 4 1G running rasbien for nodered to function as a master node&lt;/li&gt;
&lt;li&gt;A Raspberry Pi Zero 2 running raspbien for nodered to function as a slave node and doing the actual control of things&lt;/li&gt;
&lt;li&gt;A t-cobbler to break out the gpio for easy access&lt;/li&gt;
&lt;li&gt;A breadboard to connect things&lt;/li&gt;
&lt;li&gt;Some relays and switches&lt;/li&gt;
&lt;li&gt;Some optocouplers to invert the high level 3.3v signal to ground signals for the relay boards (optional if relay boards can use high level inputs and are cool with 3.3v logic)&lt;/li&gt;
&lt;li&gt;ESP32 and ESP8266 devkit boards, particularlly the nodemcu 8266 and ESP-WROOM-32 devkits.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My nodered flow is still somewhat evolving but the features it provides right now is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Debug buttons&lt;/li&gt;
&lt;li&gt;Physical button inputs&lt;/li&gt;
&lt;li&gt;A dashboard to control things&lt;/li&gt;
&lt;li&gt;An API&lt;/li&gt;
&lt;li&gt;Latching logic for the relay outputs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;//www.thelonegeek.net/downloads/posts/node-red/room-lighting.json&#34; &gt;Node-Red Flow for RaspPi Zero 2&lt;/a&gt; | &lt;a href=&#34;//www.thelonegeek.net/downloads/posts/node-red/backup-drives.json&#34; &gt;Node-Red Flow for my backup Drives&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;phase-1&#34;&gt;Phase 1&lt;/h1&gt;
&lt;p&gt;The room lights are functional. I have 3 icons on my desktop that I can double click and have them do something, one for each set of lights and one to turn on both at once. I even put a button on my desktop to one-click the desk lights.&lt;/p&gt;
&lt;p&gt;At the moment, the nodered flow is running on the slave pi because I had issues with latency and broken network connections with the master pi. The master pi was great as a proof of concept since I didn&amp;rsquo;t need any additional software on the slave pi, just gpiod (?) to enable remote gpio usage. I wanted to keep all the flows on one device to make it easy to modify and control. I may use the master to run indicator leds but leave the riskier tasks to cheap pi zeros. Like, potential acidental frying of the zeros. I&amp;rsquo;d like to also intergrate Pi Picos into the fun. Maybe as a second control system but I&amp;rsquo;d like to have some sort of software control on a host PC that doesn&amp;rsquo;t involve so many extra python dependencies.&lt;/p&gt;
&lt;h1 id=&#34;phase-2&#34;&gt;Phase 2&lt;/h1&gt;
&lt;p&gt;Introducing Home Assistant, esp8266 and esp32 devices.&lt;/p&gt;
&lt;p&gt;I have discontinued using my Pis for favor of the ESP8266 modules. I bought a few of these nodemcu modules and have one running my bedroom lights and one setup to turn on my server&amp;rsquo;s backup drives.&lt;/p&gt;
&lt;p&gt;These modules are flashed with tasmota and configured to connect with Home Assistant over mqtt.&lt;/p&gt;
&lt;h2 id=&#34;custom-tasmota-firmware&#34;&gt;Custom tasmota firmware&lt;/h2&gt;
&lt;p&gt;while playing with these modules, I discovered there&amp;rsquo;s some things the stock firmware doesn&amp;rsquo;t do so I downloaded the tasmota source and fired up vs-code which promptly installed a program to one-click build the source and flash connected esp modules.&lt;/p&gt;
&lt;h1 id=&#34;completed-projects&#34;&gt;&amp;ldquo;Completed&amp;rdquo; projects&lt;/h1&gt;
&lt;h2 id=&#34;bedroom-lighting&#34;&gt;Bedroom Lighting&lt;/h2&gt;
&lt;p&gt;I used a esp8266 coupled to a dual relay module to control a set of led lights via pushbutton input and remote input from my phone and computer. Currently runs tasmota.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;//www.thelonegeek.net/images/posts/esp8266-light-module.jpg&#34; &gt;&lt;img src=&#34;//www.thelonegeek.net/images/posts/esp8266-light-module-small.jpg&#34; alt=&#34;Light Module&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3.5mm audio jacks for the external buttons. No plug on the box for the lights and incoming power. That bit is external. An &lt;a href=&#34;https://www.amazon.com/gp/product/B0CNYJS6V7&#34; target=&#34;_blank&#34; &gt;ESP8266 devkit&lt;/a&gt;. &lt;a href=&#34;https://www.amazon.com/gp/product/B00LW15F42&#34; target=&#34;_blank&#34; &gt;Dual 12V Relay Module&lt;/a&gt;. &lt;a href=&#34;https://www.amazon.com/gp/product/B0B779ZYN1&#34; target=&#34;_blank&#34; &gt;5V Regulator&lt;/a&gt;. &lt;a href=&#34;https://www.amazon.com/gp/product/B07PCJP9DY&#34; target=&#34;_blank&#34; &gt;Solderless Breadboard&lt;/a&gt;. &lt;a href=&#34;https://www.amazon.com/gp/product/B083H9FNRT&#34; target=&#34;_blank&#34; &gt;Project Box&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;remote-pi-power-switch&#34;&gt;Remote Pi Power Switch&lt;/h2&gt;
&lt;p&gt;I have a few Pi4s sitting in a cluster case that I want to be able to remotely turn on with home assistant instead of one of those cloud based plugs. This box will support 4 Pis or whatever I plug into the 4 usb-c ports on the back.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;//www.thelonegeek.net/images/posts/esp8266-quad-relay-box.jpg&#34; &gt;&lt;img src=&#34;//www.thelonegeek.net/images/posts/esp8266-quad-relay-box-small.jpg&#34; alt=&#34;The Quad Relay Box&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4 &lt;a href=&#34;https://www.amazon.com/dp/B0CFTYSDMS&#34; target=&#34;_blank&#34; &gt;USB-C plugs&lt;/a&gt;, soon to add a &lt;a href=&#34;https://www.amazon.com/dp/B07CTCLKPP&#34; target=&#34;_blank&#34; &gt;DC jack&lt;/a&gt;, &lt;a href=&#34;https://www.amazon.com/gp/product/B07PGYTTF2&#34; target=&#34;_blank&#34; &gt;Quad Relay module&lt;/a&gt;, an &lt;a href=&#34;https://www.amazon.com/gp/product/B0CPSFKNSR&#34; target=&#34;_blank&#34; &gt;ESP8266 devkit&lt;/a&gt;, push toggle power switch, and power and status leds. May add 4 leds for relay status. &lt;a href=&#34;https://www.amazon.com/gp/product/B07PCJP9DY&#34; target=&#34;_blank&#34; &gt;Solderless Breadboard&lt;/a&gt;. &lt;a href=&#34;https://www.amazon.com/gp/product/B09B6QHQDQ&#34; target=&#34;_blank&#34; &gt;Project Box&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;remote-switch-for-my-backup-drives&#34;&gt;Remote Switch for my Backup Drives&lt;/h2&gt;
&lt;p&gt;A ESP8266 controls power to my backup drives. The controller powers a optoisolator that controls power to a Xbox 360 PSU, like how a PC PSU turns on. This PSU supplies 12v power to the drives and a powered USB Hub. There&amp;rsquo;s a script on the computer the drives connect to that will toggle the power &amp;ldquo;switch&amp;rdquo; on the controller before and after the backup operation.&lt;/p&gt;
&lt;p&gt;The whole purpose is to keep the drives offline until they&amp;rsquo;re needed and prevent any malware from finding them, should one find it&amp;rsquo;s way into my linux server. :)&lt;/p&gt;
&lt;p&gt;Also, the controller can turn on a hdd dock after 12v has been applied for my convience. An opto is wired to the power switch of the dock.&lt;/p&gt;
&lt;p&gt;No Pic atm, it&amp;rsquo;s all kind of a mess where it&amp;rsquo;s at.&lt;/p&gt;
</content>
    </item>
    
  </channel>
</rss>
