Small hacking competiton used by Ice.net during NDC Oslo 2017. Purpose to get a code to win a prize.
Built using Elixir and Phoenix. Deployed using Nerves.
The competition was hosted on a Raspberry Pi Zero W with 3 LEDs.
The goal was to get all three LEDs to light up.
The hardware setup is a connection of 3 LEDs with resistors to protect the LEDs. The Fritzing file can be found here.
If you have never used Elixir, Phoenix and Nerves before, you need to install these on you computer first. In addition the setup uses Slack to notify the hosts on what is going on (including notifying winners), and timber.io to log system events and exceptions.
Elixir is the main language of this setup.
Head over to https://elixir-lang.org and follow instructions there to install Elixir.
Phoenix framework is the webserver. Follow instructions at http://www.phoenixframework.org to install.
Nerves is used to bundle everything in a nice image to the SD card of the RPi. It wraps together the OS, runtime and your code in a package, and helps you burn the image to the SD card. Go to http://nerves-project.org to install.
The setup needs a Slack webhook to post notifications to. Follow the instructions on Slack to create a webhook. Use the URL in the config (described below).
The setup uses timber.io for logging. Head over to timber.io, sign up and get an API key. Use the API key in the config file (described below).
To avoid getting secret leaking to github (or any other source controls), you need to create the following file: /apps/firmware/config/prod.secret.exs
and fill in the blanks from the template below.
use Mix.Config
config :firmware, :wlan0,
ssid: "<WLAN SSID>",
psk: "<WLAN password>"
config :timber,
api_key: "<API key from timber.io>"
config :api, Api.Endpoint,
secret_key_base: "<random secure key - can reuse the one in confix.exs>"
config :api, :questions,
q1: "What is 1+1",
a1: 2,
q2: "What is 2+2?",
a2: 5,
q3: "What is the Answer to the Ultimate Question of Life, The Universe, and Everything?",
a3: 42
config :api, :slack,
url: "<url to slack webhook>"
With all the above in place, you can follow these steps to get up and running (instructions verified on MacOS, might differ on Windows):
/apps/firmware
export MIX_TARGET=rpi0
export MIX_ENV=prod
mix deps.get
mix compile
mix firmware
mix firmware.burn