Upload
tinamoussteve
View
43
Download
0
Embed Size (px)
Citation preview
BuildingInternet Connected Things with theParticle
PhotonStephen Harrison
@TinamousSteve [email protected]
@TinamousSteve - www.Tinamous.com
About Me• Freelance Software Developer (C#)• Founder of Tinamous.com• An Internet of Things platform• Integrates really nicely with the Particle.io API
• Recently launched ThingySticks.com• Open source hardware based on the Photon/Electron.• Boards are for sale on Tindie
• Rubbish at PowerPoint
@TinamousSteve - www.Tinamous.com
The Plan…• Make some stuff Steve!
• Pizza Delivery Indicator Light
• Bring a Photon into the world• 10 Print “Hello World”• Particle Cloud Functions• 20 Print “Hello Interwebz”• Complete the Pizza Delivery Indicator• In-depth hardware• Some other Things I’ve made with the Photon
@TinamousSteve - www.Tinamous.com
Make some stuff Steve!• PDD – Pizza Driven Development.• Lets make an Internet Connected Pizza Delivery
Indicator:• Tower of lights• Particle Relay Shield• Photon• 12V DC Power Supply• Victim Volunteer.
@TinamousSteve - www.Tinamous.com
Pizza Delivery Indicator• Tower of Lights needs 12V to work.• A Relay is an Electro-Mechanical switch that
isolates the logic from the nasty:• High voltage (DON’T PLAY WITH MAINS!)• High current• AC or DC
• 1 Relay per light• Common Ground
@TinamousSteve - www.Tinamous.com
Relay Wiring
@TinamousSteve - www.Tinamous.com
What is a Photon?• A small micro-controller….• With Wi-Fi on-board • Made By Particle• Connects to the Particle Cloud• Saves us from MQTT(s), HTTP(s), etc…
• Programmed like an Arduino
@TinamousSteve - www.Tinamous.com
@TinamousSteve - www.Tinamous.com
Bring a Photon into the world AKA: The demo guaranteed to go wrong!
• Register at Particle.io and download the App• Unbox (the difficult part)• Connect USB Power lead• Add the Photon in the App
@TinamousSteve - www.Tinamous.com
Add the Photon
@TinamousSteve - www.Tinamous.com
Select the Photon
@TinamousSteve - www.Tinamous.com
Select your Wi-Fi access point
@TinamousSteve - www.Tinamous.com
Let the magic happen…
@TinamousSteve - www.Tinamous.com
Tada….
@TinamousSteve - www.Tinamous.com
Hello Tinker
@TinamousSteve - www.Tinamous.com
Build.Particle.io
@TinamousSteve - www.Tinamous.com
10 Print “Hello World”
@TinamousSteve - www.Tinamous.com
The Real Magic: Particle Cloud• Particle.publish()
• Publish events with data• Rate limited (1Hz) – Be kind to Particle• 255 bytes max.• Public by default
• Particle.subscribe()• Photon listens for events from Particle.publish()• Public by default • MY_DEVICES only works with private publish.
• Particle.variable()• Variables that can be read via the internet
• Particle.function()• Internet accessible code
@TinamousSteve - www.Tinamous.com
20 Print “Hello Interwebz”
@TinamousSteve - www.Tinamous.com
Pizza Delivery IndicatorComplete the project.• Flash the code!• Uses the Relay Shield Library• Exposes Particle.functions:• NoPizza• PizzaIsHere• LetsEat
Test the Lights:Tinamous Integration
@TinamousSteve - www.Tinamous.com
@TinamousSteve - www.Tinamous.com
Pizza Indicator Setup
@TinamousSteve - www.Tinamous.com
Particle functions and subscriptions
@TinamousSteve - www.Tinamous.com
Helpers
@TinamousSteve - www.Tinamous.com
Button Code
@TinamousSteve - www.Tinamous.com
Safe ModeProbably the most useful thing you will learn this evening
• Hold BOTH buttons down• Release RESET• Wait for the LED to blink MAGENTA• Release SETUP
From: https://docs.particle.io/guide/getting-started/modes/photon/
@TinamousSteve - www.Tinamous.com
Input modes
@TinamousSteve - www.Tinamous.com
Pro-tip - Be careful when Flashing!
It’s very easy flash the wrong device!!!
Also, don’t use google image search of something funny to add to a “Flashing” slide.
@TinamousSteve - www.Tinamous.com
In-depth HardwareWi-Fi on-board24 “Pin” device (With and without headers)STM32 (ARM Cortex M3) 120MHz, 1M Flash, 128k RAM2047 bytes “EEPROM”18 “Digital” GPIO, 9 PWM-able. 20mA per pin max.8 ADC inputs (12 bit, 0-4095, 0.8mv)2 DACs2 SPI & 1x I2CI2S & CANUSB2x SerialFCC & CE certified.80mA @ 5V. 80uA Deep sleep.3x power options (3v3, Vin, USB)Cost: About $19 + …See also P0 and P1From: https://docs.particle.io/datasheets/photon-datasheet/
@TinamousSteve - www.Tinamous.com
Bonus Features• Analog input (A0-A7) can be used as GPIO (digital in/out)• DAC and WKP are also analog in (A6 & A7).• Tx and Rx can be used for digital IO and PWM.• USB connection is a serial port – great for debugging.• You can control the RGB LED – also great for debugging.• Up-to 5 Wi-Fi credentials stored. • Soft AP – user configurable.• Automatic/Semi and Manual cloud connect.• Most pins 5v tolerant (Not Analog inputs!)
@TinamousSteve - www.Tinamous.com
Bonus: The ElectronCellular. 2G or 3G.
Avoid 2G – Slow, wont be around for long, not much $$ saving.
Top 24 pins match the Photon.
Additional 12 pins for extra IO.
Battery and on-board charger .
Basic plan $2.99/month per device.
Most Photon code can run on the Electron.
Cost: $69 + …
From: https://docs.particle.io/datasheets/electron-datasheet/
@TinamousSteve - www.Tinamous.com
Some Things I’ve made:Environment Sensor
@TinamousSteve - www.Tinamous.com
Some Things I’ve made:Thermocouple
@TinamousSteve - www.Tinamous.com
Some Things I’ve made:Filament Storage Box
https://github.com/Tinamous/HumidityMonitor
@TinamousSteve - www.Tinamous.com
Some Things I’ve made:Low Voltage Lighting Controller
https://www.hackster.io/TinamousSteve/iot-low-voltage-lighting-controller-e7957d
@TinamousSteve - www.Tinamous.com
Some Things I’ve made:Jedi Light Switch
@TinamousSteve - www.Tinamous.com
Some Things I’ve made:Roll Pole
@TinamousSteve - www.Tinamous.com
What I (probably) didn’t cover• Local IDE.• Node command line util• Huge parts of the language• Low power modes• Webhooks• IFTTT integration• Azure integration
@TinamousSteve - www.Tinamous.com
Useful Resources• Particle.io• SparkFun.com and Adafruit.com• CoolComponents.co.uk and skpang.co.uk – UK Suppliers.• DirtyPcbs.com and OSHPark.com• hackster.io/tinamoussteve • Tindie.com• Tinamous.com • ThingySticks.com • @TinamousSteve• Lets go Green!!! Bzzzzzz• Thank You!!!!