SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
Have some Erlang
on your RaspberryPi
(Using Erlang in embedded linux systems)
Friday, June 21, 13
But first, some context
(i.e. Why running Erlang on the
RaspberryPi might be interesting...)
Friday, June 21, 13
nowyears agodecades agoa long time ago
(in a galaxy far, far away...)
The progression
mainframe
desktop
laptop
smart
phone
tablet
?
We all are aware of the inevitable progression towards more diverse, smaller, and
powerful software enabled devices. It is pretty obvious. In addition to this, it’s clear that
devices are designed around certain modes of interactions and interaction duration.
However, there is a new space in consumer devices which allows for entirely different
ways of interaction (and in some cases no interaction at all).
Friday, June 21, 13
The quantified self/
internet of things?
FitBit/Fuel Band
WiThings BodyScale
ScoutAlarm
SmartThings
Pebble Watch
Philips Hue/ Blink(1)
NinjaBlocks
Belkin WeMo
Switch
This new space is based on
the idea that devices can be
passive observers of human
behavior, the environment,
or other sources of data.
This is the central idea of
the quantified self/internet
of things. Initially devices are
focused around health and
activity.There will be an
increasing growth in other
areas.
Friday, June 21, 13
Games
Information
Environment
Security
Health
The quantified self is part of
the “Internet of Things”
There are more and more devices
entering the market every month.
To date, a large number have been
focused on health (e.g. FitBit,
Nike Fuel) and security (e.g.
ScoutAlarm). Over time these
devices will enter other aspects of
human activity. Some sense and
control the home environment
(e.g. Nest), others provide
information from internet
services (e.g. Philips Hue), and
some might be purely for
entertainment and a platform for
games.
Friday, June 21, 13
In addition to lots of interesting consumer products.
There are lots of new and interesting hardware
platforms. Almost all run embedded linux.
Friday, June 21, 13
What are people doing with
these boards?
Friday, June 21, 13
Friday, June 21, 13
Friday, June 21, 13
Build your own Google Glass perhaps?...
Friday, June 21, 13
Ok, but what does this have to
do with Erlang?
Friday, June 21, 13
Small, cheap hardware
Linux
=
Lots of internet
connected, linux
powered, small, cheap,
embedded devices
+
Expensive, big hardware
Erlang
=
A massively scaleable,
fault tolerant system
which runs on embedded
systems
+
The Internet
+
The phone network
+
Well, there are some parallels between
these “internet of” devices and Erlang
Friday, June 21, 13
What is Erlang?
(hint: It’s pronounced “Air-lang” not “Errr-lang”)
Friday, June 21, 13
• Creating and destroying processes is very fast
• Sending messages between processes is very fast
• Processes behave the same way on all operating systems
• We can have very large numbers of processes (1,000’s to 100,000’s)
• Processes share no memory and are completely independent
• The ONLY way for processes to interact is through message passing
Like some languages are object oriented,
Erlang is “process oriented”. For example,
in Erlang:
Erlang is a general purpose concurrent programming
language and runtime system. It is a functional
language which has strict evaluation, single
assignment, and dynamic typing. Originally designed
by Ericsson to support distributed, fault-tolerant,
soft-real time, non-stop applications. [from wikipedia]
Friday, June 21, 13
This is a sample of code from the demo portion of this presentation. It defines a module
called “net_led” which controls an LED over the local network. Erlang code is composed
into modules which expose certain functions via the “export” directive. In this module, I
export methods to spawn the LED light process on one machine.Then have a switch
function which controls the light via a different process running on a separate machine. In
the sample below there are two functions defined,“decouple” and “switch.” These take
parameters about the LED light process and then send messages to that process.The “!” is
the message send operator.
Full source can be found here: https://gist.github.com/breakpointer/5799847
Friday, June 21, 13
What does Erlang look like?
Friday, June 21, 13
Object Oriented Process Oriented
Ruby Erlang
class Foo
def bar
puts “hello!”
end
end
Definition
-module(foo).
-export([bar/0]).
bar() ->
io:format(‘hello!~n’,[]).
Instantiation >f = Foo.new
>f.bar
#=> hello!
>foo:bar().
hello!
>F = spawn(foo, bar, []).
hello!
<0.34.0>
Simple comparison of Ruby to Erlang
Orientation
Friday, June 21, 13
How does one use Erlang?
Friday, June 21, 13
process process
spawn
receive
ErlangVM
process
process
spawn
spawn
{messages}
receive
A typical application will use many processes, and
message passing for inter-process communications
Friday, June 21, 13
How is Erlang used
on the RaspberryPi?
Friday, June 21, 13
The components of the RaspberryPi
Your interface to the world!
Friday, June 21, 13
Friday, June 21, 13
Accessing the GPIO pins through Linux SysFs
OS mapping location of pins:
Exporting a pin for use:
Reading the value of a pin as that pin is toggled high/low:
Friday, June 21, 13
Imagine a product called
The Baconator*
How might this system be
modeled?
(*patent/trademark/startup pending...)
Friday, June 21, 13
SysFs
Dispense
process
{messages}
receive
Make
Bacon
process
Button
process{messages}
receive
GPIO
io:Read
io:Write
The Baconator!
A.K.A. the most awesome bacon dispensing machine in the world!
Bacon
supervisor Instructions:
Step 1) Push button
Step 2) Receive bacon
Step 3) NomNomNom
software hardware
Friday, June 21, 13
Demo: Erlang powered
LED light and “switch”
(Sorry, no bacon will be auto-dispensed tonight)
Friday, June 21, 13
erl shell
process
switch
process
spawn
receive
ErlangVM
erl shell
process
LED
light
process
spawn
receive
ErlangVM
{messages}
{messages}
Laptop
RaspberryPi
{
{
local network
Friday, June 21, 13
Next steps for the Erlang and
embedded systems
Friday, June 21, 13
A website to watch for progress on embedded erlang
Friday, June 21, 13
Side Project: Dash-dot-com
(a sass-talking web controlled animatronic puppet)
Friday, June 21, 13
How to get Erlang running
on the RaspberryPi?
(It’s incredibly easy, I swear)
Friday, June 21, 13
deb http://binaries.erlang-solutions.com/debian wheezy contrib
If you have the latest Raspbian distro...
add the package location to /etc/apt/sources.list
add the public key for apt-secure
Install the package
wget -O - http://binaries.erlang-solutions.com/debian/
erlang_solutions.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install esl-erlang
From the console, fire up the Erlang REPL
erl
Friday, June 21, 13
Resources
Friday, June 21, 13
• http://www.adafruit.com or http://www.sparkfun.com
• http://www.erlang-embedded.com/
• http://www.erlang-solutions.com/section/132/download-erlang-otp
• https://github.com/omerk/erl-hw/
• http://www.infoq.com/interviews/kilic-erlang-embedded
• http://www.erlang-factory.com/upload/presentations/451/Wiger-
erlangforembedded.pdf
• http://www.1011ltd.com/web/blog/post/embedded_erlang
Friday, June 21, 13
Questions?!
Brian Chamberlain
blchamberlain@gmail.com
@breakpointer
http://breakpointer.co
Friday, June 21, 13

Mais conteúdo relacionado

Mais procurados

Stretagies that fit Emerging Markets
Stretagies that fit Emerging MarketsStretagies that fit Emerging Markets
Stretagies that fit Emerging MarketsRizwan Qamar
 
Strategic Management Process
Strategic Management ProcessStrategic Management Process
Strategic Management ProcessRohit Kumar
 
SM CH 2 VISION AND MISSION ANALYSIS
SM CH 2 VISION AND MISSION ANALYSISSM CH 2 VISION AND MISSION ANALYSIS
SM CH 2 VISION AND MISSION ANALYSISShadina Shah
 
Introduction Strategic Management.pdf
Introduction Strategic Management.pdfIntroduction Strategic Management.pdf
Introduction Strategic Management.pdfzarni64
 
Global Business Today International Business case study chapter 11
Global Business Today International Business case study chapter 11Global Business Today International Business case study chapter 11
Global Business Today International Business case study chapter 11ale7inze
 
Proposal for rolls royce to adapt an erp system
Proposal for rolls royce to adapt an erp systemProposal for rolls royce to adapt an erp system
Proposal for rolls royce to adapt an erp systemKunal Chadha
 
Strategic management ch 05 by wajahat ali
Strategic management ch 05 by wajahat aliStrategic management ch 05 by wajahat ali
Strategic management ch 05 by wajahat aliWajahat Ali
 
ups vs fedex battle case study
ups vs fedex battle case study ups vs fedex battle case study
ups vs fedex battle case study Konok Mondal
 
Costco Case Analysis (Group - E).pptx
Costco Case Analysis (Group - E).pptxCostco Case Analysis (Group - E).pptx
Costco Case Analysis (Group - E).pptxSyedaSharminIslam
 
FXBL pitch deck final (12.6.17)
FXBL pitch deck final (12.6.17)FXBL pitch deck final (12.6.17)
FXBL pitch deck final (12.6.17)Blake Smith
 
Forex bermuda trading strategy system
Forex bermuda trading strategy systemForex bermuda trading strategy system
Forex bermuda trading strategy systemMichael Selim
 
The Founder's Mentality
The Founder's Mentality The Founder's Mentality
The Founder's Mentality GMR Group
 
Distribution center manager performance appraisal
Distribution center manager performance appraisalDistribution center manager performance appraisal
Distribution center manager performance appraisaldollyramie
 
Fed ex warehousing overview
Fed ex warehousing overviewFed ex warehousing overview
Fed ex warehousing overviewsavvyavarma
 
Strategic management - FedEx Corporation
Strategic management - FedEx CorporationStrategic management - FedEx Corporation
Strategic management - FedEx CorporationNguyễn Trọng Tấn
 
Assignment on Strategic Management
Assignment on Strategic ManagementAssignment on Strategic Management
Assignment on Strategic ManagementKamal Hossain
 

Mais procurados (20)

Stretagies that fit Emerging Markets
Stretagies that fit Emerging MarketsStretagies that fit Emerging Markets
Stretagies that fit Emerging Markets
 
Strategic Management Process
Strategic Management ProcessStrategic Management Process
Strategic Management Process
 
SM CH 2 VISION AND MISSION ANALYSIS
SM CH 2 VISION AND MISSION ANALYSISSM CH 2 VISION AND MISSION ANALYSIS
SM CH 2 VISION AND MISSION ANALYSIS
 
Introduction Strategic Management.pdf
Introduction Strategic Management.pdfIntroduction Strategic Management.pdf
Introduction Strategic Management.pdf
 
P R I M A R K
P R I M A R KP R I M A R K
P R I M A R K
 
Global Business Today International Business case study chapter 11
Global Business Today International Business case study chapter 11Global Business Today International Business case study chapter 11
Global Business Today International Business case study chapter 11
 
Proposal for rolls royce to adapt an erp system
Proposal for rolls royce to adapt an erp systemProposal for rolls royce to adapt an erp system
Proposal for rolls royce to adapt an erp system
 
FedEx
FedExFedEx
FedEx
 
Strategic management ch 05 by wajahat ali
Strategic management ch 05 by wajahat aliStrategic management ch 05 by wajahat ali
Strategic management ch 05 by wajahat ali
 
ups vs fedex battle case study
ups vs fedex battle case study ups vs fedex battle case study
ups vs fedex battle case study
 
Prsentation on space matrix
Prsentation on space matrixPrsentation on space matrix
Prsentation on space matrix
 
Costco Case Analysis (Group - E).pptx
Costco Case Analysis (Group - E).pptxCostco Case Analysis (Group - E).pptx
Costco Case Analysis (Group - E).pptx
 
FXBL pitch deck final (12.6.17)
FXBL pitch deck final (12.6.17)FXBL pitch deck final (12.6.17)
FXBL pitch deck final (12.6.17)
 
Forex bermuda trading strategy system
Forex bermuda trading strategy systemForex bermuda trading strategy system
Forex bermuda trading strategy system
 
The Founder's Mentality
The Founder's Mentality The Founder's Mentality
The Founder's Mentality
 
Distribution center manager performance appraisal
Distribution center manager performance appraisalDistribution center manager performance appraisal
Distribution center manager performance appraisal
 
Fed ex warehousing overview
Fed ex warehousing overviewFed ex warehousing overview
Fed ex warehousing overview
 
Strategic management - FedEx Corporation
Strategic management - FedEx CorporationStrategic management - FedEx Corporation
Strategic management - FedEx Corporation
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Assignment on Strategic Management
Assignment on Strategic ManagementAssignment on Strategic Management
Assignment on Strategic Management
 

Destaque

Using Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldUsing Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldFrank Hunleth
 
Building a Network IP Camera using Erlang
Building a Network IP Camera using ErlangBuilding a Network IP Camera using Erlang
Building a Network IP Camera using ErlangFrank Hunleth
 
Embedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBotsEmbedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBotsFrank Hunleth
 
SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...
SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...
SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...EvolvingSocBiz
 
Trabajo gestión del conocimiento (final)
Trabajo gestión del conocimiento (final)Trabajo gestión del conocimiento (final)
Trabajo gestión del conocimiento (final)Fernando Llanos
 
Winning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test CycleWinning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test CycleRusty Klophaus
 
Clojure made-simple - John Stevenson
Clojure made-simple - John StevensonClojure made-simple - John Stevenson
Clojure made-simple - John StevensonJAX London
 
Erlang - Because s**t Happens by Mahesh Paolini-Subramanya
Erlang - Because s**t Happens by Mahesh Paolini-SubramanyaErlang - Because s**t Happens by Mahesh Paolini-Subramanya
Erlang - Because s**t Happens by Mahesh Paolini-SubramanyaHakka Labs
 
Messaging With Erlang And Jabber
Messaging With  Erlang And  JabberMessaging With  Erlang And  Jabber
Messaging With Erlang And Jabberl xf
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)Pavlo Baron
 
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)Howard Lewis Ship
 
NDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsNDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsTorben Hoffmann
 
VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012Eonblast
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Introthnetos
 

Destaque (20)

Using Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled WorldUsing Erlang in an Embedded and Cross-Compiled World
Using Erlang in an Embedded and Cross-Compiled World
 
Building a Network IP Camera using Erlang
Building a Network IP Camera using ErlangBuilding a Network IP Camera using Erlang
Building a Network IP Camera using Erlang
 
Embedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBotsEmbedded Erlang, Nerves, and SumoBots
Embedded Erlang, Nerves, and SumoBots
 
SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...
SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...
SocBiz Talk: Redes sociales corporativas, claves en las organizaciones del fu...
 
Trabajo gestión del conocimiento (final)
Trabajo gestión del conocimiento (final)Trabajo gestión del conocimiento (final)
Trabajo gestión del conocimiento (final)
 
Winning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test CycleWinning the Erlang Edit•Build•Test Cycle
Winning the Erlang Edit•Build•Test Cycle
 
Clojure made-simple - John Stevenson
Clojure made-simple - John StevensonClojure made-simple - John Stevenson
Clojure made-simple - John Stevenson
 
Erlang - Because s**t Happens by Mahesh Paolini-Subramanya
Erlang - Because s**t Happens by Mahesh Paolini-SubramanyaErlang - Because s**t Happens by Mahesh Paolini-Subramanya
Erlang - Because s**t Happens by Mahesh Paolini-Subramanya
 
