How do you feel about this article? Help us to provide better content for you.
Thank you! Your feedback has been received.
There was a problem submitting your feedback, please try again later.
What do you think of this article?
Setting up the Brainboxes BB-400 and using Postman to control I/O.
The Brainboxes BB-400 (181-7467) is a smart industrial controller that mounts on DIN rail. It is based around a Raspberry Pi Compute Module 3+ and features:
- 8x Digital I/O lines
- 2x Ethernet ports – one for a local (e.g. automation) LAN and one for uplink
- Wi-Fi and Bluetooth
- Integrated UPS
The digital I/O lines are provided via an Arduino-compatible microcontroller, meaning that you can use the vast ecosystem of Arduino libraries and examples to extend its capabilities.
Connection to the BB-400 is over TCP/IP, so it can be monitored and controlled from any device that can run a web browser. It also means that Brainboxes I/O peripherals can simply be connected with a standard Ethernet cable. There is also a serial port, which can be configured as RS-232/422/485 and used with ASCII commands.
Hardware
Once the case of the BB-400 is removed you can see the custom heat-sink that keeps the Pi Compute Module cool; as the Pi will automatically reduce its core frequency to keep the CPU below a critical temperature, it is vital to keep it cool to maintain full processing power.
The UPS comes in the form of 2 large “supercapacitors” that will power the BB-400 for long enough for it to execute a clean shut down.
The Quick Start Guide provides all the information you need to get going.
I fitted the Brainbox to a DIN rail and connected a desktop power supply. The datasheet states it can be supplied with 5V to 30V – this means it can operate in a typical factory environment with standard 12V or 24V supply. I checked the specifications for the power supply that can be provided as an optional extra and it is 12V so that seemed a good setting for my desktop power supply.
Web Interface
I found the easiest way to connect to the BB-400 was to look for its WiFi hotspot, which has an SSID beginning BB-400 followed by the 4 characters that are the last in its MAC address. I connected to it and then went to http://bb400-xxxx:9090 in my web browser — where the x’s are those 4 characters again. I logged in with the user name bb and the password that is once again the 4 characters from the MAC address.
The web interface is user friendly, featuring a status page with a graphical depiction of the BB-400 with status LEDs, plus a sidebar providing links to pages to monitor IO status and configure IO protocols, edit and monitor the wireless connection, configure the serial port, and an apps section with a link to the Node-Red installation on the BB-400’s Compute Module.
Communicating with the BB-400
The BB-400 provides a REST server implementation that can be used to get and set I/O status. REST, or Representational State Transfer, is to quote the BrainBox web site, “a software architectural style that defines a set of methods to build a web Application Programming Interface (API)”.
REST is a simple way of sending and receiving data between a client and a server. The payload can be of a variety of different formats, including HTML and XML. The BB-400 happens to use the simple and increasingly popular JSON format.
The commands the REST server on the BB-400 implements are GET and POST. A GET request can be used to obtain the input or output status of the I/O lines and a POST request can be used to modify the output values.
In practice this means that you can communicate with the REST API using a number of different methods, for example:
- A web application such as Postman
- Windows Powershell
- cURL commands
- Python
There are clear guides on using each of these on the FAQs section of the Brainboxes website.
Postman
I started by using Postman, first downloading it and installing it on my Windows PC. The Online Guide on the Brainboxes web site was easy to follow and I could easily send a GET request and see the I/O Status on the web interface IO page.
I could also use a POST request to alter the output value of of the BB-400 IO lines.
To configure the Postman application to send POST commands, I changed the request from GET to POST. Then, underneath "Body" selected the "raw" option and changed the input type to JSON (application/json). Entering the IP address of the BB-400 followed by 9000/io/outputs/0 in the Post window will post to I/O 0.
POST requests are entered in the Body section and clicking the Send button will send the request.
After sending the request you can see the change in I/O output values reflected in the LED state on the front of the BB-400, and via the status or IO pages of the BB-400's web interface. Also, if the POST request is successful, you will see a "200 OK" status displayed in Postman.
Initial impressions
The BB-400 is a versatile industrial controller that I am looking forward to using in some future projects. As it comes complete with 8 Digital I/O connections it is usable straight out of the box and without the need for any add-on units, although there are a variety available if you want to add more inputs and outputs.