Skip to content

Basic Software Setup

HackersHub edited this page Sep 17, 2019 · 4 revisions

Step 1 - Set up Raspberry Pi

As we are not connecting a display, it's best to get the Lite version of Raspbian: https://www.raspberrypi.org/downloads/raspbian/

Then unpack and flash the .img file to a micro SD card, on Windows you can use Win32 Disk Imager: https://sourceforge.net/projects/win32diskimager/

When the flashing is finished but before ejecting the SD card SSH and WiFi needs to be set up.
To enable SSH, place an empty file named ssh (without a file extension) in the boot partition.
To enable WiFi, create a file named wpa_supplicant.conf in the boot partition and put the following content in it with your WiFi SSID and password:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
 ssid="WIFI_SSID"
 scan_ssid=1
 psk="WIFI_PASSWORD"
 key_mgmt=WPA-PSK
}

Eject the SD card, put it in the Raspberry Pi and connect it to power. Wait a minute or so and then depending on your setup you might be able to access it using its hostname raspberrypi.local, if that does not work you'll have to log into your router and find the IP address and use that:

ssh [email protected]

or

ssh pi@[whatever ip you found]

The default password is raspberry. It is highly advisable to change the password on the first login. Do this by running the passwd command and follow the steps.

Step 2 - Software Setup

To start you will need to install git by running the following commands:

sudo apt-get update
sudo apt-get install git

Then you can clone the repository with: git clone https://github.com/HackershubNL/SmokeyMcSmokerson.git

Change directory to the software folder: cd SmokeyMcSmokerson/Software/Controller

Install the prerequisites and Blynk server: sudo bash setup.sh

This will install the Blynk server as a system service so as soon as the Pi boots, it will start the server.
The Blynk server its default credentials are:

Username: [email protected]
Password: admin

Also here it is advisable to change these, to do this, open up a browser an go to: https://[your raspberry ip or hostname]:9443 accept the certificate warning and under the Users section click the admin account and change the password.

Step 3 - Setup Blynk App

Install the Blynk App from your app store.

When you open the app, press Login and enter the credentials you set in Step 2. But before you press Next, click the icon which looks like a router with an arrow pointing at it. Set the slider to Custom and enter the IP address or hostname of your Raspberry Pi and use port 9443. Press OK and 'Next' to login.

Then you can clone the layout by pressing the icon that looks like a QR code, top right of the screen and scan the code at: https://github.com/HackershubNL/SmokeyMcSmokerson/blob/master/Software/Controller/blynk_app.png

Lastly, you will need to get the Authorization code from the app. Having the Smokey Mc Smokerson interface open, press the nut icon next to the play button, top right of the screen. Scroll down to find your Auth Token, please note that the e-mail function does not work as it is not setup so copy the code by pressing it and send it to your self.

Step 4 - Final Controller Setup

Go to the SmokeyMcSmokerson/Software/Controller/smokey_mc_smokerson directory.

Edit the file using nano: nano config.json

Paste your Auth code and the auth section and enter your Pi's IP or hostname in the server section.

Optional:
The controller determines whether to run in simulated mode by detecting the platform. I.e. if it is not a Raspberry Pi, run in simulated mode. If you have not connected the sensors and fan(s) but do want to run it in simulated mode, you will need to make the following change:
Edit temperature_controller.py, change line 10 simulated_mode = False to simulated_mode = True, so it looks like:

import time
from simple_pid import PID
import globals
import MAX6675
import Adafruit_GPIO as GPIO

try:
    platform = GPIO.Platform.platform_detect()
    assert(platform == 1)
    simulated_mode = True
except:
    simulated_mode = True
    globals.log('warning', "Temperature Controller - Platform is not a Raspberry Pi, running in simulated mode")

Step 5 - Run the controller

In the Blynk App, press the play button, top right of the screen. (If you don't do this, the menu will not be pushed to the app)

On boot the Smokey service will start automatically and you can stop and start the service manually with:

sudo service smokey_service stop
and
sudo service smokey_service start

The app will display a notification that it has received a new menu from the controller and that's it.

Note:
If you are running in simulated mode, it will simulate the temperature based on fan speed. But the entire system is functional. To see this temperature profile, check temperature_controller.py