Tag Archives: RBPi

Interfacing the Tilt Hydrometer and Thermometer to the Raspberry Pi

Tilt is a wireless hydrometer and thermometer combination suitable for home brewers that allow instant readout of the specific gravity of your brew. You can see the specific gravity readings on your Apple iPhone, iPad, or Android smartphone. Furthermore, Tilt can talk to your single board computer, the Raspberry Pi (RBPi).

Tilt will talk to most devices sporting the Bluetooth 4.0+ interface. Once you have the data in your device, you can optionally save the data automatically into a cloud using Tilt’s free Google Sheets template. You can also save the data using other third party cloud platforms as well.

For helping home brewers make better beer, the Tilt hydrometer allows automatic checking of its specific gravity and temperature even while it is fermenting. Simply dip the Tilt hydrometer in the beer within your fermenter and leave it inside. Without having to open your fermenter again, you can receive the data on its present status, and this makes brewing simply more consistent and easy to track.

Tilt has a powerful transmitter, allowing it to send data wirelessly even through large thick-walled fermenter. Therefore, you get a better range and reception. With its sensitive sensors such as the improved temperature sensor and accelerometer, you get precise readings. Power consumption is low, which means Tilt does not consume much battery power while operating.

Operating the Tilt could not be simpler, as each unit comes calibrated and a pre-installed battery, ready to go—you only need to download the free app. Now sanitize your Tilt and drop it in your fermenter. You will automatically receive data on your device.

If you have different batches of fermenting beer, use multiple Tilt Hydrometers. You can differentiate those using separate colors for each batch. The app does not read multiple hydrometers of the same color. The Tilt has a range of 0.990 to 1.120, and gives an accuracy of ±0.002. The thermometer has an accuracy of ±0.5°C (±1°F).

If you have an RBPi with a Wi-Fi dongle and Bluetooth 4.0+ or BLE, you can use the Tilt Pi to log your Tilt readings. Tilt Pi is an SD card image, which you can download from the Tilt webpage and use to boot up your RBPi3 or RBPiZW. After downloading the image, simply write it to an 8GB or higher SD card.

On the SD card, Tilt has included a SETUP.html file that helps with the Wi-Fi and cloud logging setup. This file guides you in creating the configuration files that allow connecting to your local Wi-Fi network. You will also receive an email giving a link to your cloud data log. Another link will also point to your Tilt Pi dashboard, from where you can change settings, calibration, and view the data on your local network.

The Tilt Hydrometer does not include the RBPi, so you will have to buy one. The built-in Bluetooth and Wi-Fi wireless technology included in the Tilt Hydrometer offers reliable cloud and local data logging. The setup is streamlined, so as soon as the RBPi boots up with the Tilt Pi SD card, the system begins logging data.

Using the Raspberry Pi to Secure IoT

The popular single board computer, the Raspberry Pi (RBPi), can effectively secure systems that traditional protection mechanisms often cannot. Industrial control system networks and Internet of Things fall under this category. You can use the RBPi2B and later models as an adequate medium for running the various security tools.

For this project, you need a Micro SD card of at least 8 GB size, and the bigger it is the better, as you can use the extra space to store a longer log data history, for instance, for logging data from Bro IDS. A case for the RBPi is preferable, and you can use one suitable to your individual taste and style. Although optional, a small form factor wireless keyboard is more helpful to configure the device on the fly, rather than using a full size keyboard.

Once you have configured the RBPi for networking, enable SSH and allow configurations from an SSH client. The hardware you will need includes an RBPi2B or later, an 8+ GB Micro SD card, a case for the RBPi, a Micro USB power cord, and an optional mini wireless keyboard.

Use the RBPi website to follow their getting started guide and install the Raspbian operating system using the New Out of the Box Software (NOOBS). Those familiar with the installation system can also use the traditional method of installing the Raspbian OS directly without the NOOBS, and it should work fine. Other OS distributions for the RBPi may also work, but you will need to try them out.

As the RBPi security solution places great reliance on lightweight open-source software, and the device monitors all traffic, you need to install software that inspects the traffic to learn what is going on. This requires installation on an Intrusion Detection System or IDS. Among the several free products available in the market, the one most suitable for the RBPi is the Bro IDS. The Bro inspects traffic at all OSI layers, and adds additional scripting that increases attack detection.

Bro IDS has some prerequisites before it can install on the RBPi. Install the prerequisites via apt-get, and after completing, download the latest source code for the Bro. Now, setup the environment to build, and to install the build—use configure, make, and make install. This allows you to manually control Bro, or use Broccoli to control it automatically.

Although the Bro IDS comes with an extensive signature base that can detect a number of common attacks, you can enhance its signature with Threat Intelligence. Another advantage in using the Bro IDS is the availability of Critical Stack, and you can integrate the threat intelligence with the Bro.

You can use Critical Stack, a threat intelligence feed, as a free aggregator. It functions as a simple point-n-click integration as it pulls data, such as addresses for Tor Exit Mode IP, known phishing domains and/or other malicious IPs. After pulling the data for threat intelligence, the Critical Stack agent formats it into a scripting language that Bro understands. The Bro IDS can pick up the new script automatically.

The PiServer for the Raspberry Pi

If you were running an institution teaching computer programming to kids using Raspberry Pis (RBPis), then you would normally spend some time updating numerous RBPis with the latest Raspbian and copying over several files for the class. You can save a lot of time using the PiServer, and do away with the SD cards at the same time.

The PiServer is a new piece of software tool that can easily set up a network of client RBPis connected to a single x86-based computer acting as the server. The various RBPis connect over Ethernet, and do not need their SD cards to boot. The server can control all its clients, allowing addition and configuration of user accounts. This provides an ideal setting for the classroom, within the home, or even an industrial setting.

To recall the terminology, the server is the computer providing the boot files, the file system, and authenticates the password of the clients. The clients are several computers that communicate with the server to retrieve the boot files, and the file system from the server. Although several clients connect to one server, they share the same file system. A user, with a unique combination of a username and password, can log into a client system. Once logged in, the user can access the file system on the server. The user may log in from any client system using their credentials, but will always see the server and the same file system. As the system does not give sudo capability to any user on a client, users are unable to make significant changes to the software and its file system.

All client RBPis use the PXE or network booting, and therefore, do not require any SD card to boot. The advantages of this type of booting are a large number of clients can boot off a single server, which treats all clients as the same. Additionally, as the server runs on a regular x86 system, it offers higher performance, network speed, and disk speed.

Without the PiServer, creating such a network would involve a lot of work, setting up the required FTP and DHCP servers, and making them interact seamlessly with other components on the network. The entire network is prone to breakdown with a single error. The PiServer takes care of all the intricacies, and has automatic functionalities.

For instance, PiServer can automatically detect any RBPi trying to boot via the network, and locate its Ethernet address. PiServer also sets up a DHCP server, to act as a router to provide an IP address to each client, whether in proxy mode or in full IP mode. For the safety of the network, the DHCP server replies only to those RBPis you have specified.

The PiServer also has the task to create usernames and passwords on the server. Therefore, in the classroom, the teacher can set up all the users beforehand. This allows each user to log in individually and keep all their work separately in the central location. The PiServer uses a somewhat altered Raspbian build, which has the LDAP enabled.

Blinkt! is Compatible with the Raspberry Pi

If you are interested in learning how to control RGB LEDs with the Raspberry Pi (RBPi) single board computer, Blinkt! provides a simple way to interface. Blinkt! is a strip of eight superbright RGB LED lights that you can connect to the RBPi without wires, so it is an easy way to start. Blinkt! Has a female connector that matches the male GPIO connector on the RBPi, and that allows the tiny LED board to sit atop the RBPi.

The RBPi can individually control each of the eight APA102 RGB LEDs on the Blinkt! board individually, so you can consider them as matrix of 1×8 pixels. The footprint of the board is tiny enough to allow it sit directly on top of the RBPi and the pair fits inside most of the Pi cases. Although the RBPi controls the eight LEDs with PWM, it does not interfere with the SBC’s PWM audio. Blinkt! comes fully assembled and is compatible with RBPi models 3, 2, B+, A+, Z, and ZW. Pimoroni, the manufacturers of Blinkt!, also provide a Python library for the users.

Combining Python programming and Blinkt! with the RBPi is a great way of understanding how RGB LEDs work and how a computer program controls their operation.