Messaging With Erlang And Jabber
Messaging With  Erlang And  JabberMessaging With  Erlang And  Jabber
Messaging With Erlang And Jabber
 
High Performance Erlang
High  Performance  ErlangHigh  Performance  Erlang
High Performance Erlang
 
Clojure values
Clojure valuesClojure values
Clojure values
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Elixir talk
Elixir talkElixir talk
Elixir talk
 
Clojure class
Clojure classClojure class
Clojure class
 
20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)20 reasons why we don't need architects (@pavlobaron)
20 reasons why we don't need architects (@pavlobaron)
 
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
Clojure: Functional Concurrency for the JVM (presented at Open Source Bridge)
 
From Perl To Elixir
From Perl To ElixirFrom Perl To Elixir
From Perl To Elixir
 
NDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsNDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business Needs
 
VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
 

Semelhante a Using Erlang on the RaspberryPi to interact with the physical world

Why you should use the Yocto Project
Why you should use the Yocto ProjectWhy you should use the Yocto Project
Why you should use the Yocto Projectrossburton
 
Freesmartphone.org
Freesmartphone.orgFreesmartphone.org
Freesmartphone.orgsudharsh
 
Hacking the Kinect with GAFFTA Day 4
Hacking the Kinect with GAFFTA Day 4Hacking the Kinect with GAFFTA Day 4
Hacking the Kinect with GAFFTA Day 4benDesigning
 
DWF WP2 Jecel Lowcost
DWF WP2 Jecel LowcostDWF WP2 Jecel Lowcost
DWF WP2 Jecel LowcostRon Burger
 
Open Moko And Ubiquitous Computing Presentation
Open Moko And Ubiquitous Computing PresentationOpen Moko And Ubiquitous Computing Presentation
Open Moko And Ubiquitous Computing Presentationridgeway137
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Mandeesh Singh
 
All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015Ryan Vanderwerf
 
Cloudstack collaboration conference Europe - SDN and Devops
Cloudstack collaboration conference Europe - SDN and DevopsCloudstack collaboration conference Europe - SDN and Devops
Cloudstack collaboration conference Europe - SDN and DevopsJohn Willis
 
OLPC presentation in a class on Information Systems Strategy
OLPC presentation in a class on Information Systems StrategyOLPC presentation in a class on Information Systems Strategy
OLPC presentation in a class on Information Systems StrategySameer Verma
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015Janie Clayton
 
An introduction to erlang
An introduction to erlangAn introduction to erlang
An introduction to erlangMirko Bonadei
 
OLPC presentation in a class on Marketing
OLPC presentation in a class on MarketingOLPC presentation in a class on Marketing
OLPC presentation in a class on MarketingSameer Verma
 
Basics of tcp ip
Basics of tcp ipBasics of tcp ip
Basics of tcp ipKumar
 
The Network The Next Frontier for Devops ?
The Network   The Next Frontier for Devops ?The Network   The Next Frontier for Devops ?
The Network The Next Frontier for Devops ?John Willis
 
Sample_HEngineering
Sample_HEngineeringSample_HEngineering
Sample_HEngineeringZachary Job
 
Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?Yauheni Akhotnikau
 

Semelhante a Using Erlang on the RaspberryPi to interact with the physical world (20)

Why you should use the Yocto Project
Why you should use the Yocto ProjectWhy you should use the Yocto Project
Why you should use the Yocto Project
 
Freesmartphone.org
Freesmartphone.orgFreesmartphone.org
Freesmartphone.org
 
Hacking the Kinect with GAFFTA Day 4
Hacking the Kinect with GAFFTA Day 4Hacking the Kinect with GAFFTA Day 4
Hacking the Kinect with GAFFTA Day 4
 
DWF WP2 Jecel Lowcost
DWF WP2 Jecel LowcostDWF WP2 Jecel Lowcost
DWF WP2 Jecel Lowcost
 
about java
about javaabout java
about java
 
Open Moko And Ubiquitous Computing Presentation
Open Moko And Ubiquitous Computing PresentationOpen Moko And Ubiquitous Computing Presentation
Open Moko And Ubiquitous Computing Presentation
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)
 
All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015All your legos are belong to Us Gr8Conf.EU 2015
All your legos are belong to Us Gr8Conf.EU 2015
 
Cloudstack collaboration conference Europe - SDN and Devops
Cloudstack collaboration conference Europe - SDN and DevopsCloudstack collaboration conference Europe - SDN and Devops
Cloudstack collaboration conference Europe - SDN and Devops
 
