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

Macaroons

There’s two things I always buy at the Xmas market. Coconut macaroons… See above, and then a £10 bag of mixed sausages. Mission accomplished. 

Breakfast at Bills

We took a family trip to the Manchester Christmas market. It all started with a fantastic breakfast at Bills. A new Steele family tradition has been born

The competition for Santa Maria


Several people opine that Santa Maria is the best pizza place in Ealing if not the whole of London. We recently heard that L’Oro Di Napoli, right around the corner, was even better. We went, ate, drank and had fun. It was a great place and we thoroughly enjoyed it. I still think Santa Maria is a little better but I haven’t been for a while so maybe I should check it out again soon

PSVR

It may be a big, bulky and heavy thing to carry around but it really is excellent fun.

Oscilloscopes

Spent an awful long time trying to work out if my smoothieboard was giving me a decent PWM signal. The only way forward was to grab an oscilloscope. 

Once I had an oscilloscope I had to work out how to use it. So I fired up an old raspberry pi. Wrote a bit of python to drive one of the GPIO lines and boom. We’re in business 

Afternoon off

Had an afternoon off after working on a Sunday morning to investigate some DST issues.  It coincided nicely with half term so we had a family walk in Fairy Glen.

Wrapped up

IMG_20161101_144135

IMG_20161101_152928

 

See Ya

Furry little bastard

On All Hallows’ Day I finally managed to bag another one. I think all that time spent watching YouTube videos about catching moles is starting to pay off. 

Fan Repair Failure

During the hot hot hot Summer our fan broke.  One of the blades ripped itself free and over time another two just sort of fell off.  The metal ummm thing that was holding the blades on must have just got old and tired.  This is a job for my laser cutter, thought I.

The old metal fallen apart bit and below, my less than elegantly designed replacement bit.
The old metal fallen apart bit and my less than elegantly designed replacement bit.

I attached the blades….

Looking good so far
Looking good so far

and then attached the whole thing to the fan.

yeah, this is going to be rubbish
yeah, this is going to be rubbish

It was only at this moment, after several months thought and planning, did I notice that the arm of the metal thing was kind of angled…to kind of angle the blade and make it move air and stuff.  The way mine is set up those blades are just going to efficiently slice through the air and make barely a draught.

Can I be bothered having another go at fixing it or does it just get recycled???