+ All Categories
Home > Education > Spark - pre-#startathon Workshop 2014

Spark - pre-#startathon Workshop 2014

Date post: 27-Jun-2015
Category:
Upload: kenneth-lim
View: 176 times
Download: 0 times
Share this document with a friend
Description:
This slides are used to share about the basics of Spark and how to setup and perform simple functions like: 1.) Setup wifi 2.) Flash an app via OTA 3.) Use Spark.variable() and Spark.function
Popular Tags:
38
1 08 September 2014 pre-#startathon workshop @kennethlimcp Getting to know Spark :)
Transcript
Page 1: Spark - pre-#startathon Workshop 2014

1

08 September 2014pre-#startathon workshop!@kennethlimcp

Getting to know Spark :)

Page 2: Spark - pre-#startathon Workshop 2014

Who is Spark?

• Started off as Spark Socket, an unsuccessful Kickstarter project

• 2nd Kickstarter success last June 2013

• Successful company incubated by HAXLR8R, Shenzhen, China

• Currently a Series A company with US4.9 million funding

2

Page 3: Spark - pre-#startathon Workshop 2014

Arduino Compatibility

is compatible

!= !!!

BUT

3

Page 4: Spark - pre-#startathon Workshop 2014

Product Comparison

uC Cortex M3 ATMega32u4Clock Speed 72Mhz 16Mhz

Flash Memory 128Kb 32KbDigital I/O 8 20Analog I/0 8 12Ethernet Wireless Wireless + Wired

Price US$39 US$67

4

Page 5: Spark - pre-#startathon Workshop 2014

Spark Online Web IDE

5

Page 6: Spark - pre-#startathon Workshop 2014

Create a new account

• Go to: http://spark.io/BUILD

6

Page 7: Spark - pre-#startathon Workshop 2014

Unboxing your Core for the 1st time

7

Page 8: Spark - pre-#startathon Workshop 2014
Page 9: Spark - pre-#startathon Workshop 2014

Troubleshoot by colour

Breathing Blue: Wifi OnBlinking Green: Connecting to Wifi Breathing Cyan: Connected to Spark cloudBlinking Blue : Listening ModeBlinking Yellow: DFU Mode Blinking White: Factory reset Blinking Red: SOS panic code Blinking Yellow/Red: Bad keys

Page 10: Spark - pre-#startathon Workshop 2014

Factory Reset

• Press BOTH the RST and MODE button

• hold onto the MODE button for 10 seconds

!

!

** This always works…

Page 11: Spark - pre-#startathon Workshop 2014

Listening Mode

• To configure Wifi Credentials

• Either via Mobile App or USB

!

Solid blue: Credentials capturedFlashing green: Connecting to Wi-Fi networkFlashing cyan: Connecting to Spark CloudBreathing cyan: Connected to Spark Cloud

!

!

**Try to do one core at a time in a congested venue

11

Page 12: Spark - pre-#startathon Workshop 2014

Flash your first app (wirelessly)

Page 13: Spark - pre-#startathon Workshop 2014

Spark IDE

• Check for Core status

• Use LED example to perform OTA flashing

Page 14: Spark - pre-#startathon Workshop 2014

Adding Spark.variable()

Page 15: Spark - pre-#startathon Workshop 2014

Spark.variable()

• Allows you to read parameters from the core itself

• eg. Temperature, battery voltage, motor status etc.

• Add in the following:

double temperature = 36.95;Spark.variable("temp", &temperature, DOUBLE);

• Open Chrome and call the following URL:https://api.spark.io/v1/devices/core_id/temp?access_token=your_token

Page 16: Spark - pre-#startathon Workshop 2014

Adding Spark.function()

Page 17: Spark - pre-#startathon Workshop 2014

Spark.function()

• Calls a corresponding code function registered to the Spark.function name

• Allows you to execute a command remotely via API call

Add in the following:

Spark.function("ledlight",ledlight);

• Open Chrome and call the following URL:

http://jflasher.github.io/spark-helper/

Page 18: Spark - pre-#startathon Workshop 2014

Spark.publish() demonstration

Page 19: Spark - pre-#startathon Workshop 2014

Using Spark-CLI A command-line interface for Spark

Page 20: Spark - pre-#startathon Workshop 2014

Why Spark-Cli?

• Wraps all the long commands into simple syntax

• Saves time and allows code development locally

• Flashes code faster via USB

• It’s fun to learn! :)

Page 21: Spark - pre-#startathon Workshop 2014

Spark-CLI

• Let’s do the same activity using Spark-Cli!

spark setup

spark list

spark get core_id temperature

spark call core_id ledlight on/off

Page 22: Spark - pre-#startathon Workshop 2014

System Mode Controlling your own connection!

Page 23: Spark - pre-#startathon Workshop 2014

System Mode

• This is important to know! Especially in a #startathon context

• 3 Modes available:

AUTOMATIC, SEMI_AUTOMATIC, MANUAL

• Most user will require “SEMI_AUTOMATIC” for user code to run even without a Wifi connection

Syntax: SYSTEM_MODE(MODE_SELECTION);

Page 24: Spark - pre-#startathon Workshop 2014

DFU Utility Upload/download to Spark core via USB

Page 25: Spark - pre-#startathon Workshop 2014

DFU Utility

• Built into Spark-Cli tool as well

• Allows us to download firmware binary file via USB

• Access to the entire memory space in the internal and external flash

Page 26: Spark - pre-#startathon Workshop 2014

DFU Utility Hands-on Time!

Page 27: Spark - pre-#startathon Workshop 2014

DFU Mode

• Press BOTH the RST and MODE button

• Release the MODE button when the core starts flashing Yellow

27

Page 28: Spark - pre-#startathon Workshop 2014

Cool Spark-powered Projects Look ma, no wires!

Page 29: Spark - pre-#startathon Workshop 2014

Open Energy Monitoring

Page 30: Spark - pre-#startathon Workshop 2014

Beehive Monitoring

Page 31: Spark - pre-#startathon Workshop 2014

Robotic Rover

Page 32: Spark - pre-#startathon Workshop 2014

Mr Wolowitz Lamp

Page 33: Spark - pre-#startathon Workshop 2014

Coffee Machine hack!

Page 34: Spark - pre-#startathon Workshop 2014

RFID Smart Locker

Page 35: Spark - pre-#startathon Workshop 2014

Just for fun!

Page 36: Spark - pre-#startathon Workshop 2014

Questions?

Page 37: Spark - pre-#startathon Workshop 2014

Additional Resources

• API Helper GUI - http://jflasher.github.io/spark-helper

• Spark-CLI (Mac): https://github.com/spark/spark-cli#installing

• Spark-CLI (Win): https://community.spark.io/t/tutorial-spark-cli-on-windows-05-july-2014/3112

• Documentation: http://docs.spark.io/

Page 38: Spark - pre-#startathon Workshop 2014

Thank you :)

@kennethlimcp


Recommended