SlideShare a Scribd company logo
1 of 20
Controlling robots
 using JavaScript




 Sudar Muthu (@sudarmuthu)
 Research Engineer, Yahoo! Labs
 http://hardwarefun.com
 http://github.com/sudar
Who am I?
 Research Engineer by profession
 Creates robots as hobby
 Prefers Arduino
 Prefers JavaScript at work
 Why not combine both of them?
 .. and that’s what I am going to talk about today
Why hardware for a software hacker?




           Fun!
Let’s start with a demo




       Demo
  http://hardwarefun.com/projects/asimijs
Participate in the demo 




          Visit
    http://hardwarefun.com:3000
Control the bot at stage
               http://hardwarefun.com/projects/asimijs




#asimijs @hardwarefun
Arduino
 Visual Basic for hardware
 Includes both Hardware and software




                         Photo credit Arduino team
Interfacing Arduino with JavaScript

 Using serial connection (node-serialport)
 Using abstraction (like johnny-five or duino)
 Using serial Bluetooth connection (asimijs)
Using Serial Connection
You need node-serialport - https://github.com/voodootikigod/node-serialport

var SerialPort = require("serialport").SerialPort,
  arduino = new SerialPort("/dev/tty/ACM1");

// when data is received from arduino
arduino.on("data", function (data) {
    arduino.write(new Buffer[data]);
    console.log("Got: " + data);
});

// if there was any error
arduino.on("error", function (data) {
    console.log("Error: " + data);
});
Using Abstraction

 Build on top of node-serialport -
  https://github.com/voodootikigod/node-serialport
 Options include Johnny-five -
  https://github.com/rwldrn/johnny-five and duino -
  https://github.com/ecto/duino
 Load the firmdata program into Arduino
 It provides the necessary abstraction
 Write code using a node.js library
 Profit 
Demo




Let there be LIGHT
Code
var five = require("johnny-five"),
  board = new five.Board();

board.on("ready", function() {

 // Create an Led on pin 13
 (new five.Led(13)).strobe(1000);

});
Hardware setup
Reading sensor data

   What you need?



Any sensor and a LED
Reading sensor data
var five = require("johnny-five"),
  board, led, photoresistor;

board = new five.Board();
board.on("ready", function() {

 // Create a new `photoresistor` hardware instance.
 photoresistor = new five.Sensor({pin: "A2”, freq: 250});
 led = new five.Led(13);

  // "read" get the current reading from the photoresistor
  photoresistor.on("read", function( err, value ) {
      if (value > 50) {
          led.on();
      } else {
          led.off();
      }
    console.log( value, this.normalized );
  });
  // Inject the `sensor` hardware into the Repl instance's context;
  // allows direct command line access
  board.repl.inject({
    pot: photoresistor
  });
});
Using serial Bluetooth connection

 Bluetooth shield gives wireless capability to Arduino
 A Bluetooth connection appears as serial port in your
  computer
 Using node-serialport you can talk wirelessly to Arduino
 And that’s what I did for demo ;)
Using serial Bluetooth connection
var SerialPort = require("serialport").SerialPort,
  bt = new SerialPort("/dev/cu.FireFly-CCFA-SPP");

// when data is received from bluetooth
bt.on("data", function (data) {
    bt.write(new Buffer[data]);
    console.log("Got: " + data);
});

// error reading bluetooth serial port
bt.on("error", function (data) {
    console.log("Error: " + data);
});
How the demo worked

                Node.js Server




                                 Node Client



Admin page


                  User page
                   User page
                     User page
Links
 AsimiJS – The demo that I showed initially
  http://hardwarefun.com/projects/asimijs
 Asimi – A simple bot using Arduino
  http://hardwarefun.com/project/asimi
 Getting started with hardware programming
  http://hardwarefun.com/tutorials/getting-started-with-
  hardware-programming
 Getting started with Arduino
  http://hardwarefun.com/tutorials/getting-started-with-arduino-
  and-avr
 Node-serialport https://github.com/voodootikigod/node-
  serialport
 Johnny Five https://github.com/rwldrn/johnny-five
Questions

Thank You

Sudar Muthu (@sudarmuthu)
  http://hardwarefun.com
  http://gitbub.com/sudar

More Related Content

What's hot

JavaScript in the Real World
JavaScript in the Real WorldJavaScript in the Real World
JavaScript in the Real WorldAndrew Nesbitt
 
My Robot Poops - In JavaScript (with web sockets)
My Robot Poops - In JavaScript (with web sockets)My Robot Poops - In JavaScript (with web sockets)
My Robot Poops - In JavaScript (with web sockets)Matthew Schiffman
 
Why use JavaScript in Hardware? GoTo Conf - Berlin
Why use JavaScript in Hardware? GoTo Conf - Berlin Why use JavaScript in Hardware? GoTo Conf - Berlin
Why use JavaScript in Hardware? GoTo Conf - Berlin TechnicalMachine
 
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...Infinum
 
Continuous Integration for iOS (iOS User Group Berlin)
Continuous Integration for iOS (iOS User Group Berlin)Continuous Integration for iOS (iOS User Group Berlin)
Continuous Integration for iOS (iOS User Group Berlin)Wooga
 
Continuous Integration for iOS
Continuous Integration for iOSContinuous Integration for iOS
Continuous Integration for iOSMattes Groeger
 
Bundler is the Best
Bundler is the BestBundler is the Best
Bundler is the Bestdead_arm
 
CasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingCasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingX-Team
 
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Florent BENOIT
 

What's hot (13)

JavaScript in the Real World
JavaScript in the Real WorldJavaScript in the Real World
JavaScript in the Real World
 
Vi
ViVi
Vi
 
My Robot Poops - In JavaScript (with web sockets)
My Robot Poops - In JavaScript (with web sockets)My Robot Poops - In JavaScript (with web sockets)
My Robot Poops - In JavaScript (with web sockets)
 
Why use JavaScript in Hardware? GoTo Conf - Berlin
Why use JavaScript in Hardware? GoTo Conf - Berlin Why use JavaScript in Hardware? GoTo Conf - Berlin
Why use JavaScript in Hardware? GoTo Conf - Berlin
 
Couverture de code
Couverture de codeCouverture de code
Couverture de code
 
Mojolicious lite
Mojolicious liteMojolicious lite
Mojolicious lite
 
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
 
Continuous Integration for iOS (iOS User Group Berlin)
Continuous Integration for iOS (iOS User Group Berlin)Continuous Integration for iOS (iOS User Group Berlin)
Continuous Integration for iOS (iOS User Group Berlin)
 
Continuous Integration for iOS
Continuous Integration for iOSContinuous Integration for iOS
Continuous Integration for iOS
 
Bundler is the Best
Bundler is the BestBundler is the Best
Bundler is the Best
 
CasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated TestingCasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated Testing
 
Let's begin io t with $10
Let's begin io t with $10Let's begin io t with $10
Let's begin io t with $10
 
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
Devoxx France: Développement JAVA avec un IDE dans le Cloud: Yes we can !
 

Similar to Controlling robots using javascript

Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsSudar Muthu
 
BURO Arduino Workshop
BURO Arduino WorkshopBURO Arduino Workshop
BURO Arduino WorkshopOmer Kilic
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
Javascript robotics
Javascript roboticsJavascript robotics
Javascript roboticsIbnu Triyono
 
Setting Apple's UI Automation Free with Appium
Setting Apple's UI Automation Free with AppiumSetting Apple's UI Automation Free with Appium
Setting Apple's UI Automation Free with Appiummobiletestsummit
 
Programming objects with android
Programming objects with androidProgramming objects with android
Programming objects with androidfirenze-gtug
 
Lets make robots
Lets make robotsLets make robots
Lets make robotsSudar Muthu
 
Exploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyExploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyMike Hagedorn
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunJingfeng Liu
 
Porting your favourite cmdline tool to Android
Porting your favourite cmdline tool to AndroidPorting your favourite cmdline tool to Android
Porting your favourite cmdline tool to AndroidVlatko Kosturjak
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BJingfeng Liu
 
Setting UIAutomation free with Appium
Setting UIAutomation free with AppiumSetting UIAutomation free with Appium
Setting UIAutomation free with AppiumDan Cuellar
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...Mark West
 
Building your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry PiBuilding your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry PiJeff Prestes
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For BeginnersFTS seminar
 
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makerspchristensen
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 

Similar to Controlling robots using javascript (20)

Using arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of thingsUsing arduino and raspberry pi for internet of things
Using arduino and raspberry pi for internet of things
 
BURO Arduino Workshop
BURO Arduino WorkshopBURO Arduino Workshop
BURO Arduino Workshop
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Javascript robotics
Javascript roboticsJavascript robotics
Javascript robotics
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
 
Setting Apple's UI Automation Free with Appium
Setting Apple's UI Automation Free with AppiumSetting Apple's UI Automation Free with Appium
Setting Apple's UI Automation Free with Appium
 
Programming objects with android
Programming objects with androidProgramming objects with android
Programming objects with android
 
Hardware Hacking
Hardware HackingHardware Hacking
Hardware Hacking
 
Lets make robots
Lets make robotsLets make robots
Lets make robots
 
Exploring the Internet of Things Using Ruby
Exploring the Internet of Things Using RubyExploring the Internet of Things Using Ruby
Exploring the Internet of Things Using Ruby
 
pcDuino Presentation at SparkFun
pcDuino Presentation at SparkFunpcDuino Presentation at SparkFun
pcDuino Presentation at SparkFun
 
Porting your favourite cmdline tool to Android
Porting your favourite cmdline tool to AndroidPorting your favourite cmdline tool to Android
Porting your favourite cmdline tool to Android
 
Arduino
ArduinoArduino
Arduino
 
IoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3BIoT with openHAB on pcDuino3B
IoT with openHAB on pcDuino3B
 
Setting UIAutomation free with Appium
Setting UIAutomation free with AppiumSetting UIAutomation free with Appium
Setting UIAutomation free with Appium
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
 
Building your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry PiBuilding your own RC Car with Raspberry Pi
Building your own RC Car with Raspberry Pi
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
 
Programming the Real World: Javascript for Makers
Programming the Real World: Javascript for MakersProgramming the Real World: Javascript for Makers
Programming the Real World: Javascript for Makers
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 

More from Sudar Muthu

A quick preview of WP CLI - Chennai WordPress Meetup
A quick preview of WP CLI - Chennai WordPress MeetupA quick preview of WP CLI - Chennai WordPress Meetup
A quick preview of WP CLI - Chennai WordPress MeetupSudar Muthu
 
WordPress Developer tools
WordPress Developer toolsWordPress Developer tools
WordPress Developer toolsSudar Muthu
 
WordPress Developer Tools to increase productivity
WordPress Developer Tools to increase productivityWordPress Developer Tools to increase productivity
WordPress Developer Tools to increase productivitySudar Muthu
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPressSudar Muthu
 
Unit testing in php
Unit testing in phpUnit testing in php
Unit testing in phpSudar Muthu
 
How arduino helped me in life
How arduino helped me in lifeHow arduino helped me in life
How arduino helped me in lifeSudar Muthu
 
Having fun with hardware
Having fun with hardwareHaving fun with hardware
Having fun with hardwareSudar Muthu
 
Getting started with arduino workshop
Getting started with arduino workshopGetting started with arduino workshop
Getting started with arduino workshopSudar Muthu
 
Python in raspberry pi
Python in raspberry piPython in raspberry pi
Python in raspberry piSudar Muthu
 
Hack 101 at IIT Kanpur
Hack 101 at IIT KanpurHack 101 at IIT Kanpur
Hack 101 at IIT KanpurSudar Muthu
 
PureCSS open hack 2013
PureCSS open hack 2013PureCSS open hack 2013
PureCSS open hack 2013Sudar Muthu
 
Arduino Robotics workshop day2
Arduino Robotics workshop day2Arduino Robotics workshop day2
Arduino Robotics workshop day2Sudar Muthu
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Sudar Muthu
 
Hands on Hadoop and pig
Hands on Hadoop and pigHands on Hadoop and pig
Hands on Hadoop and pigSudar Muthu
 
Capabilities of Arduino (including Due)
Capabilities of Arduino (including Due)Capabilities of Arduino (including Due)
Capabilities of Arduino (including Due)Sudar Muthu
 
Picture perfect hacks with flickr API
Picture perfect hacks with flickr APIPicture perfect hacks with flickr API
Picture perfect hacks with flickr APISudar Muthu
 
Capabilities of Arduino
Capabilities of ArduinoCapabilities of Arduino
Capabilities of ArduinoSudar Muthu
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDDSudar Muthu
 

More from Sudar Muthu (20)

A quick preview of WP CLI - Chennai WordPress Meetup
A quick preview of WP CLI - Chennai WordPress MeetupA quick preview of WP CLI - Chennai WordPress Meetup
A quick preview of WP CLI - Chennai WordPress Meetup
 
WordPress Developer tools
WordPress Developer toolsWordPress Developer tools
WordPress Developer tools
 
WordPress Developer Tools to increase productivity
WordPress Developer Tools to increase productivityWordPress Developer Tools to increase productivity
WordPress Developer Tools to increase productivity
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPress
 
Unit testing in php
Unit testing in phpUnit testing in php
Unit testing in php
 
How arduino helped me in life
How arduino helped me in lifeHow arduino helped me in life
How arduino helped me in life
 
Having fun with hardware
Having fun with hardwareHaving fun with hardware
Having fun with hardware
 
Getting started with arduino workshop
Getting started with arduino workshopGetting started with arduino workshop
Getting started with arduino workshop
 
Python in raspberry pi
Python in raspberry piPython in raspberry pi
Python in raspberry pi
 
Hack 101 at IIT Kanpur
Hack 101 at IIT KanpurHack 101 at IIT Kanpur
Hack 101 at IIT Kanpur
 
PureCSS open hack 2013
PureCSS open hack 2013PureCSS open hack 2013
PureCSS open hack 2013
 
Pig workshop
Pig workshopPig workshop
Pig workshop
 
Arduino Robotics workshop day2
Arduino Robotics workshop day2Arduino Robotics workshop day2
Arduino Robotics workshop day2
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1
 
Hands on Hadoop and pig
Hands on Hadoop and pigHands on Hadoop and pig
Hands on Hadoop and pig
 
Capabilities of Arduino (including Due)
Capabilities of Arduino (including Due)Capabilities of Arduino (including Due)
Capabilities of Arduino (including Due)
 
Picture perfect hacks with flickr API
Picture perfect hacks with flickr APIPicture perfect hacks with flickr API
Picture perfect hacks with flickr API
 
Hacking 101
Hacking 101Hacking 101
Hacking 101
 
Capabilities of Arduino
Capabilities of ArduinoCapabilities of Arduino
Capabilities of Arduino
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Controlling robots using javascript

  • 1. Controlling robots using JavaScript Sudar Muthu (@sudarmuthu) Research Engineer, Yahoo! Labs http://hardwarefun.com http://github.com/sudar
  • 2. Who am I?  Research Engineer by profession  Creates robots as hobby  Prefers Arduino  Prefers JavaScript at work  Why not combine both of them?  .. and that’s what I am going to talk about today
  • 3. Why hardware for a software hacker? Fun!
  • 4. Let’s start with a demo Demo http://hardwarefun.com/projects/asimijs
  • 5. Participate in the demo  Visit http://hardwarefun.com:3000
  • 6. Control the bot at stage http://hardwarefun.com/projects/asimijs #asimijs @hardwarefun
  • 7. Arduino  Visual Basic for hardware  Includes both Hardware and software Photo credit Arduino team
  • 8. Interfacing Arduino with JavaScript  Using serial connection (node-serialport)  Using abstraction (like johnny-five or duino)  Using serial Bluetooth connection (asimijs)
  • 9. Using Serial Connection You need node-serialport - https://github.com/voodootikigod/node-serialport var SerialPort = require("serialport").SerialPort, arduino = new SerialPort("/dev/tty/ACM1"); // when data is received from arduino arduino.on("data", function (data) { arduino.write(new Buffer[data]); console.log("Got: " + data); }); // if there was any error arduino.on("error", function (data) { console.log("Error: " + data); });
  • 10. Using Abstraction  Build on top of node-serialport - https://github.com/voodootikigod/node-serialport  Options include Johnny-five - https://github.com/rwldrn/johnny-five and duino - https://github.com/ecto/duino  Load the firmdata program into Arduino  It provides the necessary abstraction  Write code using a node.js library  Profit 
  • 12. Code var five = require("johnny-five"), board = new five.Board(); board.on("ready", function() { // Create an Led on pin 13 (new five.Led(13)).strobe(1000); });
  • 14. Reading sensor data What you need? Any sensor and a LED
  • 15. Reading sensor data var five = require("johnny-five"), board, led, photoresistor; board = new five.Board(); board.on("ready", function() { // Create a new `photoresistor` hardware instance. photoresistor = new five.Sensor({pin: "A2”, freq: 250}); led = new five.Led(13); // "read" get the current reading from the photoresistor photoresistor.on("read", function( err, value ) { if (value > 50) { led.on(); } else { led.off(); } console.log( value, this.normalized ); }); // Inject the `sensor` hardware into the Repl instance's context; // allows direct command line access board.repl.inject({ pot: photoresistor }); });
  • 16. Using serial Bluetooth connection  Bluetooth shield gives wireless capability to Arduino  A Bluetooth connection appears as serial port in your computer  Using node-serialport you can talk wirelessly to Arduino  And that’s what I did for demo ;)
  • 17. Using serial Bluetooth connection var SerialPort = require("serialport").SerialPort, bt = new SerialPort("/dev/cu.FireFly-CCFA-SPP"); // when data is received from bluetooth bt.on("data", function (data) { bt.write(new Buffer[data]); console.log("Got: " + data); }); // error reading bluetooth serial port bt.on("error", function (data) { console.log("Error: " + data); });
  • 18. How the demo worked Node.js Server Node Client Admin page User page User page User page
  • 19. Links  AsimiJS – The demo that I showed initially http://hardwarefun.com/projects/asimijs  Asimi – A simple bot using Arduino http://hardwarefun.com/project/asimi  Getting started with hardware programming http://hardwarefun.com/tutorials/getting-started-with- hardware-programming  Getting started with Arduino http://hardwarefun.com/tutorials/getting-started-with-arduino- and-avr  Node-serialport https://github.com/voodootikigod/node- serialport  Johnny Five https://github.com/rwldrn/johnny-five
  • 20. Questions Thank You Sudar Muthu (@sudarmuthu) http://hardwarefun.com http://gitbub.com/sudar