Xmas Eve 2016

 

IMG_20161224_145551

This is how we roll in the Steele house these days.  Christmas Eve is spent wrapping presents and soldering time of flight distance sensors to build a hoopy height adjusting gizmo for my raspberry pi / k40 laser cutter.

IMG_20161224_145532

Now for wine…

Wireless K40 smoothie with a Raspberry Pi

Plenty of people are buying cheap K40 laser cutters from eBay and lots more people have a growing collection of Raspberry Pi’s – I fit into both of those categories.

IMG_20161212_140801
Please excuse the wiring, I never was very good at that kind of stuff

Fortunately I made the decision to replace the stock K40 controller board with a Smoothieboard.  This gave me the capability to connect via Ethernet and a whole bunch of other things that made me all excited.

Unfortunately my K40 is positioned on the other side of my “office” so whenever I wanted to use it I had to run an ethernet cable across the room which was very annoying.

It was whilst messing about with a Raspberry Pi I had an epiphany.  These things have WiFi and Ethernet built in, surely it can’t be that hard to turn it into a bridge/router/packet-forwarding-death-bringing machine.  Turns out it really wasn’t that hard…

I followed this guide which got me 90% of the way.

By the time I had finished implementing the above [ which is really just setting up wifi and ethernet and enabling DHCP ] 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.  So that’s nice – but it isn’t what I had hoped for.  I want to just telnet in from my Mac, or hit the Pronterface interface or use LaserWeb3 or whatever…straight from my damned Mac.

iptables are your friend

There are several guides online talking about using bridge-utils to accomplish this but I couldn’t get them working, and with hindsight I’m glad I didn’t.  If I’d have used the RPi as a bridge then I couldn’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.

All I really really wanted to do was forward certain ports from the RPi wlan0 interface to the smoothieboard eth0 interface…

-A PREROUTING -p tcp -m tcp –dport 23 -j DNAT –to-destination 192.168.2.10:23

-A PREROUTING -p tcp -m tcp –dport 80 -j DNAT –to-destination 192.168.2.10:80

-A POSTROUTING -d 192.168.2.10/32 -p tcp -m tcp –dport 80 -j SNAT –to-source 192.168.2.1

By adding something along the lines of the gibberish above to your iptables setup file that you created using the “Wifi to ethernet adapter…” then you should be cooking on gas.  Basically the prerouting stuff forwards anything received on telnet or HTTP ports onto the smoothieboard.  The postrouting stuff is to allow the response from HTTP to make it’s way back to your host machine.

You may have to modify your smoothie config file if it’s currently setup for static IP but seriously, if you’re buying laser cutters, modding the control board and then pondering sticking in a RPi to do wifi bridge/route/death then I’m pretty sure I don’t have to hold your hand and lead you through the config file modifications.

If you need help you can find me on Google+

IMG_20161212_140812
There’s the RPi, sitting top-left minding its own business receiving WiFi packets and passing them on to eth0 – a simple life

Magnetic White Board

IMG_20161211_104233
Sorry Emma, mine!

Back in the crazy foo factory days I bought a magnetic white board to design level layouts and dune buggys and stuff.  It kinda sat/hang languishing on my wall for a few years before I offered it to Emma.  She accepted it but said she wouldn’t need it for a while.  That very day I got sick of having photos sitting around on my desk and stuck them on the magnetic white board….no way is Emma having it now.

Skydiving

Not quite as much fun as the real thing but still had a lovely time.  It was a bit embarrassing when drool started coming out of my mouth – don’t remember that happening in California!

capt0767