If you are using the RBPi3 for this project, it will already have the male GPIO on the board. However, the RBPiZ and RBPiZW may not have the connector, which means you may need to solder the connector to the board. You need to be careful when plugging the Blinkt! board onto the RBPi taking care to orient it in the right way. The Blinkt! board has rounded corners on one of its side, and this side should face the outside of the RBPi. Once you align the boards properly, push the Blinkt! board in and it should fit snugly on the RBPi.

To make the RBPi control the LEDs on the Blinkt!, it will need to have the right code. The best way to begin is to update the Operating System of the RBPi to the latest Raspbian. Once you have done this, and the RBPi is running, connect it up to the Internet and open the terminal on the RBPi screen.

Typing the code “curl https://get.pimoroni.com/blinkt | bash” without the quotes, should allow the RBPi to download the necessary Python libraries from the Pimoroni website. Now you can use the Python 3 IDLE code editor to use the library to write the Python program and control the LEDs.

While writing the Python program, you will need to begin by importing the Blinkt! library you had downloaded in the first step. Each LED is termed as a pixel so the parameter “set_pixel” allows you to address a specific LED, while “set_brightness” allows setting its brightness. The command “show” turns on the specific LED, and “clear” turns it off.

Even though the LEDs are numbered as 1 to 8 on the board, the program addresses them as 0 through 7. Therefore, the program can pick a light and tell it the color it needs to be, its brightness, and whether it should turn it on or off.

Raspberry Pi Helps a Hexapod Robot Walk

Roland Pelayo has used the single board computer, the famous Raspberry Pi or RBPi to help a hexapod robot learn to walk. The RBPi allows the robot to run in an autonomous mode, so it walks without assistance, avoiding obstacles. Alternately, it can also operate in a manual mode, whereby a user with a smartphone can control the robot. Most interestingly, the hexapod walker follows the tripod gait, just as most six-legged insects do.

Roland prefers to use servomotors to control the gait of the hexapod robot. According to Roland, using three servomotors to control the movement of the six legs of the robot, strikes a balance between performance and price. He added another servomotor for moving the eyes of the robot.

The servomotors allow the robot to move in four directions, forward, backward, left turn, and right turn. The robot moves by tilting itself to the left or the right, and then moving the leg lifted by its tilt. Roland has drawn diagrams explaining the movements of the robot. The backward and turn right movement of the robot is basically the reverse of its forward and turn right movement respectively.

Therefore, the front and corresponding back legs of the robot are interconnected to two servomotors, one to the left pair and the other to the right. The third servomotor helps to tilt the robot.

The RBPi allows the hexapod walker to operate in two modes. The first is the autonomous mode, which allows the robot to roam around freely, avoiding obstacles in its path. For instance, if it detects an obstacle in front, the robot walker takes two steps backwards, turns right, and then moves forward again. The second mode is for allowing the user control the movements of the hexapod robot using a smartphone on the same network as the robot is.

Roland has designed the program to allow the RBPi control four servos simultaneously, while reading inputs from a sensor detecting obstacles. The RBPi also connects to a network for the remote wireless control. Using an RBPi for the project was simpler for Roland, as the RBPi features on-board wireless connectivity.

Roland uses three Tower Pro SG-5010 servomotors, two for moving the legs and the third for tilting the hexapod walker. A fourth micro servo motor, a Tower Pro SG-90, helps to move the head and the eyes. An RBPi2 fitted with a USB Wi-Fi dongle helps to control the four servomotors. While the RBPi runs on a small power bank, the servomotors have their own separate power source. An ultrasonic sensor, HC-SR04, performs the obstacle detection.

As the echo produced by the ultrasonic sensor may cross the 3.3 V levels, Roland placed a voltage divider in between to connect to the RBPi, as its GPIO pins cannot accept voltages above 3.3 V.

As Python is already installed on the RBPi, Roland used it to write the program for the Hexapod walker. However, he also needed an extra library called pigpio, mainly for controlling the servomotors. He used SSH to access the RBPi remotely and installed the extra library.

Storm Glass Lamp: Raspberry Pi Simulates a Storm

