Home >Web Front-end >JS Tutorial >An Introduction to NodeBots
Want to use JavaScript to control a cool robot? It can be achieved now! This article will introduce NodeBots, a robot control system based on Node.js (JavaScript running environment), and how to start your robot creation journey.
Core points:
What is a microcontroller?
Before we go deeper, we need to understand microcontrollers. A microcontroller is a small, simple computer, which is a simple programmable circuit board that detects various inputs and sends outputs. The Arduino is a common microcontroller and is also ideal for beginners to experiment. Node.js can also drive other types of microcontrollers, including Particle boards (my favorite!), BeagleBone boards, Tessel boards (the board itself runs on JS), and Espruino boards (also runs on JS). This article will focus on Arduino because it is the most common.
What are NodeBots?
NodeBots (as the name implies) are various types of robots that can be controlled through Node.js. They can be equipped with wheels, movable arms, legs, motion sensors, cameras, LED displays, and even sound playback and more. The only limitation is your imagination and the components you can find and combine!
The concept of NodeBots stems from the continuous improvement of Node.js capabilities, as well as the interests of developers such as Nikolai Onken, Jörn Zaefferer, Chris Williams, Julian Gautier and Rick Waldron. Together, they have developed various Node modules that we use in NodeBots today. Chris Williams' Node package node-serialport
enables all this, which allows access to real-world devices through low-level read and write serial ports.
Julian Gautier then implemented the Firmata protocol, a protocol for accessing microcontrollers such as Arduino through software on the computer, and he used JavaScript in his Node.js Firmata library.
Rick Waldron took it a step further. Based on the Firmata library, he created a complete JavaScript robot and IoT programming framework - Johnny-Five. The Johnny-Five framework makes controlling everything from LEDs to various sensors relatively simple and easy to use. Many NodeBots now use it to accomplish some very impressive feats!
Where to start?
If you have no idea about robot building and any type of real-world JavaScript control device, there are a lot of great resources to get started. I first recommend you find an Arduino kit with a variety of components and sensors so you can try out the various parts. Below is a list of some of the Arduino starter kits available from different companies. If the list below looks huge, don't worry! They all contain very similar components and are great choices for beginners.
Remember that none of the above suites were developed for NodeBot. Therefore, the examples in the booklet are written in simplified C code used by Arduino. See the resources below for an example using Node.js.
Resources for learning NodeBots
There are some key places online to learn how to build various NodeBot projects. Here are some recommendations:
Andrew Fisher, an Australian NodeBot enthusiast, has created a fairly simple project for people to build on in their first NodeBot experience. It is called "SimpleBot" and deserves its name. This is a NodeBot that can usually be built in one day. If you are keen to run an actual robot, not just a set of basic sensors and light switches, this is a great choice for getting started. For this reason, it is available to Australian attendees in one of the ticket types on NodeBots Day (see below)! This is a robot with wheels and ultrasonic sensors that detect if it is about to hit something. This is the finished version I prepared for NodeBots Day a few years ago:
The bill of materials required for SimpleBot and some sample Node.js code can be found in the SimpleBot GitHub repository. Andrew also made a YouTube video showing how to assemble SimpleBot.
Andrew also worked with the Freetronics team to create a SimpleBot Arduino expansion board, which may also be useful for those who want to try to use it as a learning project without soldering anything: SimpleBot expansion board kit.
Conclusion
This is a brief introduction to the world of NodeBots! If you are interested in getting involved, you should have all the information you need to start your NodeBot experience.
If you want to participate more in NodeBots, please pay attention to the annual International NodeBots Day. (It takes place around July every year.) It's a day when all kinds of people gather around the world to attend various events together to build JavaScript-based robots and enjoy good times.
If you built a great NodeBot using any of the above resources, please leave a comment in the comments or contact me via Twitter (@thatpatrickguy) and I'd love to check out your JavaScript bot!
(The following is the FAQ part, which has been rewritten and streamlined according to the original text to avoid duplicate information)
NodeBots FAQ:
What basic components are needed to build NodeBot? You need a microcontroller (such as Arduino), a Node.js operating environment, a library that communicates with a microcontroller (such as Johnny-Five), and various electronic components (LEDs, motors, sensors, etc.).
How to install Node.js and Johnny-Five? Download the installation program from the Node.js official website. After the installation is completed, enter npm install johnny-five
to install Johnny-Five in the terminal.
Can NodeBots be built using other programming languages? Although JavaScript is most commonly used, Python, Ruby, and C are also available.
Can I use NodeBots for commercial projects? Yes, but it is necessary to ensure compliance with safety and regulatory requirements.
What is the future of NodeBots? With the advancement of technology, NodeBots will become more powerful, more versatile, more economical, and more widely used.
How to contribute to the NodeBots community? Share projects, codes, tutorials, participate in activities, etc.
The above is the detailed content of An Introduction to NodeBots. For more information, please follow other related articles on the PHP Chinese website!