Date post: | 27-Jun-2015 |
Category: |
Education |
Upload: | kenneth-lim |
View: | 176 times |
Download: | 0 times |
1
08 September 2014pre-#startathon workshop!@kennethlimcp
Getting to know Spark :)
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
Arduino Compatibility
is compatible
!= !!!
BUT
3
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
Spark Online Web IDE
5
Unboxing your Core for the 1st time
7
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
Factory Reset
• Press BOTH the RST and MODE button
• hold onto the MODE button for 10 seconds
!
!
** This always works…
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
Flash your first app (wirelessly)
Spark IDE
• Check for Core status
• Use LED example to perform OTA flashing
Adding Spark.variable()
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
Adding Spark.function()
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/
Spark.publish() demonstration
Using Spark-CLI A command-line interface for Spark
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! :)
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
System Mode Controlling your own connection!
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);
DFU Utility Upload/download to Spark core via USB
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
DFU Utility Hands-on Time!
DFU Mode
• Press BOTH the RST and MODE button
• Release the MODE button when the core starts flashing Yellow
27
Cool Spark-powered Projects Look ma, no wires!
Open Energy Monitoring
Beehive Monitoring
Robotic Rover
Mr Wolowitz Lamp
Coffee Machine hack!
RFID Smart Locker
Just for fun!
Questions?
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/
Thank you :)
@kennethlimcp