Jekyll2023-12-22T15:21:43+00:00http://hubcio.dev/feed.xmlhubcio tech blogSource code of my blog pageHubert Gruszecki[email protected]Integrating Wainlux K8 laser engraver with Lightburn2023-12-22T00:00:00+00:002023-12-22T00:00:00+00:00http://hubcio.dev/posts/using-lightburn-with-wainlux-k8-engraver<p>A couple days ago I gave my SO Wainlux K8 laser engraver. We were excited to try it out, but we quickly realized that the
camera feature wasn’t working with Lightburn. I searched online for a solution, but I couldn’t find anything.</p>
<p>Sadly, manufacturer software is unusable - it’s buggy, slow, and doesn’t work on Linux.
With <code class="language-plaintext highlighter-rouge">tcpdump</code> sniffing packets in the background, I found out that when you press the screenshot button in the <code class="language-plaintext highlighter-rouge">CutLabX</code>, it sends
a <code class="language-plaintext highlighter-rouge">GET</code> request to different IP address than the K8 itself. So, camera feed is available on a different IP address
than the K8 itself. It turns out that there are network 2 devices in the K8: the engraver itself and the camera.
Also, the camera feed is just static image, not a video stream.</p>
<p>Upon further investigation, K8 has 2 ESP32s inside:</p>
<ul>
<li>first one running <a href="https://github.com/bdring/Grbl_Esp32">Grbl_Esp32</a> for the motion control, networking and controlling laser</li>
<li>second with <a href="https://github.com/s60sc/ESP32-CAM_MJPEG2SD">ESP32-CAM</a> or some fork of it for serving static image</li>
</ul>
<p>So, it should be easy peasy to get the camera feed working with Lightburn, right? Well, yes.</p>
<p>I decided to write this guide to help others, because I couldn’t find any in the Internet.</p>
<h2 id="prerequisites">Prerequisites</h2>
<ul>
<li>Wainlux K8 Laser Engraver</li>
<li>A computer with internet access</li>
<li>Basic understanding of HTML and network settings</li>
<li><a href="https://www.cutlabx.com/">CutLabX</a> app installed on your PC or Mac</li>
</ul>
<h2 id="steps">Steps</h2>
<h3 id="1-connect-wainlux-k8-to-your-home-network">1. Connect Wainlux K8 to Your Home Network</h3>
<ul>
<li>Turn on your Wainlux K8 and connect it to your home WiFi network using the <a href="https://www.cutlabx.com/">CutLabX</a>
app. You can use <a href="https://www.youtube.com/watch?v=byPe0WHrXj4">official guide</a> for reference.</li>
<li>Find out the IP address of your K8, you can see it in the bottom right corner:
<img src="/assets/images/wainlux-k8-ip-address.png" alt="Wainlux K8 IP Address" /></li>
<li>Write down or save the IP address for later use.</li>
</ul>
<h3 id="2-find-the-camera-feed-url">2. Find the Camera Feed URL</h3>
<ul>
<li>Open any browser on your computer and enter the following URL: <code class="language-plaintext highlighter-rouge">http://[XXXXX]/cam.jpg</code> - replace <code class="language-plaintext highlighter-rouge">[XXXXX]</code> with the IP
address you wrote down earlier, but add <code class="language-plaintext highlighter-rouge">1</code> to the last octet. In my case, <code class="language-plaintext highlighter-rouge">CutLabX</code> app shows <code class="language-plaintext highlighter-rouge">192.168.175.64</code>, so I need to use
<code class="language-plaintext highlighter-rouge">192.168.175.65</code>.</li>
<li>If you see a camera feed, you’re good to go. If not, try to find the addresses around (by adding or subtracting 1 from the last number).
If it still doesn’t work, you might want to use a network scanner or just try to find the camera IP in your router’s admin panel.
<img src="/assets/images/camera-feed.png" alt="Camera feed" /></li>
<li>Write down or save the camera feed URL for later use.</li>
</ul>
<p>This is needed, because the camera feed is not available on the same IP address as the K8 itself.
Usually, it’s the next address in the network due to DHCP.</p>
<h3 id="3-create-a-refreshing-webpage">3. Create a Refreshing Webpage</h3>
<ul>
<li>You’ll need to create a simple HTML page that refreshes automatically every X seconds (in my case it’s 5000 ms) to display the camera feed.</li>
<li>In any text editor, create a new file and paste the following code:</li>
</ul>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp"><!DOCTYPE html></span>
<span class="nt"><html></span>
<span class="nt"><head></span>
<span class="nt"><style></span>
<span class="nt">iframe</span> <span class="p">{</span> <span class="nl">width</span><span class="p">:</span> <span class="m">100vw</span><span class="p">;</span> <span class="nl">height</span><span class="p">:</span> <span class="m">100vh</span><span class="p">;</span> <span class="nl">border</span><span class="p">:</span> <span class="m">0</span><span class="p">;</span> <span class="p">}</span>
<span class="nt"></style></span>
<span class="nt"><script></span>
<span class="kd">function</span> <span class="nx">reload</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">setTimeout</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="nb">document</span><span class="p">.</span><span class="nx">body</span><span class="p">.</span><span class="nx">firstElementChild</span><span class="p">.</span><span class="nx">src</span> <span class="o">+=</span> <span class="dl">""</span><span class="p">,</span> <span class="nx">reload</span><span class="p">()</span>
<span class="p">},</span> <span class="mi">5000</span><span class="p">)</span>
<span class="p">}</span>
<span class="nx">reload</span><span class="p">();</span>
<span class="nt"></script></span>
<span class="nt"></head></span>
<span class="nt"><body></span>
<span class="nt"><iframe</span> <span class="na">src=</span><span class="s">"[XXXXX]"</span><span class="nt">></iframe></span>
<span class="nt"></body></span>
<span class="nt"></html></span>
</code></pre></div></div>
<ul>
<li>Replace <code class="language-plaintext highlighter-rouge">[XXXXX]</code> with the camera feed URL: <code class="language-plaintext highlighter-rouge">http://[Wainlux_K8_IP]/cam.jpg</code>. In my example, this is <code class="language-plaintext highlighter-rouge">http://192.168.178.65/cam.jpg</code>.</li>
<li>Save the file as <code class="language-plaintext highlighter-rouge">page.html</code> in any location.</li>
<li>Test the page by opening it in a browser. You should see the camera feed and it should refresh every 5 seconds.</li>
</ul>
<h3 id="4-set-up-obs-open-broadcaster-software">4. Set Up OBS (Open Broadcaster Software)</h3>
<ul>
<li>Download and install OBS from <a href="https://obsproject.com/">its official website</a>.</li>
<li>Open OBS and create a new scene.</li>
<li>Add a source to the scene by choosing ‘Browser’:
<img src="/assets/images/obs-1.png" alt="Alt text" /></li>
<li>Set the URL to the location of the HTML page you created earlier, checkmark <code class="language-plaintext highlighter-rouge">Local file</code>, set the width and height to 1024x768:
<img src="/assets/images/obs-2.png" alt="Alt text" /></li>
<li>Enable <code class="language-plaintext highlighter-rouge">Virtual Camera</code> in OBS. This makes OBS stream the content of the scene (i.e., your HTML page) as if it were a webcam.</li>
</ul>
<h3 id="5-integrate-with-lightburn">5. Integrate with Lightburn</h3>
<ul>
<li>Open Lightburn, connect to your K8 via USB, and open the camera control panel.</li>
<li>Go to the camera selection settings.</li>
<li>Select <code class="language-plaintext highlighter-rouge">OBS Virtual Camera</code> as the camera source.
<img src="/assets/images/lightburn-1.png" alt="Alt text" /></li>
</ul>
<h3 id="6-calibration">6. Calibration</h3>
<p>Now, you can proceed with the calibration for the lens and position within Lightburn.
There are <a href="https://www.youtube.com/results?search_query=lightburn+camera+setup">plenty of guides</a>, so I won’t cover it here.</p>
<h2 id="conclusion">Conclusion</h2>
<p>That’s it! Now you can use the camera feature in Lightburn with your Wainlux K8 laser engraver.
I like this little engraver, it’s a great way to get started with laser engraving.</p>Hubert Gruszecki[email protected]A couple days ago I gave my SO Wainlux K8 laser engraver. We were excited to try it out, but we quickly realized that the camera feature wasn’t working with Lightburn. I searched online for a solution, but I couldn’t find anything.Idea creates need - part 12023-02-03T00:00:00+00:002023-02-03T00:00:00+00:00http://hubcio.dev/posts/idea-creates-need-p1<p>I am an engineer. Engineers are lazy people.</p>
<p>Recently I have been having a shitload of meetings at work.
Say goodbye to good old times when you could not leave
your comfort zone for days - not talk to other people.</p>
<p>I’ve been using keyboard shortcuts to mute the microphone. Not long ago (~7 months)
I moved to a split keyboard <a href="https://github.com/kata0510/Lily58/blob/master/Pro/Doc/buildguide_en.md">DIY lily58</a>
and I’m loving it, but there’s a catch.
It has only 58 keys, so to mute myself I need to push the <code class="language-plaintext highlighter-rouge">Raise</code> button together with <code class="language-plaintext highlighter-rouge">M</code>,
in other words, I need to use both hands to mute myself. I could change it to another key on
the first layout, but changing the keymap layout requires recompilation of software and
flashing the keyboard itself, it’s tedious. Also, I would have to re-learn this shortcut. God damn.</p>
<p>Around 5 years ago I was using a Microsoft Sidewinder X6 keyboard which had a volume knob.
You could map the <code class="language-plaintext highlighter-rouge">Mute</code> function to <code class="language-plaintext highlighter-rouge">F12</code> which was near it, so both volume control
and mute were close. You could use a single hand to control it. It was awesome.</p>
<p>Taking the above thoughts into consideration, my plan is to create a device that would mitigate these problems.
Key aspects that I would love to have:</p>
<ul>
<li>ability to change the volume and mute the microphone</li>
<li>volume mute indicator</li>
<li>microphone mute indicator</li>
<li>small footprint on a desk</li>
<li>long battery life - at least 2 weeks</li>
<li>built-in battery rechargeable via USB-C</li>
<li>wireless</li>
</ul>
<p>I have some ideas in my mind but I need to sleep with them. Stay tuned for over-engineering.</p>Hubert Gruszecki[email protected]I am an engineer. Engineers are lazy people.The first post2023-02-02T00:00:00+00:002023-02-02T00:00:00+00:00http://hubcio.dev/posts/the-first-post<p>First post. The fact is that I don’t know what I want to write about (for now).</p>Hubert Gruszecki[email protected]First post. The fact is that I don’t know what I want to write about (for now).