Several people have used the versatile single board computer, the Raspberry Pi or RBPi, as many types of educational devices. In fact, the original purpose of conceiving the RBPi was to use it as an educational instrument to further computer programming among children in schools. It has been serving this purpose excellently, and has managed to go even farther. For instance, the RBPi inspired someone to make a weather-simulation lamp for recreating the weather at any place in the world.

The RBPi within the Storm Glass lamp uses the API Weather Underground for accessing current and future predicted weather at any place in the world. At first glance, one may be rather skeptic about the project, especially when the current weather can be gleaned simply by looking out of the window. However, perception soon dawns when explained that the project is actually able to predict weather—observing tomorrow’s weather today. Alternately, it is possible to keep track of the weather in a distant location, say, a prospective holiday destination.

The designer created the cap and base for the lamp by 3-D printing them. The glass sitting in between the two actually belongs to that fancy mineral water bottle readily available in the supermarkets, which people casually overlook and are forever unable to justify buying. The base also holds the RBPi, a microphone, a speaker, and other varied components such as a NeoPixel LED Ring and a Speaker Bonnet from Adafruit.

The Storm Glass lamp uses two important arrangements. One of them is the rain maker and the other the cloud generator. The rain maker uses a tiny centrifugal pump working at 5 VDC to pump water via glass tubing into the lid, from where the rain falls. An ultrasonic diffusor/humidifier, also working at 5 VDC, forms the cloud generator. Only the electronics parts of the diffusor, which create the ultrasonic signal, are necessary, and the rest can be discarded. All the equipment goes in together into one spectacular lamp.

By installing Alexa Voice Service within the Storm Glass lamp, and setting it up to use the Weather Underground API to receive data related to weather conditions in a specified place, these conditions are easily recreated within the lamp, functioning as a home automation device.

When taken outdoors, and placed on a nightstand, the Storm Glass can actually recreated he weather conditions outside. It gives a weather forecast for the day by checking the weather periodically online. For instance, if the prediction for the day is rainy, expect some rain to fall within the Storm Glass Lamp. If the predicted says partly cloudy, you will see clouds forming inside, with some sunshine interspersed.

An RBPiZW powers the project, as it needs both Wi-Fi and Bluetooth support. Apart from the Speaker Bonnet, mini water pump, and the ultrasonic diffuser, there is a NeoPixel 12-LED ring, a 2.5 A micro USB power supply, 8 GB micro SD Card, two TIP 120 transistors and two 2K2 resistors. Additionally, you will also need tubing for moving water, lots of hot glue, and the 3-D printed parts to hold all the above together. All the parts operate at 5 VDC, so there is no additional converter, and the RBPIZW controls everything.

Expanding the GPIO on the Raspberry Pi

Although the single board computer the Raspberry Pi or RBPi has nearly 26 GPIO pins in its earlier models and 40 in its latest, there are times when the project demands more of them. In such cases, a GPIO expander is the only solution, and the MCP23S08, a device that Microchip Technology makes provides an easy way to expand the IO pins of a micro-controller using only a 2-wire serial interface.

The MCP23S08 works with the I2C protocol as a slave device, providing 8-bit, general purpose, bi-directional IO expansion for the I2C bus. It supports a 7-bit slave addressing, with the control byte acting as the read/write bit. Of the slave address, the MCP23S08 fixes the four most significant bits to 0100. This leaves the remaining three bits to be defined by the user as the address bits. Therefore, one can connect up to eight MCP23S08 devices on a common I2C bus at any one time.

It is possible to configure individual bits of the 8-bit GPIO port as either input or output. At the same time, it is also possible to enable the internal pull-up resistor on the port pins to interrupt-on-change. A set of configuration and control registers control these operations. Each resistor has its own address and its power-on reset value, as listed on the datasheet of the MCP23S08.

The first register is the IO direction register, and controls the direction of the data IO. On setting a bit in this register, its corresponding pin assumes an input direction, and if the bit is clear, its corresponding pin works like an output.

With the input polarity register, the user can configure the polarity of the corresponding GPIO port bits. When he/she sets a bit on this register, the corresponding GPIO register bit stores the inverted value present on that pin.

Interrupt-on-change control register controls this feature for each pin. When the user sets a bit on this register, the corresponding pin becomes capable of interrupt-on-change. Of course, for enabling this feature, the user must also configure the INTCON and DEFVAL registers as well.

