Category Archives: Raspberry Pi

An Exquisite Raspberry Pi Enclosure

There are countless types of enclosures available for the inexpensive credit card sized Single Board Computer – the Raspberry Pi, popularly known as the RBPi. All have their unique capabilities and advantages. Some are made of wood, some of paper while most others are made of plastic.

The molded enclosure from Hammond Electronics is specifically designed to house the RBPi model B. The exquisitely molded container is shaped like a book and is available in black, grey and translucent blue. The stylishly rounded design has apertures for all the IO interfaces and accessories supported by the RBPi. The enclosure is actually two parts made to fit one on top of the other, holding the RBPi between them. No screw-fixings are involved, and a specific sequence is required to get the bottom, the RBPi and the top fitted together perfectly.

On opening the 1593HAMPI enclosure assembly, you will notice the bottom half has some stationary clips on its inside. Holding the bottom half in your palm, slide the RBPi board in at an angle against these stationary clips. Once in place, push down firmly on the RCA jack of the RBPi, until you hear the board click into position. Now the RBPI is securely held in the bottom part of the enclosure.

Take the top part of the enclosure and touch its rounded ends to the corresponding rounded ends of the bottom part, on an angle. Still holding the bottom part firmly, push down on the outer edge of the top part, until you hear a snapping sound. On turning the assembly around, you will see a clip from the top part jutting through an opening on the bottom part. This holds both the halves together. In case you would like to separate the two parts of the enclosure, simply pull back the clip from the bottom part and the two halves will come apart.

Hammond Electronics offers self-adhesive rubber feet, which you can fit in the circles on the bottom part of the enclosure. They will prevent the encased RBPi from sliding off. One of the most popular accessories of the RBPi is the camera module. You have a choice of two methods for mounting the camera module. Screw the camera to the inside of the top part, which has a hole provided for the lens. However, if the camera must remain outside the enclosure, you can fit it through a slot in the top. The camera will now be standing at right angles to the assembly.

Access to the GPIO header is provided through a cutout on the mating line between the top and the bottom halves. The sides also have apertures of the right size and shape for all the ports. Therefore, you can easily access the HDMI interface, the micro-USB power-in connector, the RCA ports for audio and video, the SD card, the RJ45 LAN and the two USB ports. The base has two captive slots so that you can attach the enclosure to a surface. For stand-alone applications, the rubber feet are helpful.

Meet the Prettier Raspberry Pi Model B+

Just as soon as you thought you knew as much as there is to know about the most popular single board computer, the tiny versatile Raspberry Pi or the RBPi, acquaint yourself to a prettier cousin. There is an update to the familiar RBPi Model B and it is called the RBPi Model B+. Raspberry Pi Foundation, the manufacturers of the RBPi, have incorporated several improvements requested by users in the new model.

Although the RBPi Model B+ retains the same controller, has the same amount of RAM and runs on the same software as the Model B, there have been several cosmetic changes. The most notable improvements in RBPi Model B+ are:

— GPIO has 40 pins; the first 26 pins retain their pinout as in Model B.
— Four USB 2.0 ports with better hot plugging and overcurrent behavior; Model B has 2 ports
— A micro SD socket (push-push type); Model B has SD card socket of friction-fit type
— Power consumption 0.5-1.0W; Model B power consumption 0.55-1.65 W
— Better audio with separate low-noise power supply
— Improved form factor. Compared to Model B, the USB connectors align with the board edge and composite video moved to the 3.5 mm jack. Model B+ has four mounting holes.

Even with all the above improvements, the price of the RBPi Model B+ has been retained at $35. So what happens to the Model B now? According to the Raspberry Pi Foundation, Model B will remain in production as long as demand for it continues.

In its lifetime of two years, the RBPi SBC has gone to many places such as floating in space, deep under the sea and controlled complex machinery. Considering that the initial goal of the project was to educate children in Computer Science, RBPi has definitely marked a place of its own. RBPi has revolutionized the landscape of education for children and adults alike. People have learnt more about Computing and Electronics with RBPi.

