SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
Little bits & node.js
IOT for beginner
Michele Capra
!
@piccoloaiutante
!
michele.capra@nearform.com
Summary
• Little bits
• Arduino
• Node.js
• Demo
• Q&A
Little bits
• Modular electronic components that
snap together via magnetic connectors
• Designed for education
• Arduino coding kit
Arduino coding kit
• 1 x arduino
• 1 x fork
• 1 x power
• 1 x button
• 2 x dimmer
• 1 x bargraph
• 1 x servo
Arduino
It's an open-source physical computing platform based on a simple
microcontroller board, and a development environment for writing
software for the board
Node.js & johnny-
five
• johnny-five is an Open Source, Firmata
Protocol based, IoT and Robotics
programming framework
• “..johnny-five wants to be a baseline
control kit for hardware projects,
allowing you the freedom to build,
grow and experiment with diverse
JavaScript libraries of your own
choice..”
Setting up Arduino
board
!
• Connect the Arduino module to the
computer using USB
• Connect power module because the
Arduino module is not powered via USB.
• Upload StandardFirmata to Arduino
board using the Arduino IDE
Demo
• Using dimmers to draw to the screen
just like an Etch-a-sketch.
Little bits in
action
• 1x Arduino
• 1x power
• 1 x fork
• 2 x dimmers
• 1 x button
The circuit
Code
• Webpage as web interface for our etch-
a-sketch (HTML5 canvas + socket.io)
• Node webserver that will read the X
and Y values from dimmers and
communicate to our client
(socket.io + johnny-five)
Server code
board.on("ready", function() {
!
joystick = new five.Joystick({
pins: ["A1", "A0"],
freq: 100
});
button=new five.Button(0);
Server code
html = fs.readFileSync('draw.html').toString();
!
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(html);
});
Server code
io.listen(server).on('connection', function (socket) {
// send the X, Y values to the client
joystick.on("axismove", function(err, timestamp) {
console.log(this.fixed.x, this.fixed.y);
socket.emit('drawing', this.fixed);
});
!
button.on("press", function(value){
socket.emit('clear');
});
});
Client code
!
socket.on('clear', function(){
context.clearRect(0,0,600,400);
context.beginPath();
});
!
socket.on('drawing', function (data) {
$('#status').html('Connected (x: ' + data.x +
', y: ' + data.y + ')');
// scale values to match canvas size
data.x *= 600;
data.y *= 400;
// if values have changed, draw a line to the new position
if (prev && (prev.x != data.x || prev.y != data.y)) {
context.moveTo(prev.x, prev.y);
context.lineTo(data.x, data.y);
context.stroke();
}
prev = data;
});
Demo time
That’s all
Credits
• little-bits-js:Anna Gerber has created
several exercise that you could do
with little bits, included the etch-a-
sketch that you’ve seen (https://
github.com/AnnaGerber/little-bits-js)
• Images of bits used in this
presentation have been sourced from
littlebits.cc and used under a
Creative Commons CC-BY-SA license.

Contenu connexe

Similaire à Little bits & node.js IOT for beginner

E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
Akshar Desai
 

Similaire à Little bits & node.js IOT for beginner (20)

Using OSVR to Support (practically) Any Device in VR/AR
Using OSVR to Support (practically) Any Device in VR/ARUsing OSVR to Support (practically) Any Device in VR/AR
Using OSVR to Support (practically) Any Device in VR/AR
 
Android and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout jsAndroid and Arduio mixed with Breakout js
Android and Arduio mixed with Breakout js
 
Overview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer KitOverview of the Intel® Internet of Things Developer Kit
Overview of the Intel® Internet of Things Developer Kit
 
E yantra robot abstractions
E yantra robot abstractionsE yantra robot abstractions
E yantra robot abstractions
 
Massively Social != Massively Multiplayer
Massively Social != Massively MultiplayerMassively Social != Massively Multiplayer
Massively Social != Massively Multiplayer
 
Electric Imp - Hackathon Intro
Electric Imp - Hackathon IntroElectric Imp - Hackathon Intro
Electric Imp - Hackathon Intro
 
Node azure
Node azureNode azure
Node azure
 
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 ...
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
IOT beginnners
IOT beginnnersIOT beginnners
IOT beginnners
 
IoT Node-Red Presentation
IoT  Node-Red PresentationIoT  Node-Red Presentation
IoT Node-Red Presentation
 
Robots conf microcontroller and iot survey
Robots conf   microcontroller and iot surveyRobots conf   microcontroller and iot survey
Robots conf microcontroller and iot survey
 
Tablet pc
Tablet pcTablet pc
Tablet pc
 
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft AzureDIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
DIY IoT: Raspberry PI 2 + Windows 10 for IoT devices + Microsoft Azure
 
Building a Thought Controlled Drone
Building a Thought Controlled DroneBuilding a Thought Controlled Drone
Building a Thought Controlled Drone
 
Hacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT CoreHacking with the Raspberry Pi and Windows 10 IoT Core
Hacking with the Raspberry Pi and Windows 10 IoT Core
 
How To Electrocute Yourself using the Internet
How To Electrocute Yourself using the InternetHow To Electrocute Yourself using the Internet
How To Electrocute Yourself using the Internet
 