Interrupt control or INTCON register controls the manner in which the associated pin value compares for the interrupt-on-change feature. If the user sets the bit, MCP23S08 compares the corresponding IO pin against the associated bit in the DEFVAL register. If clear, the MCP23008 compares the corresponding IO pin to its previous value.

The default comparison value or DEFVAL register is for configuring the default comparison value. If the user enables a bit in this register, and the associated pin has an opposite value, it will cause an interrupt.

The PI-SPI-DIN series of IO modules has the RBPi reading 2 modules of eight isolated digital inputs for a total of sixteen inputs and controlling four modules of four relay outputs for a total of 16 relays, all using the IO expander chip MCP23S08.

As the RBPi can select only two chip-select lines, each of the PI-SPI-DIN modules has a jumper selection of five chip selects. The two address lines of the MCP23S08 need to be enabled in the setup routine while determining the port pins as inputs or outputs.

Talk to your Raspberry Pi

The Raspberry Pi Foundation has tied up with Google for a project called the Artificial Intelligence Yourself or AIY. This is a Hardware on Top or HAT project for the Raspberry Pi 3 (RBPi3) to transform the single board computer into a virtual assistant. This is the first time that Google is offering something exclusively for hobbyists, and the kit comes free with the printed issue 57 of the MagPi—the official magazine of the Raspberry Pi.

The kit with the MagPi magazine consists of a Voice HAT board, a speaker, a stereo microphone board, a large arcade push button, and a set of wires. This is all one needs to add-in voice integration to the RBPi3, turning it into a personal Alexa alternative. Alexa is an intelligent personal assistant developed by Amazon. Intelligent personal assistants are capable of offering real time information, such as news, traffic, weather, apart from playing audiobooks, streaming podcasts, setting alarms, making to-do lists, playing back music, and most importantly, capable of voice integration.

The MagPi magazine contains all the build instructions for putting together the free hardware voice kit; you only need to add the RBPi3 to get it working. There is also a custom cardboard case to house the entire kit along with the RBPi3. Apart from the RBPI3, the AIY voice project will work with an RBPi2 and an RBPiZW as well. Once the hardware is assembled, you will need some software setup, with access to the Google Assistant SDK and Google Cloud Speed API.

The MagPi 57 issue offers several voice integration ideas for the AIY voice kit and you can enhance them or build your own projects. For instance, you can have a voice integration project to answer all your questions just as Alexa does. Alternately, you can create a voice-controlled robot. In fact, some owners of RBPi are building secret AIY projects at Hackster.

According to Billy Rutledge, Google’s director on the project, the AIY project demonstrates a practical method of starting and running a natural language recognizer in conjunction with the Google Assistant. Not only will you have all the functions of the Google Assistant, you can as well add your own pairs of questions and answers.

The Voice Kit and RBPi3 combination acts as a voice recognizer and uses the Google Assistant SDK to recognize speech. For evaluating local commands, it uses a local Python application. You can talk to the Google Assistant, which makes use of the Google Cloud Speech API to answer back. If you wish to use voice capabilities in your future projects, check out the Maker’s guide for more creative extensions.

The arcade style button has additional functions other than initiating the speech interaction. A bright LED mounted within the button signals to verify your device is running properly through different types of blinking. For instant, the LED pulses to indicate the device is just starting up, and the voice recognizer has not started functioning yet. Once the device is ready to be used, the LED blinks every few seconds. The LED glows steadily when the device is listening, and pulses if the device is thinking or responding.

Two Raspberry Pi HAT Controller Modules

Atomo Systems, from Hong Kong, will be producing the Atomo Modular Electronic System for building electronic projects with four parts—Control, IO, Power, and Connector. The system also includes two low-cost HAT modules with onboard ARM MCUs compatible to the Raspberry Pi (RBPi). The combined controller connector board uses a small and inexpensive MCU, similar to what an Arduino Uno uses. However, the ARM MCU is faster, has more IO, and is better compatible with the RBPi.

The idea behind building such a modular system is to allow the user to focus more on the project rather than worrying about running extra wires for power or adding more IO. The system is highly flexible and has ample system resources. For instance, if you need to solve larger problems, you can simply add more resources such as by swapping controllers rather than starting all over again.