OLPC presentation in a class on Information Systems Strategy
OLPC presentation in a class on Information Systems StrategyOLPC presentation in a class on Information Systems Strategy
OLPC presentation in a class on Information Systems Strategy
 
LinuxCon Europe 2013
LinuxCon Europe 2013LinuxCon Europe 2013
LinuxCon Europe 2013
 
GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015GPU Programming: Chicago CocoaConf 2015
GPU Programming: Chicago CocoaConf 2015
 
An introduction to erlang
An introduction to erlangAn introduction to erlang
An introduction to erlang
 
Foss Presentation
Foss PresentationFoss Presentation
Foss Presentation
 
OLPC presentation in a class on Marketing
OLPC presentation in a class on MarketingOLPC presentation in a class on Marketing
OLPC presentation in a class on Marketing
 
Routing_Article
Routing_ArticleRouting_Article
Routing_Article
 
Basics of tcp ip
Basics of tcp ipBasics of tcp ip
Basics of tcp ip
 
The Network The Next Frontier for Devops ?
The Network   The Next Frontier for Devops ?The Network   The Next Frontier for Devops ?
The Network The Next Frontier for Devops ?
 
Sample_HEngineering
Sample_HEngineeringSample_HEngineering
Sample_HEngineering
 
Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?Actor Model and C++: what, why and how?
Actor Model and C++: what, why and how?
 

