Category Archives: Raspberry Pi

Make Your Raspberry Pi Follow Walls

The versatile single board computer, the Raspberry Pi or RBPi, makes an excellent base for an autonomous bot using a rover 5 platform. The bot uses custom laser range finders for basic wall following. It features speed control of each track, regulated by PID using feedback from its quadrature encoders, giving it the ability of directional control. The basic features are explained below.

Batteries power the bot, feeding two separate switching mode regulators. One supplies power to the motors via the H-bridge, while the other powers the RBPi and other electronic devices. The H-bridge and the SMPS reside on the lower layer of the bot, while the sensors and the RBPi are on the upper layer. Mechanical standoffs separate the two layers, and the physical separation between the two layers creates a barrier for the electromagnetic fields from the power system that would otherwise affect the compass.

A Pixy CMUCam and a line laser form the laser range finding system of the bot. A simple piece of PVC pipe with slots cut into it breaks up the beam from the line laser. That allows the cam to recognize the color of the laser blobs as it reports this data via I2C to the RBPi, which then uses simple trigonometry for converting the data into vectors representing range and angles.

A sonar device mounted on the front of the bot implements a fairly simple crash prevention mechanism. The laser range finding system may also be used for a more sophisticated crash prevention system. Even though the bot is meant for autonomous operation, it also has a basic user interface built-in to allow control for testing purposes. The interface allows simple operations such as setting the heading and limiting the forward and backward speeds. It uses some feedback from the current heading of the robot.

For testing the laser range finding, the bot has a built-in GMR or graphical mapping representation, but in a minimal configuration. Using the GMR reveals a basic difference between the mapping from the sonar device and that from the laser range finder. For example, the sonar data interprets long flat surfaces as convex, but the data from the laser shows them to be perfectly straight – implying the laser range finding is linear.

A custom mount holds both webcams and the laser line. As the cases of the webcams made it difficult to mount them, they had to be removed from their casings. One of the cams faces 25-degrees to the left, while the other faces 25-degrees to the right. That gives a 100-degree field of view to the bot. Both the cams are tilted upwards such that the bottom-line of their images is just below the horizontal.

The software processes the images and locates the laser line to calculate ranges. It makes 30 vertical scans from the top of the image looking for the laser line. Looking specifically for a laser line makes it simpler as the line is never vertical. Therefore, every point located on the line has a neighboring point.

A New Raspbian for your Raspberry Pi

Your single board computer, the Raspberry Pi or RBPi runs an operating system, or more specifically a Linux OS. Keeping true to its form, the Linux OS comes in umpteen flavors and you can choose and pick the one most suitable to your purpose. Operating Systems are built for the processor in the system, and the most popular so far are the Intel family of processors. Since SBCs generally use the ARM family of processors, a special version of the Linux OS is available for them. Of the many versions of the Linux OS for the ARM processors, the Raspbian is the most popular. A new version of Raspbian is now available.

Although people consider versions of operating systems primarily as updates and bug fixes, the new Raspbian is something more. The existing Jessie image used for the desktops and laptops has been modified and adapted to work with the ARM family of processors. Among the standard applications that come with Raspbian, many have been upgraded to offer newer features.

The new Raspbian offers Sonic Pi, version 2.9. If you view the history section of the Info window in Sonic Pi, you can read the full list of changes. The most important are two new effect functions – all articles of SAM Aaron of The MagPi magazine are now included as part of the online tutorials, and there is a new logging system.

Scratch, at version 20160115, has an improved capability for sound input, and supports the CamJam Edukit 3 robotics board. It offers basic PWM support in its GPIO server, and adds several improvements to the font scaling and display.

You will get the new Mathematica at version 10.3 with added support for additional functionality as described by Stephen Wolfram in his book. It supports Sense HAT, includes several new functions, and adds more interfacing to the Arduino.

WiringPi library has been upgraded to version 2.31 and now it allows access to the GPIO pins without use of the the sudo command from applications that use the library. Another Python library, the Rpi.GPIO is at version 0.6.1, and includes several bug fixes that plagued the GPIO Zero library. Additionally, the ping command does not require sudo anymore.

