### Use Raspberry Pi and B4x

TinkerForge (TF) is an open source hardware platform of stackable microcontroller building blocks (Bricks)
that can control different modules (Bricklets).
The hardware can be controlled by external programs written in various languages, like C, Delphi, Java etc.
Visit their homepage http://www.tinkerforge.com .
Control TF Bricklets Solutions
For B4x, I started to build solutions based upon the Java and JavaScript Bindings.
TF Java API Binding
Reference: http://www.tinkerforge.com/en/doc/Software/API_Bindings_Java.html
The Tinkerforge.jar, a precompiled Java library, is accessed via B4x JavaObjects.
TF JavaScript API Binding
Reference: http://www.tinkerforge.com/en/doc/Software/API_Bindings_JavaScript.html
The Tinkerforge.js is accessed using B4J Websockets.
Control TF Bricklets via Raspberry Pi (RPi)
Use a RPi Model B or B+ to control TF Bricklets.
Detailed information, see TinkerForge > Use TinkerForge Java API Binding.
How it works?
The TF Bricklets are connected to the TF Master Brick, which is connected via USB to a RPi Model B+.
The TF Master Brick has a WIFI-Extension. On the RPi the TF Brick Daemon is running.
Accessing the TF Brickets, is done directly via the WIFI-Extension using an IP-Address, like 192.168.n.n with default port 4223.
The TF Brick Viewer can be used to verify if the Master Brick and the Bricklets are working properly.
Also it is required to obtain the unique Bricket UID as required to control.
Control TF Bricklets with WIFI-Extension without USB connection to RPi or PC
To control the Master Brick with a WIFI-Extension, without being connected via USB to a RPi or PC,
add power to the Master Brick and remove the USB connection.
To obtain information or configure via the TF Brick Viewer (brickv), the USB connection is required.
Control TF Bricklets via Raspberry Pi as WebServer
Use a Raspberry Pi (RPi) Model B or B+ B4J Webserver to control TF Bricklets.
Detailed information, see TinkerForge > Use TinkerForge JavaScript API Binding.
How it works?
The TF Bricklets are connected to the TF Master Brick, which is connected via USB to a RPi Model B+.
The RPi functions as a Home Server (RasPi Home Server), which can be accessed from the Internet (inhouse or external) using Websockets and ssh.
For inhouse use, the internal IP address (192.168.n.n:port) is used.
For external access, the Home Router uses Port Forwarding for DuckDNS dynamic hosting (duckdns.org).
The TF Brick Daemon (brickd) runs as a service on the RPi Home Server, listening to its Websocket port = waiting for the B4J Webserver requests.
The B4J Webserver runs also on the RPi Home Server, listening to its Websocket Port = waiting for client requests.
The Webclient (Browser has to support Websockets) accesses via DOMAIN:PORT the B4J Webserver running on the RPi Home Server. Based on the selected function, the
respective HTML page is loaded with TinkerForge HOST, PORT, Bricklet UID parameter set.
These parameter are used to access the Tinkerforge Brick Daemon, which then feeds the relevant Bricklet.
The TF Brick Viewer can be used to verify if the Master Brick and the Bricklets are working properly.
Also it is required to obtain the unique Bricket UID as required to control.
TF Bricks and Bricklets
Some reference to the various bricks & bricklets used in these B4J HowTos. There are many more.
Hardware Requirements
TF Master Brick: https://www.tinkerforge.com/en/shop/bricks/master-brick.html
TF WIFI-Extension: https://www.tinkerforge.com/en/shop/master-extensions/wifi-master-extension.html
TF Temperature Bricklet: https://www.tinkerforge.com/en/shop/bricklets/temperature-bricklet.html
TF Remote Switch Bricklet: https://www.tinkerforge.com/en/shop/bricklets/remote-switch-bricklet.html
Software Requirements
Install the Brick Daemon (brickd) and the Brick Viewer (brickv) on the device.
Read here:
http://www.tinkerforge.com/en/doc/Tutorials/Tutorial_Extending/Tutorial.html#tutorial-first-steps

Changed: , Category: TinkerForge, File: T6C264M1967.htm, ID: 1967