Any electronic project needs Inputs and outputs to connect to the rest of the world. The modular electronic system comes with IO modules with a useful amount of IO. In addition to offering adequate power for most applications, you can double up the modules using the 8-module connector board.

The onboard connectors on the extended controllers offer features such as multi-channel clock generation and bus multiplexing. Therefore, you can easily keep track of the system temperature using the built-in thermistor, and drive a fan if the temperature exceeds a certain limit.

The modular electronic system needs power to work. Apart from deriving power from the USB socket, other options are also available, from 13 W to 2 kW. These include a 5.5 mm DC Barrel Plug, ATX, and POE. Voltages on tap include 12 VDC, 5 VDC, and 3.3 VDC. For driving higher power devices such as heaters and motors, the input voltage may be used directly.

All the controllers are compatible to the 40-pin HAT connector on the RBPi. They contain EEPROMs for the RBPi HAT to allow for system configuration and automatic device driver setup. Separate SPI and I2C interfaces allow addressing two PWMs, two ADCs, and four GPIOs. The MKE02Z16VLD4 MCU by NXP powers both. This is a 44-pin LQFP, 5 V tolerant, and ESD robust ARM Cortex m0+ CPU running at 40 MHz. One of the controllers is a low power module, while the other is a high power module capable of handling up to 600 W of power usage, via a 34-pin power module connector.

Compatibility with the HAT connector on the RBPi allows programming on the RBPi for updating the controllers. Additionally, you can simply use the Atomo as a modular HAT. This way, you can handle ROS robots or any other system where the RBPi is solely used for interfacing and processing, while the Atomo HAT provides the additional power, IO, or real time control the project requires.

The low power RBPi HAT combined controller and Connector boards make two IO module systems. Therefore, you can build POE powered RBPi applications for a simple RBPi powered robot. This board features 2×28-pin IO modules powered by the RBPi itself. The higher power version has a standard 34-pin power module.

VNC: Controlling a Raspberry Pi from Anywhere

Sometime you wish you could remotely control your Single Board Computer (SBC), the Raspberry Pi (RBPi). This could be because you have set up your RBPi as a home security system with a camera that you want to monitor remotely, or the RBPi is in control of some appliance that you would like to switch on/off from a remote location. Ordinarily, to access an RBPi from outside your home network, you would need to give it an IP address, and set up your home router accordingly. However, there is another method to bypass all that.

Before you begin, make sure your RBPi has the latest OS installed, and is set up to access your home network. Also, as you will be exposing the RBPi to the Internet, change its default password at the setup process. Once you have done this, you can use VNC Connect to access your SBC from anywhere.

Using VNC, you can easily connect to any computer remotely on the same network. Additionally, VNC Connect allows you to connect to any computer from anywhere using a cloud connection, and this includes the RBPi as well. Once you have set it up, the VNC Viewer app will allow you to access the graphic interface of your RBPi from any other computer or smartphone.

The most recent version of the RBPi operating system, namely PIXEL, comes with VNC Connect already present. Others can install it via the apt-get command. You will need to install both realvnc-vnc-server and realvnc-vnc-viewer. Once you have done that, run the raspi-config and set VNC as enabled. This will allow you to set up VNC Connect.

Use a browser to go to the sign-up page of RealVNC Raspberry Pi. Enter your email address in the sign up box. The on-screen instructions will now guide you to complete setting up your account with a password.

On the screen of your RBPi, you should see a VNC icon, which you can click to open. Now, click on the Status Menu and select Licensing. Here, you can enter your email address and its password you created on the sign-up page. On the next prompt, select Direct and Cloud Connectivity, to make your RBPi accessible online.

Now go to the computer or smartphone from which you would like to control your RBPi, and download the VNC Viewer application therein. Open the application, and enter your email address and its password you created on the sign-up page.

This should make your RBPi pop-up automatically as an option. You can use to open up the connection. It will prompt you for the username and password of your RBPi. By default, this is pi as username and raspberry as password, unless you have changed the password as instructed earlier. It takes only a few seconds to connect to your RBPi.

Now, as long as your RBPi is connected to the Internet, you can log into and access its graphic desktop from anywhere. That means you have complete control of any software on the RBPi, check on the status of any project it is running, or even play the games stored on your private server.