Blog

RS485 Bricklet and new Streaming-API

RS485 Bricklet

Today we released the new RS485 Bricklet. It is now available in our shop!

The Bricklet supports low-level RS485 as well as Modbus RTU master/slave with full- and half-duplex. The Modbus RTU implementation is fully compliant for reading and writing of coils and registers. Baudrate, parity, stop bits and word length are configurable and a 120 ohm termination can optinally be switched on with a DIP switch.

It is one of the new co-processor Bricklets with a connector for the 7p-10p Bricklet cable. The Bricklet uses some of the many new possibilites that co-processor Bricklets can offer. It has a 10kb send- und receive buffer (the buffer size of the old Bricklets was limited to 256 bytes at most). The Modbus RTU implementation is comprehensive, with the old system it would have only be possible to implement this with a Brick. Additionally the RS485 Bricklet uses the new Streaming-API (see below).

Streaming-API

Together with the new Bricklet we will release new featuers for our APIs. Until now an API function (e.g. getTemperature) did always generate exactly one packet, which was exchanged between your PC and a Brick/Bricklet. A TFP (Tinkerforge protocol) packet can have a maximum payload length of 64 bytes, so a function could always only transfer 64 byte at a time. Because of this, it was only possible to transfer big amounts of data piece-by-piece with many function calls.

With the new Streaming-API it is now possible for functions to transfer an arbitrary amount of data. A rs485.write() call can transfer 1000 byte (or more) at once. Internnaly the calls to the Streaming-API are again translated into 64-byte blocks that are send to the Bricks/Bricklets. The Streaming-API is, like the old API, generated for all of our supported langauges from a config file. We majorly misjudged the amount of time it takes to extend the generators by this new feature. Originally we planned to release the new Streaming-API and the RS485 Bricklet together with the GPS Bricklet 2.0 (over 2 month ago).

The new streaming functions are currently supported in all languages but Delphi, Shell and JavaScript. The three missing languages will be released in the next weeks. We had lots requests regarding the RS485 Bricklets and since we announced a much earlier release date, we decided to do this "partial release". If you need to use one of the three not-yet-supported languages, you can either be patient and wait for the release or use the low-level API that is the basis for the Streaming-API.