Category Archives: Raspberry Pi

A Portable Raspberry Pi Powered display

If you have a motor to control, the RasPiRobot Board is a very good fit. Apart from controlling motors, you can also use its switch mode voltage supply to power your RBPi or Raspberry Pi using a large range of battery types. Therefore, with a pack of AA type batteries and the RasPiRobot shield, you can make a very convenient and portable RBPi powered display.

To make an RBPi display that will show the current time as a scrolling text, you need to collect a few parts. These would be – the Adafruit Bicolor square Pixel LED Matrix along with its I2C backpack, A RasPiRobot Board version 2, a battery holder with on/off switch suitable for holding 4xAA batteries and the RBPi Model B+ with 512MB RAM.

Not much of wiring is involved in setting up the parts together. The only soldering you will need to do involves the LED Matrix display, as this comes in a kit form. This is not too difficult as all the instructions are included inside the kit. Once soldering is over, fit the LED Matrix display into the I2C socket of the RasPiRobot Board.

If you are using the latest version 2 of the RasPiRobot board, you have to be careful its extended header pins do not reach up to the bare connections on the underside of the LED Matrix module. In case they do, you will need to insulate the module by covering the header pins with a layer or two of electrical insulating tape.

Next, plug in the RasPiRobot Board on top of the RBPi. Just make sure the RasPiRobot board fits over all the GPIO pins on the right hand side of the RBPi. The RasPiRobot Board has two screw terminals marked GND and Vin. From the battery box, attach the flying leads to these screw terminals taking care of the correct polarity.

Fit four rechargeable AA batteries to the battery holder. Make sure they are fully charged and fitted with the correct polarity. When you turn on the switch on the battery holder, you should see the RBPi light up its power LED as well as the two LEDs on the RasPiRobot Board.

To operate the LED Matrix board from the RBPi, you will need to install the Adafruit I2C and the Python Imaging Libraries – follow the instructions here. The guide also has a few examples to allow you to check the working of your I2C interface and consequently the LED Matrix display. For example, you can have a slow display scrolling text on the LED Matrix, showing the current time.

The LED Backpack library has a number of sub-libraries that handle the low-level interface to the matrix display. The Python Imaging Library handles the job of writing text onto the display as an image. This uses the True type Font FreeSansBold size 9 from the library, although you can use other fonts as well that look good. You may need to experiment with the fonts, as they are not primarily intended to be displayed in the 8×8 pixels the matrix uses. You can select the color of the display also.

The RasPiRobot Board for the Raspberry Pi

In robotics, it is usual to have to drive a few motors with the RBPi or Raspberry Pi. However, instead of letting the RBPi handle the low-level job of motor control, using a motor controller board is another option. This frees the RBPi for handling more of the high-level code, resulting in better utilization of the resources and improving the efficiency of the project.

For turning your RBPi into a proper motor controller, you can use the RasPiRobot Board. Apart from simply running your motors from an external supply, the RasPiRobot does a fantastic job of powering your RBPi as well. A switch-mode power supply on board the RasPiRobot ensures that your RBPi receives a well-filtered and regulated power supply.

To run two motors from the RBPi, you will need a few parts. These include a battery holder with a switch – capable of holding six batteries of the AA type, two 5V or 6V DC motors, a RasPiRobot Board v2 and an RBPi Model B+ with 512MB RAM. You will find the version 2 of the RasPiRobot Board perfectly matches the RBPi Model B+. The RasPiRobot Board fits directly over the RBPi, with its GPIO connector matching the GPIO pins of the RBPi.

The RasPiRobot Board uses the L293D motor driver chip in an H-bridge configuration to run two DC motors independently and bi-directionally. The switch-mode power supply on board allows you to drive low-voltage DC motors from a higher voltage battery supply. Additionally, the RasPiRobot Board can also supply the RBPi with over 2A of current. That means you need only a single power supply for driving both the motors and the RBPi.

You must connect the motors via the screw terminal pairs on the RasPiRobot Board. These terminals are marked as L and R on the board. Take care to connect leads from one motor to the L terminals and the leads from the other motor to the R terminals. Swapping the leads of a particular motor will make it spin in the reverse direction.

Now plug in the RasPiRobot Board on the RBPI, taking care to match the GPIO pins and connector correctly. After this, you may connect the flying leads from the battery pack to the screw terminals. Be careful to connect the positive lead (red/yellow color) to the screw terminal marked Vin and the negative lead (black/blue color) to the screw terminal marked GND. Reversing these leads could result in irreversible damage to your RasPiRobot Board.

Place the batteries in the holder (be careful of maintaining the sequence), and throw the switch to the on position. The RBPi starts to boot, which is evident from its LED lighting up. The two LEDs on the RasPiRobot Board should also light up. You will need to download and install the Python Library – follow the tutorial.

After the library has installed, you can get the motors running individually in forward or reverse directions for a definite interval or stop them. It is also possible to make your entire assembly mobile by mounting it on a robot chassis.

Raspberry Pi for the Talking Chatter Smartphone

You may have seen and even played with the Chatter Telephone, as the classic Fisher Price toy has been around since 1962. Although the design of the toy evolved over the years, in 2010, the Disney/Pixar film Toy Story 3 managed to depict the Chatter phone in its original classic form. Coinciding with the release of the movie, Fisher Price updated their model as the Talking Chatter Telephone. The new model carried some voice clips from the movie and had an all-plastic body, reminiscent of the boxy shape of the 1960’s original model.

Grant has used the famous Raspberry Pi or RBPi single board computer to turn the Talking Chatter Telephone into a Talking Chatter Smartphone. The modified phone gets its enhanced brains from an RBPi Model B+. All the logic comes from a Python script that runs on startup and access to the network is via a tiny Wi-Fi dongle. To retain the original factory look of the phone, Grant has avoided adding unnecessary buttons or screen and retained the original components and controls for interaction.

Internally, Grant has added a sensor to the hook cradle, but retained the original rotary dial that controls playback of the movie clips. For the eye movements, he has added a servo, while retaining the built-in speaker for providing audio output. He has retained the three micro switches the dial uses as a digital encoding system to sense the five dial positions. The RBPi replaces the battery box and the original PCB.

The phone pulls data from various online services via JSON format APIs. As of now, it connects to Forecast.io for receiving weather information and to Rotten Tomatoes for information on movies. However, one can easily extend this to other APIs as well. For example, the phone could be made to swap APIs for weather forecast with APIs providing current exchange rates, stocks or a Quote for the Day.

The phone also has a push notification system that uses a Twitter account. Grant uses it to pull new alerts from that account and to push them onto the account using IFTTT. He uses pre-defined alerts or recipes that he drives from his iPhone. For example, the IFTTT alerts the phone when Grant leaves work, there is rain forecast for tomorrow, the garden temperature is getting close to 10°C and when the International Space Station is about to pass overhead.

Grant has given the Chatter Smartphone a Wall-E startup sound for its boot up. That serves a dual purpose as the RBPi makes the sound when it has finished booting and lets Grant know that it is ready for an SSH connection. According to Grant, this should be made a standard feature for every RBPi. If you feel the volume of sound is low, it is easy to extend the RBPi’s audio jack to the back panel of the phone. This has the added potential of turning the Fisher Price phone into a high-end hi-fi system.

Using a Bluetooth add-on for the RBPi it is also possible to extend the audio to powered Bluetooth speakers outside the phone – making it wireless.

Using Raspberry Pi for Dog Training

Dog lovers and those who keep dogs as pets know that every dog has its own personality and like us humans, they too, often succumb to temptations. Some canines just cannot resist chewing those delicious new sandals, while others must investigate the leftover food scraps on the dining table. And, as working people cannot monitor their pet’s behavior the whole day, Dave Young took up a project involving lasers and the single board computer, the Raspberry Pi or RBPi, to help their pet keep its nose out of food scraps.

Dave Young’s Laser Dog Watcher consists of a laser tripwire, which silently alerts the RBPi as soon as the dog trips the invisible beam. The RBPi then takes a snap of the situation and plays an audio clip to dissuade the dog from its intentions. The project borrows the laser tripwire from an earlier design of a silent doorbell that Dave had installed at his home.

The laser tripwire system is of a simple reflection type. Both the laser source and its detector are in the same enclosure on one side of the room. On the other side is a small mirror placed to reflect the laser light back to the photo-resistive detector. Anything interrupting the beam also trips the detector, which sends out a signal. As ambient light plays an important role when detecting interruptions of the laser beam, Dave added a threshold level adjustment. In addition, to make it easier for the laser to hit the detector, he added a Fresnel lens in front of it.

The tripwire system is wirelessly linked to the RBPi. For this, Dave used an XBee module, series 1 by Digi, who has a starter kit for users. The integrated AD converter on the module transmits the detected light level digitally, which serves two purposes. Setting the threshold level for detection becomes simpler and there is no noise involved as during an analog transmission.

The XBee interface transmits the digital value to the receiver as a PWM signal. The XBee receiver filters this PWM signal to produce a DC voltage level. You need a second AD converter to translate the DC voltage level to a digital value. Although this method of converting the signal twice is somewhat cumbersome, the XBee module makes it very easy to create the wireless link.

XBee provides their XCTU setup utility, which helps in setting up the XBee radio transmitter and receiver. The starter kit also includes an XBee USB Adapter board that connects to the RBPi, which may need FTDI VCP or Virtual Com Port drivers.

When there is a break in the laser beam, the XBee radio alerts the RBPi, which then triggers its GPIO to play an audio file as well as takes a photo with the Pi camera. The audio file changes so that the dog does not get accustomed to the same reprimand each time it tries to break the rules. According to Dave, the camera is not essential, but it serves to detect false alarms and to record the surprised look on the dog’s face.

An Action Camera for the Raspberry Pi

If you are the type that goes biking into the mountains and all the while recording your adventures on camera while on the trip, you need a camera that is biking-centric, robust and suitable for long-distance trips. Of course, several suitable cameras already exist such as the GoPro, Fly6 and the Sony Action CAM, but they are expensive not accessible to all. On the other hand, an action camera for the Raspberry Pi (RBPi) is not only cheap, it is also open-source and suitable for the purpose.

The design of the RBPi action camera is based on off-the-shelf components. It is very easy to build this project if you have access to a soldering iron and a 3D printer. Of all the models of the RBPi series, model A+ consumes the lowest amount of power, which is an important factor to consider since you will be running it on batteries.

If you are trying out the camera for the first time with an RBPi, using an open-source case is advised.

For an RBPi camera meant to be used for biking, three design goals must be met: the project must have a long battery life, be capable of wireless communication and its enclosure must be simple and made of durable material.

Apart from using the RBPi model A+, meeting the first requirement means using a large battery, especially if your rides are going to be multi-hour long. For the second requirement, it is necessary to have both Wi-Fi and Bluetooth, to make it easy to communicate with the camera. The last goal contributes to the first two, therefore, it must be given due consideration. Since the action camera is meant for outdoor use, making every port available outside the case would have reduced the structural integrity and its dust/water resistance.

To package everything into a small enclosure and ensure their working, you may need to work on the Wi-Fi dongle first, as that sticks out more than anything else does. For this, you may need to remove the USB jack and then remove the adapter from its plastic case. You can solder the wires directly to the board. The Bluetooth module may be placed on top of the RBPi and a ribbon cable used to connect it to the headers underneath. Next, make a support for the battery and its charger/booster so they fit snugly under the RBPi. You may need a few spacers to ensure the protruding headers do not puncture the battery.

Place the camera as close to the side of the RBPi and design the case to around all the components along with the RBPi. Usually, the case will be in two parts, with the camera module mounted on the top. Keep the camera module within the case and mount it in place with screws.

Use two buttons, with which the RBPi will start and stop the recording sessions. This may require you to use special scripts (you can use those by Alex Eames) for the RBPi to listen to a button press to start the camera and another button press to stop recording. Communication with the RBPi is done primarily through ssh.

Zumo-George the Raspberry Pi Behavior Driven Robot

It is difficult to forget the roving Roomba, but it is time we have a new rover – Zumo-George. It is necessary to look differently at the process of control from a series of behaviors, while defining the tenets of development driven by behavior. Development undertaken via BDD or behavior-driven development is a superior method of emphasizing collaboration and communication between testers, developers and business stakeholders. Features and scenarios define behavior, as the Gherkin syntax specifically elicits –

Given: Zumo-George is more than 10cm from wall

Situation: Power is applied to the motors

Result: Zumo-George should drive forward

Developers write the BDD scenarios before writing other code, and this determines what code is written. This process reduces wastage. In addition, the written code drives the development, which, in most cases, passes the first time. As Zumo-George executes the scenarios, developers can see exactly what steps it passes, what it fails to pass and whether it encounters any situation that they have overlooked.

Intermixed with electronics, use of BBD to program robots such as Zumo-George can be an ideal abstraction for exploring robotic control based on behavior – BDR, or Behavior-Driven Robotics. Such programming can even include testing or internal diagnostics on Zumo-George. For example,

Given: Lights are all off

Situation: When light is switched

Result: light should turn

Or, on a lighter side,

Given: Batteries are fully charged

Situation: Shoot lasers

Result: Target should fry

As Zumo-George has no laser.

Zumo-George has to execute a series of internal diagnostic tests each time it boots up. If it fails any test, then it will simply refuse to rove and will flash a red light. This will preclude the problem of the robot running out of control.

Naming the robot Zumo-George, the developers prefer referring to the robot as a “he” rather than “it.” They expect Zumo-George to mimic certain human behavior. For example, do not bump into a wall while walking/driving.

Polulu’s Zumo and the Explorer HAT Pro from Pimroni form the basis of the rover (including its name). Therefore, Zumo comes in several variants. For example, for Arduino, there is the all singing Zumo 32U4, with accelerometers, LCD, buzzers, sensors and more. Then there is the bare-bones Zumo Chassis Kit and this is most suitable for Raspberry Pi (RBPi), as users can add their own electronics.

A Slice of the Raspberry Pi

The Compute Module of the credit card sized popular single board computer, RBPi or the Raspberry Pi, is not an end-user product. Manufacturers can use the device when they require an ARM-based platform to build their devices on and sell. Therefore, computing hobbyists will find it difficult to get their hands on the Module if they want to evaluate it.

The RBPi itself is readily available to anyone who wants to buy and use it for projects. However, this Compute Module is not sold as such to hobbyists and for evaluating the Compute Module, it is necessary to get hold of a real product based upon it.

Five Ninjas, some people from the RBPi Foundation and the Pi-friendly accessories seller Pimoroni has a compact media player based on this Compute Module. Their product – Slice – was the result of inspiration based on the original Apple TV.

The first Apple TV was based on the x86 and was silver colored. This was eminently hackable, unlike the later iOS running black box that Apple made. People ripped out the custom Mac OS X installed, replacing it with a Linux desktop. They then added a more open, flexible media center, which ran XBMC.

The FiveNinjas Slice Media Player turned out to be more powerful than the modified x86 version of the Apple TV. The first few Slices have just left the Sheffield assembly plant of Pimoroni. Each has a custom motherboard with a single Compute Module in a DIMM-slot.

The Slice looks like a small metal box that has a translucent plastic spacer running all round the middle. The metal of the box is anodized aluminum in one of choice of three colors – red, gunmetal and black. The entire device feels and looks very stylish. Although you cannot see inside the box through the spacer, Slice puts out a very cool light through it. The light comes from Slice’s 25 NeoPixels. These are individually addressable RGB LEDs, with each containing an in-package controller.

The Slice uses these LEDs to create a rainbow of various color sequences. These sequences are triggered as the user interacts with the Slice using its remote control. While Apple had a slimline aluminum remote, Slice has a somewhat thicker one made of plastic.

Slice has 4GB of flash, which allows it to run any Operating System without a hard disk. It actually runs OpenElec, which is a simplified Linux distro capable of booting straight into Kodi, the media application. Therefore, users can simply play video and music files on their NAS or share from their computers.

Internally, Slice has a SATA connector mounted on the underside of the motherboard. Users can put in a small 2.5 inches disk drive and fasten it on to the motherboard within the case. There are four USB ports and users can hook up Slice to their computers to mount as an external drive automatically.

Currently, there is no app to control the display of colors from the LEDs. However, one is in development and will be available soon. The Compute Module uses a powerful 900MHz Broadcom SoC with a graphics core.

Pi Lite: Bright White LED Display with the Raspberry Pi

If you did not know, you can run many LEDs with the tiny, credit card sized single board computer popular as the RBPi or Raspberry Pi. Among the many accessories made for the RBPi using LEDs, Ciseco makes one that is very interesting and useful. This is a display panel using bright white LEDs and aptly named the Pi Lite. You can use the series of white LEDs on the Pi Lite as a scrolling marquee for a Twitter feed, for displaying real-time weather information or stock quotes. You can use it to display static information such as time or functional information such as bar graphs, or other dashboard type applications such as VU meters. On the other hand, you could even play such games as Pong. Pi Lite is strong enough to view in direct sunlight.

Pi Lite is completely self-contained and does not require any soldering. You can get Pi Lite in two colors – white and red. For operation, simply connect Pi Lite to the GPIO pins of the RBPi, and you are set. GitHub has several open-source projects that you can download or you could do your own programming using Python code.

If you are just starting out with the RBPi, Pi Lite is an exciting way to let RBPi do some physical work and generate some fun. The large LED matrix display is easy to plug in and add-on. Since no soldering or any other special skills are needed, anyone can simply start using the Pi Lite for their project.

All the 126 LEDs on the Pi Lite are in the form of a 14×9 matrix, with an ATMega328p processor controlling them. This mixes the highly popular LOL or Lots of LEDs shield of Arduino with the world of RBPi. The Pi Lite communicates with the RBPi via the standard serial communication protocol at 9600bps. That makes it a simple affair to send graphics and text to the LED matrix. With the ATMega processor driving the 126 LEDs, the RBPi processor and its GPIOs remain free for other functions.

The Pi Lite offers several advantages. You can read your emails or tweets from a distance in real time. The firmware being open-source, you can add extra functions as you like. You can achieve multiple functions by sending simple text strings – scroll the text, VU meter, bar graph and or graphics. You can use the well tried, tested and supported LOL shield by Jimmy Rogers. The serial interface makes Pi Lite useful for connecting to any TTL micro radio or PC interface – you can use the popular FTDI cable.

The Pi Lite uses a high quality gold plated PCB. No extra power supply is required, as Pi Lite draws only 49mA maximum at 5VDC, so the RBPi supply can power it. With preloaded software, you can use it out of the box and display variable speed scrolling text, 14 vertical bars as a bar graph, two horizontal bars as VU meter, frame buffer for animation and graphics, or turn on or off individual pixels.

To make a bigger display, you can link up additional Pi Lites with the I2C bus. Each Pi Lite measures 85x55x13.7mm.

Power Supply Ignition and other Switches for the Raspberry Pi

There are several occasions where you may require operating your RBPi or Raspberry Pi powered from a vehicle’s electrical system. To keep your single board computer safe and operational, an accessory is needed to sense when the ignition on the vehicle is engaged and when it is turned off. Accordingly, the accessory will respond by powering the RBPi on or off safely. MausBerry Circuits make such safe power supply ignition switches and other shutdown switches for the RBPi to be used in vehicles.

The power supply ignition switch attachment from MausBerry features a built-in step-down converter that produces 5V from the 12 or 14V of the vehicle’s power supply. Once connected with wires behind the vehicle’s radio, the attachment provides the RBPi with instructions based on the vehicle’s ignition status. It communicates with the RBPi using two of its GPIO pins.

An added advantage of the ignition switch attachment is it can retain power for about 20 minutes during its power-down cycle. That means the RBPi will remain powered for 20 minutes after the vehicle’s ignition is switched off, so waiting for the RBPi to boot is not required for those making frequent stops. A selector switch on the device will allow you to reboot the RBPi, if required. Even if the RBPi was left in the vehicle and not shut down, there is no cause to worry. The automatic shutdown feature of the device will kick-in to shut the RBPi down after four hours of non-use, thereby preventing drain on the batteries.

MausBerry makes many other similarly useful attachments for an RBPi to be used with vehicles. One of them is the 3A car supply that can sense the car ignition to shut down the RBPi safely when the car is turned off. The unit has two USB ports and communicates with the RBPi using two GPIO wires. The unit is to be wired to the vehicle’s battery and the 12V ignition source. Ground and power wires, both 18AWG and 18-inches long, are included.

If you are looking for an on-off switch for your RBPi, MausBerry has an illuminated LED type switch. Plug this unit into the RBPi power port and it accepts your existing micro-USB power cable. To turn the RBPi on, simply press the button. To switch off, press the button again briefly – the operating system senses the button and safely shuts itself down. After a safe shutdown, the switch will cut off all power to the RBPi. When illuminated, the LED gives off a bright blue light, and holding the button for five seconds performs a hard-reset for the RBPi.

Although aligned to the layout of the RBPi models A and B primarily, the illuminated LED shutdown switch will work directly with all models A, A+. B, B+, RBPi2 of the RBPi series. For the B+ models, the new power port location may make the switch stick a little out of the side.

Another shutdown circuit from MausBerry allows you to use any custom switch for operating the RBPi. The circuit plugs into RBPi power port and accepts the micro-USB power cable. This circuit is useful when installing the RBPi into a case, as the switch can be installed separately.

Graspinghand’s SweetBox, ScorPi and Heatsinks for the Raspberry Pi

Those who need a casing for their Raspberry Pi or RBPi are rather spoiled for choice. There are so many types of casings available, and that makes it so difficult to settle on one. Sometimes, you need a casing that does not take up too much space, but is able to protect your RBPi from sundry damage. If you want the smallest case on the market, try the SweetBox from Graspinghand.

Besides being the smallest on the market, SweetBox is injection molded with high-performance nylon, and is compatible with RBPi models B, Rev 1 & 2. It has several features such as it allows the insertion of a Micro-SD card into its adapter and the mounting of the RBPi camera. A rubber cap protects the GPIO pins when not in use, and is easily removable to allow connections.

Slots on the casing allow easy access to the DSI or Digital Serial Interface for attaching an LCD panel to the RBPi and the CSI or Camera Serial Interface for attaching a camera. Other mounting holes are available on the base, while the entire casing allows simple opening and closing without any screws or tools.

SweetBox is made from high-performance nylon, the EMS Grilamid type typically used for glass frames, electrical equipment and tools. This material makes the casing nearly unbreakable. The material is also lightweight, and the casing is only 35gms with dimensions of 95x65x25mm.

However, one of the most remarkable features of the SweetBox is it allows heatsinks to be mounted, so that your RBPi can operate within the casing, but without getting all heated up. Graspinghand offers three CNC machined heatsinks that you could use with or without SweetBox. The three heatsinks come with ready-to-mount thermal pads. With the heatsinks fitted, your RBPi will run at least 4°C cooler at full power.

Placing the heatsinks requires some dexterity. First, you must peel off the protective film off one side of a thermal pad. Then fix the heat sink very carefully in the center of the uncovered surface – this will stick the thermal pad to the heatsink. If there is excess thermal pad protruding out around the heatsink, use scissors to cut it off. Now peel off the remaining protecting film from the other side of the pad and place the heat sink and pad combination very carefully on top of the IC to be cooled. Use the same procedure for mounting all the three heatsinks, taking care to keep the same orientation of the fins for all the three.

Graspinghand also offers ScorPi, a flexible gooseneck arrangement for holding things such as the camera board on the RBPi. A brass fixture allows the ScorPi to be attached to SweetBox, while the brass fixture on the other end of ScorPi attaches to the camera board. You can flex the ScorPi to position the camera at any angle required, and it will remain in position to allow capturing images without any blurring due to shaking.

Cleaning the ScorPi is also very easy, as you can loosen all parts and clean them with a soft wipe using a mixture of white vinegar and salt.