Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Ruby Makes Better Beer

How Ruby Makes Better Beer

Ruby on Ales 2013 talk on using Ruby and the Raspberry Pi to automate, monitor, and design craft beer recipes.

Andrew Nordman

March 07, 2013
Tweet

More Decks by Andrew Nordman

Other Decks in Programming

Transcript

  1. How Ruby Makes
    Better Beer
    Andrew Nordman
    cadwallion @cadwallion
    1
    Thursday, March 7, 13

    View full-size slide

  2. =
    2
    Thursday, March 7, 13

    View full-size slide

  3. =
    3
    Thursday, March 7, 13

    View full-size slide

  4. +
    4
    Thursday, March 7, 13

    View full-size slide

  5. 5
    Thursday, March 7, 13

    View full-size slide

  6. • Started Homebrewing in 2010
    • Founded Company in 2012
    • “Nano” Brewery Scale
    • Licensing in Progress
    6
    Thursday, March 7, 13

    View full-size slide

  7. 7
    Craft Brewing is a blend of Art and
    Science
    + =
    http://goo.gl/O7Qdc http://goo.gl/Z8oag
    Thursday, March 7, 13

    View full-size slide

  8. Why Raspberry Pi?
    • Raspberry Pi is extremely cost-effective
    • Arduino ethernet shields are expensive
    • I like Ruby
    8
    Thursday, March 7, 13

    View full-size slide

  9. Grain to Glass
    • Creating a Recipe
    • Brew a Batch (Hot-Side Brewing)
    • Fermenting (Cold-Side Brewing)
    9
    Thursday, March 7, 13

    View full-size slide

  10. Creating a Recipe
    • Pick a style or key characteristics
    • Pick ingredients to match
    • Plan Fermentation
    • Plan Carbonation
    • Use BeerSmith!
    10
    http://goo.gl/Kdlji
    Thursday, March 7, 13

    View full-size slide

  11. Batch Notes / Brew Log
    • Treat your recipes like applications
    • Treat your equipment like servers
    • Log Everything about a Batch
    • Feed Batch Notes back to Recipe
    11
    Thursday, March 7, 13

    View full-size slide

  12. BrewLab
    • Picks up where BeerSmith leaves off
    • Imports BeerSmith Recipes
    • Associates Batches with Recipes
    • Stores Times, Temperatures, and Notes
    • API to Integrate with Brewing Equipment
    12
    Thursday, March 7, 13

    View full-size slide

  13. Brewscribe
    • https://github.com/cadwallion/brewscribe
    • Imports BeerSmith/BeerXML Files
    13
    document  =  Brewscribe.import  File.read  './spec/support/recipe.bsmx'
    recipe  =  document.recipes.first
    recipe.ingredients.class  #  =>  Brewscribe::IngredientList
    recipe.ingredients.grains.class  #  =>  Array
    recipe.ingredients.grains.first.class  #  =>  Brewscribe::Grain
    recipe.ingredients.grains.first.name  #  =>  "Pale  Malt  (2  Row)  US"
    Thursday, March 7, 13

    View full-size slide

  14. Brewing a Batch
    14
    Thursday, March 7, 13

    View full-size slide

  15. Mashing Process
    15
    Thursday, March 7, 13

    View full-size slide

  16. Boiling Process
    • Reduction of sweet wort for concentration
    • Periodic addition of hops for bitterness
    • Periodic addition of flavorings
    • 60-120 minutes at hard boil
    • AUTOMATE!
    16
    Thursday, March 7, 13

    View full-size slide

  17. Brewby
    • Runs on MRI 1.9, porting to mruby
    • Handles HERMS/RIMS
    • Small expansion board for relay/sensor
    connectors
    • Touchscreen GUI
    • Raspberry Pi GPIO
    17
    Thursday, March 7, 13

    View full-size slide

  18. Temper
    • https://github.com/cadwallion/temper
    • PID-based Anger Temperature Management
    18
    require  'temper'
    temper  =  Temper::PID.new(interval:  1000,  minimum:  0,  maximum:  1000,  direction:  :direct)
    temper.tune(9.0,  25.0,  6.0)      #  Set  Kp,  Ki,  and  Kd
    temper.setpoint  =  100.0              #  Set  target  temperature  (Degrees  Fahrenheit)
    while  input  =  read_sensor()      #  Replace  read_sensor  with  your  external  system
       output  =  temper.control(input)
       #  output  is  a  value  between  minimum  and  maximum.  This  can  be  used  for  thresholds  or
       #  PWM-­‐based  control
    end
    Thursday, March 7, 13

    View full-size slide

  19. Brewby Integration
    • Uses PWM to handle Boil Process
    • Loads Recipe from BrewLab (or .bsmx on Pi)
    • Sends sensor data to BrewLab
    19
    Thursday, March 7, 13

    View full-size slide

  20. Hardware
    • 5500W Water Heater Element
    • DS18B20 Temperature Sensor
    • 40A Solid State Relay
    • Raspberry Pi
    • 240V/30A Mains Power
    • Handles up to 20 Gallon Batches
    20
    Thursday, March 7, 13

    View full-size slide

  21. 21
    Thursday, March 7, 13

    View full-size slide

  22. Operation
    • Start Strike Water
    • Start Mash
    • Start Lauter
    • Start Boil via Manual Power Level
    • Pump to Chiller
    22
    Thursday, March 7, 13

    View full-size slide

  23. Fermentation
    • Keep beer at Specific Temperature
    • Log and Monitor Temperature
    • AUTOMATE!
    23
    http://goo.gl/DaVyE
    Thursday, March 7, 13

    View full-size slide

  24. Problems with
    Raspberry Pi
    • Linux kernel isn’t ‘real-time’
    • Limited number of GPIO
    • Single PWM Timer GPIO
    • Single 1-Wire GPIO
    24
    Thursday, March 7, 13

    View full-size slide

  25. Arduino!
    • Raspberry Pi handles networking, GUI, etc
    • Arduino handles low-level hardware
    interface
    • Raspberry Pi interfaces Arduino via I2C
    • Requires logic-level shifter
    25
    Thursday, March 7, 13

    View full-size slide

  26. YeastyMon
    • Raspberry Pi + Arduino Uno
    • Up to 6 Temperature Sensors
    • Passive Monitoring Mode or Active Control
    • Interfaces with BrewLab to send
    fermentation data
    26
    Thursday, March 7, 13

    View full-size slide

  27. Future
    • Add Support for Solenoid Valves
    • Switch Brewby to I2C
    • Large-scale Brewby Panels (100A+)
    • Open BrewLab to Public
    • Release BrewLab API Gem
    27
    Thursday, March 7, 13

    View full-size slide