Click here to Skip to main content
15,880,796 members
Articles / Internet of Things

(Stage 2 ) Getting started with Spark Core

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
10 Nov 2014CPOL7 min read 24.6K   5   1
Getting started with Spark Core,setup a guide for everyone new.

Introduction

The aim of this article is to highlight how easy it is for any programmer to step into the world of lot and hardware engineering through an uncomplicated out of the box microcontroller known as the Spark core.

Often novice programmers like myself do not make the leap from software engineering to hardware engineering deu to the steep setup process of Microcontrollers and associated costs of making the devices internet ready.

Unlike the traditional Arduino Uno which requires additional hardware modules such as wifi shields to connect to the internet ,the sparkcore has an embeded wifi chip which makes it an innovative microcontroller that needs to be Highlighted as it is Internet ready out of the box./p>

This article will simply explain how to setup and connect the Spark Microcontroller to the internet and is meant for beginners. It is intended to make the activation ,setup configuration and use as seemless as possible in in conjunction with the Android platform .

This artical within the scope of stage 2 connectivity will Outline :

  1. Specifications of the Spark microcontroller
  2. Seemless activation and setup of the Spark microcontroller using wifi
  3. How to flash the spark core via its web Ide , using the Arduino coding syntax.

We apologise in advanced to experienced experts that may be expecting Cli and additional tinkering of the Sparkcore in comparison with arduino ,but we write this article to encourage simplicity and ease of use and connectivity for any one and everyone.

Back Ground on Internet of Things

In a nutshell The Internet of things is a innovative revolution that allows one to connect embeded devices to the internet :

  1. Interface virtual code, with numerous physical hardware that have the capacity to share data
  2. Execute remote commands
  3. Deliver output through a networked environment via the internet using Micro processors and controllers.
  4. Create Wearable technology

In the fields of :

  1. Information and Technology
  2. Neural network development
  3. Data sampling
  4. Education
  5. Science
  6. Medicine
  7. Sociology Etc

What is the SPark Core ?

The spark core is a versatile (802.11 b/g) wifi enabled ARM 32-bit Cortex micro controller available for $39.00.

Featuring USART,SPI and I2C interfaces.
An ARM 32-bit Cortex-M3 CPU with a 72Mhz operating frequency.
128KB of Flash memory for firmware storage and 20KB of SRAM.

which you can use to connect Digital and Analog hardware Via 8 Digital and 8 Analog GPIO pins.

Examples of such hardware include:

  • Sensors
  • Switchers
  • Motors
  • actuators
  • buzzers
  • Leds
  • speakers
  • Potentio meters
  • and other shields too.
  schemetics

Manufacturers Device Specifications

Programming Language Syntax

  • You can program the core using Arduino, C/C++ or even ARM assembly.

Spark Core

  • 8 digital I/O pins, 8 analog I/O pins
  • 8 PWM pins; UART (Serial), SPI, I2C, and JTAG peripherals available
  • Programmed wirelessly (through Spark Cloud), via USB or JTAG
  • 3.3V DC supply voltage (on board power regulator); can be powered by USB Micro
  • 100mA typical current consumption; 300mA peak consumption (during transmit events)
  • 2MB of external flash; EEPROM supplied by CC3000

Microcontroller

  • STM32F103 microcontroller
  • ARM Cortex M3 architecture
  • 32-bit 72Mhz processor
  • 128KB of Flash, 20KB of RAM

Wi-Fi module

  • Texas Instruments SimpleLink CC3000
  • 802.11b/g
  • Range of 100-300 feet

schemetics

Getting started Connecting and Configuring Spark Core Microcontoller over WIFI

SUDO STEPS

  1. Plug the included USB cable into the Spark Core and your computer. The Core should start blinking blue.
  2. Download and Install the Spark core Android App on your android phone or tablet from https://play.google.com/store/apps/details?id=io.spark.core.android
  3. Register your email address and Device on the Spark cloud via Adroid app.
  4. Access the Web IDE https://www.spark.io/login and CODE your First instruction set in arduino syntax in the web ide.
  5. Connect sensors to Analog and Digital pins or to bread board.
  6. Flash your devices micro controller via the web ide with firmware that created in step 4 and you are good to go.
  7. You can use the Spark io android app in step 2 that you downloaded to remotely controll each pins on and off state and read and write parameters.
  8. Very simple

Step 1: Power the Core

Plug the included USB cable into the Spark Core and your computer.

The Core should start blinking blue!

If it doesnt blink blue ,press and hold the mode button until the light turns blue("The button on the left") Now put your spark core device aside leaving it still connected to the USB.

schemetics

Step 2: Install the Android App

If you have an Android tablet or phone install the Spark core companion APP from google play.

https://play.google.com/store/apps/details?id=io.spark.core.android

Fill in your email address and password and click register,It should take 10-30 seconds to go to the next screen

schemetics

In the SSID field type in your Home network SSID That you use to connect to the Internet with and its Password and click connect. Please Ensure the correct credentials have been entered

schemetics

Now Focus your attention to the led light on the spark Core It should go through a sequence of flashes.

