Category Archives: Customer Projects

Fun projects for the Raspberry Pi Model A+ – Part 1

Fun Projects for the Raspberry Pi Model A+ – Part 1

The latest release of the Raspberry Pi, the RBPi Model A+ is not only smaller, it is cheaper as well. That makes it an ideal device for taking a plunge into coding and for trying out new projects. Here are some fun projects that you may find interesting.

A Garden with Digits

With a Pibrella add-on board, your RBPi can run several small motors to create a digital garden. Define the garden to your exact specifications with ornate flowers that you could make out of card or cloth. Add artificial bees and make then spin when you press a button. You could also arrange a relaxing setup of plants and have some soothing music going on at the same time. For details, look here.

Juggle With Illuminated Pins

This is for those who like to juggle things. While juggling, let your RBPi help you out with the routing using some extra LED lights. You will need a Pibrella board and some custom Python code to make the project work independently. Although this may be a niche case, the project is worth undertaking. Lauren Egts has a blog post.

Console for Retro Games

Arcade cabinets of yesteryears still draw a lot of interest. Both young and old enjoy retro games and your RBPi can work as the basis for such a console. With RetroPie, you can simply load emulator software. All you need is an SD card and some USB peripherals. This simple but fun project can be completed within one hour. Life hacker has a guide.

Control Your Pottery Kiln via Wi-Fi

Those using kilns for firing up potteries will find this project useful. RBPi provides remote capabilities for automatic temperature control using a thermocouple and a stepper motor. Temperature stability is maintained with a system of closed-loop feedback. Visit the RBPi blog for code and photos.

Watch Birds with Infrared

Although this is a project for birdwatchers, others can adapt it for their own requirements. An RBPi makes it possible to watch what birds are doing inside the bird box. This way, you are in complete control of watching birds on the outside as well as on the inside of the bird box. The RBPi even makes it possible to set up a live internet stream if your bird box is in a remote location. You will need the RBPi NoIR camera board and some infrared LEDs. The RBPi site has more details.

RBPi Weather Station

You do not need to rely on forecasts from the radio or television any more. Make your own weather station with the RBPi. This project is very cheap and requires very little energy. Of course, some extra hardware is necessary, but nothing too complicated. For details on the setup, visit DragonTail.

Transmit Morse code

Although this is ancient technology, people dabbling in Amateur Radio still find Morse code very useful. Building an RBPi powered Morse code station will be a very exciting project. With this, you can have device for encoding and decoding Morse code. If you add a vintage Morse key, the authenticity of the project will increase dramatically. For complete details, head over to the RBPi website.

Raspberry Pi gets a stepper-motor hat

Robotics enthusiasts find the credit card sized single board computer, Raspberry Pi or RBPi – a versatile unit for controlling various functions. With several add-ons or HATs readily available in the market, the RBPi can be a formidable force to reckon with. With its latest Motor HAT from Adafruit, your RBPi can control up to four DC motors or two stepper motors using PWM to achieve full speed control.

Although the RBPi has several GPIO pins, not many of them work as PWM. That means, to control motor direction and speed, you require a fully dedicated PWM driver chip onboard. Such chips will handle all the motor and speed controls, while communicating with the RBPi on only two pins – SDA & SCL. These pins follow the I2C standard protocol for communication. Therefore, you can connect this Motor HAT to any other device working with the I2C protocol.

In case you need to control a larger number of motors, as it is often required in robotics, you can easily stack up several of these Motor HAT boards. A total number of 32 boards are allowed by the I2C standard. Therefore, you will be able to control simultaneously 64 stepper motors or 128 DC motors, or a mix of both. To do this, you will have to replace the header on the Motor HAT with a stacking header.

Typically, stepper motor drivers rely on L293D chips. However, the Adafruit Motor HAT uses TB6612 MOSFET drivers. These drivers have the flyback diodes built-in and provide a huge improvement over the L293D – you get 1.2A per channel with 3A as peak current capability. The Motor HAT board comes with a small prototyping area and a polarity protection FET on the power pins. Adafruit offers the Motor HAT fully assembled and tested. All that a user has to do is to solder on the included terminal blocks and the 2×20 plain headers. However, stacking headers are not included.