The ALSA system had earlier made it very difficult to get some USB devices to work as the default output. Now it has a new volume/audio device icon on the taskbar. That allows it to be compatible with a wider range of audio devices than before.

With the improved Main Menu editor, you can now create new menus. Earlier, the LXDE desktop environment did not allow visibility of all other menus, and this has now been addressed to work correctly.

Overclocking options for the RBPi models 1, 2, and Zero boards are now available from the command-line and the RBPi Configuration GUI. Updated language translations are also available for those not using English.

Earlier, there was a wide selection of names in different places such as Trash, Rubbish Bin, and more. Now, the name is consistently Wastebasket everywhere when you set the desktop to British English.

PIXY: Versatile CAM for Your Raspberry Pi

If you are looking for a small, fast, low-cost, easy-to-use, and readily available vision system for your Raspberry Pi or RBPi, then the Pixy can be a great choice. Pixy or CMUCam5 is somewhat more than a normal camera that you may have used so far for your single board computer. It comes with several features not available on most camera systems.

First, Pixy is versatile – use it for all kinds of projects. Along with the hardware, you will receive all kinds of information – PCB layout, bill of materials, schematics, and other hardware documentation. All software/firmware is GNU-licensed and open-source. The configuration utility provided with Pixy runs on all platforms – Windows, MacOS, and Linux. RBPi can communicate with Pixy over one of several interfaces – analog/digital output, USB, UART, I2C, or SPI. The Pixy comes with all libraries for RBPi, BeagleBone, and Arduino and supports programs written in Python and C/C++. The cable provided with Pixy can connect directly to Arduino, and it also works with BeagleBone and RBPi.

On the performance side, Pixy can learn to detect and recognize objects that you have taught it and outputs what it detects 50 times per second. With a Pixy, an RBPi and a servo control board, you can reconstruct Wall-E, the waste-collecting robot.

Pixy resulted from a partnership of the Carnegie Mellon Robotics Institute with Charmed Labs. First started as a Kickstarter campaign, Pixy is now the most popular vision system since it first started selling in March 2014. You can gage the versatility of Pixy from the activities it can do in association with an RBPi – pick up objects, chase a ball, locate a charging station, and more – doing all this with a single vision sensor.

Although there are other vision systems that can sense or detect practically anything, almost all of them have two drawbacks. One, they output huge amounts of data, a few megabytes per second. Two, enormous computing power is necessary to process this data, leaving the attached SBC with little else to cater to other tasks.

Pixy gets around these barriers as it pairs a powerful and dedicated processor along with its image sensor. The processor does all the processing of the data captured by the image sensor, and sends only the relevant information to the attached SBC. For example, yellow ball detected at x=50, y=110. Therefore, the RBPi can easily talk to Pixy and still have enough computing power left over for other activities. That also means you can have multiple Pixy cams hooked up to your RBPi. For instance, you can make a robot with a 360-degree sensing capability with four Pixys.

Although Pixy began with interfacing capabilities with the Arduino controller, it has matured sufficiently to be able to communicate with other controllers as well. The Pixy comes with all sorts of software libraries and a Python API for connecting to Linux-based controllers, such as an RBPi.

On-board Pixy is a color-based filtering algorithm that helps in detecting colored objects. The popular color-based filtering method makes Pixy singularly fast, efficient, and relatively robust. Pixy examines each RGB pixel from the image sensor and computes the saturation and hue to use as its primary filtering parameters.

An Energenie Pi-Mote controller Board for Your Raspberry Pi

Those looking for a low-cost automation and home control solution can use the Pi-Mote controller board from Energenie. The Pi-Mote controller board is an add-on for your single board computer, the Raspberry Pi or more simply, RBPi. With this combination, you can control electrical appliances connected to special radio controlled electrical sockets.

Working at 433.92 MHz, the Pi-Mote controller board for radio-controlled sockets is easy to install and command. The product offers a safe and simple way to let your RBPi control mains powered devices and appliances. The Pi-Mote controller board from Energenie is compatible with all RBPi models such as the A, A+, B, B+ and B2.

The Pi-Mote controller has a range of up to 30 meters and puts out an output power of 3V, 27mA at +12 dBm. The output is encoded at four data bits, offering a 20-bit address pre-set with OTP. The user can select the output modulation with software from OOK or FSK.

The product actually comes in two parts, the RF board and the electrical socket. The RF board attaches to the RBPi for controlling several 13A, 3-pin electrical sockets. Although the original Energenie sockets are meant for use in the UK, plug adapter sockets are available, which make these almost universal. You can also get kits with a 4-way extension lead and other compatible sockets from Energenie. All can be controlled from the Pi-Mote controller board.

A small Python program allows the add-on RF transmitter board to control up to 4 radio controlled sockets simultaneously by toggling the socket on and off individually. The add-on board attaches to the GPIO pins of the RBPi. In its basic form, each board transmits a frame of information to the sockets. The frame is made up of a 20-bit address and a 4-bit control data. Additionally, the frame uses the On-Off Keying or OOK technique, a basic form of Amplitude Shift Keying or ASK. The source addresses are pre-programmed and the user cannot change them.

When using the Pi-Mote controller, you are required to insert the radio-controlled socket into the mains wall socket and switch it on. The socket then enters a learning mode, which is indicated by the slowly flashing LED in front of the socket housing. You can force a socket to enter the learning mode at any time by pressing the green button on its housing form, holding it for five seconds and releasing it.

Once it is in the learning mode, send the socket a signal from the program running on the RBPi. The LED on the socket housing gives a brief flash and stops glowing. This indicates the socket has accepted and memorized its address. You can then program the rest of the three sockets in turn; otherwise, they will react to the same address. When using more than one socket, insert each into separate mains wall outlets, maintaining a physical separation of at least 2 meters so they do not interfere with each other. The sockets must not be put into a single extension lead.

Cool your Raspberry Pi with PiCoolFan

Applications for the single board computer, the Raspberry Pi or RBPi are exponentially increasing and there is a great demand on the RBPI for extending its performance to the limits. While users try to push their RBPi to achieve higher results with overclocking, this may result in SBC frying itself, unless the CPU temperature is kept in check.

To enable complete control over the CPU temperature, an advanced cooling fan system is available – PiCoolFan. On the bonus side, the system also includes a Real Time Clock that RBPi does not have in-built. Therefore, if your RBPi is running hot, for whatever reasons, you can use the PiCoolFan to keep its CPU cool. The applicability extends to all models of the RBPi.

The cooling fan does not require any additional power supply to operate. It draws its power from two GPIO pins. You simply have to insert the connector on the PiCoolFan on top of the P1 connector of the RBPi. A dedicated sensor on the PiCoolFan continuously senses the PCB temperature of the RBPi, feeding the readings to an embedded temperature measurement system on the PiCoolFan. Depending on the measured temperature, the micro-controller on-board the PiCoolFan will start, stop or regulate the rotational speed of the tiny fan.

As an added advantage, PiCoolFan contains an Air Distribution Plate, which cools not only the microprocessor on the RBPi board, but also all the heat-generating devices and the entire RBPi PCB. The RBPi user can easily access the embedded micro-controller on the PiCoolFan via the I2C interface. Apart from being able to read the temperature measured, the user can also set the temperature threshold and the temperatures at which the micro-fan will start and stop.

The PiCoolFan also offers on the same board a real time powering voltage monitoring and a real time clock with full battery backup. The entire unit is small enough to be included within most of the already existing cases of the RBPi. Apart from reading the temperature via I2C interface, PiCoolFan offers the user an information system based on three LEDs. A glowing blue LED assures the user the RBPi is comfortably within the allowed operating temperature range. If the temperature exceeds the range, the red LED will start to glow.

A flashing green LED indicates the powering status. When the voltage is within threshold limits, the flashes are continuous. When higher than the threshold, the frequency of the flashes increases. If the voltage is below the threshold limit, the frequency of the flashes decreases. Therefore, with a transparent case, it is easy to see from a distance whether the temperature and voltage of the RBPi system is within specified limits.

The user has complete control over the PiCoolFan system via the I2C interface. The fan can be switched on or off unconditionally and its speed controlled by pulse width modulation or PWM. The user can read the current system temperature and set the temperature threshold – PiCoolFan supports both the Celsius and the Fahrenheit scales. The PiCoolFan kit contains all the hardware necessary for setting up the fan and the air distribution plate.

Get VGA from your Raspberry Pi

Those of you who use the single board computer, the Raspberry Pi or RBPi, know that it has two video outputs. It offers high definition video via the HDMI port and a composite video via the RCA port. For viewing the output of the RBPi on a VGA monitor, one must use an HDMI to VGA adapter or similar. However, there is a simpler and cheaper method now available – the Gert VGA 666.

The Gert VGA 666 is a breakout/add-on board, useful only for the RBPi Model B+. The board does not work on other RBPi Models such as A and B, as it requires the additional GPIO pins that are only available on the Model B+. Gert van Loo has designed this Gert VGA 666 board and has released it as an open source hardware design. Incidentally, Gert van Loo was associated with the initial design of the original RBPi and is one of the architects of the BCM2835 chip that forms the heart of the RBPi.

The Gert VGA 666 is a useful and neat solution for attaching a VGA monitor/screen to your RBPi. Additionally, this works out much cheaper than buying a converter or adapter for converting HDMI to VGA. A parallel interface from the GPIO pins drives the hardware natively for the VGA connection, using the same CPU load as the HDMI connection does. Users have the added advantage of setting up a dual screen, one for HDMI and the other for VGA. This is possible as the RBPi can drive both interfaces at the same time. With no CPU load, you can expect a VGA video display with resolution of 1080p60 or 640×480.

You can buy this adapter in the form of a kit, comprising the PCB for Gert VGA 666, a 40-pin header connector for the GPIO, a 15-pin female VGA connector, 20 through-hole resistors and two Pi supply stickers. When assembled and fitted on the RBPi, the board uses up nearly all the GPIO pins on the Model B+. Therefore, it will not be possible to use any other add-on boards at the same time when using the VGA adapter.

The decision to offer the adapter as a kit stems from the requirement of meeting EMC compatibility regulations. A fully assembled board would be required to meet most EMC regulations. However, these regulations do not cover the kit, as it is a homemade electronic product.

After soldering the board, plug it into the RBPi and power up the combination. However, the adapter does not work directly and you will need an intermediate solution for video output. You can use either an HDMI or a DVI-D monitor. If that is not available, use a composite monitor or TV via the RCA port. However, using the composite video means you will need to program the NOOBS on the RBPi.

After booting, you must install the necessary drivers for the Gert VGA 666 adapter. This requires an Internet connection, preferably via an Ethernet connection. If you simply plug in the Ethernet cable, Raspbian will automatically start to use it.

Adding Memory to the Raspberry Pi

Although the memory onboard the Single Board Computer Raspberry Pi or RBPi is sufficient for most applications, some may feel the necessity of expanding the storage capacity. The options provided on the RBPi are limited, as the USB ports often engage a keyboard, a mouse or a game controller and the SD card slot holds only a single device.

The most obvious option for expanding the storage capacity on the RBPi is through the USB ports. However, tying up ports with a USB hard disk drive or flash drive can run into difficulty if you need the port for plugging in another USB device. One way of getting around this problem is by using powered USB hubs. It is important to realize the RBPi cannot supply enough power for driving the hub.

Using a powered USB hub makes it easy to add USB devices to your RBPi, including additional storage. However, you must consider a few things when expanding storage on your RBPi. In reality, there are only two common USB storage options available – flash drive and hard disk drive. Nevertheless, you may also consider a card-expanding trick for the Raspbian operating system for your RBPi. These are the three primary options available for expanding storage on your SBC. Apart from this, you may also consider using secondary storage devices such as networked drives, USB DVD-r drives and NAS drives.

The SD card in the RBPi acts as the main storage option – use an SDHC card for best results. It is a boot device acting as the general storage and from which the operating system also runs. You may think of the SD card as a replacement for the HDD of a regular desktop computer, more like an SSD or Solid State Drive, as it has no moving parts and uses very low energy.

By default, Raspbian, the standard Operating System of the RBPi, is designed to run from a 2 GB SD card. Therefore, when you flash the Raspbian image, the SD card will have a partition of 2 GB, with the balance of the card memory remaining unused.

To get around this, you must use the expand file system feature included in the raspi-config screen in Raspbian. This enables expanding the size of the partition to the maximum capacity of the SD card.

When you insert your flash drive into a USB port of the RBPi, you may be surprised it does not have the same effect as it does in a regular Ubuntu or Windows computer. It is not enough to insert the flash drive, Raspbian expects you to mount the device manually before you can use it as an additional USB storage device. However, before you can mount it, you must know the exact device name that Raspbian has assigned to the drive.

For this, the command necessary is: sudo ls /dev/sd*. The command “sudo” gives you temporary administrative status, “ls” allows listing the devices and “/dev/sd*” lists the devices seen by Raspbian. With this command, you will know the number Raspbian has assigned for your drive.

Now, you can mount the USB flash drive and use it as an additional storage device with the command: sudo mount -t vfat /dev/[USB DEVICE NUMBER] /mnt/usb.

A New Operating System for the Raspberry Pi

The Single Board Computer, the Raspberry Pi or RBPi runs on a version of the popular operating system Linux – the Raspbian. Although there are other versions of Linux equally capable of running on the RBPi, another operating system is in the making. Not ready yet, the Tizen 3.0, is being ported for the RBPi Model 2.

While not attracting a lot of attention, Tizen is another Linux-based operating system into which huge resources are being pumped to make it more popular for the RBPi. The Linux Foundation is providing all the guidance for its development along with help from a number of companies led by Samsung.

Samsung is pushing for the adoption of Tizen, which, until now, it has implemented only on some low-end devices including a watch. Samsung wants Tizen as a replacement for the Android OS developed by Google, mainly because it has to pay royalties to Google. Hence, Tizen 3.0 for the RBPi 2 is an important step for Samsung.

However, the trouble is the community is not very aware of Tizen. The main issue is people do not even know of its existence. By making it available for the RBPi, an SBC already in use by over a million people, Samsung expects to make Tizen more popular.

The Open Source Group of Samsung is currently attempting to port Tizen 3.0 to the RBPi 2. Their goal is to run a fully functional Tizen 3.0 on the RBPi 2. They have chosen the RBPi 2 as their base system, as this is the most popular SBC that more than five million people are using.

Although Tizen 3.0 is presently working on the RBPi 2, there are still a number of issues that Samsung has yet to sort out. For example, installation of applications is one of the biggest issues they need to overcome. However, one can assess the speed of the porting process, as the developers have already managed to enable the 3D acceleration on the platform. However, there is still no indication of when Tizen 3.0 may be available in a stable form, and Tizen 3.0 is still in Beta stages.

In its stable form, Tizen 3.0 will ship with Linux Kernel 4.1 and Wayland in place of the familiar X-windowing system. Linux Foundation, the developers of the open source Linux operating system, aims to run it on phones, tablets, watches, and in-vehicle entertainment systems. They claim Tizen 3.0 will bring some interesting changes.

Although many companies are still evaluating their choices, some of them have chosen to support Tizen as they are looking for alternatives to Android. They know it is not an easy task to move people away from Android, just as Microsoft has discovered to their chagrin.

The Linux Foundation is building Tizen for various profiles and is making the current iteration for the TV and Mobile. It will support 64-bit systems and provide a replacement for the X-server in the form of Wayland. Additionally, Tizen will come with Chromium-efl, a generic policy manager, in place of Webkit2.

Raspberry Pi Can Keep Your Plants Happy

Those who like indoor plants know how important it is to maintain a proper atmosphere for the plants to grow happily. Only a few parameters are important – air humidity, air temperature and soil moisture apart from adequate sunshine. However, it is rare for people to be able to monitor the health and well-being of their flora personally, given the busy schedules.

That is where a single board computer such as the Raspberry Pi or RBPi can help. Being flexible in setting up and connecting to the various sensors necessary, this SBC not only looks after the plants, but also alerts you with SMS and via email whenever the situation differs from the normal. This project also has an app, Plant Friends, for your Android phone, so that you are up to date on the real-time and historical parameter data on your plants. The project consists of three main components – the sensor nodes, the base station and the app.

You need a sensor node for each plant. Each of these sensor nodes consist of an Arduino clone called Moteino fitted with an RF transceiver, a battery meter, a temperature sensor, a humidity sensor and a sensor for soil moisture. The sensor nodes collect the readings from all the sensors and transmit the data using the transceiver to the base station. The sensors and the base station are connected via the 915MHz ISM band.

For this project, users must be slightly above the beginner level. Some basic experience with Arduino hardware and Arduino IDE will be necessary – for installing libraries, making LEDs blink, etc. Additionally, experience in wielding a soldering iron is also necessary. On the RBPi side, it is essential to be familiar with the basic knowledge of the SBC and with installing the Raspbian OS.

The Plant Friends system has several advantages. It reminds you to water your plants and sends you an alert via email and/or SMS. It works for multiple plants at the same time, even if they are in different rooms of your home. Since wires are a minimum and all components of the system are of a reasonable size, you can move the plants and the system freely about the home.

The entire system consumes low power and therefore runs on batteries. Typically, battery swaps are necessary every 4 to 6 months. The electronics is low-maintenance as it is housed in a moisture-proof enclosure. The best part of the system is the Android app, as it allows monitoring from anywhere in the world.

An RBPi, model B, is used for the project, although a model A will work equally well. However, model B has more RAM and an Ethernet port, which may be necessary for flexibility. A USB Wi-Fi adapter helps to connect to the internet.

For each sensor node, you will need a holder for four AA type rechargeable batteries. In addition, you will need a combined sensor for temperature and humidity. For sensing the moisture in the soil, you may use a soil probe consisting of a PCB with exposed traces. However, ensure there is no lead involved.

PIR Sensor: Let Raspberry Pi Guard your Home

With a versatile platform such as the Raspberry Pi or RBPi, prototyping a project is very simple. The scale does not matter for you can start with a single blinking LED and move on to complex quad copters. If you have the necessary components, simply add a little amount of imagination, and RBPi can work wonders for you.

A practical use for the RBPi is to sense the surrounding environment. Not only is this interesting, but also gathering this data is useful in myriad ways. For example, a weather station uses different sensors to measure pressure, humidity, wind speed and temperature. The main objective in recording and manipulating such data is to predict future weather conditions. Anyone technically savvy can store this data and manipulate it to produce tables and graphs for importing into other applications or projects.

Using a PIR or Passive Infra-Red sensor with an RBPi can be an effective guard for your home. These inexpensive sensors are used with motion activated air fresheners from which, you can easily harvest a couple for building this project. The PIR and RBPi combination can act as an effective burglar alarm in homes and offices.

The PIR sensor effectively sends out a beam of infrared light into the area that it is monitoring. As long as there is no movement in the area, the beam remains undisturbed. However, the slightest movement causes the beam to change, which the PIR sensor can sense. The PIR sensor, when connected to the RBPi, sends it a signal once it detects movement. The RBPi responds to this signal in a manner defined by its program.

For this project, the PIR sensor is set up to watch over an area for any movement. As soon as it detects movement, it triggers the RBPi, which responds by capturing a picture of the event on its camera, including recording a 10-second video at a resolution of 640 x 480 pixels.

Additionally, the RBPi will send out a text message to the owner’s phone, thereby alerting the user of an intruder or whatever that triggered the event. The text message includes the picture and the video. After sending the text, the RBPi will wait for 30 seconds before resuming its watchful stance.

Apart from being an effective burglar alarm, you can use this combination of PIR sensor and RBPi with its camera in many innovative ways. For example, those who like to study birds and their habitat, can set it up near the nest to record the coming and goings of the parent birds.

Using a text message to alert the user is effective, as all phones are capable of receiving SMS. Other methods using emails or tweets usually rely on 3G or Wi-Fi coverage and may not be always useable. Additionally, you can use several alerts from the project simultaneously. The RBPi stores the pictures and video it captures in its memory. You can retrieve them later via any means convenient.

To set up, install the OS in the RBPi, enable the camera via raspi-config and test its working. Use the command “raspistill -o test.jpg” for testing. This produces an image file by the name test.jpg.