Tag Archives: spark photon

Getting started with BrewPi Photon on Ubuntu 15.04

Brewpi SparkBrewPi is a raspberry-based brewery automation system. Combined with a central brain based on a Spark Photon, you can drive fermentation chambers and soon, pumps & valves to make a fully-automated HERMS system.

Here are my notes that got me started with the new version of BrewPi (based on the Spark Photon) after spending a few hours reading everything I could and bothering Elco on the forum. I hope it’ll save you a few hours!

Upgrade and install an ARM compiler

Since the Spark Firmware requires at least gcc4.9 and 4.8 is only available atm (2015-07-28) on Ubuntu 14.10, you need to add a PPA first:

sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi

If you already had an arm compiler installed as I did, you might encouter an error about overrinding files from another package. If that’s the case, you can do (you may need to adjust the command line with your package version):

sudo dpkg -i --force-all /var/cache/apt/archives/gcc-arm-none-eabi_4.9.3.2015q2-1vivid1_amd64.deb

Checkout Spark Firmware and flash your Photon

Checkout the spark firmware using git:

git clone https://github.com/spark/firmware/ spark-firmware

cd into spark-firmware/main and use:

make clean all PLATFORM=photon

then, cd into spark-firmware/modules and use again:

make clean all PLATFORM=photon

You should end up with something like this (no error):

arm-none-eabi-size --format=berkeley ../../../build/target/user-part/platform-6-m/user-part.elf
   text       data        bss        dec        hex    filename
   4596        144        332       5072       13d0    ../../../build/target/user-part/platform-6-m/user-part.elf

Now, plug you Photon via USB and put it in DFU Mode (hold both RESET and SETUP buttons then release RESET and wait until the LED becomes Yellow). Make sure you have dfu-util by apt-get installing it:

sudo apt-get install dfu-util

Then, from the spark-firmware/modules directory, flash it using:

sudo make PLATFORM=photon program-dfu

It should flash three parts (system1, system2 and user) and finish on

Download    [=========================] 100%         4740 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status

Don’t worry about this error message, it’s known and can be safely ignored. Your Photon should now flash green.

Configure the WiFi

First, put your Photon in SETUP Mode. Just hold the SETUP button for three seconds while it’s running. You should get a blinking Blue led.

First, make sure you have npm installed:

sudo apt-get install npm

then, install the particles tools in a local folder:

npm install particle-cli

You should get a node_modules/ directory.

Now, run:

node_modules/.bin/particle setup wifi

Say ‘n’ when prompted for scanning networks and enter your SSID and password. It should finish with:

Done! Your device should now restart.

And indeed, your device should restart and you should have a pulsing cyan led. It means it’s connected!

Compiling BrewPi firmware