Controlling your home with IoT Hub
Controlling your home with IoT HubControlling your home with IoT Hub
Controlling your home with IoT Hub
 
Internet of Things 101 - Part II
Internet of Things 101 - Part IIInternet of Things 101 - Part II
Internet of Things 101 - Part II
 
Edge Of The Web
Edge Of The WebEdge Of The Web
Edge Of The Web
 

Plus de Michele Capra

Plus de Michele Capra (11)

Nodeschool italy at codemotion
Nodeschool italy at codemotionNodeschool italy at codemotion
Nodeschool italy at codemotion
 
Testing Windows Phone 8.1 app with unit test and Coded UI test
Testing Windows Phone 8.1 app with unit test and Coded UI testTesting Windows Phone 8.1 app with unit test and Coded UI test
Testing Windows Phone 8.1 app with unit test and Coded UI test
 
Porting business apps to Windows Phone
Porting business apps to Windows PhonePorting business apps to Windows Phone
Porting business apps to Windows Phone
 
The magic of Dynamic in Nancy Fx
The magic of Dynamic in Nancy FxThe magic of Dynamic in Nancy Fx
The magic of Dynamic in Nancy Fx
 
Building High Performance and Reliable Windows Phone 8 Apps
Building High Performance and Reliable Windows Phone 8 AppsBuilding High Performance and Reliable Windows Phone 8 Apps
Building High Performance and Reliable Windows Phone 8 Apps
 
Test and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 AppTest and profile your Windows Phone 8 App
Test and profile your Windows Phone 8 App
 
Getting started with Windows Phone 7 and unit test
Getting started with Windows Phone 7 and unit testGetting started with Windows Phone 7 and unit test
Getting started with Windows Phone 7 and unit test
 
Introduzione a Node.js
Introduzione a Node.jsIntroduzione a Node.js
Introduzione a Node.js
 
Developing application for Windows Phone 7 in TDD
Developing application for Windows Phone 7 in TDDDeveloping application for Windows Phone 7 in TDD
Developing application for Windows Phone 7 in TDD
 
Windows Phone 7 Development
Windows Phone 7 DevelopmentWindows Phone 7 Development
Windows Phone 7 Development
 
My Final Dissertation
My Final DissertationMy Final Dissertation
My Final Dissertation
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Little bits & node.js IOT for beginner

  • 1. Little bits & node.js IOT for beginner Michele Capra ! @piccoloaiutante ! michele.capra@nearform.com
  • 2. Summary • Little bits • Arduino • Node.js • Demo • Q&A
  • 3. Little bits • Modular electronic components that snap together via magnetic connectors • Designed for education • Arduino coding kit
  • 4. Arduino coding kit • 1 x arduino • 1 x fork • 1 x power • 1 x button • 2 x dimmer • 1 x bargraph • 1 x servo
  • 5. Arduino It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board
  • 6. Node.js & johnny- five • johnny-five is an Open Source, Firmata Protocol based, IoT and Robotics programming framework • “..johnny-five wants to be a baseline control kit for hardware projects, allowing you the freedom to build, grow and experiment with diverse JavaScript libraries of your own choice..”
  • 7. Setting up Arduino board ! • Connect the Arduino module to the computer using USB • Connect power module because the Arduino module is not powered via USB. • Upload StandardFirmata to Arduino board using the Arduino IDE
  • 8. Demo • Using dimmers to draw to the screen just like an Etch-a-sketch.
  • 9. Little bits in action • 1x Arduino • 1x power • 1 x fork • 2 x dimmers • 1 x button
  • 11. Code • Webpage as web interface for our etch- a-sketch (HTML5 canvas + socket.io) • Node webserver that will read the X and Y values from dimmers and communicate to our client (socket.io + johnny-five)
  • 12. Server code board.on("ready", function() { ! joystick = new five.Joystick({ pins: ["A1", "A0"], freq: 100 }); button=new five.Button(0);
  • 13. Server code html = fs.readFileSync('draw.html').toString(); ! server = http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end(html); });
  • 14. Server code io.listen(server).on('connection', function (socket) { // send the X, Y values to the client joystick.on("axismove", function(err, timestamp) { console.log(this.fixed.x, this.fixed.y); socket.emit('drawing', this.fixed); }); ! button.on("press", function(value){ socket.emit('clear'); }); });
  • 15. Client code ! socket.on('clear', function(){ context.clearRect(0,0,600,400); context.beginPath(); }); ! socket.on('drawing', function (data) { $('#status').html('Connected (x: ' + data.x + ', y: ' + data.y + ')'); // scale values to match canvas size data.x *= 600; data.y *= 400; // if values have changed, draw a line to the new position if (prev && (prev.x != data.x || prev.y != data.y)) { context.moveTo(prev.x, prev.y); context.lineTo(data.x, data.y); context.stroke(); } prev = data; });
  • 18. Credits • little-bits-js:Anna Gerber has created several exercise that you could do with little bits, included the etch-a- sketch that you’ve seen (https:// github.com/AnnaGerber/little-bits-js) • Images of bits used in this presentation have been sourced from littlebits.cc and used under a Creative Commons CC-BY-SA license.