Blog

JavaScript Bindings for Browser/Node.js and Authentication

We just released a big bunch of new software. The release includes JavaScript Bindings for Node.js and JavaScript Bindings for Browser as well as support for authentication. In order to do this we also have new versions of Brick Daemon, Brick Viewer and the Master Brick Firmware as well as new versions for all Bindings.

JavaScript for Node.js

https://www.tinkerforge.com/static/img/_stuff/logo_nodejs.png

Node.js is a platform that can run server-side JavaScript. With Node.js it is now possible to control Bricks and Bricklets with server-side JavaScript. Reading out the current illuminance from the Ambient Light Bricklet looks as following:

The JavaScript Bindings for Node.js work by the same principle as all of the other Bindings. A TCP/IP connection to the Brick Daemon or the WIFI/Ethernet Extension is established through normal sockets. The functionality to do this is provided by Node.js. JavaScript that is run in the Browser can unfortunately not open normal sockets. Because of this we have separate JavaScript Bindings for Browser.

JavaScript for Browser

https://www.tinkerforge.com/static/img/_stuff/html5_websocket.png

The JavaScript Bindings for the Browser are based on WebSockets. To this end the newest versions of the Brick Daemon as well as the Master Brick include a small web server with support for WebSockets. In the current Master Brick version Websockets only work with the Ethernet Extension. Support for the WIFI Extension will be added later on.

Why is this so awesome that we expended this huge effort? The JavaScript Bindings for the Browser allow to control Bricks and Bricklets directly from every Browser that supports modern web standards. For example: It is possible to get the environmental data from the Starter Kit: Weather Station with a small amount of HTML and JavaScript lines und show them on a web page. This web page can either be loaded from a server or locally. It does not matter where the HTML/JavaScript comes from, since the JavaScript itself is always executed locally.

That means that you can make apps for Android or IPhone that show weather data or that can control the Remote Switch Bricklet with just a few lines of HTML and JavaScript. It is not necessary to write a complicated native app in Java or Objective-C!

Reading out the current illuminance from the Ambient Light Bricklet looks as following:

The JavaScript Bindings for the Browser introduce a big amount of new possibilities in the realm of the Internet of Things. To demonstrate this we will release a new Starter Kit that consists of a complex web application (completely open source) which can control one of our Bricklets.

To counteract possible attacks (over the Internet) through the Browser on our Bricks/Bricklets, we released a possibility to authenticate connections to Bricks/Bricklets in addition to the JavaScript Bindings.

Authentication

By default no access control is performed on the TCP/IP interface of Brick Daemon and the Ethernet/WIFI Extension. If you can connect to it you can control the Bricks and Bricklets. With the new JavaScript Bindings it is now easier for an attacker to get access to the local TCP/IP network (through the Browser), for this we introduced authentication. With authentication enabled only parties that know your authentication secret can control your Bricks and Bricklets.

Authentication can be activated for the Brick Daemon as well as for the Ethernet/WIFI Extension. Additionally we added an authentication tutorial to ease the beginning. To extend an existing program by authentication you usually only have to add one line to your program that sets the authentication secret.

Internally the authentication is done with the HMAC-SHA1 technique. The same technique is for example also used by amazon to authenticate access to Amazon S3.

NI LabVIEW bindings ready!

The NI LabVIEW bindings are now ready to use on Windows!

https://www.tinkerforge.com/static/img/_stuff/labview_logo.png

LabVIEW can use .NET libraries on Windows. This allows to use the existing C# bindings to integrate Bricks and Bricklets with LabVIEW. We provide dedicated example code and documentation to demonstrate this.

Example live-graph of the Barometer Bricklet:

https://www.tinkerforge.com/en/doc/_images/Screenshots/labview_example_frontpanel.jpg

Corresponding block diagram:

https://www.tinkerforge.com/en/doc/_images/Screenshots/labview_example_blockdiagram_small.png

If you find bugs, please report them in the generator git: https://github.com/Tinkerforge/generators

Swiss Reseller

https://www.tinkerforge.com/static/images/resellers/playzone-logo.jpg

Good news for Swiss tinkerers! With PLAY-ZONE we have found a well known Swiss open source hardware seller. PLAY-ZONE sells open source hardware, microcontrollers, DIY-electronics, sensors, robotic kits and other electronic stuff.

Tinkerforge goes Stand-Alone aka RED Brick

Plans to make the system of Tinkerforge building blocks stand-alone existed since the beginning. Originally we wanted to provide a C-API, that could have been used to write firmwares for Bricks. We called the idea “On Device API”. The advantage of our “High-Level” API with the strong abstraction of the hardware would have been lost. Users of our building blocks would have been forced to learn low-level C, which is against our grand scheme.

Since we can’t do everything at the same time, we decided some time ago to hold on to our “High-Level” approach. We want to give everyone the possibility to write stand-alone applications fast, easy and flexible. A good solution for that are embedded-PCs, such as the Raspberry Pi. Those are already often used to control Bricks and Bricklets.

With the RED Brick (RED = Rapid Embedded Development) we take that concept of an embedded-PC and bring it into the system of Tinkerforge building blocks. In our Forum we asked you for ideas about the RED Brick. The general consensus was that the RED Brick should be of size 40x40mm like the other Bricks.

After some development work and lots of swearing (4x4cm is really small) we are excited to be able to present the first screenshots of the layout:

https://www.tinkerforge.com/static/img/_stuff/red_layers.jpg

The 6-layer circuit board design is not yet completely done. Some signals still have to be routed and optimizations as well as planes are still missing. We are however confident that we will be able to order first prototypes next week.

https://www.tinkerforge.com/static/img/_stuff/red_front.jpg

An A10s processor from Allwinner is accommodated on the top-side. This processor is an Cortex A8 with a frequency of 1GHz. Directly next to it we located a 512MB DDR3 RAM module. The decision for the type of processor was not easy. If the PCB is supposed to still be moderately priced we can’t use blind vias. Without blind vias we have to put both the RAM and the processor on one side of the PCB. As a consequence the space for the CPU is very limited.

Additionally we placed the following interfaces on the top-side:

  • USB Host for USB devices such as USB thumb drives, USB <-> Wi-Fi adapters, HDDs, keyboards, mice, etc.

  • Micro HDMI to connect monitors or TVs

  • Mini USB for a serial console and for configuration

https://www.tinkerforge.com/static/img/_stuff/red_back.jpg

On the bottom-side you can find:

  • Micro SD card slot as a storage media for the operating system, your own applications etc.

  • General purpose connector for flat cable. Many different interfaces are routed to this connector. The utilization of these is not yet planned.

Short Hardware Specification:

  • CPU: Allwinner A10s

  • Frequency: 1 GHz

  • # Cores: Single Core

  • RAM: DDR3, 512MB

  • Interfaces: Stack, Micro HDMI, USB Host, Mini USB, General Purpose

  • Storage: Micro SD card

We will keep you informed with more blog posts in the future. Keep your fingers crossed that the prototype works as we are hoping :-).

Stay tuned!

Starter Kit: Blinkenlights

After the small preview from the end of November we can now finally present the new Starter Kit: Blinkenlights.

200 RGB LED pixel are arranged as 20x10 Matrix in a black perforated board. Thus the pixel can be used as a display. Many applications are more beautiful if an additional front panel is put infront of the LEDs. As usual with our starter kits, there are several example applications in different languages available. Particularly the game demos Pong and Tetris already resulted in lots of impromptu competitions between Tinkerforge employees.