Último

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Último (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Using Erlang on the RaspberryPi to interact with the physical world

  • 1. Have some Erlang on your RaspberryPi (Using Erlang in embedded linux systems) Friday, June 21, 13
  • 2. But first, some context (i.e. Why running Erlang on the RaspberryPi might be interesting...) Friday, June 21, 13
  • 3. nowyears agodecades agoa long time ago (in a galaxy far, far away...) The progression mainframe desktop laptop smart phone tablet ? We all are aware of the inevitable progression towards more diverse, smaller, and powerful software enabled devices. It is pretty obvious. In addition to this, it’s clear that devices are designed around certain modes of interactions and interaction duration. However, there is a new space in consumer devices which allows for entirely different ways of interaction (and in some cases no interaction at all). Friday, June 21, 13
  • 4. The quantified self/ internet of things? FitBit/Fuel Band WiThings BodyScale ScoutAlarm SmartThings Pebble Watch Philips Hue/ Blink(1) NinjaBlocks Belkin WeMo Switch This new space is based on the idea that devices can be passive observers of human behavior, the environment, or other sources of data. This is the central idea of the quantified self/internet of things. Initially devices are focused around health and activity.There will be an increasing growth in other areas. Friday, June 21, 13
  • 5. Games Information Environment Security Health The quantified self is part of the “Internet of Things” There are more and more devices entering the market every month. To date, a large number have been focused on health (e.g. FitBit, Nike Fuel) and security (e.g. ScoutAlarm). Over time these devices will enter other aspects of human activity. Some sense and control the home environment (e.g. Nest), others provide information from internet services (e.g. Philips Hue), and some might be purely for entertainment and a platform for games. Friday, June 21, 13
  • 6. In addition to lots of interesting consumer products. There are lots of new and interesting hardware platforms. Almost all run embedded linux. Friday, June 21, 13
  • 7. What are people doing with these boards? Friday, June 21, 13
  • 10. Build your own Google Glass perhaps?... Friday, June 21, 13
  • 11. Ok, but what does this have to do with Erlang? Friday, June 21, 13
  • 12. Small, cheap hardware Linux = Lots of internet connected, linux powered, small, cheap, embedded devices + Expensive, big hardware Erlang = A massively scaleable, fault tolerant system which runs on embedded systems + The Internet + The phone network + Well, there are some parallels between these “internet of” devices and Erlang Friday, June 21, 13
  • 13. What is Erlang? (hint: It’s pronounced “Air-lang” not “Errr-lang”) Friday, June 21, 13
  • 14. • Creating and destroying processes is very fast • Sending messages between processes is very fast • Processes behave the same way on all operating systems • We can have very large numbers of processes (1,000’s to 100,000’s) • Processes share no memory and are completely independent • The ONLY way for processes to interact is through message passing Like some languages are object oriented, Erlang is “process oriented”. For example, in Erlang: Erlang is a general purpose concurrent programming language and runtime system. It is a functional language which has strict evaluation, single assignment, and dynamic typing. Originally designed by Ericsson to support distributed, fault-tolerant, soft-real time, non-stop applications. [from wikipedia] Friday, June 21, 13
  • 15. This is a sample of code from the demo portion of this presentation. It defines a module called “net_led” which controls an LED over the local network. Erlang code is composed into modules which expose certain functions via the “export” directive. In this module, I export methods to spawn the LED light process on one machine.Then have a switch function which controls the light via a different process running on a separate machine. In the sample below there are two functions defined,“decouple” and “switch.” These take parameters about the LED light process and then send messages to that process.The “!” is the message send operator. Full source can be found here: https://gist.github.com/breakpointer/5799847 Friday, June 21, 13
  • 16. What does Erlang look like? Friday, June 21, 13
  • 17. Object Oriented Process Oriented Ruby Erlang class Foo def bar puts “hello!” end end Definition -module(foo). -export([bar/0]). bar() -> io:format(‘hello!~n’,[]). Instantiation >f = Foo.new >f.bar #=> hello! >foo:bar(). hello! >F = spawn(foo, bar, []). hello! <0.34.0> Simple comparison of Ruby to Erlang Orientation Friday, June 21, 13
  • 18. How does one use Erlang? Friday, June 21, 13
  • 19. process process spawn receive ErlangVM process process spawn spawn {messages} receive A typical application will use many processes, and message passing for inter-process communications Friday, June 21, 13
  • 20. How is Erlang used on the RaspberryPi? Friday, June 21, 13
  • 21. The components of the RaspberryPi Your interface to the world! Friday, June 21, 13
  • 23. Accessing the GPIO pins through Linux SysFs OS mapping location of pins: Exporting a pin for use: Reading the value of a pin as that pin is toggled high/low: Friday, June 21, 13
  • 24. Imagine a product called The Baconator* How might this system be modeled? (*patent/trademark/startup pending...) Friday, June 21, 13
  • 25. SysFs Dispense process {messages} receive Make Bacon process Button process{messages} receive GPIO io:Read io:Write The Baconator! A.K.A. the most awesome bacon dispensing machine in the world! Bacon supervisor Instructions: Step 1) Push button Step 2) Receive bacon Step 3) NomNomNom software hardware Friday, June 21, 13
  • 26. Demo: Erlang powered LED light and “switch” (Sorry, no bacon will be auto-dispensed tonight) Friday, June 21, 13
  • 28. Next steps for the Erlang and embedded systems Friday, June 21, 13
  • 29. A website to watch for progress on embedded erlang Friday, June 21, 13
  • 30. Side Project: Dash-dot-com (a sass-talking web controlled animatronic puppet) Friday, June 21, 13
  • 31. How to get Erlang running on the RaspberryPi? (It’s incredibly easy, I swear) Friday, June 21, 13
  • 32. deb http://binaries.erlang-solutions.com/debian wheezy contrib If you have the latest Raspbian distro... add the package location to /etc/apt/sources.list add the public key for apt-secure Install the package wget -O - http://binaries.erlang-solutions.com/debian/ erlang_solutions.asc | sudo apt-key add - sudo apt-get update sudo apt-get install esl-erlang From the console, fire up the Erlang REPL erl Friday, June 21, 13
  • 34. • http://www.adafruit.com or http://www.sparkfun.com • http://www.erlang-embedded.com/ • http://www.erlang-solutions.com/section/132/download-erlang-otp • https://github.com/omerk/erl-hw/ • http://www.infoq.com/interviews/kilic-erlang-embedded • http://www.erlang-factory.com/upload/presentations/451/Wiger- erlangforembedded.pdf • http://www.1011ltd.com/web/blog/post/embedded_erlang Friday, June 21, 13