Brewing ALE with Pi
Kristian Kristensen
@kkristensen
Get $5 to start:!
http://bit.ly/
VenmoKristian
Agenda
•

Beer Brewing

•

Raspberry Pi

•

Erlang/ALE

•

Monitoring temperatures
Raspberry Pi
•

ARM 700 MHz CPU

•

512 MB RAM

•

10/100 Ethernet

•

HDMI, Comp. Video, Audio.

•

$40!
Interface Real World (I)
•

GPIO

•

I2C

•

SPI

•

<Others>
Interface Real World (II)
•

Memory Mapped
•

/dev/mem
•

•

Kernel modules
•

•

Fast, needs root, dangerous!

Slow, does...
Erlang/ALE
•

Actor

•

Library for

•

Embedded

https://github.com/esl/erlang_ale
Erlang (hearts) Embedded
•

Soft real time

•

Concurrency and Parallelism

•

Fault tolerant & Robust

•

Hot-code loadin...
Architecture
•

Fix the mess
we saw earlier

•

Familiar
abstractions

•

Clean model
What works
•

GPIO and GPIO interrupts

•

Basic I2C and SPI

•

Erlang Solutions actively working on it
GPIO
A

{init, 17, output}

GPIO

pin 17
GPIO
A

B

{state, 17, high}

GPIO

{state, 17, low}

pin 17
{state, 17, high}

C
GPIO Supervisor
•

Replaces locks
•

•

Access Control, Mutual Exclusion

Safety constraints
•

Toggling, sequence detecti...
Blink some LEDs
{ok, _} = gpio:start_link(?LED_PIN, output),
!

blink() ->

gpio:write(?LED_PIN, 1),

!

timer:sleep(1000)...
Blink some LEDs

•

http://bit.ly/18KP8xF
Interrupts
{ok, _} = gpio:start_link(?IN_PIN, input),
!

ok

= gpio:set_int(?IN_PIN, rising),

!

handle_info({gpio_interr...
1-wire
•

Creates a network of sensors all communicating
using 1 single wire

•

Great digital thermometer sensor availabl...
Raspberry Pi & 1-wire
•

Kernel module
•

•

/sys/bus/w1/devices/28-0000044719d7/w1slave

=>
•

4b 01 4b 46 7f ff 0e 10 d8...
Read temperature
•

read(<<A1:16,_,A2:16,_,A3:16,_,A4:16
,_,A5:16,_,A6:16,_,A7:16,_,A8:16,_,C
RC:16,_,$:,_,”crc=",CRC:
16,...
Projects
•

Kegerator control

•

Boil Wort

•

Strike water, Hot Liquor Tank

•

Mash temperature

•

Fermentation Chambe...
Thank you
Links
•

https://github.com/esl/erlang_ale

•

http://www.erlang-embedded.com/

•

Blink LEDs: http://bit.ly/18KP8xF

•

R...
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Brewing ALE with Pi
Upcoming SlideShare
Loading in …5
×

Brewing ALE with Pi

911 views

Published on

I'm an avid home brewer and what better than to combine your hobbies in the service of home brewing? The Raspberry Pi is a low cost computer with some very nifty interfaces for interacting with the real world. We can utilize that to monitor all things home brewing to make sure our brews come out great!

Join me for a whirlwind tour of brewing beer and hacking Erlang on the Raspberry Pi.

Agenda:

The Raspberry Pi
Erlang on Pi using Erlang/ALE (Actor Library for Embedded)
Beer Brewing
Monitoring temperatures
Target audience: Anyone interested in Raspberry Pi and how you can get started with Erlang on it. Anyone interested in beer and how it's made.

Published in: Technology
  • Be the first to comment

Brewing ALE with Pi

  1. 1. Brewing ALE with Pi Kristian Kristensen @kkristensen
  2. 2. Get $5 to start:! http://bit.ly/ VenmoKristian
  3. 3. Agenda • Beer Brewing • Raspberry Pi • Erlang/ALE • Monitoring temperatures
  4. 4. Raspberry Pi • ARM 700 MHz CPU • 512 MB RAM • 10/100 Ethernet • HDMI, Comp. Video, Audio. • $40!
  5. 5. Interface Real World (I) • GPIO • I2C • SPI • <Others>
  6. 6. Interface Real World (II) • Memory Mapped • /dev/mem • • Kernel modules • • Fast, needs root, dangerous! Slow, doesn’t need root, easier, safer Can Erlang help us?
  7. 7. Erlang/ALE • Actor • Library for • Embedded https://github.com/esl/erlang_ale
  8. 8. Erlang (hearts) Embedded • Soft real time • Concurrency and Parallelism • Fault tolerant & Robust • Hot-code loading • (http://www.erlang-embedded.com/2013/10/minimal-downtime-in-flight-drone-firmware-upgrade-in-erlang/)
  9. 9. Architecture • Fix the mess we saw earlier • Familiar abstractions • Clean model
  10. 10. What works • GPIO and GPIO interrupts • Basic I2C and SPI • Erlang Solutions actively working on it
  11. 11. GPIO A {init, 17, output} GPIO pin 17
  12. 12. GPIO A B {state, 17, high} GPIO {state, 17, low} pin 17 {state, 17, high} C
  13. 13. GPIO Supervisor • Replaces locks • • Access Control, Mutual Exclusion Safety constraints • Toggling, sequence detection, direction control, etc.
  14. 14. Blink some LEDs {ok, _} = gpio:start_link(?LED_PIN, output), ! blink() -> gpio:write(?LED_PIN, 1), ! timer:sleep(1000), ! gpio:write(?LED_PIN, 0), ! timer:sleep(1000).
  15. 15. Blink some LEDs • http://bit.ly/18KP8xF
  16. 16. Interrupts {ok, _} = gpio:start_link(?IN_PIN, input), ! ok = gpio:set_int(?IN_PIN, rising), ! handle_info({gpio_interrupt, _Pin, _Condition}, State) -> blink().
  17. 17. 1-wire • Creates a network of sensors all communicating using 1 single wire • Great digital thermometer sensor available • DS18B20
  18. 18. Raspberry Pi & 1-wire • Kernel module • • /sys/bus/w1/devices/28-0000044719d7/w1slave => • 4b 01 4b 46 7f ff 0e 10 d8 : crc=d8 YES
 4b 01 4b 46 7f ff 0e 10 d8 t=26125
  19. 19. Read temperature • read(<<A1:16,_,A2:16,_,A3:16,_,A4:16 ,_,A5:16,_,A6:16,_,A7:16,_,A8:16,_,C RC:16,_,$:,_,”crc=",CRC: 16,_,"YES",Rest0/binary>> • read(<<A1:16,_,A2:16,_,A3:16,_,A4:16 ,_,A5:16,_,A6:16,_,A7:16,_,A8:16,_,C RC:16," t=",Rest/binary>> • http://bit.ly/1cst0ah
  20. 20. Projects • Kegerator control • Boil Wort • Strike water, Hot Liquor Tank • Mash temperature • Fermentation Chamber Control
  21. 21. Thank you
  22. 22. Links • https://github.com/esl/erlang_ale • http://www.erlang-embedded.com/ • Blink LEDs: http://bit.ly/18KP8xF • Read Temperature: http://bit.ly/1cst0ah

×