IoT Tech Day Coding Mojo slides. Utrecht, April 2016
-
Upload
mark-west -
Category
Technology
-
view
355 -
download
0
Transcript of IoT Tech Day Coding Mojo slides. Utrecht, April 2016
“AnyapplicationthatcanbewritteninJavaScript,willeventuallybewrittenin
JavaScript”
JamesAtwood(founder, stackoverflow.com)
NodeBot RoverComponentOverviewHardware
Computer
MicroController
Camera
Chassis
Pan&Tilt
Software
Speech
RobotControl
WebServer
Integration
Other
TheArduino Ecosystem• MicroController platform.
• ManydifferentArduinomodels.
• OpenSourcedesign.
• MicroControllers extensiblevia“Shields”.
Actuators
Sensors
Nervous System
RaspberryPI2RaspberryPICam
ArduberryMicrocontroller Arduino Chassis Servo
Servo
Brain
NodeBot RoverHardware
Combining the Raspberry PI&ArduinoRaspberry PI
• LinuxPC.
• SupportsUSBperipherals.
• Programming.
ArduinoPlatform• MicroController.
• Robust.
• Nativeanalogue support.
Thewhole isgreater than the sumof parts!
Actuators
Sensors
Nervous System
RaspberryPI2RaspberryPICam
ArduberryMicrocontroller Arduino Chassis Servo
Servo
Brain
NodeBot RoverHardware
NodeBot RoverComponentOverviewHardware
RaspberryPI
Arduberry(Arduino)
PiCam
ZumoChassis
Servos
Software
Speech
RobotControl
WebServer
Integration
Other
RaspberryPI2
Arduberry
Servo
SoftwareCommunicationacrossHardwareLayers
Servo
Raspberry PI Chassis
JavaScriptPI Binary (Compiled C/C++)
1. Maturity2. Community3. DSL4. Portability5. OpenSource6. Node.js ecosystem7. REPL
BenefitsofusingJohnny-Five
ImportsJ5Dependancy
Adds LEDinstance toREPL
Declares LEDasconnected toUNOPin13
BlinksLEDevery 500milliseconds
Codeblock triggered byUNO”Ready”Event
Initialises UNO
Johnny-FiveCodeExamplevar five = require("johnny-five");
var myBoard = new five.Board();
myBoard.on("ready", function() {
var myLed = new five.Led(13);
myLed.blink(500);
this.repl.inject({replLed: myLed
});});
Arduberry
Servo
BridgingthegapwithFirmata
Servo
Raspberry PI Chassis
Johnny-Five(Firmata Client)
Std.Firmata(Firmata Server)
JavaScriptPI Binary (Compiled C/C++)
GettingStartedwithJohnny-Five1. BuyanArduino ExperimentersKit.
2. Followthetutorialsathttp://node-ardx.org.
3. Visithttp://johnny-five.io formoreinformationandinspiration.
NodeBot RoverComponentOverviewHardware
RaspberryPI
Arduberry(Arduino)
PiCam
ZumoChassis
Servos
Software
Speech
Johnny-Five
WebServer
Integration
Other
SpeechRecognitionRequirements
Needtohave
• Qualityandspeedofspeechrecognition.
• Free,norestrictions.• Softwarebased.• JavaScript.
Nicetohave
• Speechtotext.• Onestopservice.• Battletested.
ButtonpressandreleaseconnectedtoWebSpeechAPIstart andstop Control
methods.
Continuousdictationswitchedon, toavoidcuttingcommandsshort.
Interimresultsswitchedon– showningreentext(finalresultsinwhite).
Eachsetofresultscheckedforuniquenesstoavoidsendingduplicatecommandsto
theRobot.
WebSpeechAPI:Robot
NodeBot RoverComponentOverviewHardware
RaspberryPI
Arduberry(Arduino)
PiCam
ZumoChassis
Servos
Software
HTML5Speech
Johnny-Five
WebServer
Integration
Other
NodeBot RoverComponentOverviewHardware
RaspberryPI
Arduberry(Arduino)
PiCam
ZumoChassis
Servos
Software
Speech
Johnny-Five
Express
Integration
Other
Johnny-FiveProcess
ExpressProcess
Raspberry PI2
WE
Browser
HTTPS
NodeBotRover
Hardware
Firmata
MQTTMessageBroker
MQTT
MQTToverWebSockets
Commands
Acknowledgements
MQTT.jsClient
MQTT.jsClient
MQTT– MQTelemetry Transport• Internet of Thingsconnectivityprotocol.
• Designed tobelightweightwith asmall footprint andlittleoverhead.
• Isaprotocoland aPub-SubMessageBroker.
• UsedbyFacebook forpushing updates tomobileclients.
Adding MQTTtothe NodeBot RoverBroker
• PublicMQTTBroker
– ManyPublicBrokersexist.– Onelessprocess torunon
Raspberry PI.
Client
• MQTT.js
– Provides anMQTTclientlibrary forNode.js.
– Extremely simpletouse.– Integrates seamlesslywith
Johnny-Five.
MQTTOverWebSockets with MQTT.js• MQTT.js isaNode.js package andis
meant foruse on the ServerSide.
• Toallow MQTT.js torunfromtheBrowser,we firstneeded to”Browserify”the MQTTlibrary.
• We could then access the”Browserified”MQTTclient libraryfromthe Browser.
• Thissolution requires that your MQTTBrokerhasaWebSocket endpoint.
MQTTOverWebSockets Demo
DemooftheHiveMQ WebSocket Clienthttp://www.hivemq.com/demos/websocket-
client
NodeBot RoverComponentOverviewHardware
RaspberryPI
Arduberry(Arduino)
PiCam
ZumoChassis
Servos
Software
HTML5Speech
Johnny-Five
Express
MQTT&WebSocket
Other
Node.js Twitter Client• Fully fledged Twitter Client:
– Asynchronous.– SupportsRESTAPI(read andwrite)– SupportsStreaming API(events andtweets).
• Requires developer credentials fromTwitter:– Trivialtoget holdof.
VideoStreaming viaMotion• Motion:SoftwareMotionDetector.
• Provides streaming videowith possibility tocreatesnapshots.
• Good performance on the Raspberry PI.
• Potential sideproject:get Robottofollow moving objects?
NodeBot RoverComponentOverviewHardware
RaspberryPI
Arduberry(Arduino)
PiCam
ZumoChassis
Servos
Software
HTML5Speech
Johnny-Five
Express
MQTT&WebSocket
Twitter &Motion