Category Archives: Raspberry Pi

Thin Clients with the Raspberry Pi

When deploying a large number of computers at a single location, it is a common practice to employ thin clients. In such cases, several client computers access a powerful central server computer that controls resources such as the hard disk data and Internet access. The logical operating system of the server is isolated from the clients accessing it via a concept known as desktop virtualization.

Implementation of desktop virtualization or VDI follows several conceptual models. One can broadly divide them into two categories depending on whether the operating system executes locally on the client machines or remotely on the server. Therefore, desktop virtualization may not always involve the use of virtual machines.

When the desktop virtualization uses a host-based form, users have to view and interact with their desktops over a network. For this, they must use a remote display protocol. As all processing takes place at the data center housing the server, client devices can be tablets, smartphones, zero clients and thin clients.

Citrix offers a suite of products known as Citrix Receiver with which client devices can easily connect to different desktop virtualization services from Citrix. They offer several types of client platforms and form factors. Included in these are embedded operating systems. zero clients, thin clients, Google Chromebook, Linux, Blackberry Playbook, Blackberry, Android, iPhone, iPad, Mac OS X, Windows Mobile and Windows.

For example, using Citrix Receiver technology, users can connect their client devices to XenDesktop and XenApp desktops and applications via the HDX protocol. They can also connect to the Citrix Access Gateway, XenVault secure storage and other Citrix services.

Citrix has since decided that putting a lot of effort into creating special versions of Receiver for one device is inefficient. Therefore, it has decided to work with the Pi Organization for ensuring their Linux Receiver would work with the new architecture of Raspberry Pi Model 2 or RBPi2 and its supported OS images.

With this effort, it is no longer necessary to have hardware-accelerated plugins for the RBPi2. The new HDX Thinwire and XenDesktop/XenApp 7.6 FP3 compatibility codecs work efficiently on the RBPi2. On the other hand, ThinLinx makes a Thin Client & Digital Signage Operating System for the RBPi. Citrix has tested this OS and has confirmed it is capable of handling video with impressive speed.

According to Citrix, their selection of RBPi2 as a thin client for VDI is based on the inherent security feature of the Single Board Computer. The SBC is secure as there is no on-board storage and the SD card of the computer can be removed and stored in a safe place when not in use. An additional factor is the price. RBPi is far cheaper than any other thin client available in the market. Another advantage is in addition to vanilla models, you can also have custom RBPis as thin clients.

That the RBPi is an interesting VDI option also comes from the fact that all dedicated thin clients require the same hidden costs to make them useful. This includes pointing devices, keyboards, Wi-Fi dongles, SD cards, USB hubs and monitoring devices.

A USB Hub with a Raspberry Pi Zero

Computers available today come with only one or two USB sockets. With the multitude of USB or Universal Serial Bus devices we use today, it is easy to run out of sockets. For example, you may have to connect your mouse, keyboard, printer, webcam and microphone, all operating on USB technology, to your computer. With only two ports available, it is obviously a difficult task.

However, there is an easy solution. You can use an inexpensive hub. According to the USB standard, which also covers USB hubs, they can support up to 127 devices. Typically, a USB hub has four ports, but some models can have more. Operation of a hub is plug-n-play. You plug the hub into your computer and plug your devices, including other hubs, into its ports. Chaining hubs allows you to build up dozens of available USB ports on your computer.

USB devices can use their own power supply or they can draw power from the computer they are connected. Devices that draw power from the host computer are mostly low power devices such as mice and digital cameras. According to the USB standards, a USB 2.0 port can power devices drawing a maximum of 500 mA and a USB 3.0 port allows devices to draw up to 900 mA maximum.

Self-powered devices connecting via the USB port do not need to draw power from the host computer. For example, your computer does not need to supply power to printers and scanners connected to it. For connecting many unpowered devices to your computer, you will need a hub that has its own power supply, so that the devices do not load the computer’s supply. Such hubs have their own power supply that supplies power to the bus.

If you have the single board computer, the Raspberry Pi or RBPi, especially the Zero version, it is easy to convert it into a USB hub. Frederick had a LogiLink UA0160 USB hub lying around and he used it together with an RBPi Zero to make a powered hub with four ports. He removed the board from its casing and connected the power points to the power points of the RBPi Zero. Since the form factor of the hub board matches that of the RBPi Zero, the entire assembly looks neatly done.

For supplying power to the hub, you will need to connect PP1 of the RBPi Zero to the 5V point of the hub and PP6 of the RBPi Zero to the GND of the hub. Next, you have to connect the USB OTG from the RBPi Zero to the USB port of the hub. For this, use two wires to connect PP22 of the RBPi Zero to the D+ on the hub and PP23 of the RBPi Zero to the D- of the hub.

Use an ohmmeter to check for any shorts between the hub and the RBPi Zero. Additionally, make sure all connections are correct. Use some insulating material such as a plastic board between the hub board and the RBPi Zero, before bundling everything together. If possible, get a case to house the combination and you are done.

Connecting To a Raspberry Pi via an Ethernet Cable

You can use your Raspberry Pi or RBPi single board computer in different ways. Sometimes you may have a keyboard, mouse, and display to connect to your RBPi to use it as a regular computer. At other times, you may prefer to communicate with it through another computer such as a desktop or a laptop. Your method of communication may also vary. For example, if your RBPi is at a distance, you may have to connect to it over the Internet via Wi-Fi.

However, Wi-Fi may be an unreliable and a slow way of connecting to your RBPi if you are communicating with it often using SSH or a remote desktop application. Rather, a faster method would be to use a direct Ethernet connection, which would also be a lot more stable. Since you are connecting to your RBPi directly with an Ethernet cable, you are actually bypassing your local network and not sharing the bandwidth with other computers. Moreover, a direct Ethernet connection allows you to connect to your RBPi even when you are away from your home network, experiencing slow connectivity and or network time outs.

For this, all you need is an Ethernet cable. You will need to assign a static IP address to the Ethernet port of the RBPi. The static IP address will depend on the IP address of the computer and its Ethernet adapter that you will be using to connect to the RBPi. The process of assigning a static IP address is straightforward and should be easy for any OS.

If you are using a Windows computer to connect to your RBPi, open up the Network Connections window from the task bar or by accessing the Control Panel. Now look at the Properties of the Ethernet connection under Internet Protocol Version 4. This will show an IP address of the form 10.0.0.6 or similar.

In some cases, the internet connection may also be set for automatic assignment. Here, you need to connect your RBPi to the computer via an Ethernet cable first. Now access the Windows command prompt and use the ipconfig command to see the address your computer has automatically assigned to the connected RBPi. Next, you will also need to note the default gateway IP, which is the local IP address of your network router.

Apart from the above, you will also need to find out the IP addresses of the domain name servers used by your RBPi for finding websites on the Internet. This you can find out by executing the command cat /etc/resolv.conf on the command prompt of your RBPi.

Now you must edit the /etc/dhcpcd.conf file on your RBPi and modify the three IP addresses in the file. Change the last number of the IP address of your computer’s Ethernet adapter, to any other number between 0 and 255. This becomes the static IP address you will use to SSH or connect remotely to your RBPi.

The static router is the IP address of the default gateway IP you noted earlier and the static domain name servers are the IPs you noted from the /etc/resolv.conf. Save the dhcpcd.conf file and reboot your RBPi. Enjoy your connection.

Which Raspberry Pi Should I Use?

Which Raspberry Pi or RBPi you will use is getting more and more difficult to answer as the family keeps growing. It was simple and straightforward when the RBPi first launched – there was only one model. Since then, with four major models to choose from, things are more complicated. However, this versatile beast comes in different specifications and you should select the one most fitting your requirements. Among the models available, here is a summary to help you decide:

RBPi Zero

This is the latest addition to the family. Although it is ultra-cheap, the RBPi Zero is definitely a fully functional single board computer. Compared to the first model of family, the processor used in the RBPi Zero is more than 40% faster. However, purchasing this variant compels you to make major compromises.

To start with, you will need adapters to use the mini HDMI and micro USB ports on the device. As there is no on-board Ethernet port, you need to use the single USB port. Although you can expand its functionality by adding a powered USB hub, the additions begin to detract from the major selling point of the Zero – its tiny footprint.

If the application does not require a fair amount of connectivity, is low-powered and for single-use, you may consider using the RBPi Zero.

RBPi Model A+

Although a full-sized version, this model also lacks the Ethernet port and has only one USB port. Moreover, it has only 256GB RAM that goes with the 700MHz processor. The price and lack of power makes it difficult to recommend the RBPi Model A+ for any application other than for specific ones.

RBPi Model B+

If performance is not a criteria and price is the only consideration, then the RBPi Model B is hard to beat. The model offers good connectivity as it has on-board Ethernet, four USB ports and a full sized HDMI connector. That makes the RBPi Model B+ more versatile than either the Model A+ or the RBPi Zero.

You can use it for any project that requires good connectivity, less than top-notch performance, and low power.

RBPi Model 2

This is the top-of-the-line model in the family and a surprisingly capable beast. With an updated chipset, a quad-core processor and 1GB RAM, the RBPi Model 2 makes a major difference in the large variety of Single Board Computers available in the market.

You can use the RBPi Model 2 as a media server for your network or use it for tasks of more intensive nature such as running a home surveillance system or playing games. It also allows you to explore platforms other than Linux – you can run the IoT version of Windows 10.

Even though the total power consumed by the RBPi Model 2 is below 1W, it uses significantly more power as compared to its predecessors. For example, RBPi Model 2 consumes more than 33% power drawn in by the RBPi Model B+ and five times more power than what the RBPi Zero consumes. Use the RBPi Model 2 for anything where you need good performance.

Check our other guides for information on Model 3.

Controlling RGB LEDs via the Raspberry Pi

Digital gates are great for switching LEDs on or off. Micro-controllers are even better and so are single board computers. That is because they contain several gates to control the LEDs. To top it all, you can program single board computers such as the RBPi or Raspberry Pi to control several LEDs individually to run at different on/off cycles. Additionally, multiple color LEDs are available, such as RGB LEDs, with which you can generate any combination of the basic red, green and blue colors.

Although the GPIO pins of the RBPi can switch on an LED, the pins cannot supply beyond their limit. Therefore, when driving LEDs from the GPIO pins, a current limiting resistor is necessary in series with the LED, to prevent the IO pin from being damaged. The resistance value will depend on how much current the IO pin can source or sink, and the supply voltage of the RBPi or LED.

The RBPi has a 40-pin GPIO header among which, you can control several pins through software. The most common use of external circuits and LEDs with GPIO pins is to indicate status visually. For example, you may be controlling a remote circuit with software, and an LED nearby can indicate its status. The LED lights up to indicate the remote circuit is powered.

It is a good thing that human eyes have something called the persistence of vision. When we see something, its image persists in our eyes for a brief time. Therefore, we can see flashing lights only when they are flashing relatively slowly. Beyond a certain speed, our eyes cannot make out the individual flashes and the flashing light looks as if it is steadily lit. Using a technique called PWM or Pulse-Width Modulation, and controlling the on time of a GPIO pin through software, we can make an RBPi drive an LED such that it looks as if the LED is breathing. Doing the same with an RGB LED, the RBPi can cycle the lights to produce any color in the rainbow.

You can build a simple RGB LED board with a single bright RGB LED, three current limiting resisters and a four-pin connector on a prototype PCB. RGB LEDs have four pins and come in two configurations, common cathode and common anode. In the common cathode configuration, the package combines the cathodes of all the three LEDs into a single pin with the anodes individually available. For the common anode configuration, all the three anodes are combined into one pin, while the cathodes are individually accessible.

To drive an RGB LED you will need to connect its individual anodes or cathodes to three GPIO pins through current limiting resistors. If you use a common anode RGB LED, you will have to connect its common anode to a supply voltage. For a common cathode RGB LED, you will need to ground its common cathode. Now, you can switch on an individual LED of the combination by switching on the corresponding IO pin. See this tutorial for writing simple Python scripts for controlling the LEDs via the RBPi.

The Raspberry Pi Sense HAT

If you are targeting the Astro Pi mission, it makes sense to get the Sense HAT as an add-on board for your tiny single board computer, the Raspberry Pi or the RBPi. With a fantastic RGB LED matrix, not only is the board beautiful to look at, but it also comes with a plethora of sensors on-board. That makes it useful for the applications in the International Space Station where it is headed to in December 2015.

The Sense HAT looks like an ordinary board with an 8×8 RGB LED matrix on it. You can use it to display graphical information in color. For example, using the display you can indicate geomagnetic North. Apart from the matrix, the Sense HAT also has a five-button joystick, which allows the user to interact with the programs the RBPi is running. That includes playing games such as Tetris, Snake or Pong on the RBPi.

The Sense HAT includes several sensors such as a gyroscope, accelerometer and magnetometer. It also has sensors to read ambient temperature, barometric pressure and humidity. A Python software library that comes with the board provides the user with an easy access to everything on the Sense HAT.

Using the software library, you can conduct a huge range of projects for the Sense HAT and RBPi combination. For instance, if you are traveling with the combination, it can measure and show your speed. At the same time, it can tell you the direction it is facing, how humid is the atmosphere nearby and even the temperature of your surroundings.

The Sense HAT kit comes with the fully assembled Sense HAT board, four mounting posts and eight screws so you can mount the HAT on your RBPi securely. Mounting the board on the RBPi is simple. First, fit the four mounting posts with four screws on the board. Now, align the 40-pin connector on the HAT to fit on to the GPIO connector of the RBPi and push in firmly. The four posts will align with the mounting holes of the RBPi. Secure those with the remaining four screws and you are done.

To install the software, visit the AstroPi and the Swag websites. Here, you can find out of the world projects, a host of ideas and instructions related to the RBPi and the Sense HAT, fit for the applications on the ISS or the International Space Station.

Technical specifications of the Sense HAT are impressive, considering the inexpensive setup. The Gyroscope measures angular rate at +/- 245/500/2000 dps. The Accelerometer measures linear acceleration at +/- 2/4/8/16 g. Temperature accuracy measured in the 0-65°C range is +/- 2°C. The Relative Humidity sensor has an accuracy of +/- 4.5% within the 20-80%RH range, with a temperature accuracy of +/- 0.5°C in the 15-40°C range.

You must take care while measuring temperature with the Sense HAT. When the LEDs are lit for some time, they, together with the board, tend to get warm. That heats up the air nearby and the measurement may not reflect the ambient temperature accurately.

Create a Baby Monitor with the Raspberry Pi

The arrival of a baby nearly always alters the entire timetable for all the members of the family, whether willingly or otherwise. For the parents, if they are first timers, the joy of seeing the tiny human is never-ending – they want to see the baby even if they are away from home. That is where a baby monitor comes in and what better to use for the project other than the versatile single board computer, the Raspberry Pi or RBPi.

As a simple, cheap, and low power computer, the RBPi works as a perfect fit for a baby monitor that has a motion detector and a simple web browser interface. That allows you to see the little one on your phone or laptop any time you want.

You will need the entire RBPi kit for this project. The kit will have the RBPi, its SD Card, the USB charger, and the micro USB cable. Additionally, you will need a USB webcam, an Ethernet cable, and a Wi-Fi dongle or an Ethernet power line adapter. Although not part of the project, you will also need a laptop or a desktop to prepare the SD Card for the RBPi. To interact with the RBPi, you will also need a keyboard, mouse, and a monitor.

From the official site of the Raspberry Pi, download the latest Raspbian image on your laptop. Now transfer the image to your SD card, making sure you have backed up anything important on the SD card beforehand. Writing an image wipes off whatever you have on your SD card, so be careful. If this is complicated for you, pre-pared SD cards are also available. Insert the SD card into the slot on your RBPi, plug in the keyboard, mouse, monitor, and the Ethernet adapter and power up the RBPi.

If you do not have a keyboard, mouse, and monitor for your RBPi, you can still connect to it using your laptop. If you are using Linux or Mac on your laptop, connect using SSH. For Windows, you can use Putty. Once you have powered on the RBPi, there will be only a few LEDs blinking, but nothing else. That is why it makes such a good baby monitor – it is silent.

To connect to the RBPi, you will need to know its IP address. As the RBPi is connected to the Ethernet adapter, your router will be the best place to look – search in the connected devices, and make a note of the IP address. Now, to connect via SSH, issue the command from your laptop: ssh pi@xxx.xxx.x.x, where the xx denote the IP address you noted down from the router. When prompted for a password, enter raspberry, as this is the default.

Update and upgrade your OS to ensure you have all the updates and security patches. Now, install motion, as this is the package to allow you to monitor the baby with the webcam. Configure motion to operate in daemon mode with a low frame rate, and start it working with the command: sudo service motion start. Now browse to the webcam from your laptop with: http://xxx.xxx.x.x:8081.

Using OpenHAB with a Raspberry Pi

Nowadays it is common to have smart home products that you can remotely command to control, adjust, and to switch on and off. The single board computer, Raspberry Pi or RBPi is suitable for building a touchscreen command center to interface with such smart products and to provide a suitable interface for control and task scheduling. As an introduction, the project will consist of a Wi-Fi enabled RGB LED strip. It will interface with an RBPi running OpenHAB. This will allow wireless control to switch the LED strip on or off from a smartphone or any other computer on the network.

With OpenHAB, you can interface with over 150 different existing smart home products. Moreover, OpenHAB is very flexible, is open source, and is free to use. Although you can use OpenHAB on an RBPi, it can easily run on any platform – Linux, OS X, or Windows. That means the same setup can be run from any old laptop or desktop you may have lying around.

For this project, the main components you will need are an RBPi and its touchscreen. An RBPi2 is recommended and you can use the 7-inch Raspberry Pi Foundation touchscreen. Some of the additional things you will need are a microSD card, a USB Wi-Fi dongle, a power supply for the RBPi, the NeoPixel LED strip starter pack, a logic level shifter, an ADAfruit HUZZAM ESP8266, and some hookup wire.

To begin, assemble the screen to the RBPi. This can be somewhat tricky if you do not have instructions. There will be two flat ribbon cables, a large one for the display, and a smaller one for the touchscreen. The large cable from the display connects to the display controller board, and the smaller cable from the display controller board connects to the display. Once this is done, you can screw the display controller board with the RBPi on its back on to the standoffs on the back of the screen. The ribbon cable from the controller board connects to the display connector on the RBPi. Power to the display comes from the GPIO pins on the RBPi, for which you need to connect the 5 V and the GND pins via two jumper wires of red and black color, respectively.

Flash the microSD card with the latest build of Raspbian from the Raspberry Pi website and boot up the RBPi with it. You can now connect your keyboard, mouse, and the Wi-Fi adapter. Configure the RBPi to connect to your Wi-Fi network and get the touchscreen to work. For this, you may need to update and upgrade your OS.

The next step is to install the home automation control software, OpenHAB, and its add-ons – follow the instructions here. Next, solder the logic level converter between the ESP8266 and the NeoPixel LED strip. This is necessary, as the strip works on 5 V, whereas its controller, the ESP8266 works on 3.3 V. Make sure the logic level converter is connected the right way. After this, you will need to flash the ESP8266 with the Arduino IDE.

Now, you can download and install the OpenHAB app on to your phone and set it up to control the RBPi on its IP address.

Volumio: Control Your Hi-Fi through a Raspberry Pi

Traditionally, amplifiers connect to loudspeakers through wires. The wires carry the electric currents that make the loudspeakers work to produce sound. So far, wires were also necessary to feed amplifiers from different sources such as CD players, TV sets and others. By placing amplifiers within the speaker enclosure, part of the ugly wiring was taken care, but the wires from the source persisted until wireless methods were discovered.

Introduction of the Walkman and other portable players changed the music scenario forever, bringing it out of the living room and allowing people to carry their music with them. However, there was a limit to the number of songs one could carry on their person. The advent of the smartphones and the Internet opened another door. People could stream music over the net, leaving their collection at home. This was the age of iTunes, Spotify and Beats Music, facilitating listening to music wherever you may be.

Most often, these new methods prove expensive for those on a budget, and they are forced to bypass the newer ways of consuming music. An RBPi (Raspberry Pi) is a great help in these cases, simply because the single board computer is affordable, flexible and of a convenient size. Its flexibility makes it a perfect fit for use as a home audio solution and you can control your music wirelessly without having to invest in expensive high-fidelity stuff.

An RBPi gives you many modes of selecting songs to play and the manner in which they are played. For this, the RBPi uses a specially tailored Operating System by the name of Volumio. The major attraction is the nice and simple cross-platform web interface through which you can control music.

The RBPi sits as a controller just in front of the amplifier. It can pick up songs from a USB stick plugged into one of the USB sockets, select it from your local home NAS or take your picking from Web Radio. For the last part, you will need a Wi-Fi dongle to connect the RBPi to the Internet.

Volumio is easy to set up, as not much of advanced functions or graphics are to be handled. Simply download the Volumio disk image, transfer it to your microSD card and use it to boot up the RBPi. You will not require a keyboard, mouse or monitor to set up the software, as the entire configuration is possible through the web interface of Volumio.

Use your computer to connect to Volumio. You can find it by connecting your computer to the same network where you have your RBPi plugged in. You may also use Volumio over a wireless network, for which, you will have to first connect to the RBPi via Ethernet to configure its settings for use with a Wi-Fi dongle. This also allows you to control the software with the browser on your smartphone – simply type in the URL ‘http://volumio.local’ in your browser.

Using the RBPi makes it simple to select songs and set up other parameters for playing them on your home Hi-Fi system. As an advanced arrangement, this is affordable and one can easily modify it to suit specific needs.

Build a Humanoid Robot from Raspberry Pi

Raspberry Pi or RBPi is the ubiquitous low-cost, credit card sized single board computer with huge potential starting from teaching youngsters computer programming to driving robots on Mars. However, when Tyler Spadgenske tried his hands on RBPi, he used the SBC to create Andy – a completely open-source humanoid robot.

Tyler has tried to make Andy a connected robot. Andy can connect to humans through speech, using language as humans do – for answering questions. With access to the Internet, he (Tyler assures Andy is male) can also talk to client programs over the Web. With ability to connect via Bluetooth, Andy communicates with other robots such as the Mindstorms NXT.

Using a bipedal mechanism that offers him mobility, Andy can do additional tasks such as moving stuff. Of course, Andy has his limitations, but then, he can collaborate with other robots to get those things done, which he cannot. Tyler has given Andy only speech as the user interface, since he feels a humanoid should have no other. However, that does not limit Andy from interfacing with other computers over the Internet, because basically, he is a computer himself.

Initially Tyler was using Robosapien for Andy’s bipedal movement, but that did not work out satisfactorily. He is using a new bipedal system using SolidWorks. Later, Tyler plans to add a torso, a head and arms for Andy, again using SolidWorks and 3D printing.

Starting up Andy is very simple – flip the switch on his back to the on position. Andy has LiPo batteries rated for 11.1V, 1.3A and 1300mAH. These power his motors through the L298 motor drivers, which the RBPi drives. As soon as the RBPi receives power, which is regulated with a UBEC, it starts executing Andy’s software. This begins with some configuration checks such as for starting the server and running some modes. Then Andy settles down and prepares to listen to his microphones.

Now, Andy is up and running as a state machine. He will listen to commands from either his microphones or his server – first converting any command received from either to text and then executing it.

After converting the command to text form, Andy interprets it by comparing it to the command set in his repertoire. That gives him the correct function he must execute for a specific command. For example, for a shutdown command, Andy initiates a complete sequential software and hardware shutdown, ultimately switching himself off. For any other command, however, Andy executes it and then goes back to wait for commands from his microphone or server.

Andy’s brain, the RBPi, controls almost everything for him, including speech recognition and motor control to Andy’s software. Andy has three L298 motor drivers, with each capable of controlling and driving two motors each. Therefore, Andy is capable of driving a total of six motors. As the RBPi had only a limited GPIO pins, Tyler had to expand them using an MCP23017 chip.

Tyler plans to give Andy 10 degrees of freedom with the new SolidWorks hardware. His new features will include monitoring the battery voltage, a power on LED, an LED output with five segments and ten servos – six for the arms and four for the legs.