{"id":977,"date":"2016-12-12T15:00:58","date_gmt":"2016-12-12T15:00:58","guid":{"rendered":"https:\/\/junglefreedomfighters.com\/?p=977"},"modified":"2016-12-12T15:08:56","modified_gmt":"2016-12-12T15:08:56","slug":"wireless-k40-smoothie-with-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/junglefreedomfighters.com\/?p=977","title":{"rendered":"Wireless K40 smoothie with a Raspberry Pi"},"content":{"rendered":"<p>Plenty of people are buying cheap K40 laser cutters from eBay and lots more people have a growing collection of Raspberry Pi&#8217;s &#8211; I fit into both of those categories.<\/p>\n<figure id=\"attachment_978\" aria-describedby=\"caption-attachment-978\" style=\"width: 840px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140801.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-978 size-large\" src=\"https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140801-1024x768.jpg\" alt=\"IMG_20161212_140801\" width=\"840\" height=\"630\" srcset=\"https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140801-1024x768.jpg 1024w, https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140801-300x225.jpg 300w, https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140801-768x576.jpg 768w, https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140801-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption id=\"caption-attachment-978\" class=\"wp-caption-text\">Please excuse the wiring, I never was very good at that kind of stuff<\/figcaption><\/figure>\n<p><strong>Fortunately<\/strong> I made the decision to replace the stock K40 controller board with a <a href=\"http:\/\/smoothieware.org\/smoothieboard\">Smoothieboard<\/a>. \u00a0This gave me the capability to connect via Ethernet and a whole bunch of other things that made me all excited.<\/p>\n<p><strong>Unfortunately<\/strong> my K40 is positioned on the other side of my &#8220;office&#8221; so whenever I wanted to use it I had to run an ethernet cable across the room which was very annoying.<\/p>\n<p>It was whilst messing about with a Raspberry Pi I had an epiphany. \u00a0These things have WiFi and Ethernet built in, surely it can&#8217;t be that hard to turn it into a bridge\/router\/packet-forwarding-death-bringing machine. \u00a0Turns out it really wasn&#8217;t that hard&#8230;<\/p>\n<p>I followed this <a href=\"https:\/\/rbnrpi.wordpress.com\/project-list\/wifi-to-ethernet-adapter-for-an-ethernet-ready-tv-new-version\/\">guide<\/a>\u00a0which got me 90% of the way.<\/p>\n<p>By the time I had finished implementing the above [ <em>which is really just setting up wifi and ethernet and enabling DHCP<\/em> ] I was able to telnet from my Mac into my Raspberry Pi and from the Pi I could telnet into the 192.168.2.x domain that my K40 was now sitting on. \u00a0So that&#8217;s nice &#8211; but it isn&#8217;t what I had hoped for. \u00a0I want to just telnet in from my Mac, or hit the <a href=\"http:\/\/smoothieware.org\/pronterface\">Pronterface<\/a>\u00a0interface or use LaserWeb3 or whatever&#8230;straight from my damned Mac.<\/p>\n<p><strong><em>iptables are your friend<\/em><\/strong><\/p>\n<p>There are several guides online talking about using bridge-utils to accomplish this but I couldn&#8217;t get them working, and with hindsight I&#8217;m glad I didn&#8217;t. \u00a0If I&#8217;d have used the RPi as a bridge then I couldn&#8217;t SSH in or do any of the funky magic that I have planned for the future with this K40 such as z-axis manipulation and a full on pretty UI running on a RPi powered LCD touch display, but I digress.<\/p>\n<p>All I really <strong>really\u00a0<\/strong>wanted to do was forward certain ports from the RPi <em>wlan0<\/em> interface to the smoothieboard <em>eth0<\/em> interface&#8230;<\/p>\n<p class=\"p1\"><span class=\"s1\">-A PREROUTING -p tcp -m tcp &#8211;dport 23 -j DNAT &#8211;to-destination 192.168.2.10:23<\/span><\/p>\n<p class=\"p1\"><span class=\"s1\">-A PREROUTING -p tcp -m tcp &#8211;dport 80 -j DNAT &#8211;to-destination 192.168.2.10:80<\/span><\/p>\n<p class=\"p1\"><span class=\"s1\">-A POSTROUTING -d 192.168.2.10\/32 -p tcp -m tcp &#8211;dport 80 -j SNAT &#8211;to-source 192.168.2.1<\/span><\/p>\n<p>By adding something along the lines of the gibberish above to your iptables setup file that you created using the &#8220;Wifi to ethernet adapter&#8230;&#8221; then you should be cooking on gas. \u00a0Basically the prerouting stuff forwards anything received on <em>telnet<\/em> or <em>HTTP<\/em>\u00a0ports onto the smoothieboard. \u00a0The postrouting stuff is to allow the response from <em>HTTP<\/em> to make it&#8217;s way back to your host machine.<\/p>\n<p>You may have to modify your smoothie config file if it&#8217;s currently setup for static IP but seriously, if you&#8217;re buying laser cutters, modding the control board and then pondering sticking in a RPi to do wifi bridge\/route\/death then I&#8217;m pretty sure I don&#8217;t have to hold your hand and lead you through the config file modifications.<\/p>\n<p>If you need help you can find me on <a href=\"https:\/\/plus.google.com\/u\/0\/+DarrenSteele\">Google+<\/a><\/p>\n<figure id=\"attachment_980\" aria-describedby=\"caption-attachment-980\" style=\"width: 840px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140812.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-980 size-large\" src=\"https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140812-1024x768.jpg\" alt=\"IMG_20161212_140812\" width=\"840\" height=\"630\" srcset=\"https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140812-1024x768.jpg 1024w, https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140812-300x225.jpg 300w, https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140812-768x576.jpg 768w, https:\/\/junglefreedomfighters.com\/wp-content\/uploads\/2016\/12\/IMG_20161212_140812-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><figcaption id=\"caption-attachment-980\" class=\"wp-caption-text\">There&#8217;s the RPi, sitting top-left minding its own business receiving WiFi packets and passing them on to eth0 &#8211; a simple life<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Plenty of people are buying cheap K40 laser cutters from eBay and lots more people have a growing collection of Raspberry Pi&#8217;s &#8211; I fit into both of those categories. Fortunately I made the decision to replace the stock K40 controller board with a Smoothieboard. \u00a0This gave me the capability to connect via Ethernet and &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/junglefreedomfighters.com\/?p=977\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Wireless K40 smoothie with a Raspberry Pi&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-977","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=\/wp\/v2\/posts\/977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=977"}],"version-history":[{"count":3,"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=\/wp\/v2\/posts\/977\/revisions"}],"predecessor-version":[{"id":982,"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=\/wp\/v2\/posts\/977\/revisions\/982"}],"wp:attachment":[{"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/junglefreedomfighters.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}