Looking at the specs of the Motor HAT, you will find four H-bridges with thermal shutdown protection and internal kickback protection diodes. The bridges are capable of driving motors operating from 4.5VDC to 13.5VDC. Each board is capable of driving up to four bi-directional DC motors with individual speed selection using 8-bits or 0.5% resolution. Alternately, you can drive up to two stepper motors – unipolar or bipolar. These could be of single coil or double coil type and the driving could be interleaved or micro stepping.

Motors require a good amount of current for producing the required torque. The huge terminal block connectors allow use or 18-26AWG wires for drive and power. External power can come from a 5-12VDC power supply; the two-pin terminal block connector on the board is polarity protected.

Adafruit Motor HAT board is best suited for RBPi models B+ and A+. For using with models A and B, you have to use an extra-tall 2×13 header in place of the 2×20 header supplied. Adafruit supplies the easy-to-use Python library that makes driving motors a breeze with the RBPi wearing the HAT.

Telegram, Raspberry Pi and Remote Control

People from an older generation may still recall the days the postman would land on the doorstep and deliver a slip of paper with some message in it. Those were the days of Telegrams associated with Morse Code, the dots and dashes way of communicating with far-off places. Mobiles and instant messaging services have now replaced that and other such slow modes of communication. As a result, you can always remain in instant contact with people across the globe.

Similar to the WhatsApp messenger service, Telegram is another application that allows you to chat and share documents with your contacts. Telegram surfaced when WhatsApp crashed about a year back. Being a cross-platform messenger app from Berlin, it gained above five million users within 24 hours and more, since Facebook purchased WhatsApp.

Although at first introduction Telegram and WhatsApp seem identical, there are interesting differences. Both require the telephone number of the recipient for sending them a message. In addition, chatting to individual contacts or to groups is possible. Both have a single and double track system for knowing if the recipient has received your message and has read it.

However, unlike WhatsApp, Telegram allows you to send your messages, videos and photos with a self-destruct timer. Once the set time ends, all your shared documents disappear within a ‘secret chat’. This has a huge advantage. Under secret chat, all documents, locations, videos and images remain encrypted end-to-end and only the sender and the recipient can read them; nobody else can read them, not even the staff at Telegram. The timer can be programmed to activate either after two seconds or up to a week.

Using Telegram on the RBPi is fun and you can use the versatile instant messaging service on the same phone number with different devices simultaneously. Apart from simply using the messaging service to exchange messages, it is also possible to make the RBPi take specific actions automatically, based on the message received by it. For example, if the text message sent is say, “photo”, the RBPi responds by taking a snap of the surroundings with its camera and sends the image to the sender. Similarly, if the message says “lamp”, RBPi can turn on a lamp or open a garage door if the message says “open”.

For using Telegram for remote control, it is best to use the RBPi model B or B+ and have the latest version of the Raspbian as the operating system. However, you can also use the pre-installed Raspbian on the 8GB Class 10 Micro SD card available here. Follow the configuration given in this tutorial as a starting point.

RBPi will be intercepting new incoming messages with Lua, a lightweight, fast, powerful and embeddable scripting language application. Lua uses extensible semantics and associative arrays by combining the simple procedural syntax to powerful data description constructs. That means Lua has the capability to understand text and interpret the action to be taken. In fact, Lua uses a lookup file “action.lua”, much as we use a dictionary, to correlate specific text messages received and the actions that RBPi will take. For details of programming, refer to this blog.

Two Delightful Robots Using the Raspberry Pi

Two kits are presented here for those trying to build a robot for the first time. The first is the GoPiGo, a complete robot kit from Dexter Industries and the second is TiddlyBot, a simple fun robot with lots of features. Both kits are great for introducing anyone to the exciting world of robotics and doing it in a fun and simple way. Building robots is a great way for learning Science, Technology, Engineering and Math (STEM), including basic robotics and programming.

GoPiGo

Apart from the robot itself, the GoPiGo kit comprises a full Linux computer, the Raspberry Pi or RBPi, USB and camera expansion for less than $100. You can turn GoPiGo into a full-fledged Wi-Fi robot for exploring unreachable corners of a closet. The inclusion of RBPi makes the possibilities endless. You can even control the robot with your mobile or phone over local Wi-Fi network.

GoPiGo has an acrylic robot body and associated hardware or mounting the RBPi and the Pi camera. It has a control board for motors, controls and extra hardware other than the encoders, wheels and motors.

You need only a screwdriver to assemble the kit. The kit comes with its power source in the form of an 8XAA battery pack along with its connector. You can use your desktop to program GoPiGo directly downloading the program wirelessly or via a USB stick.

The use of the Pi camera along with the RBPi increases the potential of GoPiGo many times over. There is a servo camera mount with the kit and it allows the camera to turn a full half-circle. This increases the robot’s potential for dynamic exploration – for details visit here.

TiddlyBot

If you are looking for something a little less complicated, TiddlyBot is sure to help. Under RBPi control, TiddlyBot begins with robot like movements, using a multi-colored light and progressing to line drawing and following. This is great for teaching children how to program robots as well as for simply playing games.

You can program TiddlyBot using any smartphone, tablet or PC with the provided Blocky Interface, out of the box. It has a web interface for remote control. Use TiddlyBot as a squiggly bot and draw programmatically or let it run freestyle. Use several pens with different colors to make modern art. Makers of TiddlyBot run many workshops for enabling young people pick up nuances of robot building and programming.

What can you do with these two simple but exciting robots? For starters, here are some suggestions:

• Use Wi-Fi To remotely explore a house or office
• Deliver drinks remotely
• Make sneak attacks on unsuspecting people
• Use it for herding pets and babies
• Use it for remote monitoring an event
The greatest benefit of both the robot kits is the inclusion of the Pi camera, which gives the robots their vision. You can monitor where they are going and manoeuver them remotely. This opens up possibilities of several awesome projects. You can make your robots follow hand motions, navigate and map rooms, track objects, follow faces, check on pets remotely, find lost stuff under the couch and so much more – the possibilities are endless.

Expansion Board for Wi-Fi Connectivity for Raspberry Pi

The tiny credit card sized single board computer, the mighty Raspberry Pi or RBPi is mostly self-contained. However, the small footprint of the SBC has not allowed many important functions to be integrated within it. For example, the RBPi lacks an in-built Wi-Fi. This has led to several developments of Wi-Fi add-on kits, with the xPico Wi-Fi Plate from Lantronix leading the pack.

This pluggable, simple and easy-to-use expansion board from Lantronix provides a feature-rich and robust Wi-Fi solution that few can match. It enables the RBPi to attain several mobile-ready capabilities very easily and quickly. Not only does the xPico completely offload all Wi-Fi connectivity from the RBPi, it also provides many advanced capabilities such as Soft Access Point or Soft AP and Client Mode, along with QuickConnect and Wi-Fi connection management.

Combining xPico with RBPi allows developers to concentrate on the main application for RBPi. This is possible because xPico takes care of all the concerns about wireless connectivity management and wireless stacks while providing hassle-free Wi-Fi connectivity. Users get a robust and true 802.11 b/g/n solution, which provides a painlessly enabled Wi-Fi access either as a client or as a Soft AP. In fact, xPico offers a whole gamut of features along with industrial-ready quality and ease-of-use. Therefore, whether you are a hobbyist, a student or an engineer, you can readily enable your RBPi platform to achieve mobility by offloading the TCP/IP stacks and networking applications such as a web-server to the xPico Wi-Fi.

The xPico expansion board is an embedded wireless device server and has several useful functions. For example, it can provide a universal wireless technology to your tablets and smartphones. Your product designs can be faster now with the simplification of Wi-Fi implementation and integration. It provides unmatched flexibility as the footprint is compact and power consumption is very low. The proven feature-set includes simultaneous Soft AP and client mode, configuration by customization and zero host load. The user improves his competitive position by saving on cost and time-to-market. In short, xPico is designed with the necessary functionality to differentiate your Wi-Fi enabled products by providing flexible, mobile-ready Wi-Fi solutions for IOT and M2M applications.

If you are looking for a robust, full-fledged networking solution, the Lantronix xPico Wi-Fi module provides an extremely compact and low-power alternative. It will provide wireless LAN connectivity on virtually any platform that has SPI, USB or serial interface, such as on an RBPi.

Being one of the smallest embedded device servers in the market at present, you can utilize the xPico Wi-Fi module in designs that require chip solutions, as it befits the advantages to cost and time-to-market. The connected micro-controller need not have any drivers as xPico provides the zero-host-load feature. Therefore, implementation becomes very simple, since not a single line of code has to be written. That translates to a considerably reduced development cost and complexity. Additionally, xPico Wi-Fi meets all EMC and safety compliances such as EN, UL and FCC Class B.

Another advantage with the xPico Wi-Fi module is that it is compatible to a huge range of embedded microprocessors and controllers.

Building a UPS with Raspberry Pi and Supercapacitors

It is always a dilemma when integrating a Raspberry Pi (RBPi) Single Board Computer into a project that works on the mains voltage and the RBPi has to turn it on or off. The difficulty is in deciding whether to power the RBPi separately or maybe power it from a UPS.

Lutz Lisseck solved the problem in an ingenious way. He was looking for a way to shut down his RBPi gracefully, after it had turned off his ambient-lamp. Since the lamp operated directly from the mains and Lutz wanted to turn it on/off from the mains power switch, he would normally have two choices. He could either use a mains wall adapter to power his RBPi or use a battery pack as a traditional UPS. He decided he did not like either, and instead opted for a third alternative, building a UPS with supercapacitors.

Lutz used two 50F supercapacitors to make his UPS. When the lamp was on, the capacitors stored enough charge to outlast the RBPi. When the SBC cuts the power, a GPIO pin senses the loss and informs the RBPi to begin its shutdown sequence. The RBPi takes about 30 seconds to shut down, and the capacitors happily power it for the time. Supercapacitors are usually rated at 2.7V; therefore, Lutz had to put them in series for the RBPi to get 5V. An alternative would be to place the capacitors in parallel and use a step-up converter to jack up the voltage. An upside to this is the capacitors will supply the RBPi for a longer time.

Since the project was a very simple one, there are some shortcomings in using the RBPi this way. First, the capacity is just about enough to shut down the RBPi in 30 seconds. However, when switched on, the capacitors take time to charge and the RBPi has to wait for about 10 seconds, before it gets adequate voltage to boot. Another drawback is that although the RBPi has only 30 seconds to shutdown, the capacitors discharge very slowly, and the system has to remain unplugged for about 10 minutes after shutdown, before it will boot up again. For this ambient-lamp project, Lutz does not consider that as a handicap.

Using supercapacitors over batteries has some advantages as well. The capacitors have a lifetime that far surpasses that of batteries. For example, you could charge and discharge supercapacitors completely several 100,000 times. Moreover, supercapacitors can be charged and discharged at rates that are not possible with a battery. A completely discharged supercapacitor can be fully charged up in just 2 minutes.

Therefore, with the supercapacitors in place, you do not need to worry about improper shutdown when the mains supply collapses. A GPIO pin on the RBPi senses when the mains voltage has been removed and the RBPi immediately begins a shutdown sequence. Whether using the supercapacitors in series or in parallel, a low value resistor (0.5-2.0 Ohms) must be placed in series with the batteries to limit the inrush current at startup. As the resistor can get hot, preferably a high wattage type should be used.

Solar Powered FTP Server with a Raspberry Pi

Why would anyone want an FTP server and that too powered by the sun? Well, with an FTP server, you can access all your digital files from anywhere with an internet connection. The sun-powered bit has two advantages, the sun charges those standby batteries and the expense does not show up in your utility bills.

For the project all the parts used are standard items. The Single Board Computer used is the Raspberry Pi (RBPi), a convenient case with all the right slots for the output ports and a small solar panel. Additionally, you will also need a solar charger and a battery box to house the four AAA sized rechargeable NiMH batteries and a micro-USB cable.

A word about the solar panel; you can buy the solar panel from Cottonpickers. The advantage is you get a solar panel with a built-in battery box and a box for the RBPi together. All you have to do is to slide in the RBPi and plug in the batteries. This model has an on/off switch, so you do not have to pull out the cord to switch off. The batteries keep charging even with the switch in the off position.

A blue LED on charger lights up when the sun is charging the batteries. There is also a USB socket, which you can use for charging other USB devices such as mobile phones. Cottonpickers also supplies a USB cable along with the solar panel, so you have almost everything you need for the project.

The solar panel supplies a little more than 300mA, which means that it is perfect for charging 3000mAH NiMH batteries, since they require a C/10 charging rate. The panel has blocking diodes to prevent the batteries from discharging through the cells.

The RBPi model B, with all its keyboard, mouse, TV and networking plugged in and running consumes about 400mA, which the solar panel can easily meet if the sun is shining in its full glory. When the sun goes down, the battery takes over seamlessly. The solar panel can fully charge four AAA cells of 750mAH capacity within three hours. This allows an operation time of more than one and a half hours on the battery.

Charging four AA cells rated at 3000mAH takes the panel about 10 hours to complete. That means if the panel is left in the sun the whole day, the battery will be fully charged for the night. The options you have are:

Powering your RBPi directly from the sun and use the four NiMH cells as a buffer when the sun hides behind clouds. Let the solar panel charge the battery of cells during the day and you can use your RBPi at night.

Next, you will need a static IP address. This is essential, as the address will let your network firewall know it has to allow incoming FTP requests from there. You will also need a vnc-server and load it up as a service every time the RBPi boots up. For the FTP, use the Very Secure FTP Daemon or VSFTPD. Setup all the software as per the instructions found on CNET and you are ready to go. Don’t forget that your RBPi needs a lot of sunshine!

Let Raspberry Pi Read You an Audio Book

People who have grandmothers (and grandfathers) are fortunate. Although most of these old people are healthy and strong despite their advancing years, not all are so lucky and may be impaired in some way, mostly because of their failing eyesight and trouble with arthritic hands. Since they have a physical handicap, they find it difficult to operate a laptop, a DVD player or a tiny MP3 player. A Raspberry Pi (RBPi) with a large play button is actually helpful if it can read back an audio book.

This can be done in two ways. The RBPi player can have a single large button to pause and play, or have no buttons at all and be operated by NFC tags. The tags are best attached to empty CD or DVD cases, on which the details of the Audio book are printed in large letters for easy reading. Simply passing a case over the player will cause the specific audio book to start playing from its last state.

The player saves its state after every two seconds. Therefore, when the listener is bored or otherwise wants to stop listening, he or she can simply disconnect the player from its mains socket. Reconnecting it allows the player to get back to playing from its last saved state.

The RBPi player with a single large button works as a play/pause button when pressed. Going back to the previous track is easy if the listener holds the button pressed for more than four seconds. Copying files into the player is also a simple affair with a thumb drive. The files are copied into the thumb drive under a special volume label. As soon as it is plugged into the RBPi USSB port, the books are copied into the SD card and starts playing when the drive is unplugged.

For the single button RBPi player, apart from the RBPi and its enclosure, you will need a blue LED, some wires, a pair of speakers and of course, the large button. Among the software that you will need are – Raspbian image (Wheezy), mpd, mps, mpd-python, pyudev and a python script.

When the RBPi player is first powered up, it boots, starts the python script and waits with the audio book in pause. Since at a time only one audio book is stored, pressing the button starts the player. If the button is held pressed by more than four seconds, the player goes back one track. The player always remembers its last playing position.

As soon as a USB thumb drive is plugged in, the player stops playing, mounts the thumb drive, deletes the old audio book, copies the new one from the special name/label on the thumb drive and rebuilds the playlist. A flashing blue LED signals the end of file copy. Once the thumb drive is removed, the new audio book starts in pause mode, proceeding to play when the play/pause button is pressed briefly once.

Use of mpd allows the RBPi player to support wave, Musepack, MOD, MP4/AAC, MP3, MP2, OggFLAC, FLAC and Ogg Vorbis file formats.

Turtle Graphics on the Raspberry Pi

In 1966, Seymour Papert and Wally Feurzig developed the Logo Programming Language. As a part of this, Turtle Graphics was a very simple way of teaching programming to children. It consisted of a robotic turtle starting at coordinates 0, 0 in the X-Y plane on a computer screen. With a command turtle.forward(20), the turtle would move forward by 20 pixels in the direction it was facing, drawing a line as it moved. To turn the turtle where it is standing, a command turtle.right(30) would make it rotate 30-degrees clockwise. By combining the two commands and a few others, drawing intricate pictures and shapes on the screen was possible.

Now, the Python standard distribution contains a module “turtle” that allows extending the re-implementation of Turtle Graphics. You can run this on your tiny credit card sized inexpensive single board computer, the Raspberry Pi or RBPi. The Python module tries to keep the same merits as available with Turtle Graphics and is nearly fully compatible with it. That means the learning programmer can use the same commands, classes and methods interactively, when using the module.

For example, if you want to find out where your turtle is at present, you can query it with turtle.postion(), and the turtle will respond with its current X & Y coordinates. Now you can command it to move forward or backward, turn right or left and even check its orientation. For a complete list of the turtle commands, look up module-turtle. Apart from moving in straight lines, you can command the turtle to move in a circle of a given radius.

The Python module turtle is a versatile program. Various commands make the turtle do different things. For example, you may want the turtle to move but without drawing any line. Another command can make the turtle leave a stamped mark at its current position. Yet another command can make the turtle invisible, and another can make it draw lines in the color you specify.

Since RBPi is for children who are starting to learn computer programming, the combination of Turtle Graphics and RBPi is a powerful way of teaching them the basics of robotics. The language used by the module turtle is very similar to every-day English, which makes it very easy for children to learn and use.

Children find it difficult to grasp the abstractions on which traditional Euclidean geometry is built. For example, how do you have a point without size or a line that has a length but no thickness? Young people find all this difficult to grasp. However, the turtle being a real concrete object can be seen and manipulated. Turtle geometry being body syntonic, is easily understood since the turtle moves about just as everybody does. That makes it easy to identify with and its actions are well understood by kids.
Seymour Papert has explained the rationale behind turtle geometry in his book Mindstorms.

Another very simple way of learning turtle graphics on the RBPi is through Kids Ruby. Overall, with Turtle Graphics you can teach absolute beginners the concept of storing algorithms and running them so that the computer will simply obey the given commands.

Drive a 16-Channel Servo with the Raspberry Pi

To drive servomotors micro-controllers must have PWM outputs. These are output pins on which the micro-controller will generate pulse outputs with controlled or modulated variable widths. Most embedded micro-controller units have one or more of these outputs. The famous single board computer, the tiny credit card sized Raspberry Pi or RBPi also has one IO pin dedicated for PWM. This is the PWM channel available at the GPIO18 of the RBPi and with this, you can drive a single servo at best. However, if you want the RBPi to drive more than one servo, it will need additional circuitry.

A PWM driver IC such as the PCA9685 can drive 16 servos at a time, but requires commands and data through its I2C interface. Fortunately, the RBPi can also communicate using the I2C protocol, enabling it to control 16 servos via the PCA9685. Adafruit has a very convenient breakout board with the PCA9685 on it and that makes it very convenient to connect to the RBPi. Not only can you drive servos with the PWM outputs, you can use the PWMs for controlling LED lighting as well.

To let RBPi communicate with the I2C protocol, it will require a special OS available from Adafruit. This is the Occidentalis flavor and it has all the libraries required for invoking I2C. However, if you are using the stock Raspbian OS, you must install the python-smbus and the i2c-tools using the “sudo apt-get install” command. To learn more about using I2C, refer Adafruit’s rather informative tutorial.

The two packages will allow you to search for any I2C device connected to the RBPi. The easiest way you can connect the servo breakout board to your RBPi is with the help of the Adafruit Pi Cobbler. Here, VCC is the digital supply for the IC or 3.3V, and V+ is the supply for the servomotors (typically 5V).

The actual chip that drives the servos, the PCA9685, needs 3.3V, and connects to the VCC on the cobbler board. Servos usually require much higher currents to operate. Therefore, they are powered from a separate power supply, typically 5V, and are connected to the V+ on the Cobbler. Note that this 5V is different from the 5V supply for the RBPi. The PWM operation on the servos creates a huge amount of electrical noise, which can cause the 5V supply voltage to fluctuate significantly. RBPi may not be able to tolerate such voltage fluctuations, and this may cause it to crash and lock up.

If you are driving many servos, it will be a good idea to add a capacitor to the driver board. There is a spot already marked for such a capacitor. As a thumb rule, you need a capacitor with a value n x 100uF, where n is the number of servos you are driving. Capacitors are manufactured in standard ratings, and you may have to go for the next higher standard value that you have calculated.

Depending on whether you are using a standard or continuous rotation servo, your python code will vary. For the actual code with which you can control the various parameters of I2C and hence the servo, you may refer to this site: https://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi