Category Archives: Raspberry Pi

Raspberry Pi Radio

Raspberry Pi or the RBPi, the tiny credit card sized single board computer is so affordable that people can easily create single purpose appliances around it. For example, just by adding a small LCD that has a few buttons and a USB wireless network adapter, you can build a self-contained music streamer around the RBPi. This you can move around to any room of the house. The only extra items you need to connect to it are power and speakers or headphones.

Use the Adafruit LCD kit that has a keyboard along with an RBPi. You can select from several versions of the LCD kit: RGB negative backlight, the RGB positive or the more affordable Blue and White. For this kit, you must be prepared for some assembly and soldering. Although the RBPi can be any model, A or B, you will need a 4GB or larger SD memory card. You may use any mobile phone charger, but the charger cable must be compatible with the USB Micro-B connector on the RBPi.

You may connect headphones or amplified speakers to the audio output of the RBPi. Alternately, connect it to the A/V setup in your living room. To connect to the internet, you will require a USB Wi-Fi adapter compatible with the RBPi and of course, an existing wireless network and a working Pandora account. If you have wired Ethernet, you could use that with the RBPi Model B, but that will reduce the convenience of wireless. Finally, you will need a suitable enclosure – one that offers full access to the top of the RBPi board.

You will also need some temporary items only for setting up. These can be removed and do not need to remain permanently attached. To communicate with the RBPi, you will need a monitor and keyboard. Additionally, you may possibly require a powered USB hub, a soldering iron and some solder for assembling the LCD keypad kit.

The Linux OS available for the RBPi has several flavors. For this project, the recommended distribution is the Raspbian Wheezy (official distribution) or Occidentalis (from Adafruit). You may also use any of the other stock distributions along with additional software. Download the OS, uncompress the ZIP file and follow this link to install the OS onto the SD card.

Start by formatting the SD card as a FAT32 file-system and install the OS on it. Next, solder the LCD Pi Plate following this tutorial. House the RBPi in its case. Also, set up a free Pandora account and select your favorite stations.

Once your SD card is populated with the OS of your choice, connect a USB keyboard and a monitor to your RBPi. Insert the SD card in its slot and connect the Micro-B USB cable to the power connector on the RBPi. The other end of the USB cable you can plug into the mobile phone charger, a powered USB hub or simply to the USB port of your computer.

Once you successfully power up the RBPi and navigated past the initial UNIX stuff, you can follow the instructions presented here for the rest of the project.

DIY Google Glass with Raspberry Pi

If you thought Google Glass was something beyond your capabilities, well you can think again. Adafruit has a Do-It-Yourself design that can turn a pair of display glasses into the coveted Google glass type of form factor. Not only does it clip to the prescription glasses you are using, it can display any type of device that puts out Composite Video such as the Raspberry Pi or RBPi does.

With 3D printed parts you can download free, one pair of these wearable video glasses will cost you only $100. The display uses simple plug-n-play technology to connect to the RBPi. The project uses the NTSC/PAL Video Glasses (1:20) and uses only one-half. The glasses are full-color LCD micro-display presenting a virtual large screen of 52” at 2m distance. With a resolution of 320×240, and a color depth of 24 bits, it has an in-built LiPoly battery rated at 800mAH, which lasts for 4-5 hours. You will also need miniature wireless USB keyboard with touchpad and of course, an RBPi.

Other parts that you will need for this project are a 3D printer to print out the parts, flat pliers, 30AWG Wire Wrap, a pack of heat shrink tubing, a screwdriver set and a composite video cable.

You start with disassembling the Video Glasses. First, remove the nose guard piece. For this, you may have to remove tiny screws – use a small screwdriver. Then, carefully pop the shaded lenses off. There will be more tiny screws behind the lens, remove them and the frame should come off easily. Now, gently pry open the enclosure and use a flat-head screwdriver to separate the two halves. Remove the PCB from its enclosure – use a pair of flat pliers. Also, remove the two video display screens from the enclosure. Holding the eye covers to the magnifying lenses, unscrew the two eyepieces. Now carefully detach one of the displays from the PCB and store away as a backup unit.

You will now have one of the video display units along with the kopin video processing circuit. The power circuit with its USB port and the two audio input jacks should also be present. With disassembly over, it is time to begin the assembly of the project.

Begin by unsoldering the four connections from the power circuit, as you will need to increase the lengths of the wires. Use about 140 mm or 5.6 inches of 30AWG wire to extend the length of the wires. You may need to tin the ends of each wire before soldering them together. Use heat shrink tubing to secure the connections. Disconnect all components before you put them into the enclosure.

3D print the eight pieces design to make the snap-fit enclosure. This will house the components extracted from the Video Glasses. The plastic eyepiece with the magnifying glass goes on top of the eye part. You can reuse the same screws to secure the eyepiece into the eye part. Positioning the eyepiece into the cap part, thread the cable connections through the opening on the side. Similarly, thread the wires through the elbow part and snap it in place. Assemble the rest of the parts following the guide here.

Raspberry Pi Temperature Monitor and Alarm Project

Although five-day weeks are a boon to white- and blue-collar workers, some businesses need to be extra careful during the two days of the weekend. For example, commercial monitoring systems generally protect warehouses with large freezers and cooler rooms. However, between Friday evening and Monday morning when the food shelf remains closed, a unit may blow a fuse. Usually, this goes unmonitored with the result that food is found ruined by Monday. The inexpensive, tiny credit card sized single board computer, the Raspberry Pi or RBPi was found to be a suitable base for a temperature monitor and alarm for a walk-in display-case cooler and freezer.

The project objectives are very simple. A low cost temperature monitoring system is required that can send free text messages when the temperature within the freezer or fridge goes outside the acceptable range.

For this, the RBPi has to monitor the temperatures within the fridge unit and the freezer. For the fridge unit, the valid temperature given is 33F, while it is -10F for the freezer unit. However, since stocking personnel and customers open the doors frequently during the business hours, temperatures in the fridge rises to 60F. Therefore, a wider temperature range is to be allowed during business hours as compared with the temperature range during off hours.

To draw the attention of maintenance personnel, the RBPi has to provide an audible temperature range alarm, which makes a noise when the temperature goes beyond the range. Additionally, a switch button is necessary, as a snooze, to silence the noise when the problem is receiving attention. As personnel are expected to be away on weekends, the RBPi is required to send a text message to someone who would be able to either fix the problem or move the food to a safer location. To make the temperature visible to the staff, an LCD temperature display is used. The RBPi is required to project the current temperature on a wall mountable LCD mounted outside the fridge/freezer unit.

Parts needed for the project include the RBPi Model B, although Model A can also be used. However, since Model A has only one USB port, an additional USB hub will be necessary. For the operating system, you will need the 8GB SD card with the NOOBS installer image. The Adafruit RGB 16×2 LCD kit with Keypad is the most suitable, since it has five momentary push-button switches useful for navigation. For connecting to the internet, you may use the Wi-Pi Wireless Adapter. In case you are planning for an XBMC solution, you will also need an Ethernet cable, an HDMI cable and wireless keyboard/mousepad.

For the audible alarm, you will need 2×3.5mm stereo headphone plugs, a portable speaker and audio cable. To house the RBPi, a suitable case will also have to be used.

You can use 2x DS18B20 Digital temperature sensors for monitoring the two temperatures. Although the stand-alone IC components are just as good, prepackaged waterproof units are available; these will suit the project better. When you are ready with the parts, follow the instructions in this tutorial to set up the project and to calibrate it.

Teaching Raspberry Pi to teach itself

For most of us, learning is a part of life. Beginning at birth, we learn how to understand emotions, walk and talk as the primary steps in learning. For machines, although learning appears to be high-tech, it is not an isolated incident. We see incidents of machine learning around us almost every day without knowing. For example, machine-learning algorithms accomplish automatic tagging of Facebook photos and spam filtering of emails. Most of machine learning is a step in the direction of achieving artificial intelligence. Recently, a lot of interest has been generated by a new area of machine learning known as deep learning.

