The software that powers IoT is changing rapidly as customers demand more sophisticated products. Developers creating the software for embedded products need to adopt new techniques to meet these increased customer expectations.
This book introduces the Moddable SDK, a breakthrough in embedded software that gives professional developers the tools they need to deliver products today. The Moddable SDK combines the ease of use of modern JavaScript with the speed of C/C++ code. Developers working this way are more productive, without compromising performance or flexibility.
The book focuses on the ESP32 and ESP8266 microcontrollers because they deliver a major leap in capabilities at a very low cost. These chips are found in commercial products from major companies worldwide and are also popular with students and makers.
The authors are both members of the team that created the Moddable SDK. This book draws on their years of experience using it to deliver products. They wrote this book for embedded developers, web developers, product designers, and makers.
This book introduces a powerful new approach to embedded development, grounded in modern JavaScript. Each chapter goes in‑depth on a single topic, providing both practical knowledge and examples for you to learn from, run, modify, and incorporate into your products.
Examples are available in the book's repository on GitHub. The book includes instructions for building the examples using macOS, Windows, and Linux computers.
JavaScript is the language of the web, popular for communication and building user interfaces. It just makes sense to use it in connected IoT products too. You'll learn how to use JavaScript efficiently in IoT products. For embedded developers, JavaScript is a new tool for creating more reliable, more powerful products more quickly. For web developers, JavaScript is a way apply their skills to IoT products. The book also includes a fast-paced, practical introduction to JavaScript for embedded programmers more familiar with C or C++.
Network connections are fundamental to IoT. The examples include secure communication with the essential IoT cloud protocols HTTP, WebSockets, and MQTT. You'll also learn to scan for Wi‑Fi networks using the built-in Wi‑Fi on the ESP32 and ESP8266, and how to use mDNS to advertise and discover local network services.
Displays make products easier to understand and use, so it is no surprise they are becoming more common in IoT products. You'll learn how to overcome the constraints of inexpensive microcontrollers to deliver high-quality, high-performance graphics using the APIs and build tools in the Moddable SDK.
Sensors are a key hardware component in most IoT products. You'll learn how to read data from a widely used temperature sensor, configure the resoution of its readings, and manage its energy use. More importantly, you'll see how to use a sensor's data sheet to write the software to communicate with it, so you can support whatever sensors your project needs.
Getting pixels on the screen is only the first step in building a user interface. It is challenging to create an interface that looks and feels like it belongs next to a modern mobile phone. The Piu user interface framework brings powerful ideas from the web to inexpensive microcontrollers. That includes cascading styles, responsive layout, timeline driven animation, and declarative user interface specification.
A series of step-by-step examples shows you how to use Piu to create a beautifully animated interface for your project, including an expanding touch keyboard for small screens.
When writing software for an IoT product, eventually you need to write code that interacts directly with the hardware. You'll learn how to detect presses of tactile buttons, control single and tri‑color LEDs, turn servo motors commonly used in robotics, retrieve readings from sensors, and play sound on a speaker.
For web developers getting started with embedded development the book introduces hardware communication protocols used in microcontrollers. It also includes color wiring diagrams for connecting inexpensive hardware components to your development board. No soldering required!
BLE is the most energy efficient way for IoT products to communicate wirelessly. It is found in electric toothbrushes, ovens, phones, lightbulbs, and more. Starting with a simple JSON device description, you'll see how to implement a heart rate monitor peripheral for ESP32 that communicates with your phone. You'll also learn how to advertise services over BLE and discover nearby BLE devices.
If you are just getting started with BLE, the book introduces key terms and concepts from the BLE standard.
This book is for professionals creating IoT products. It explains the capabilities and constraints of microcontrollers and provides a wealth of practical example code to perform common tasks.
The book is written for both embedded developers getting started with JavaScript and web developers getting started with embedded development. It is also a valuable resource for students, makers, and hobbyists looking to get the most out of their ESP32 and ESP8266 development boards.
The ever increasing demand for more features in IoT products means embedded developers are expected to move at web development speed. Using the high level JavaScript language lets developers move faster. The many powerful modules built into the Moddable SDK — graphics, user interface, networking, BLE, sensors — augment the capabilities of the embedded platform. The book also shows you how to bridge between JavaScript and C code for a speed boost or to reuse existing native code.
Web developers are constantly learning new tools and techniques to grow their skills. With modern JavaScript now a reality on low cost IoT hardware, web developers have a head start in extending their skills to an entirely new field, to move from animating elements on a web page to animating objects the real world. This book introduces key concepts in embedded development, so you don't need any prior embedded knowledge.
The choice of hardware to use in a product has far reaching consequences, from the product's features and performance to its price. Many product designers, unfamiliar with just how powerful modern microcontrollers are, choose unnecessarily powerful hardware that costs more. This book shows how much can be done with hardware that costs just a few dollars. It also includes a detailed discussion about adding a cost effective display to an IoT product.
Makers are looking for the fastest way to bring their project to life. Using JavaScript and the Moddable SDK lets makers focus more on achieving their vision because they need to spend less time on technical details. The forgiving nature of the JavaScript language is particularly valuable when exploring and prototyping. Once you've finished reading this book, you'll be ready to use many modules in the Moddable SDK in your own projects.
Get our new book along with Moddable Two, our most popular and most powerful development board. Shipping is free!
With a Moddable Two, you'll be ready to run the examples in the book including networking, BLE, graphics, and user interface. Moddable Two includes an ESP32 microcontroller with Wi‑Fi and BLE built in, plus a high quality color IPS display with capacitive touch. The bundle also includes the Moddable Programmer for installing and debugging over USB.
Get "IoT Development for ESP32 and ESP8266 with JavaScript" and the shipping is on us!
You can run the examples on popular development boards including Moddable One, Moddable Two, Moddable Three, M5Stack, M5Stack Fire, M5Stack Core2, M5Atom Matrix, M5Atom Echo, M5Atom Lite, M5Stick C, ESP32 Thing, NodeMCU ESP8266, NodeMCU ESP32, and ESP32-WROVER.