Category Archives: Customer Projects

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.

Let ezIGBT guide you to the right IGBT

Those who design with IGBTs or Insulated Gate Bipolar Transistors know how difficult it is to select the proper component for a specific application. Several factors have to be carefully weighed simultaneously before you can zero in on the right product. IGBTs are very useful in equipment handling high power, with huge currents passing through them. Failure due to a mismatch involves high expensive replacements. Therefore, engineers have to be very selective when deciding on the right component to use.

For IGBTs, just as for any other semiconductor component, the junction temperature plays a very crucial role in maintaining the proper operation and life of the component. Other parameters that the designer must take into account are the operational voltage, the continuous and maximum currents and the power that the IGBT must handle. While the designer has to rely solely on the information provided to him by the manufacturer, the datasheet of a specific component may be cumbersome and static. From the steady-state figures provided by the manufacturer, it may be difficult to estimate the performance a particular part will play when placed in a circuit.

The website of ezIGBT makes things easier for the designer. It liberates him from the paper data and allows him to model the performance of a part, given specific conditions of junction temperature, operating frequency, applied voltage, current and size of heat sink. The website provides several IGBT models and ezIGBT takes great care to maintain the accuracy of the data.

On the website of ezIGBT, the designer has to supply several operational parameters. These include the on-time voltage across the Collector and Emitter or Vceon, the forward voltage across the copak diode or Vf, on-time voltage or Von, off-time voltage or Voff and the reverse recovery voltage or Err. The website then uses Industry standard techniques to generate equations in two sets: one at 25°C and the other at the highest possible junction temperature.

The equations compute the losses and thermal conditions for the device selected, with the parameters being linearly interpolated between the two temperatures. The datasheet graphs are generally curve-fitted, and expected errors remain less than 10%, which are below the normal variations in manufacturing these devices. At present, ezIGBT is only providing calculations based on “hard switching” type of converters. Calculations for resonant operations are planned for the future.

The website provides three types of tools: Analyze, Compare and Recommend. The Analyze tool helps the designer calculate the power loss at the operating frequency, when the designer specifies the junction temperature and duty cycle. This tool also allows an understanding of how the losses are split between the IGBT and its diode. With this data, the website also estimate the size of the heat sink required.

On the Compare page, you can run the analysis calculated in the previous Analyze section, along with the additional ability to compare the performance of multiple IGBTs.

When you choose your operating conditions, ezIGBT can recommend the parts that will most closely match the requirements of your application. This is done in the Recommend section. At present, the selection depends on the incremental junction temperature rise over the case temperature. Other criteria are expected to be addressed in the future.

A smartphone built from Raspberry Pi: the PiPhone

You may not be looking for a new cell phone right now, but someone has just managed to transform his Raspberry Pi (RBPi) into a working cell phone. David Hunt has used only off-the-shelf components and put them together for the project. Although it is not as slick as the regular cell phones available in the market, at about $160, David has created a one-off project that certainly has no economics of scale working for it. The best part is all components of the phone can be taken apart at any time, used for some other projects and then reassembled. Can you do that with your regular cell phone?

David has called his cell phone the PiPhone, in honor of the base RBPi that powers it. The other major parts used for making the PiPhone work are a Sim900 GSM/GPRS module and an Adafruit touchscreen interface. The GSM/ GPRS module allows the cell phone to make and receive calls, while the touchscreen provides the user interface. A 2500 mAh LiPo battery powers the entire contraption. The GSM module connects to the RBPi through a UART, while the battery fits in between the TFT screen and the RBPi, allowing the PiPhone to work standalone, without wall warts or dangling wires.

The touchscreen interface has a numeric keypad displayed on the screen. After dialing the required number, you need to touch the phone icon at the bottom to make the call or hang up.

The Sim900 GSM/GPRS is an intelligent module, which oversees the entire communication process of the PiPhone, including sending the standard AT commands to the RBPi for making calls, hanging up and sending text messages or data. Towards the bottom of the PCB is the connector where you can insert your SIM card. Therefore, you can use a regular prepaid SIM card available in the local phone store.

Just below the GSM module, there is an on/off switch and an off-the-shelf standard DC-DC converter. This converts the 3.7V supplied by the battery to the 5V required by the rest of the electronics. Heat dissipation was the only problem that David faced because of sandwiching the RBPi, the TFT, battery and the GPS module together. During development, as all the components were placed apart, they remained cool to the touch even after extended periods of use. However, sandwiching prevents air from circulating within, resulting in the CPU getting a bit warm after switching the unit on for a few minutes.

The GPS card is insulated from the RBPi with a thick foam-core board, allowing no accidental electrical connections between them. David used a couple of cable-ties to hold the different parts together.

Of course, walking into a local phone shop and picking up a normal smartphone would be simpler and cheaper, but that would not be as much fun as making your own. Moreover, as said earlier, you can put the parts to other uses as well, which you cannot do with a standard phone.

David has put up all his code and instructions on the GitHub. There are links available to instructions on installing the TFT.

Using the Texy’s Mini TFT Screen for Your Raspberry Pi

The single board computer, the Raspberry Pi (RBPi) is a wonderful device, but it needs a screen for you to see what it is doing. The Mini TFT screen from Texy’s is just made for the RBPi and the kit comes in a beautiful Perspex box too, which makes it very smart and practical. The Perspex box has a neat slot in the corner for the RBPi-Camera, although you may have to add blu-tack to prevent the camera from popping out. The screen and display are pre-built and ready to plug into the RBPi GPIO socket.

The display is backlit TFT, measuring 2.8-inches. The resolution is 320×240, which is a quarter VGA or QVGA, with 64 thousand colors. The current consumption is a mere 99mA. A major portion of this current is on account the backlight, which consumes 85mA. That means, if you switch the backlight off, by setting P1 on Pin18 to low, this screen uses only 19mA, which is great for battery-powered applications.

If you compare this with the 9-inch DVD player screen, which is 640×220 in resolution, and runs from the RBPi Analog output, the Texy’s screen is much sharper and more usable. Note that the standard TV resolution is 720×480 or 720×576. The digital connection makes the RBPi desktop very clear, perfectly formed and very easy to read on the small TFT screen.

The Texy’s screen provides a useful terminal display, fully displaying the entire RBPi desktop. Although it may not run full speed frame-rates, the display shows video perfectly. The compact fonts get a lot of text displayed on the terminal despite it being only 2.8-inches.

The addition of the resistive touch screen is the magical bonus as this opens up a great multitude of project possibilities, where a mouse, full keyboard and display setup would be rather impractical. You can bring the touch panel alive by combining some python code and Tkinter to get a very effective touch-based control system for your RBPi.

Texy’s has added flexibility to the screen in the form of the PI header pass-through available on the display board. You can use a ribbon cable to link the display to the RBPi GPIO and use the GPIO connections on the underside of the display. Alternately, you can connect the display directly to the RBPi GPIO and extend the GPIO with the cable.

Since the display uses SPI interface pins on the GPIO, including CE0, CE1, GPI00, GPI01 and GPI06. The GPIO pass-through allows you to connect your own ribbon cable to add further hardware, which can use the rest of the GPIO pins. A convenient GPIO pin out key is printed on the board for reference.

The easiest option for most is to use pre-configured images for driving the Texy’s display. Others, who are more confident, can modify the existing OS to use the screen; it is suggested to make a backup before setting out. Follow instructions here.

The display case, while providing support to the display unit, also extends out providing protection to the SD-Card while allowing full access to all sockets and connections of the RBPi.

Use your Raspberry Pi as a Hi-Fi Player

If you use your Raspberry Pi (RBPi) in combination with a USB DAC and RuneAudio, it will become a Hi-Fi music player providing surprising sound quality. RuneAudio is a free and open source software that you can use with the single board computer for running the custom-built Linux distribution. The RuneAudio and RBPi combination replaces the PC or the laptop that you normally use as a digital source for music.

Like other open source projects, RuneAudio also came to be born due to personal needs. The developers were not very happy about having to use the laptop as a digital source, its absolute sound quality and ease of use. They started the RuneAudio project and encouraged people to download it, try it free and contribute to the development.

Project RuneAudio has two distinctive goals: One, to provide exceptional sound quality and two, make it easy to use for everyone. The developers are using the RBPi and other supported platforms for deriving the best results. For this, they are using Arch Linux as the base for their RuneOS and optimizing it as best as possible for audio reproduction.

For making project RuneAudio easy to use for everyone, the developers have built a handy web interface – RuneUI, that lets users control the playback and system settings, without any need for touching the Linux command line. With a cross-platform web-interface, the responsive RuneUI adapts to the screen size automatically. That makes it accessible from all types of devices, whether you are using a PC, notebook, tablet or a smartphone. All you need to do for installing is to write an image file to your SD card.

To install, first you will have to download the latest RuneAudio image for your RBPi from the official webpage. Next, extract the contents of the zipped file with a utility for manipulating compressed files such as Unzip on Linux, Zipeg on Mac or 7-Zip on Windows. That will leave you with a raw disk image file (an extension of .img).

The raw disk image file has to be written onto an SD card. You may follow these guides on elinux.org: Linux howto, Mac howto and Windows howto. Before you plug-in the SD card into your device, make sure the card’s write-protection is turned off. After the card has finished writing, unmount it safely and plug it into your RBPi.

Plug-in a USB DAC into the RBPi USB port (you can simply plug in the analog jack if you do not have a USB DAC). You can also plug-in your USB storage or your USB hard drive. If you are using a hub for the USB devices, it is strongly suggested that you use an external power supply for it. Now plug-in your Ethernet connector, plug-in the power supply unit of the RBPi power it on.

That’s all. RuneAudio boots up your RBPi for the first time, and acquires an IP address. Open a web browser on your Android mobile and run RuneAudio from http://runeaudio.local. You should be in RuneUI now. If you want to see this being done, you can view the videos that can be found online.