So far, only big data centers had confined this knowledge of deep learning, as deep learning technology depends largely on huge data sets. Only the big data-mining firms such as Microsoft, Facebook and Google had access to such large amounts of data. Now, a new startup Jetpac is planning to let everyone access this technology. Any person with a computing device can use their app to access deep learning technology, as the video on their website shows (https://www.jetpac.com/deepbelief). However, you may find that this technology is not so perfect. Just as the human brain, machines too suffer from optical illusions – confusing sidewalks with crossword puzzles, flutes with spiral bound notebooks and trash bags as black swans – see it below.

Pete Warden has done a great job of porting deep learning technology to the immensely popular, credit card sized, inexpensive single board computer, the Raspberry Pi or RBPi. The factor that has helped this process is that RBPi has a GPU with roughly 20GFLOPS of computing power, according to the documentation released recently by Broadcom, the manufacturers. That enabled Pete to port his SDK of Deep Belief Image Recognition to the RBPi.

If you would like your RBPi to be able to recognize things it sees around itself, follow the instructions here. However, for running the algorithm on the RBPi, you must allocate at least 128MB of RAM to the GPU and reboot the RBPi so that the GPU can claim the memory freed-up in the process. When you first run the program deepbelief on your RBPi, it will spew out a long list of different types of objects.

Thanks to the documentation about the RBPi GPU made public by Broadcom, Pete was able to write custom assembler programs for the 12 parallel ‘QPU’ processors that lurk within the embedded GPU. Additionally, the GPU makes heavy use of mathematics, which allows the algorithm process a frame in around three seconds. The technical specs of the graphics processor were released only a few months back, which has led to a surge of community effort to turn that into useable sets of examples and compilers.

Pete had to patch one of the existing assemblers heavily so that it could support more instructions. He had to create a set of helper macros so that programming the DMA controller was easier. Once these algorithms were tuned to the GPU’s internal method of working, Pete released them as open source.

Are drones invading your privacy?

Unmanned drones have proved to be a stealthy asset in the war on terror, making strikes on targets and collecting data on enemy movements. However, these small, nimble and nearly silent fliers can also be used to keep tabs on law-abiding citizens from nearby skies. This domestic use of drones is raising concerns about privacy violations including potentially violating the Fourth Amendment. Now APlus Mobile is planning to build a Linux-based Personal Drone Detection System. These will detect any nearby drone using a method known as Mesh Grid Triangulation.

The R&D division of APlus Mobile, the DDC or Domestic Drones Countermeasures, is planning to launch a device that will detect and track a drone aircraft that approaches within 50 feet. DDC has launched a Kickstarter project for building the Linux-based Personal Drone Detection System. They plan to make it available in November 2014, at $499 for the alpha test model, and in April 2015, at $699 for the beta test model.

DDC has a drone detection algorithm for which a patent is pending. The Personal Drone Detection System relies on this algorithm to work its magic. APlus Mobile will be using a MotherBone PiOne board-level Linux subsystem motherboard for building the device. The motherboard is an open spec PiOne type, which means it can fit either a BeagleBone Black or a Raspberry Pi single board computer.

The MotherBone PiOne is actually a part of the Primary Command and Control Module unit. This unit works in conjunction with two nodes of detecting sensors and establishes a mesh grid network. In turn, the network can triangulate the location of mobile transmitters. If you deploy more control modules and nodes, the network can cover a wider area.

The wireless mesh network and target triangulation work together. You can set up the nodes as far as 200 feet apart. Although the mesh network uses Wi-Fi to communicate, it is kept isolated from the user unlike the control module, which communicates with the user over Wi-Fi.

To detect the wirelessly enabled, mobile devices or drones, the sensor nodes use a frequency that ranges between 1 MHz and 6.8GHz. While detecting all known telemetry transmission frequencies, the system tries to determine if the mobile transmitter is actually a drone. All drones must transmit some telemetry data that allows it to navigate. Therefore, even if the drone is only storing recorded media and not transmitting it, it can be detected.

The biggest challenge for the drone detection algorithm will be in distinguishing between a jogger passing by with a cell phone and an actual drone. According to Aplus, the software does reduce false triggering. The system is designed to detect and trigger an alarm only if a drone is loitering nearby. Therefore, a jogger would have to stop for a while in front of the house for the device possibly to trigger a false alarm.

Once the device detects a drone hovering nearby, it sounds an alarm and simultaneously, sends a message on your mobile device. That should make you draw your infrared-resistant blinds and call for the police, unless the drone belongs to the police.

A Car Computer with the Raspberry Pi

There are many reasons one would want to make a car computer. Although one of the reasons might be the savings on the expenses of buying a branded one, the most plausible reason would be the thrill of making your own. What could be more exhilarating than to use the most inexpensive, credit card sized, single board computer, the Raspberry Pi or RBPi and turning it into a sophisticated car computer, ready to compete with the most expensive ones in the market.

That is exactly what Derek Knaggs did. He wanted a car computer and searched for one on the Internet – only to be put off by the large costs involved. As an RBPi enthusiast, he reasoned that his tiny RBPi had all the ingredients required to build one – flexible video and audio outputs HDMI and Composite RCA for video, HDMI and 3.5 mm audio jack for audio). Additionally, it has the complete flexibility of switching to any operating system simply by changing the SD card.

