Embedded systems are everywhere. They run your dishwasher, control the temperature in your home, make sure the engine of your car runs correctly, and help you brake in case of emergencies. An embedded system is a combination of hardware and software that perform a very specific, predefined task. The electronics themselves are usually encapsulated within the device it controls. They’re usually equipped with sensors and actuators to perform their task. Some have a user interface, but most don’t, or perhaps only a few LEDs to tell what it’s doing.
Embedded System Capabilities
The processing power of the embedded processor is usually dependent on the tasks they have to perform. The processor can vary from simple 8- or 16-bit processors (families like PIC, AVR, MSP and H8) to more powerful 32-bit systems (like ARM Cortex or SuperH). ARM cores are getting more and more popular because of the lowering prices, and the simple processors are mostly interesting for high volume products. Their clock frequencies are usually not very high – somewhere between 8 to 25 MHz is quite common, although the 32-bit systems quite often run at higher speeds. Of course there are some applying even higher power processors like the ARM7/9 or MIPS at +500MHz.
The list of embedded operating systems is long, but quite often embedded systems don’t use an OS. A simple ‘task scheduler’ is usually enough because their tasks are relatively simple and they don’t need a real OS with all it’s overhead.
The first system I want to mention is Tessel. It consists of a base board that can be extended with hardware modules that you can buy through the website. The base board is well equipped; it has a WiFi module and plenty of memory available. The extension modules are very interesting as well – camera, bluetooth LE, GPRS, micro SD, and quite a few sensors. The only unfortunate thing is that most are out of stock or pre-order. Don’t let that spoil the fun for you though. Their documentation looks very good and there are plenty of code examples to choose from. Another plus is that package management is done with npm.
Then there is the Espruino Board. Like Tessel, it is powered by a CortexM3 processor which will give you excellent performance. The main difference with this project is that there are no extension boards available. However, you can connect things to the system by wiring up electronics. This may sound like a negative point, but it isn’t necessarily. There are quite a few libraries available for specific ICs. They are mostly for sensors and displays though. Memory might be an issue on this system because you’ll have to use the processor’s embedded RAM.
- The system will need to have some sort of network connection.
- The system must be able to accept and respond to HTTP requests over that network connection. The HTTP request can, of course, be proxied by some other system.
Most embedded processors have a family member that embeds an Ethernet controller, or an interface to an external one. Most embedded operating systems have TCP/IP available as a library. In other cases the lightweight TCP/IP stack is a good option which can be integrated quite easily. The contributions include a HTTP server example. It might also be interesting to see if WebSockets are available, or can be implemented on the platform.
The interaction between the system and the browser is best done using Ajax calls. They are relatively simple, and the response from the server can be simple as well. This reduces the amount of work that the embedded device has to do. All it has to do is parse the requested URL with parameters, set a value in its configuration, or return requested values.
Security is a concern. Most embedded systems don’t have a lot of libraries and power to run SSL/TLS, so an important question should be, is that acceptable. Next, you’ll probably want to do authentication. Ravi Kiran wrote a a very nice article here on SitePoint about implementing authentication in AngularJS, which I recommend should you need it.
Arno Slatius is a web developer from the Netherlands. He has a background in electronics and embedded systems and started web development over a decade ago, He works with Yii professionally and loves digging into new things. Arno loves clean, commented and simple code. When he's not coding, he spends most of his time with his family or flying his model helies, planes and quads.
Jump Start Git, 2nd Edition
Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers