Tag Archives: RBPi

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.

Using a Raspberry Pi to Hack an Apple Time Capsule

You may have an old Apple Time Capsule lying around, which you may not be using because it has a failing hard drive. These were expensive at the time Apple first introduced them and for many people, a failed power supply or hard drive might have forced them to stop using the device. If you are not familiar with the Time Capsule, it is a backup arrangement for everything on your Mac. Apple coined the name Time Capsule for the hardware and Time Machine for the software. Windows users will not have seen anything like it, and you can read about Time Capsule on Apple’s official link.

You can bring your dead Time Capsule back to life using the low-cost credit card sized single board computer Raspberry Pi (RBPi). Even if you do not have a Time Capsule to modify, you can simply add a Solid State Drive to your RBPi, house the two in a suitable box and make a Pi Capsule for using on your Mac with the Time Machine software. For information, Linux users may backup to the Pi Capsule using any one of the 21 backup software programs listed here.

Backing up over the wireless may be slow, depending on the Wi-Fi speed. However, you can get much faster speeds using the Pi Capsule over wired Ethernet. Of course, the first time you start a backup, the process will take a long time, so try not to interrupt it. Future backups will be faster because they will be only incremental.

You will need a power supply suitable to power up both your RBPi and the Time Capsule (in case the power supply in the Time Capsule has given up the ghost). Connect the SSD hard drive using a SATA to mini-USB cable via a powered USB hub. It is essential to connect only the wireless mouse and the powered USB hub to the RBPi. Anything else you want to connect to the RBPi, such as the keyboard, SSD, wireless card, etc., goes through the powered USB hub.

For the RBPi, you will need an 8GB SD card with the latest “Wheezy” Linux operating system on it. For instructions on how to load Linux on the SD card, see instructions here. Connect a display through the HDMI. When booted the first time, you will be taken to “Raspi-config” automatically, allowing proper setting for the keyboard connected to the RBPi. Now connect the Hard Drive or the SSD to the RBPi using a SATA to mini-USB cable via the USB hub. For getting the RBPi working with the Time Machine on a Mac, follow the guide here.

Pi Capsule has some extended features over the Apple Time Capsule. For one, it can plug into your TV or any other display. Apart from using it only as backup device, the Pi Capsule is actually a full-fledged computer, which you can simultaneously use for web surfing or emailing. If you are not using an Apple Time Capsule and if you have the ability to make cases, build one to house both the hard drive and the RBPi, taking care to leave openings for the RBPi connectors.

Some of the Best Raspberry Pi Add-Ons

To most people, the Raspberry Pi or the RBPi Single Board Computer is only a cheap desktop. That is because by the time you have added a monitor, a keyboard, a mouse and the SD card, it would have cost as much as a cheap laptop and would still be a lot less powerful.

However, the real innovation of the RBPi lies not in its cost, but in its form factor. You can run the tiny RBPi on a few batteries or solar cells and use its exposed General Purpose Input and Output pins. This trio of combinations does not have any precedents in computing, at least not in the price range of the RBPi.

Being a new type of device, the RBPi is a lot easier to understand with some of the readily available components that connect to it to enable some function or to add some feature.

Most of these add-on components are not from large companies, but developed by hobbyists who saw the need for and filled it. One of these add-on components is the multi-purpose LED display Pi Lite. This is a simple board full of LEDs allowing people to use the RBPi to turn them on or off individually. This has made the RBPi SBC different from the regular PC and forced people to think differently for using it in its particular niche.

Pi Lite has 126 red LEDs, with a white LED version on its way. You plug the board into the GPIO pins on the RBPi. Pi Lite nearly covers the main RBPi board and has about the same form factor. Of course, you need a little configuration to enable the board to use the RBPi serial port, but that is well documented.

You send commands to the Pi Lite via a minicom terminal. Once connected over the serial port, anything sent over will scroll across in beautiful red light. Not only can you send text, you can also send commands preceded by three-dollar signs. You can turn all pixels on or off, display horizontal and vertical graphs and manipulate individual pixels.

You can improve the connectivity of your RBPi by expanding its ports. As the GPIO pins are exposed, any circuitry can be added to the RBPi. That may cause accidents and fry your RBPi very easily. Although there are several add-on boards that provide access and protection to the RBPI GPIOs, Quick2Wire has a board that uses the I2C and SPI features of the RBPi.

These are the Inter-Integrated Circuit and Serial Peripheral Interface and the board comes in two parts. The main board provides the I2C and SPI ports, adds protection for the RBPi and voltage selectors. Additional boards provide more GPIO ports including analog inputs and outputs that RBPi lacks. You can daisy-chain the boards to allow even more ports to be added to the RBPi.

To control the ports, you need to program the board with the Python programming language. For this, you may have to install the python3-setuptools package. You can find additional details of the above two add-on boards in openmicros.org and Quick2Wire.com.

The Raspberry Pi Command Line Interface

Being Linux based, the tiny Single Board Computer Raspberry Pi or RBPi has a graphical user interface familiar to regular computer users. Again, as most users of Linux will be familiar with, RBPi also has a command line interface where you have to type in the commands you want the SBC to execute. Well, a graphical user interface does have its merits and although the command line interface is a little more intimidating to the uninitiated, it is not a very difficult beast to tame.

One of the major advantages of the command line interface is its scope and speed – it easily accomplishes and most often surpasses what can be achieved with the graphical user interface, and does it faster as well. For most day-to-day tasks, however, the graphical interface is enough and has many useful applications including a web browser, test editor and file manager.

For those who want to delve deeper and learn more about how the SBC actually works, the command line interface is the way to go. Most of the work is done by opening up a Terminal or Shell and typing within it.

As the name suggests, the command line interface is an entirely text-based interface. You type in the commands that you want the SBC to execute, and it gives you a response. Although in the beginning, it will seem a little confusing, it is more like interacting in a natural way, just as we converse with another person. Once mastered, interacting with a computer via the command line interface will let you learn much more about it in the future.

You begin by opening up a Virtual Terminal/Console. Why is the name Terminal used? This is a legacy from the past when computers were gargantuan beasts, centrally located, with remote terminals distributed to the users. When you click on the LXTerminal on the Raspbian desktop, a small bordered box opens up, with ‘pi@raspberrypi $’ written inside it. The box is the terminal and inside it is the command prompt. The command prompt shows the name of the user – ‘pi’, the name of the computer – ‘raspberry’, also called the domain name, and the ‘$’ signifies that pi is a regular user and not the root or superuser (for root, the prompt would change to ‘#’).

The command prompt shows that your RBPi is now ready and waiting for you to type in your command. For example, you can see where you are by asking the computer to Print the Working Directory, by entering ‘pwd’ and hitting Enter. The SBC will most likely return – ‘/home/pi’, unless you have changed your username.

You can change the directory with ‘cd ..’, the computer knows that it has to return to the parent directory – ‘/home’. You may verify this with another ‘pwd’. With the command List Files or ‘ls’, you will be able to see all the files residing in the directory. Use a flag ‘-a’, to list the hidden files or all the files in the directory. Now the command becomes ‘ls -a’. Use ‘ls -l’ to see more information about the files.

For more information and for learning the command line, visit the website linuxcommand.org

Give Your Raspberry Pi an Intelligent Power Switch

Whether you use a desktop or a laptop computer, one of its features is the intelligent power supply that shuts down the system once it detects that the software has sent the shutdown command. To switch the system on, you need only press a small button. The Raspberry Pi, or the RBPi, being a low-cost single board computer, does not have this feature. After shutting down the OS, you have to unplug the power cable physically from the RBPi.

With large numbers of community projects springing up around the credit-card sized SBC, the RBPi can also enjoy the features of an intelligent power supply. This is the Pi Supply project, which sits between the actual power supply and the RBPi, adding its own intelligence as necessary. Pi Supply takes its power from the micro-USB charger and powers the RBPi.

When the RBPi issues a ‘sudo halt’ command, Pi Supply detects the shutdown command and switches off the power to the SBC at a safe moment. To switch the power back on, simply press a button on the Pi Supply, and your RBPi springs back to life. You do not need to plug/unplug the micro-USB connector anymore. With power supply issues being one of the biggest headaches for SD card corruption, the Pi Supply is a very handy project.

The Pi Supply provides a single window solution to all the power management problems your RBPi currently faces. This intelligent ATX style power supply switch is a revolutionary solution for the RBPi, since you do not need to disconnect any power supply wire from the wall-wart to the RBPi. Turning power on/off to the RBPi is now possible simply by touching one of the two buttons on the Pi Supply.

Once your work with the RBPi is over, you simply issue the command ‘sudo halt’. Once the OS has safely and fully shutdown, the Pi Supply will cut the power to the RBPi. If you would like to resume working, touch the on button, and the Pi Supply will restore power to the RBPi.

The second button on the Pi Supply is meant for a hard power off. In case of emergency, pressing this button will immediately cut the power to your RBPi. However, this button must only be used when absolutely necessary, as when your SBC has crashed or is in the frozen state and is refusing any attempts of revival. Note that use of this button increases the risk of file corruption on your SD card, if operated at the wrong moment.

One of the most amazing features of the Pi Supply is that it is able to distinguish between ‘sudo halt’ and ‘sudo reboot’. That means not only can Pi Supply shut down the power supplied to your single board computer when you give the halt command, but it can also reboot your SBC when you want, without you touching a single button or removing a single connector. That makes it almost as intelligent as the ATX power supply of your desktop.

MIPS Creator CI20: Challenge for the Raspberry Pi?

Although the Raspberry Pi or the RBPi did bring a revolution in the world of tiny computers that can teach children the intricacies of computer programming with inexpensive ease, not all are happy about its capabilities. There are two main points of contention with the credit-card sized single board computer – the low amount of RAM and the lack of onboard storage.

A quick recap of the RBPi’s specifications shows that it uses a system on a chip (Broadcom BCM2835). This includes the 700MHz processor (ARM1176JZF-S) and a GPU (Videocore IV). Initially, the board shipped with 256MB of RAM, but later up-gradations had 512MB in the Models B and B+. There is no built-in storage device and RBPi uses the SD card for booting and persistent storage. The latest model B+ has four USB2.0 ports, one Ethernet port, one 15-pin MIPI camera interface, one composite video output, one HDMI output and one audio output on 3.5mm jack. The 40-pin expansion header has 27 GPIO pins.

Now, there is a more powerful computer in the market to challenge the RBPi. Moreover, it is available free. The MIPS Creator CI20 is a development board from Imagination Technologies and it can run Linux distributions such as Gentoo, Arch and Debian 7.

The CI20 runs on a dual core processor based on the MIPS architecture and operating at 1.2GHz. The GPU, a PowerVRSGX540, is capable of running OpenGL ES 2.0.The onboard RAM size is 1GB, with 8GB onboard flash storage. The board features an SD expansion slot, one pair of USB 2.0 ports, Bluetooth 4.0, Wi-Fi and Ethernet. The expansion header features 25 GPIO pins and 2 SPI buses. You can boot the board from either the SD slot or the flash memory.

Compared with the RBPi model B+, the advantages that CI20 has are – double the RAM, a faster processor, onboard storage and built-in Wi-Fi and Bluetooth. In addition, CI20 has its power supply onboard, which the B+ does not. The disadvantages are – CI20 has only two USB ports compared to the four on the B+. In addition, the form factor of the CI20 is larger than what the B+ has.

Since the CI20 has higher capabilities such as more computing power, onboard storage and wireless connectivity, it is assumed that it will cost more than the current price of the RBPi B+ ($35). However, Imagination Technologies have not yet revealed the price of their new board. Imagination, instead of selling the initial batch of CI20s, is giving them away free to tinkerers.

Therefore, if you want to lay your hands on a CI20, you must have a grand project idea for the board. That means this giveaway is not actually meant for the hobbyists, but rather aimed at developers. However, do not be discouraged even if you are planning to create a video arcade console/home entertainment center/TOR proxy at home. It may turn out that your CI20 based home automation hub is interesting enough for Imagination and they are willing to send one of their free development boards your way.

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

Raspberry Pi add ons

Accessories have been flooding the market ever since the release of the tiny Single Board Computer Raspberry Pi (RBPi). Some of them merit a closer look because they can take your RBPi to the next level.

MotorPiTX board

For people interested in projects that need to run motors such as in robotics, the MotorPiTX board is a great accessory. It fits on top of the SBC and comes packed with some interesting features such as its own power supply (four AA batteries). This is enough to run the RBPi along with attached motors and servos. Full ATX style power controls are available, such as two 5V outputs (for LEDs), two bi-directional DC motor connectors, two servo connectors, two 3.3V inputs, one I2C breakout board and a micro-USB port.

A Smart IO Expansion Card

You can stack this add-on device atop the RBPi. As this is a super IO port, you can connect just about anything to it. There are 13 inputs for analog, pulse and digital signals, two analog outputs, eight digital outputs capable of 1A and ports for AHRS, CAN, RS485 and RS232. Apart from using it as an electronic test platform, the card can also be used for home automation, machine control, UAVs and robotics navigation.

The Pi Crust

This breakout board sits on top of the RBPi like a crust, allowing users to connect a multitude of devices easily. Rising only a scant 2mm above the RBPi base, the crust does not interfere with any other device connected to the RBPi. Pins are clearly labeled together, grouped logically together and include power, UART, SPI, I2C and GPIO. Female headers allow ease of connection along with plenty of GND and 5V pins.

SweetBox, Heat Sinks and ScorPi

SweetBox is a minimalistic approach to an enclosure for the RBPi and the smallest one in the market. It comes with a removable, flexible GPIO cap, allowing access to plug-in components. The SweetBox also has a set of anodized aluminum heat sinks that aid in extra heat dissipation. ScorPi is a flexible mount allowing the user to mount an RBPi camera, with direct plugin into the RBPi’s RCA port.

Power Supply Ignition Switch

This attachment allows using the RBPi with vehicles. It allows powering the RBPi through the electrical system of the vehicle. As you engage the vehicle’s ignition or turn it off, the attachment senses and powers the RBPi on or off safely. The built-in converter takes in 12/14V from the vehicle and provides 5V to the RBPi. Its ignition sensing talks to the SBC through two of its GPIO pins. The attachment retains power for the RBPi for 20 minutes after switch off. That means frequent stops will not repeatedly boot your RBPi. Additionally, if you left the RBPi running in the vehicle, the automatic shutdown feature will shut it off after four-hours to no-user activity.

HDMIPi HD Screen Prototypes

These are 1290×800 displays, which are not too expensive, portable and only 9-inch in size. You can watch movies comfortably, or incorporate into whatever project that needs a display. The cost-to-size ratio is perfect, competing successfully with the other portable screens in the market.