Spark Core-based proxy

10 Aug 2015

C  Hardware  Python 

Originally posted at

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:

  1. While in a nice Wi-Fi environment (e.g. at home before the convention), download the spark-proxy and install the Particle CLI
  2. Get your Spark’s id with particle list
  3. Make sure your Spark Core is powered up and then run 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
  4. Your Spark Core is now running the proxy code, and you can now go to to the event with the crappy Wi-Fi
  5. Connect the Spark Core to your laptop and run particle serial list to get the serial port of your device
  6. Now run python [path to serial port] [wifi network name] [wifi network password] to get it to talk to the annoying Wi-Fi network
  7. Run python [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.
  8. Boot up a browser (ideally a different one to your main one so you can use the main one to check things) and get it to talk to the proxy at http://localhost:1080
  9. Go through the relevant Wi-Fi authentication pages, and then disconnect your Spark Core from your laptop

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:

Previously: Automatic scheduling of people and rooms Next: Waveform Necklace as a Service