Remember when you first plugged in the USB cable and the light turned blue,that was when it began listening for wifi credentials.

What the color of light and its blink speed means:

Step 4 :Loging into the Web Ide !

  1. Blinking blue: Listening for Wi-Fi credentials
  2. Solid blue: Getting Wi-Fi info from app
  3. Blinking green: Connecting to the Wi-Fi network
  4. Blinking cyan: Connecting to the Spark Cloud
  5. Blinking magenta: Updating to the newest firmware
  6. Breathing cyan: Connected! (slow light pulse)

If all goes well,your device led light should be breathing cyan and your android app should present you with the screen below

The Spark app should now be on the Tinker screen!

By default the embeded Led light on your spark device is connected to Pin D7 so let us test to see if the spark device is indeed connected to the internet and whether it can receive remote commands.

Lets begin our first test !

  1. Tap D7 then tap digitalWrite in the popup. Now when you tap the D7 circle the tiny blue LED on your spark microcontroller should turn on! In the screen shot below Digital pin 0 has been selected indicated by the green circle surrounding D0. All the other pins are greyed out indicating you have not selected them.

    schemetics

    Congratulations Your device is now Operational!

  • Simply Navigate to: https://www.spark.io/login

    schemetics

  • Login with your email address and password.
  • Once logged in you should see the following screen
  • Type in your arduino code and than click on the flash button to flash your Spark Micro controller over the internet.
  • Its that easy, At this point i would like to let you know that i reside on a small island in the middle of the pacific ocean,we dont have access to much electronics so for the purpouse of this article i will just write a loop that flashes the led connected by default pin D7.

Writing flashable code in the web IDE in arduino syntax

// Program to blink original embeded LED connected to pin D7


// We name pin D7 as defaultled led
int defaultled = D7;


// This routine runs only once upon reset
void setup()
{
  // Initialize D7 pin as output
  pinMode(defaultled, OUTPUT);
  
}

// This routine loops forever
void loop()
{
  digitalWrite(defaultled, HIGH);   // Turn ON the LED
  delay(2000);               // Wait for 2000mS = 2 second
  digitalWrite(defaultled, LOW);    // Turn OFF the LED
  delay(1000);               // Wait for 1 second
   digitalWrite(defaultled, HIGH);   // Turn ON the LED
  delay(500);               // Wait for 500mS = 1/2 a second
  digitalWrite(defaultled, LOW);    // Turn OFF the LED
  delay(1000);               // Wait for 1 second
}

Once you have finished writing your code in the web IDE click on the flash icon to upload your insrtuction set

schemetics

Lets look at another example this one is provided by spark.io

// Program to blink a  LED connected via bred board to pin D0


// We name pin D0 as myled
int myled = D0;


// This routine runs only once upon reset
void setup()
{
  // Initialize D0 pin as output
  pinMode(myled, OUTPUT);
  
}

// This routine loops forever
void loop()
{
  digitalWrite(myled, HIGH);   // Turn ON the LED
  delay(2000);               // Wait for 2000mS = 2 second
  digitalWrite(myled, LOW);    // Turn OFF the LED
  delay(1000);               // Wait for 1 second
   digitalWrite(myled, HIGH);   // Turn ON the LED
  delay(500);               // Wait for 500mS = 1/2 a second
  digitalWrite(myled, LOW);    // Turn OFF the LED
  delay(1000);               // Wait for 1 second
}

schemetics

Once you have finished writing your code in the web IDE click on the flash icon to upload your insrtuction set

Important points to note

Windows Device drivers(optional)

Baudrate: 9600
Data Bits: 8
Parity: none
Stop Bits: 1

Power supply

You can connect an external power supply Via the V in pin that can range from 3.6V to 6.0V DC but its recommended to power the Core via the USB port or usa a 3.6V LiPo battery.

PINS AND I/O

The board has a total of 18 IO pins that operate at 3.3V. 8 analog pins labled A0,A1,A2,A3,A4,A5,A6,A7 on the left hand side of the board and has 8 Digital pins labled D0,D1,D2,D3,D4,D5,D6,D7 on the Right hand side of the board The pins labeled TX and RX are preset to serial.

Analog Inputs

Pins A0 to A7 can be set up as analog inputs and can measure voltages of upto 3.3V The pins can be read using analogRead() function and it will return a 12bit value.

Conclusion

Thank you very much for reading this article on how to setup development environment and flash your first code to the spark core intended for people who are new to coding and engineering.

References

https://www.spark.io/

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Fiji Fiji
Prilvesh is a Front end and Back end developer who holds certificates from Google , Microsoft and Oracle who Specializes in Web development and automation using Python and PHP.
He has experience designing developing and building Api's and secure platforms that can handle enterprise level transactions with encryption.

He often simplifies complex problems and solves them through processes and procedures that are efficient and easily understandable even by non programmers including management.

Comments and Discussions

 
SuggestionSuggestion Pin
Ranjan.D23-Nov-14 12:22
professionalRanjan.D23-Nov-14 12:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.