Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript and the Internet of Things!
You have completed JavaScript and the Internet of Things!
Preview
The final strategy is to use the client-host model.
JavaScript Runtimes
Microcontroller Software
Examples of Microcontrollers
Examples of Single Board Computers
JavaScript Frameworks
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
The last strategy for
0:00
JavaScript in the Internet of
Things is the Client-Host model.
0:01
This is where you install software
on a microcontroller that waits for
0:05
instructions from a more
powerful computer.
0:09
To get yourself up, you need a
microcontroller with specialized software
0:12
flashed to the device.
0:16
The most common is Firmata.
0:17
Secondly, you need the host
computer running Node.js that
0:19
talks using the Firmata protocol and
tells the microcontroller what to do.
0:23
One of the most common microcontroller
bolts is the Arduino Uno.
0:28
Computers communicate with the UNO,
the A USB.
0:32
The Arduino 101 has
a Intel Bluetooth chip inside
0:35
which enables you to talk
wirelessly to the device.
0:40
Firmata can be also flashed to
the ESP 8266, and can talk over Wi-Fi.
0:44
The host computer running Node.js
doesn't have to be a laptop or desktop.
0:50
It could be a single board
computer like the Raspberry Pi.
0:55
In addition to Node.js, you need
a framework that can speak Firmata.
0:58
Johnny-Five and Cylon.js are two
libraries that can do just that.
1:02
The pros of the Client-Host model is that
you're getting the best of both worlds.
1:08
For example, you can do computer vision
1:13
because you have the power of
a general purpose computer.
1:16
You get faster IO from
the microcontroller devices.
1:19
And you can use a modern
workflow with MPM,
1:23
a package.json file to manage dependencies
and an editor of your choice.
1:26
It's also great for robotics, where you
may require a more sophisticated brand,
1:31
the general purpose computer, and the more
responsive IO from the microcontrollers.
1:36
The cons are because you're
using more than one device,
1:41
there are more points of failure and
attack, is more expensive.
1:45
But if you're doing a robotics project,
you may be fine.
1:48
But if you're doing a few simple tasks,
it's a bit over-engineered.
1:51
You may be okay with just
using a microcontroller.
1:55
Hopefully, this is given you some
ideas on what strategies to use and
1:59
when you'd want to use them.
2:03
Let me know what you're going
to build with JavaScript and
2:05
the Internet of Things.
2:08
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up