Since the RBPi B+ model has the same architecture as the earlier Model B, the Foundation assures compatibility with the existing projects and software developed so far. According to the feedback received from the community, RBPi Model B+ is a more refined product.

Measuring 85x56x17mm in size, the RBPi B+ is slightly smaller than the form factor you are accustomed to with the Model B. Additionally, an improved layout backs up the size reduction. The organization of the board is neater and there are several improvements.

For example, there are now four USB ports as opposed to the two earlier. This is because the RBPi Model B+ uses the new LAN9514 chip. The Model B had its ports dotted all around the perimeter of the board. In contrast, the Model B+ has concentrated its ports only on two sides. The RBPi Model B+ with its four USB 2.0 ports supporting higher currents can now attach external portable USB2 hard drives. For those who had to counter the USB reboot issue on the Model B, can now rejoice since RBPi Model B+ has more stable USB hot swapping of USB devices.

Talk To Your Raspberry Pi through an FTDI Breakout Board

You do not really need a monitor and a keyboard for logging into the tiny credit card sized single board computer, the famous Raspberry Pi or RBPi; there are several ways to do that. One of the very simple ways is to listen in on two of the serial communication monitoring pins on the GPIO header of the RBPi.

Manufacturers of most computers have now given up on including serial ports on their products in favor of the more Universal Serial Bus or USB. However, connecting the serial pins on the RBPi to the USB port on the computer is not so straightforward. A special translator is required, one that understands and converts between the serial and USB protocols.

FTDI makes a special cable with an FT232 chip in between that can help to connect the serial port pins on the RBPi to the USB port of the computer and provide meaningful communication between the two. Modern Devices have gone one step further. Instead of having to deal with connectors or soldering on the RBPi side, they have designed a breakout board with the FT232 on it. The FT232 TTL signals are available on a header, which is suitable for plugging into the GPIO header on the RBPi; this is the USB BUB 1,

On one side of the BUB is an FTDI header, a six-pin version very common with most of the Arduino-compatible boards. The breakout area of the BUB is very handy as it allows you to reconfigure the signals to any of the pins on the second header. When you have to connect different devices such as the Parallax Propeller, this rerouting is very useful, as pinouts or the RBPi and the Parallax Propeller are different. The rerouting process also allows you to select the proper logic level (5V or 3.3V) for your device with a single jumper. You can suitably modify the breakout area of the BUB to enable it to connect appropriately to two different style devices without resoldering the connections.

When connecting to the RBPi, make sure you are connecting the Transmit of the RBPi to the Receive pin of the BUB, and the Transmit of the BUB to the Receive of the RBPi. Unless you follow this method of connections, BUB and RBPi will be unable to communicate with each other. For connecting with the RBPi, another very important thing to take care on the BUB is the logic level jumper. Make sure and double-check that it is connected to the 3.3V rail and NOT to the 5V.

Now that you have everything under control, boot up your RBPi, plug in the BUB and connect the other end of the serial cable to the USB port on your computer. All FTDI chips have a unique ID and this will show up as the device name. The device will be available under the /dev directory if you are using a Mac or Linux computer. On Linux, the BUB will show up as /dev/ttyUSBx, where x will depend on the number of USB devices already plugged in.

Use F-RAM to Replace SD Card in Raspberry Pi

For those who use their Raspberry Pi very frequently, there is always the risk of wearing out the SD card. This tiny, inexpensive, credit card sized, single board computer – the Raspberry Pi – or RBPi, boots and runs a Linux Operating System held on an SD card. Therefore, if your RBPi has to boot often, you run a database on the SBC or use virtual swap space that resides on your SD card, the life of the SD card reduces very fast.

In fact, any time you use the SD card, for example, for data logging, serial or network capture or while reading sensors, you are saving data to the SD card at fairly frequent intervals. Similarly, when you run a customized server on an RBPi such as an email or a web server, the system writes temporary or configuration files constantly to the SD card. That puts the SD card at risk.

The problem with SD cards or any other standard Flash-based memories and EEPROMs is that they require a block erase before writing any data. These devices have a limit to how many times these erase cycles may be used.

However, you can supplement the Flash-based SD card of your RBPi with an F-RAM board, called the Ironman. The first advantage is that F-RAM does not require any erase cycle to write new data, which makes it very fast. Secondly, F-RAMs can be written limitless times, so it will last a very long time. Thirdly, F-RAMs do not need external batteries to retain data. This video compares the three types of memories.

All over the world, nearly two million RBPis are running from SD cards. The RBPis write data frequently to the Linux root partition stored on their individual SD cards. On average, after 10,000 writes, an RBPi may fail to boot, losing all the data and configuration. Using an F-RAM card that adds 1-4 MB memory allows your SD card to be used as read-only. All the small databases, log-files, temporary files, configuration files, caches and anything that changes during normal use, goes on to the F-RAM card. That prevents use of precious kernel or application memory from the built-in RAM or tmpfs of the RBPi. The best part is that all the temporary files are available even after a reboot.

F-RAM or Ferroelectric RAM is very well suited for embedded systems. Being non-volatile, it does not require power or battery backup to retaining data up to 10 years. There is no restriction on erase/write cycles, making it as fast as SRAM. Unlike EEPROMs or Flash, there is no limit to the number of writes before device failure. The only disadvantages of F-RAM are cost and density/size.

F-RAMs can be read and written to up to 100 trillion times. To put that figure in understandable terms, you could write to the same address on the F-RAM chip 1,000 times per second continuously every second over 317 years – without the device failing. If the same process were to be tried on a Flash memory, the device would fail in just 100 seconds.

Forget Keys Use Raspberry Pi Face Recognition

Now it is no longer necessary to use a key or a password to protect your treasures from prying eyes. Just teach your treasure box to recognize your face and it will open to no one except only when you are near it. The trick is to use the tiny, credit card sized, single board computer, the Raspberry Pi (RBPi) and its camera. When you are near, the camera and the RBPi recognize your face and the box unlocks itself.

The RBPi is the best-suited platform for this project, as it is very small and you can fit it almost anywhere. Additionally, all algorithms for this project are from the OpenCV computer vision library, which the RBPi is able to run. The advantage in building this project is that being an intermediate-level design, the project will teach you how to compile and install software on the RBPi.

For this project, you will need an RBPi model A or B and it should be running the Raspbian or the Occidentalis OS. You will also need Internet access when you are building the project. Additionally, you will require the RBPi camera module.

For the treasure box, you can use any type as long as it opens from the top and is big enough to hold the RBPi, and of course, your treasure. Among the other things you will require are a battery holder to hold 4x AAA batteries – this will be used to power the servo. For making the latch, you may use a wooden dowel and a few planks – these will be used to make a frame for the RBPi. A momentary push button may also be used – you can mount that on the side of the box.

As a start, you will have to make a hole on the top cover of the box for fitting the RBPi camera. You will also need a few more holes on the side of the box for the power cables and the push button. Mount a dowel in front of the box – the latch will catch this when the servo turns. You will need a small frame to support the RBPi and the latch servo. Clamp the servo to the frame using some wood scraps and machine screws. Fit the RBPi under the top cover of the box, such that the latch servo can swing down and catch the dowel to lock the box.

For the software, you will require the latest version of OpenCV. However, you will need to compile this from source, as the binary versions available are too old to be of use for face recognition. Compiling OpenCV on the RBPi will take about 5 hours.

For training the system to recognize you, you need to press the button to let the camera take a picture of your face and save the picture in the training directory. RBPi requires at least five pictures from different angles, with different lighting etc., for making a positive identification. The images form a database of the permitted faces that are allowed to open the treasure box.

Carberry for your car

Why do you need a Carberry for your car? Carberry forms a link between the car electronics and the tiny, inexpensive, versatile single board computer, the Raspberry Pi (RBPi). In sort, Carberry is a shield for the RBPi microcomputer and allows an enthusiast to develop end-user applications such as internet, carputing, burglar alarms, blackboxes, tracking, fleet management, data logging, vehicle diagnostics, media centers and much more.

Carberry can sit directly atop your RBPi, as it has the same form factor, and connects to the RBPi with the help of a 26-pin GPIO header, which is located on the Carberry PCB. You connect it to your car via a 22-pin Microfit connector, also on the PCB. Although the Carberry needs a 12VDC supply, it generates the 5V, 1A onboard for the RBPi and uses the ground connection from the vehicle. For managing the power flow to the RBPi, Carberry controls the 5V supply with a mosfet.

This also helps in performing a controlled shutdown, as it controls the power to the RBPi in the case of a logical shutdown. The entire combination follows automotive standards of low power consumption and normally consumes less than 3mA. Carberry communicates with the RBPi through the UART and utilizes pins 15 & 16 of the RBPi header.

Carberry provides ignition signal output at +12V, 2.5A controlling it through a mosfet. It reserves two CAN Bus lines and two GMLAN lines for parallel or series connection to the vehicular bus. On board, two channels are reserved for controlling a resistive steering wheel and this has the capability of being bypassed with a single key.

The general purpose UART operates at 5V or 3V3, as required by the user, while the two general purpose, open collector outputs can sink 500mA. There are two general purpose user-programmable LEDs and two general purpose inputs – the user can select the referencing to the ground or to 5V.

Carberry operates on a Microchip PIC32X microcontroller and provides a button and two-color LEDs for resetting and learning can bus profiles. If required, the user can send PWM signals to the RBPi for managing LIRC.

Cranberry can emulate infrared remote controls for media centers via the controls of the steering wheel, with the infrared sensor being suitable for 38 KHz. The board has an infrared LED onboard for the IR codes emission.

Other features of the Carberry are the user can develop applications under Linux that are ready for Apple MFI compatible. The on-board RTCC is capable of handling date and time along with battery wakeup and RBPi wakeup at programmed date/time.

An onboard external EEPROM comes with a unique identifier and users can utilize it for any license related to the card. Onboard accelerometer and magnetometer provide anti-theft features, blackboxing and positioning. The accelerometers and magnetometers can wake up the RBPi with their events, while the microusb device connector offers a stand-alone functionality for the shield in the future.

The user can upgrade the Carberry firmware via the RBPi and they can interface the Carberry to the RBPi via ASCII strings, similar to controlling modems with AT commands.

Raspberry Pi Pursues Ping-Pong Balls

Ping-pong balls are light and apt to bounce around a lot. Players have a hard time running after them, and when many are playing, finding a number of balls on the floor is a common sight. This was the case at the office of the 37signals at Chicago as well, until their system administrator, Will Jessop, who runs the North West Ruby User Group in Manchester, decided that enough is enough. He designed a solution for the problem with a Raspberry Pi running a robot to pick up the balls and collect them in a basket.

Raspberry Pi or RBPi is a low-cost, credit card sized single board computer with Linux as its operating system. Will designed the original version of the robot using the Custard Pi breakout. However, he changed over to MotorPiTX motor controller developed by Jason Barnett, as this was a much neater board. Will then sourced some of the parts necessary for the robot and built the others.

For example, he designed and 3D printed the motor mounts, the caterpillar track mounts, the ball basket and even a new base. In the end, he added a PiCamera mounted with a fish-eye lens. This made the whole contraption a neat little camera robot, reminding one of Wall-E.

Since the robot had to move around and pick up ping-pong balls, it needed its own power source to allow it to roam free. Will looked at the power requirements and tested its power usage while it was running all its motors. The RBPi robot had its own lifter arm fitted to the chassis and while this was controlled independently, the robot itself streamed video over wireless. Will finally opted for a lithium battery rated at 5AH, 7.4V.

For the software, Will decided to use Go. This, he found, was a great language for the RBPi, as he could use Go to create small, efficient statistically compiled binaries. Additionally, he could also fit them easily within the resource limits of the RBPi. Will runs the Go binaries alongside his gamepad library on his laptop, and these are available as a Ruby gem in C. To allow the RBPi to shutdown cleanly via the MotorPiTX, Will had also to write a power controller script.

Now that the robot was capable of roaming free on its battery, Will controlled it with an Xbox controller, with its camera feed streaming over Wi-Fi. By watching the video stream on a laptop, it was easy to let the robot pick up ping pong balls; see it in action below.

There were some suggestions that Will considered. One of them was to allow the robot to recognize the ping-pong balls on its own and pick them up. Initially Will did think of using OpenCV for accomplishing this, but then he found that people are more excited at driving a robot around and had more fun. Another suggestion that Will is considering for the future is using a vacuum pick up, since ping-pong balls are very light, and easily slip away from the robot’s fingers.

The Raspberry Pi-Fi bundle

The mighty single board computer, the credit card sized Raspberry Pi or RBPi, as it is fondly called, is making waves for all the good reasons. Developed by the Raspberry Pi foundation as a low-cost, hands-on for children learning about the inner workings of a computer, this tiny SBC has caught the imagination of hobbyists all over the world. As a result, people have developed innumerable projects based on the RBPi, and the flood shows no signs of abating.

For those still not initiated in the RBPi bandwagon, it is best to buy the SBC as a bundle. The Pi-Fi bundle will include the RBPi, a preloaded 8GB SD card, a Wi-Fi dongle along with an instruction manual “Getting Started with Raspberry Pi.” Add an appropriate power supply, a USB keyboard, a mouse and a display and viola – you have a fully functional Linux computer, fully Wi-Fi enabled, capable of playing games, writing programs, streaming media and web browsing. The USB keyboard and mouse is not a strict requirement. You may also use a wireless keyboard and mouse with their USB receiver.

Other sundry things you may need are an HDMI cable and a USB A to micro cable. Make sure the power supply is capable of supplying 5V at 1.0A on its USB port, and you are good to go.

To start, plug in your keyboard, mouse and monitor to the RBPi. Next insert the SD card and plug in the power cable between the RBPi and the power supply. Hook up the power supply to the mains and switch it on. On the monitor screen, the NOOBs (New Out Of Box) interface from your SD card will prompt you with a choice of the operating system you would like to install. If you dislike the OS you just installed, shut down, switch off, and reboot but hold down the shift key while the RBPi reboots. You will be returned to the NOOBs interface to select a new OS.

The RBPi consists of a System on Chip, a Broadcom BCM2835 that has a CPU, a 700MHz ARM 1176jZF-S and a GPU, a Broadcom VideoCore IV that supports MPEG-2, OpenGL, h.264/MPEG-4 AVC and 1080P. For memory, the SBC has 512MB of RAM, and an onboard storage of MMC/SD/SDIO card slot, for which a minimum size of 4GB is recommended. The board consumes about 700mA or 3.5W of power at 5VDC via the Micro USB or the GPIO header.

The RBPi is capable of outputting video as composite RCA or HDMI, audio via 3.5mm jack or HDMI. It has two USB-2.0 ports and a Micro USB port, exclusively for power. An onboard Ethernet network is available – 10/100 RJ-45. There is support for low-level peripherals such as SPI bus (along with two chip selects at +3V3 and +5V), I2C bus, UART and 8x GPIO or General Purpose Interface Bus.

If you are not too keen on an Ethernet cord dangling from your RBPi, simply plug in the wireless USB adapter to get 802.11b/g/n networks. In case power flakiness is observed, go for a powered USB hub to plug in the adapter. Wi-Fi requires substantial amounts of power.

Cassandra on a Raspberry Pi

The Cassandra database typically runs on large clusters of computer systems as it is designed to hold massive amounts of data. Now, a lecturer from the Dundee University is running it on the tiny, credit card sized, single board computer – the ARM based Raspberry Pi or RBPi.

At the Cassandra Summit, 2013, Andy Cobley, a lecturer at the University of Dundee, Scotland, presented his process of running Cassandra on multiple RBPis, which work as multiple Ethernet connected computers for his students. The advantage – no server racks and no data-centers required.

With 512MB of memory and a 700MHz ARM processor booting off an SD card, the Linux running RBPi does not look like a suitable candidate for usefully running Cassandra – the big data oriented Java-based database. Facebook originally contributed Cassandra as an Apache project. Organizations such as CERN, Twitter, eBay and Netflix use it to process huge amounts of data. For this, they use powerful servers in multiple data centers. Cassandra stores data and spreads the load over several clusters of connected disks and RAM loaded servers and connecting these clusters over highly constrained links results in an internationally reliable and resilient database.

Andy Cobley wanted to make it possible to run Cassandra on multiple RBPis, so that his students could experience running a database on multiple computers connected via the Ethernet, without having to build data centers and server racks. For this, Andy had to accept some compromises.

Cassandra is designed so that it can write data to disk at high speeds. Typically, in the time a laptop completes 12,000 write operations, a single RBPi can manage only 200 writes to its SD card. Making it write to an external USB drive only slows it down further. Moreover, the Ethernet port of the RBPi shares the same bus as its external USB port and the SD card. Cassandra, being very network centric, sees drastic reductions in network performance when there is any improvement in disk performance. Therefore, the route data takes through a system affects its performance.

With four to eight RBPis powered from USB hubs and all attached to an Ethernet switch, Andy was able to run Cassandra. Each of the RBPis was running the Debian Linux variant Raspian. Although he was unable to run the current Oracle JDK with the above setup, he ran Cassandra over OpenJDK. Running Cassandra in this manner, although complicated, resulted in some bugs being fixed for Cassandra. For example, Andy had to make the startup script resilient to accepting no CPU cores in the system.

Cassandra uses compression for boosting performance. However, it was not possible for Andy to use the native default method – Google’s Snappy compressor. Instead, he had to settle for the Java-based Deflate compressor, which is slower and has a penalty in write performance. Further performance boost for Cassandra came from ensuring that the RBPi CPU has more memory as compared to its GPU.

Andy has scaled down the Cassandra platform for his students, without actually rewriting it, making it easier for them to examine how a combination of Linux and Java runs on an RBPi cluster.

The compute module for Raspberry Pi

If you thought that the tiny single board computer, the Raspberry Pi (RBPi), could get no smaller, well, you really need to think again. There is now a Compute Module, which is much smaller. It contains the processor of the RBPi and 4GB of memory. The size of this board is roughly equal to a DDR2 laptop memory stick. However, the Compute Module is not exactly a miniaturization of the RBPi.

The advantage in fitting the system onto a small connector-less standard circuit board allows users to attach their own choice of interfaces. They need not be tied down to the built-in ports and devices that are available on the conventional RBPi board. The Compute Module is used along with a Starter IO board, which contains the rest of the devices.

The combination of the Compute Module and the Starter IO board is aimed at business and industrial users. The idea is to free the core technology of the RBPi to become an integral part of several new and exciting products and devices. The software of the RBPi is now full-featured and stable. A heroic community of volunteers is always hard at work constantly improving and improvising on the software. The manufacturers feel that this is the right time to free the hardware of the RBPi and make it more open.

Looking at the different types of users putting the RBPi to good use, it is really amazing to witness the huge number of products the community is developing around the tiny credit card sized SBC. The creativeness, ingenuity and inventiveness of the users are simply stunning. People are using the RBPi as not only a standalone module, but also embedding the tiny SBC into commercial products and systems. The dual combination of the Compute Module and the Starter IO board will make it even more versatile for these users.

The Compute Module contains the guts of the RBPi – the BCM2835 controller along with 512MBs of RAM. It also has a 4GB eMMC Flash memory, as a replacement of the SD card on the RBPi. Although all this is integrated onto a DDR2 SODIMM standard connector of the size 67.6x30mm and looks very much like a laptop memory card, it is not pin compatible to the memory card. Therefore, do not make the mistake of plugging in the Compute Module into a standard memory slot; it will only end in disaster.

The flash memory on the module is connected directly to the processor, but the remaining interfaces of the processor are freely available on the pins of the connector. That means you now have the full flexibility of the BCM2835 SoC. Compared to the original RBPi, many more number of GPIOs and interfaces available to the user on the Compute Module. That makes interfacing the Compute Module into a customized system should now be relatively simpler.

Although the Compute Module is aimed primarily at users who will be designing their own PCB, others not willing to go that far may use the Starter IO board. Snap the Compute Module into its connector on the Starter IO board and you are good to go.