30
DIY Wireless Sensor Networks 18 Nov 2013, 9:00am, Dreamforce Reid Carlberg, Salesforce.com, Director - Evangelism @ReidCarlberg (Link) Update: 30 Jan 2014 (a)

IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Embed Size (px)

DESCRIPTION

Follow along as we make a Wireless Sensor Network using the Arduino, XBee and a free Salesforce.com Developer Edition.

Citation preview

Page 1: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

DIY Wireless Sensor Networks18 Nov 2013, 9:00am, Dreamforce

Reid Carlberg, Salesforce.com, Director - Evangelism

@ReidCarlberg (Link)

Update: 30 Jan 2014 (a)

Page 2: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Safe harborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Page 3: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

REST API

Streaming API

Node JS

XBee

http://github.com/ReidCarlberg/DF13_WirelessSensorNetwork

We’re Building a Wireless Sensor Network

Page 4: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Hands on making is the best way to learn connected device app development.

Page 5: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Arduino – Open Source Prototyping Board.

ATmega328 Controller

32k of RAM

Easy to program (~C++)

No SSL.Arduino Classes here Tues & Thurs

Page 6: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

XBee

Cheap, easy

Serial communication

Self configuringStop by the Etherios table to learn more!

Page 7: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Raspberry Pi

Single board computer

Education focused

Runs Linux/Python/Node

Network Aware

SSL Capable

Page 8: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Salesforce Platform

APIs make it dead easy

Free developer edition

We all know how to use it

Page 9: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Bill Of Materials

Arduino Experimenter’s Kit: $85

Arduino XBee Shield: $25

XBee Pro Series 1 (2): $76

Raspberry Pi Starter Pack: $105

Xbee Adapter Kit: $10

Salesforce Developer Edition: FREE

9V Battery: $2

Total: $303

Page 10: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Breadboards

+/- conduct up and down.

#’s conduct side to side

A,b,c,d,e, etc don’t matterVoltage goes to + (red)

Ground goes to – (blue)

Put component leads in different #

rows – up and down, not side to side

Page 11: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Wires

Red or Orange – Positive

Black or Green – Negative

Otherwise doesn’t matter

Page 12: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Polarity Sometimes Matters

Positive is voltage in.

Negative is voltage out.

Matters on: LED, TMP36

Doesn’t matter on: RESISTORS,

PIEZO

On an LED, the long lead

is POSITIVE.

Page 13: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Know Your Voltage

3.3V or 5.0V

Everything today is 5.0V

safe.

**Connect to 5V

Page 14: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Get Everything Out

It’s in a bag on top.

You can dig through the

explorer kit later.

Page 15: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Assemble the Shield

Stack the wireless shield

on top of the Arduino.

Be careful not to bend any

pins!

Page 16: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Add the XBee

Don’t force it.

Make sure all the pins are

in.

Page 17: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Add Components to Breadboard

LED: Positive lead up

TMP36: Flat side, right.

Put things in the F column

toward the center.

Positive Leads

+ + +

Page 18: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Add Components to Breadboard (optional view)

“Fritzing” Style illustration

Note the vertical bars on

right – polarity reversed!Careful:

RED & BLUEREVERSED

Page 19: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Add Resistors to Negative LED leads

Resistors connect

negative LED leads with

GROUND.

Remember Fritzing may

not match your board!

Page 20: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Connect Power

+/Red to 5V

-/Blue to Ground

Page 21: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Connect Positive LED leads to Arduino

Purple LED to Digital 2

Green LED to Digital 3

Red LED to Digital 4

Page 22: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Connect Piezo Speaker

Top pin to Arduino Digital 5

Bottom pin to to -/Blue

(Ground)

Page 23: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Connect TMP36 – PLEASE DOUBLE CHECK

Middle to A0

Top to - / Blue (Ground)

Bottom to + / Red

Polarity Matters here –

reversed wiring will result in a

VERY HOT TMP36.

Page 24: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Plug In The Battery!

Purple & Green Light = initializing.

Purple (flashing) = Xbee activity

Green = ready

Red = alarm

Disco Lights = DISCO

If you smell something burning your

TMP36 is wired wrong. Disconnect your

battery, wait for it to cool & try again.

Page 25: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Raspberry Pi in action

Connected to the network.

GPIO cable to breadboard

XBee to TTYAMA0

Page 26: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Org Configuration

Apex REST Streaming API

Page 27: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Communication Protocol

To Arduino

^Address:Message\n

Address = 2 char

Message = 5 char

Specific Unit Ex: ^A1:ALARM\n

All Units Ex: ^00:DISCO\n

To Raspberry Pi

REST format (single line)

{

“addr”:”A1”,

“msg”:”hello”,

“detail”:”tmp36,alarm,disco”

}

Page 28: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

System Flow

Page 29: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

Lessons Learned

Prototype, not production.

Test with a meaningful # of devices.

Easy to set up race conditions.

Arduino is limited.

Simple communication protocols are better.

Page 30: IoT Projects - DIY Wireless Sensor Network at Dreamforce 2013 #DevZoneLab

@ReidCarlberg (Link)http://github.com/ReidCarlberg/DF13_WirelessSensorNetwork