Derek made a list of the items he would need for his car computer – RBPi model B, a car DVD player, TFT monitors (7-inch models used, one for the front and one/two for the back seats), composite video cables, audio cables suitable for 3.5mm jacks), Wireless N USB dongle, Wireless mini keyboard and a micro-USB car charger.

Derek’s car already had a radio installed and he connected the audio output of the RBPi to the auxiliary port of the radio. That allowed the audio to be played via the car speakers, so he had stereo audio playing loud and clear. He placed the RBPi in the center console, so that he could route all the cables under the console, giving the whole arrangement a neat and clean look, without any cables hanging around.

For playing video on the RBPi, Derek used XBMC, which comes with the Raspbmc operating system. Inputs to the RBPi were controlled by the wireless keyboard, which also has a built-in mouse touchpad. The keyboard has an on-off switch, useful for saving its batteries. The Wi-Fi dongle gave Derek the freedom to connect to any wireless network. Of course, another option is to connect it to the mobile phone, provided it has the option to set up a portable Wi-Fi hotspot.

One of the TFT monitors connects to the RBPi, and although Derek chose to position it on the central console, you might want it behind on the headrest of one of the front seats. Since Derek already had a car DVD player fitted in, there was another TFT monitor available. If the TFT monitors have HDMI inputs, you may want to connect them via HDMI cables. TFT monitors typically come with RCA composite video inputs, so that should not be a problem, as RBPi has composite video outputs along with HDMI. However, as soon as you use one of the video outputs on the RBPi, the other switches off, so it is not possible to use two monitors at a time from the two types of video outputs on the RBPi.

Raspberry Pi Digitizes and reads books

You can make your own book reader that will read books aloud after it has digitized them. The ingredients you will need are the tiny single board computer Raspberry Pi or RBPi, a BrickPi and some Lego motors and blocks. The finished book reader will flip through one page of a book at a time, take its picture and turn the picture into a text document, before moving onto the next page.

The book reader works by preparing a page to turn with the help of a rotating Lego motor. Gravity does its bit by providing just enough friction on the page of the book to allow it to inch forward. Finally, a Lego arm beam swings over and forces the page to turn over.

Once on a new page, the camera of the RBPi snaps an image of the page and saves it in the form of a JPEG file format. The RBPi then uses an open source Optical Character Recognition (OCR) software program to transform the page into text format and saves it. The RBPi then uses free text-to-speech software to read the page aloud over the speakers connected. The BrickPi operates the Lego modules that turn to the next page of the book.

For this project, you will need an RBPi (Model B), an RBPi camera, the BrickPi, the BrickPi Power Pack, Raspbian Wheezy on an SD Card, a Wi-Fi dongle and a Lego Mindstorms kit. The Lego kit could be either an EV3 or a NXT system.

As you have to use the camera to capture the image of the page, you will need good lighting. Arranging for the RBPi and the BrickPi to be placed above the book allows the camera to be positioned squarely above the book. Arrange lights over the sides at angles to fall and illuminate the page from two sides.

You may have to calibrate the page turning mechanism until it runs perfectly. This is done by adjusting the values of the variables in the arm_test.py. The motor connects to the Port A of the BrickPi and for calibration, the values of speed_arm, speed_roller, t1 and t2 may have to be changed and tested until the page turns flawlessly.

The camera is placed in position and held there with two Lego Technic beams. Once the camera is fitted in place, you may have to change its focus, as the camera focus is typically at infinity. Although the camera may give acceptable results without adjusting, focusing on the page gives improved results for OCR recognition. To change the focus read here and here for guidance.

Once the camera is adjusted, take a few images and check for clarity over the whole page. If the image does not look proper, adjust the focus and angle again. If the image looks good, it is time to test whether the OCR can convert it. Setup the Tesseract OCR engine, and use it to convert an image with “tesseract image.jpg o”. The output will be o.txt and this should now be readable with the text-to-speech engine eSpeak. This software allows choice of the reader’s gender and the accent. Once you connect a pair of headphones or speakers to the RBPi, you should be ready to go. For more details on this project, refer here.

High Fidelity Audio from the Raspberry Pi

Although the Raspberry Pi or RBPi has many exceptional qualities such as a small form factor, low price, low power consumption and credit card size, the single board computer is not endowed with a high fidelity onboard sound output. Therefore, to get high-fidelity sound, you must add a sound card to the RBPi. For all RBPi users who love music, HiFiBerry produces sound cards designed for optimal sound quality output.

HiFiBerry has two types of boards depending on whether you are looking for an analog or a digital board. If you have an analog amplifier, use the DAC board. However, if you connect to your amplifier via an optics link, use the Digi board. The standard RBPi kernel in the Raspbian distribution supports both the boards and they use Open Source software. HiFiBerry provides all drivers for both boards as open source. These boards utilize the P5 connector on the RBPi.

The HiFiBerry DAC is available as a Standard version with RCA connectors or as a 3.5mm phone jack version for headphones. Both are fully soldered boards; however, if you prefer to do some soldering, there is a DIY kit as well. For providing the best sound quality, these boards use a dedicated 192KHz/24-bit DAC from Burr-Brown. No cables are required, as the board connects directly to the RBPi, which also supplies it with power. Optimal audio performance is assured with on-board ultra-low-noise voltage regulators. Mechanical spacing between the audio board and the RBPi requires nylon spacers.

To connect the DAC board, you will need to solder an 8-pin header on to the RBPi, on its onboard sound connector P5. Now simply plug the DAC board in and start using it. The on-board ultra-low-noise voltage regulator will filter out all the noise from the RBPi power supply and you do not require any additional power supply or cable.

If your amplifier connects with an optical signal, use the HiFiBerry Digi board, which offers a high-quality S/PDIF output. The board connects to the P1 and P5 headers of the RBPi and supports up to 192KHz/24-bit resolution via optical (Toslink) and electrical outputs. The audio data streams produced are bit-perfect outputs, unmodified in any way.

The Digi board is also available in two versions, one with an isolation transformer and the other without. Although the hardware on the board is capable of DTS/Dolby Digital output, suitable software is required to make its full use. At present, HiFiBerry is not providing this software, but they will offer support to developers who want to implement this feature. The isolation transformer will provide complete galvanic isolation between the DAC on its output and the amplifier. However, most consumer-grade SPDIF connections do not require any output transformers.

For the future, HiFiBerry is planning a high-quality highly efficient stereo class D power amplifier to be connected directly on to the RBPi. Only external loudspeakers are necessary to get full 2x25W output power when driving 4-Ohm speakers with 44.1KHz and 48KHz sampling rates. This board will require an external power supply of 12-18V, but will power the RBPi as well, so ultimately only one power supply will suffice.

Raspberry Pi Lights up an RGB LED Matrix Panel

Colorful LED screens are a joy to watch. Bright LEDs making up a 16×32 display are not only easy-to-use, but also low cost – you may have seen such displays in the Times Square. Controlling such a display is simple if you use the low-cost, versatile, credit card sized single board computer, the Raspberry Pi or RBPi. Although the wiring is simple, the display is quite demanding of power when displaying.

The items you need for this project are a 16×32 RGB LED Matrix Panel, Female-to-Female jumper wires, Male-to-Male jumper wires, a 2.1mm to Screw Jack Adapter, an RBPi board and a 5V 2A power supply. Use the Female-to-Female jumper wires to connect the display to the GPIO connector pins of the RBPi. Although this connection is display specific, following a generic pattern is helpful:

GND on display to GND on the RBPi (blue or black)
OE on display to GPIO 2 on the RBPi (brown)
CLK on display to GPIO 3 on the RBPi (orange)
LAT on display to GPIO 4 on the RBPi (yellow)
A on display to GPIO 7 on the RBPi (yellow or white)
B on display to GPIO 8 on the RBPi (yellow or white)
C on display to GPIO 9 on the RBPi (yellow or white)
R1 on display to GPIO 17 on the RBPi (red)
G1 on display to GPIO 18 on the RBPi (green)
B1 on display to GPIO 22 on the RBPi (blue)
R2 on display to GPIO 23 on the RBPi (red)
G2 on display to GPIO 24 on the RBPi (green)
B2 on display to GPIO 25 on the RBPi (blue)

When connecting the wires, ensure that both the display and the RBPi are powered off, as the display is able to pull some power from the GPIO pins. Once all the data pins are connected as above, it is time for the power supply to be connected. The panel has a power supply header and a cable that has two red wires for the positive supply and two black wires for the negative. While connecting these wires to the screw jack adapter, make sure of maintaining proper polarity. Additionally, double check that the power supply you are using is rated for 5V, as any other higher voltage is likely to fry the display. The sequence for powering up must be the display first and the RBPi last.

To display an image or a message, you must convert it to a ppm or portable pixel format. Image editors can do this for you and you can very well use the free open source application GIMP. Once the image is in the required format and placed in the specific directory, the display program picks it up and it appears on the display. Shift registers on the back of the display module help with the shifting or scrolling of the image on the display. Of course, the RBPi has also to do a lot of work in bit-banging the pixels onto the screen.

You may use the code as it is in C, or you may prefer to use Python. Currently, the program displays only eight colors; for reference, see here.

PicoBorg Helps To Build a DoodleBorg

Imagine a small tank driven by a Raspberry Pi or RBPi. This is the DoodleBorg, a two-horsepower goliath and is the most powerful robot controlled by the RBPi. Powered by starter motors originally from a motorcycle, the DoodleBorg uses six PicoBorg motor boards made by PiBorg.

The DoodleBorg uses a tiny, credit card sized single board computer, the RBPi, as its brain. It has six reverse motor controller boards or PicoBorgs controlling its six wheels. Each of the boards is capable of handling 10A on average. Therefore, with two batteries in series, the average power output is 6x10x24=1440Watts or roughly 2HP. Peak power outputs are higher, about 2.1KW or three horsepower. Usually, the RBPi is prominently visible in the robot it is powering. However, in this case, you will hardly recognize it in the massive size of the project. Commands to the DoodleBorg are sent via a PS3 controller.

The PicoBorg reverse motor controller cards were specifically chosen for this project. These are advanced dual motor control boards for use with an RBPi. PicoBorgs can control big or small motors, with forward or reverse speed control. Each board, with its own emergency power off, is sized to mount on your RBPi for PID control and feedback via the GPIO pins. If you need to control more motors, simply plug in more boards and control up to 200 motors.

The dual motor controllers can handle input voltages between 6 and 25VDC and control up to 5A per channel, that is, 10A when combined. The emergency power off switch works in both bidirectional and speed control modes. PicoBorg boards are capable of handling two DC motors or one stepper motor with 4- or 6-wire configuration. For communication, you can use the I2C or SCK/SDA pins on the GPIO together with 3V3/GND pins. Adding the PicKit2 brings additional functionality.

PicoBorg reverse motor controllers are protected against overheat, short circuits on all outputs and under-voltage lockout. Connections are very straightforward. Six screw-terminals on the board allow connecting two motors and a battery. There are two 6-pin terminals, one of which is for connecting to control signals from the GPIO of the RBPi. The other 6-pin terminal can be used for daisy chaining another PicoBorg board.

Another connector on the board allows you to easily add a normally closed switch to act as an emergency switch. In case of any fault, simple open the switch and the motor will be cut off. The software on the PIC micro-controller on board will recognize the emergency switch operation and prevent further operation of the motors until enabled by a software command.

Another feature of the PicoBorg is its ability to run DC motors with taco feedback. The software accepts taco input signals that indicate either the number of rotations or the distance traveled by the wheels. Acceptable feedback signals are – quadrature signal (A or B) from an encoder, taco signal from a computer fan motor, index mark feedback such as one per revolution pulse. The motor connection remains the same as that for a standard DC motor setup.