Originally posted at https://tech.labs.oliverwyman.com/blog/2015/08/10/spark-core-based-proxy/
Regular readers of this blog will have seen my earlier post on Dalek remote control where I used a Spark Core to connect the Dalek’s remote control to the internet. However, in the second post I noted how hotel Wi-Fi is basically evil, and so I ran into all manner of problems with connecting the Spark to the Wi-Fi in the hotel where I actually wanted to demo the Dalek…
I’ve therefore spent the last week or so writing a way around this problem in the form of the Spark Proxy. It lets you proxy a web browser’s requests through a Spark Core, and so deal with browser-based Wi-Fi authentication mechanisms for this embedded device that doesn’t have a web browser.
Here’s how to install it:
particle flash [your Spark's id] .(don’t forget that last ‘.’ as it indicates to use the files in the current directory) from the directory with the Spark proxy code in
particle serial listto get the serial port of your device
python wifi.py [path to serial port] [wifi network name] [wifi network password]to get it to talk to the annoying Wi-Fi network
python proxy.py [path to serial port]and you’ve now got an HTTP proxy up and running. HTTPS, not so much, but generally that’s enough for this limited use case.
Congratulations! You’ve now got a Spark that’s trusted by the local Wi-Fi network, and has the Tinker functions installed so all of that will work nicely which is what most apps need. Hopefully they’ll trust it for at least a day or so… Alternately, go to an event like the one I was at this last weekend where the Wi-Fi just works nicely with none of this web browser stuff, and your life is much easier, but meant I couldn’t beta-test this in full real-world conditions
Other things learned along the way: