Tag Archives: Raspberry Pi

Sleep Better with a Raspberry Pi

Sleep is an integral part of our lives, and lack of quality sleep quickly leads to a whole host of issues related to physical, emotional, behavioral, etc. Quality sleep is linked to a good environment that includes proper bedding, clothing, temperature, humidity, and lighting among other things. Although electronics may not be able to help much with the proper choice of bedding and clothing, a cheap but versatile single board computer such as the RBPi or Raspberry Pi is a good contender for controlling temperature, humidity and lighting during sleep hours.

When using the RBPi for controlling the environment of the bedroom, it is necessary to build an RBPi-based temperature-monitoring network in the house. This helps to get some hard data on the existing temperature trends at different places, so it will be easy to know whether the solutions tried did actually work. Since temperature is to be monitored at different places at the same time, it is necessary to use remote sensors.

You can use temperature sensors such as the single-wire DS18B20 thermometers for inexpensive and accurate temperature measurement. This model has two types of sensors – transistor-sized and waterproof, and you can use either for the purpose. However, people have found the waterproof sensors were easier to position and calibrate, and they were slightly more accurate as well.

Testing the sensors on the RBPi is simple as this SBC supports the DS18B20 sensors by the built-in w1-gpio library. The RBPi allows easy readouts of the 1-Wire devices. You can wire up a few DS18B20s to multiple RBPI, Model A+ and position them at all main parts of the house. It also helps to integrate data from your Nest Thermostat API, if you are using this and collect the local outdoor temperature data as well – use the Weather Underground, for instance. Monitor the temperatures from the different sensors on a rolling 24-hour graph, and you can make out if there is a trend.

It is possible to even out temperature variations in the house by sealing vents and leakages in areas where the temperature dips. However, this may not be enough to raise the temperature to comfortable levels at locations distant from central heating ducts. Moreover, not all walls of the house may receive equal amounts of sunlight, and this may be another reason for the temperature dropping in certain rooms after sunset.

You can use unobtrusive wall-mounted space heaters to boost the temperature up in these areas. Usually, these are slabs of stone with heating wires running through them. Stone has high thermal capacity, meaning it retains and radiates heat for a long time. This arrangement is also safe for use in children’s bedrooms. When used on a thermostat-triggered outlet, the heater only turns on at a select temperature that you choose. You can fine-tune the settings after monitoring the temperature data for a couple of nights.

This project is useful if you are planning to have an extended network, with remote-controlled HVAC using branch air ducts. Individual controls on the branch ducts can control the airflow, so the system efficiency goes up, such as by turning down the airflow to sections of the house where there is no one present.

PINE64 : A 64-bit Contender for the Raspberry Pi

Earlier, a DIY computing project could cost an enthusiast hundreds of dollars. Now, with single board computers such as the Raspberry Pi or RBPi or its latest kin, the Raspberry Pi Zero, anyone can start a new project at the cost of a cup of coffee. Seen from the other side of the fence, a competitor has to include a better choice of components, offer a better price or both. PINE64 Inc. has taken the third route.
PINE54 Inc. is attempting to improve on the legacy so far built up by the RBPi. According to the team, two mathematical constants make up the name of their board – Pi and Euler’s Number e. As it has a 64-bit processor, the name also includes the number 64 along with an A to differentiate it from future versions. The PINE A64 runs on an ARMv8 processor, the Cortex-A53, and is available for just $15.
PINE A64 measures 12.7×7.94cms and uses a 64-bit processor, a quad-core ARM Cortex A53 running at 1.2GHz. A dual-core Mali 400 MP2 handles the graphics. Memory includes a micro SD slot to handle cards up to 256GB and 2GB DDR3 SDRAM onboard. Ports available on the PINE A64 include one gigabit Ethernet, two USB 2.0, one HDMI 1.4 connector for 4K output, a stereo mini-jack connector and a charging circuit for a 3.7V Lithium battery.
PINE64 Inc. will also be offering separate modules to augment the functionality of PINE A64. The modules will add a touch panel port, a 5MP camera port, Bluetooth 4.0 and Wi-Fi connectivity and a 4-Lane MIPI video port. The board runs on 5V power via its micro USB connector, but can fall back on its internal battery with on-board power management.
According to Johnson Jeng, the co-founder of PINE64 Inc., the company has designed a simple, smart and affordable computer. People can use this to bring their next big ideas to life. The 64-bit quad-core single board computer is available at an exceptional price. It is compatible with several open-source platforms, enabling people to build a community of innovation and creativity.
Just like other ARM-based single board computers, you can set up PINE A64 to operate as a gaming console or a mini-computer. You can control your connected home or allow it run your own media center. PINE A64 can operate with Android 5.1, openHAB, Ubuntu Linux, OpenWRT and Kodi. Additionally, it supports Miracast and offers the H.265 video standard to give your 4Kx2K output.
The Raspberry Pi Foundation concentrates on delivering performance without increase in costs, and hence, prefers to retain the ARMv7 architecture for the RBPi family even when ARMv8 64-bit chips are readily available. According to Eben Upton, the founder of the RBPi series, a more powerful processor will certainly come with a boost in the prices.
With companies now launching new Systems-on-a-Chip or SoC platforms that are 64-bit and super-cheap, PINE64 Inc. has decidedly stolen a march over the RBPi series. Allwinner started this trend with the 64-bit Cortex A53 processor for their tablets and now PINE64 Inc. has used it to power their PINE A64, A64+ and A64+ 2GB boards.

The Popp-Hub Home Automation Gateway with the Raspberry Pi

Sometimes it is necessary to monitor the home remotely, such as when you are away on a vacation. For this, you need to hook up all the sensors in the home to the Internet for remote monitoring and control. To avoid the complexity of wiring, people prefer wireless devices for monitoring the sensors. As wireless devices could also be in the form of nodes, with each node monitoring multiple sensors, you need a gateway acting as a bridge for connecting many wireless nodes to the Internet.

Launched by Z-Wave Europe and Popp & Co., Popp Hub is one such home automation gateway. What distinguishes it from others available on the market is it is based on the famous Single Board Computer, the Raspberry Pi or RBPi running Linux. The Z-Wave Plus home automation Popp Hub supports Z-Wave and IP smart devices.

The reference design of the Popp Hub gateway includes a software stack certified by the ZigBee Home Automation. It also includes tens of APIs for simplifying the ZigBee integration and the development of applications within a Linux system. The APIs incorporate TCP/IP for the ZigBee bridge as this enables easier integration of low power connectivity solutions and faster development of applications. The included USB dongle is CC2531-based and it runs the ZigBee HA1.2 certified Protocol Stack, MAC and PHY – this has been extensively tested for interoperability.

Z-Wave Europe GmbH is Europe’s largest distributor for all devices based on the Z-Wave wireless technology. They sell and distribute the Popp Hub smart IP home gateway on behalf of the UK-based Popp & Co. The Single Board Computer RBPi2 in the Popp Hub runs the Z-Way Middleware. According to Z-Wave Europe, Z-Way Middleware happens to be the first Z-Wave controller certified to the new standard, the Z-Wave Plus.

Z-Wave Europe claims you can connect Z-Wave wireless enabled devices sourced from more than 300 device manufacturers to the 89x71x25mm Popp Hub. These devices could be remote controlled devices, for windows and blinds, alarms, lighting, security or HVAC. Additionally, Popp Hub is capable of working with several non Z-Wave devices as well, such as IP based devices, plugins and IP cameras.

Users can use a mobile Android or iOS application, a remote control or a single wall switch to control up to 230 Z-Wave devices connected to the Popp Hub. This includes features such as selectively activating the heating system or closing windows automatically depending on changes in the weather conditions. If a sensor device has set off any alarms, you will receive a notification from the application.

The RBPi2 is a 900MHz, quad-core Cortex-A7 SoC that runs on 1GB of RAM and Linux-based firmware. All major ports of the RBPi are exposed to the user. Besides, it has an audio jack, an Ethernet port and four USB ports. You can use Wi-Fi or other wireless devices on the USB ports. The internal SD slot handles the 8GB SD card that holds the Operating System.

Within the Popp Hub, a Sigma Designs SM5202 chip augments the basic RBPi2 functionality. This is a static controller certified by Z-Wave Plus and it provides 48 command classes and adds enhanced security.

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.