Monthly Archives: June 2016

Adding Memory to the Raspberry Pi

Although the memory onboard the Single Board Computer Raspberry Pi or RBPi is sufficient for most applications, some may feel the necessity of expanding the storage capacity. The options provided on the RBPi are limited, as the USB ports often engage a keyboard, a mouse or a game controller and the SD card slot holds only a single device.

The most obvious option for expanding the storage capacity on the RBPi is through the USB ports. However, tying up ports with a USB hard disk drive or flash drive can run into difficulty if you need the port for plugging in another USB device. One way of getting around this problem is by using powered USB hubs. It is important to realize the RBPi cannot supply enough power for driving the hub.

Using a powered USB hub makes it easy to add USB devices to your RBPi, including additional storage. However, you must consider a few things when expanding storage on your RBPi. In reality, there are only two common USB storage options available – flash drive and hard disk drive. Nevertheless, you may also consider a card-expanding trick for the Raspbian operating system for your RBPi. These are the three primary options available for expanding storage on your SBC. Apart from this, you may also consider using secondary storage devices such as networked drives, USB DVD-r drives and NAS drives.

The SD card in the RBPi acts as the main storage option – use an SDHC card for best results. It is a boot device acting as the general storage and from which the operating system also runs. You may think of the SD card as a replacement for the HDD of a regular desktop computer, more like an SSD or Solid State Drive, as it has no moving parts and uses very low energy.

By default, Raspbian, the standard Operating System of the RBPi, is designed to run from a 2 GB SD card. Therefore, when you flash the Raspbian image, the SD card will have a partition of 2 GB, with the balance of the card memory remaining unused.

To get around this, you must use the expand file system feature included in the raspi-config screen in Raspbian. This enables expanding the size of the partition to the maximum capacity of the SD card.

When you insert your flash drive into a USB port of the RBPi, you may be surprised it does not have the same effect as it does in a regular Ubuntu or Windows computer. It is not enough to insert the flash drive, Raspbian expects you to mount the device manually before you can use it as an additional USB storage device. However, before you can mount it, you must know the exact device name that Raspbian has assigned to the drive.

For this, the command necessary is: sudo ls /dev/sd*. The command “sudo” gives you temporary administrative status, “ls” allows listing the devices and “/dev/sd*” lists the devices seen by Raspbian. With this command, you will know the number Raspbian has assigned for your drive.

Now, you can mount the USB flash drive and use it as an additional storage device with the command: sudo mount -t vfat /dev/[USB DEVICE NUMBER] /mnt/usb.

RS-485 – The Wired Communication Standard

TIA/EIA-485 is a popular wired communication standard published by the TIA/EIA or the Telecommunications Industry Association/Electronics Industries Association. This standard is also known as the RS-485 and uses differential signaling enables the standard to transmit data over long distances for factory automation and in noisy industrial environments.

This is because differential signaling allows rejection of common mode noise, while the twisted pair cable ensures the most received interference comes as common mode. When used over long distances, the standards improve the chances for ground potential differences, while the wide CMR or common mode range of the standard ensures that the network operates satisfactorily, even when there are large common mode voltages present.

In practice, both the transmitter and the receiver have non-inverting and inverting pins. Bidirectional communication over a single cable can use half-duplex devices, where the corresponding Receiver and Transmitter terminals connect to the same IC pins. Networks can also use two cables for bidirectional communication, and employing full-duplex devices, only, the Receiver and Transmitter terminals now must connect to separate pins.

The number of transceiver models available in the market is huge, and that makes it a challenge picking out the best and most cost-effective device for a specific application. That requires considering the common design considerations, examining the electrostatic discharge (ESD) protection and comparing the Human Body Model. Other important points to be considered are the over voltage protection (OVP) and data skew in case of high-speed transmissions.

Requirements of RS-485

Although the published standard for the RS-485 is over 14 pages long, the most important requirements are:

The differential output voltage generated must be over ±1.5V, while the receiver must be capable of detecting signals with a minimum of ±200mV. This combination makes sure the devices can tolerate attenuation from long cables and there is a robust noise margin available.

As the standard allows multiple drivers on the bus, each transmitter must have an enable pin giving it tri-state output capability. This ensures true bidirectional transmission over a single cable.

Transmitters must have high output current capability to drive long cables and cables with double termination, especially for high-speed bidirectional transmission.

The CMR should be at least -7V to +12V. This allows using RS-485 over networks of 1220 m or 4000 feet. Long distances can involve ground potential differences and a high CMR helps to tolerate them in noisy environments. Additionally, devices with different supply voltages can also communicate on the same bus because of a large CMR.

The receiver input resistance must be over 12KΩ. According to the standard, there can be 32 devices on a bus.

The Basic RS-485 Transceiver

People often use less expensive RS-485 transceivers for simple, short, low-node-count networks. This works because short networks do not involve much CMV or common mode voltage and OVP, and they can work with the CMR specified by the standard.

When there are less than 32 modes in the network, fractional unit load devices are not necessary. Moreover, when cables are not frequently connected and disconnected, ESD protection is also not necessary. However, most basic devices now include the ±8 to ±15 KV Human Body Model for ESD protection.

Solid State Drives – Why Are They So Fast?

For most people, an HDD or hard disk drive inside their computer is the flat broad box that stores their Operating System, files, documents, and other essentials. So far, not many users were aware of the inner workings of their HDD. Lately, with speeds of computers going up many folds, people have started looking at alternatives for the HDD – the SSD or the Solid State Drive.

Whatever else you change in your computer system, the general experience remains the same. For example, you may get a new display, add more RAM or install a new graphics card. Barring a few moments of exhilaration, you do not experience the constant euphoria that you get when you replace your regular HDD with an SSD.

An SSD suddenly transforms your computer into a high-speed demon. Additionally, you get this feeling every time you use the computer. Even if you do not realize this increase in speed with an SSD, you will appreciate it as soon as you have to revert to operating a computer with a regular HDD. It is truly amazing the way this new technology is helping to transform our computer experience.

To understand the functioning of SSDs, it is necessary to know the computer’s inner structure or architecture regarding its memory. A computer’s memory architecture is actually made up of three sections: the cache, the temporary memory and the actual memory storage itself.

The CPU or the Central Processing Unit of a computer is intimately connected to the cache memory and accesses it almost instantaneously. As the computer operates, the CPU uses the cache memory as a sort of scratch pad for all its interim calculations and procedures.

The temporary memory, also known as the RAM or Random Access Memory of a computer is the place where the CPU stores information related to all the active programs and running processes. Although the CPU can access the RAM at high speeds, the access is slower than that for cache memory.

For permanent storage, your computer uses the memory within the HDD or the SSD. These may be programs, documents, configuration files, movie files, songs, and many more. Unlike cache and RAM, an HDD or an SSD retains its contents even when the computer has been shut down.

When people replace their HDD with an SSD, their computer operates at a higher speed even when they have not updated their cache or RAM. This is fundamentally because of the difference in the way of working of an HDD and an SSD.

An HDD is essentially an electromagnetic device. Inside, there is a motor to spin the several magnetic platters stacked one on top of the other. Before the CPU can read data from the magnetic plates, they have to spin until the right sector comes under the reading heads, which then move in to read from the exact location. All this mechanical movement takes time.

On the other hand, the SSD, being an all-electronic device, involves no mechanical movements. It uses a grid of electrical cells to store and retrieve data. Moreover, these cells are further separated into sections called pages. Further, pages are clumped together to form blocks. All this contributes to the fantastic speed of an SSD.

A New Operating System for the Raspberry Pi

The Single Board Computer, the Raspberry Pi or RBPi runs on a version of the popular operating system Linux – the Raspbian. Although there are other versions of Linux equally capable of running on the RBPi, another operating system is in the making. Not ready yet, the Tizen 3.0, is being ported for the RBPi Model 2.

While not attracting a lot of attention, Tizen is another Linux-based operating system into which huge resources are being pumped to make it more popular for the RBPi. The Linux Foundation is providing all the guidance for its development along with help from a number of companies led by Samsung.

Samsung is pushing for the adoption of Tizen, which, until now, it has implemented only on some low-end devices including a watch. Samsung wants Tizen as a replacement for the Android OS developed by Google, mainly because it has to pay royalties to Google. Hence, Tizen 3.0 for the RBPi 2 is an important step for Samsung.

However, the trouble is the community is not very aware of Tizen. The main issue is people do not even know of its existence. By making it available for the RBPi, an SBC already in use by over a million people, Samsung expects to make Tizen more popular.

The Open Source Group of Samsung is currently attempting to port Tizen 3.0 to the RBPi 2. Their goal is to run a fully functional Tizen 3.0 on the RBPi 2. They have chosen the RBPi 2 as their base system, as this is the most popular SBC that more than five million people are using.

Although Tizen 3.0 is presently working on the RBPi 2, there are still a number of issues that Samsung has yet to sort out. For example, installation of applications is one of the biggest issues they need to overcome. However, one can assess the speed of the porting process, as the developers have already managed to enable the 3D acceleration on the platform. However, there is still no indication of when Tizen 3.0 may be available in a stable form, and Tizen 3.0 is still in Beta stages.

In its stable form, Tizen 3.0 will ship with Linux Kernel 4.1 and Wayland in place of the familiar X-windowing system. Linux Foundation, the developers of the open source Linux operating system, aims to run it on phones, tablets, watches, and in-vehicle entertainment systems. They claim Tizen 3.0 will bring some interesting changes.

Although many companies are still evaluating their choices, some of them have chosen to support Tizen as they are looking for alternatives to Android. They know it is not an easy task to move people away from Android, just as Microsoft has discovered to their chagrin.

The Linux Foundation is building Tizen for various profiles and is making the current iteration for the TV and Mobile. It will support 64-bit systems and provide a replacement for the X-server in the form of Wayland. Additionally, Tizen will come with Chromium-efl, a generic policy manager, in place of Webkit2.

Detecting Plunger Movement in DC solenoids

DC solenoids are used in many applications that require movement of a part to be arrested in some way, to be released when an event occurs. An example of such an application would be the garage door. A solenoid keeps the garage door locked down until a signal reaches it to release the door – to allow a vehicle to go in or out – a simple operation as long as the door operates as intended. However, there may be times when the door does not, and one of the reasons could be the solenoid failing to activate.

If the solenoid is easily accessible, the movement of its plunger or parts attached to it can indicate whether it is functioning as intended. However, some solenoids must be located at remote locations that are difficult to reach and therefore, pose difficulties for visual fault diagnosis. However, there is a way to remotely sense whether there is proper plunger movement when the solenoid is switched on.

Many types of valves, relays and contactors use electromechanical solenoids. Typically, these operate from 12-24 V DC and 110-230 V AC systems, consuming power ranging from 8-20 Watts. Electromechanical solenoids consist of a movable iron or steel slug named the plunger or armature, and an electromagnetically inductive coil wound around it.

During actuation, when the plunger has to be pulled into the coil, the solenoid needs high current. Once actuated, the solenoid can hold the armature in the pulled-in position with only about 30% of its nominal current – this is called the hold current. If the solenoid coil consistently operates at the nominal current, high power dissipation raises the temperature of the coil and plunger. Therefore, immediately after the plunger has moved, reducing the current to the hold current helps to reduce power consumption and minimize the temperature rise in the solenoid. This is another reason to detect the plunger movement in a solenoid.

Two popular methods used to detect plunger movement depend on one, Hall sensors and two, on excitation current profile. However, Hall sensors cannot detect faulty or slow movement of the plunger, while the excitation current profile depends on the working temperature of the solenoid. Therefore, these are not particularly suitable for detecting faulty operation of solenoids.

A third and more reliable method of detecting plunger movement in solenoids depends on the current profile from the Back EMF generated by the movement. The solenoid operates when an excitation voltage energizes the solenoid coil. Current passing through the coil causes a distribution of magnetic flux through the plunger. The current increases until the magnetic flux is strong enough to move the plunger.

As soon as the plunger starts to move, its movement produces a magnetic flux in opposition to the main magnetic flux. This induces back EMF in the solenoid coil opposing the excitation voltage – momentarily reducing the current through the coil. Note that this reduction happens only because of the plunger movement and not because of anything else.

Temperature does not affect the dip seen in the current due to plunger movement. Hence, this method is a reliable indication of detecting plunger movement in solenoids.

Raspberry Pi Can Keep Your Plants Happy

Those who like indoor plants know how important it is to maintain a proper atmosphere for the plants to grow happily. Only a few parameters are important – air humidity, air temperature and soil moisture apart from adequate sunshine. However, it is rare for people to be able to monitor the health and well-being of their flora personally, given the busy schedules.

That is where a single board computer such as the Raspberry Pi or RBPi can help. Being flexible in setting up and connecting to the various sensors necessary, this SBC not only looks after the plants, but also alerts you with SMS and via email whenever the situation differs from the normal. This project also has an app, Plant Friends, for your Android phone, so that you are up to date on the real-time and historical parameter data on your plants. The project consists of three main components – the sensor nodes, the base station and the app.

You need a sensor node for each plant. Each of these sensor nodes consist of an Arduino clone called Moteino fitted with an RF transceiver, a battery meter, a temperature sensor, a humidity sensor and a sensor for soil moisture. The sensor nodes collect the readings from all the sensors and transmit the data using the transceiver to the base station. The sensors and the base station are connected via the 915MHz ISM band.

For this project, users must be slightly above the beginner level. Some basic experience with Arduino hardware and Arduino IDE will be necessary – for installing libraries, making LEDs blink, etc. Additionally, experience in wielding a soldering iron is also necessary. On the RBPi side, it is essential to be familiar with the basic knowledge of the SBC and with installing the Raspbian OS.

The Plant Friends system has several advantages. It reminds you to water your plants and sends you an alert via email and/or SMS. It works for multiple plants at the same time, even if they are in different rooms of your home. Since wires are a minimum and all components of the system are of a reasonable size, you can move the plants and the system freely about the home.

The entire system consumes low power and therefore runs on batteries. Typically, battery swaps are necessary every 4 to 6 months. The electronics is low-maintenance as it is housed in a moisture-proof enclosure. The best part of the system is the Android app, as it allows monitoring from anywhere in the world.

An RBPi, model B, is used for the project, although a model A will work equally well. However, model B has more RAM and an Ethernet port, which may be necessary for flexibility. A USB Wi-Fi adapter helps to connect to the internet.

For each sensor node, you will need a holder for four AA type rechargeable batteries. In addition, you will need a combined sensor for temperature and humidity. For sensing the moisture in the soil, you may use a soil probe consisting of a PCB with exposed traces. However, ensure there is no lead involved.

Replace Your Hall Devices with LVDT-On-PCB

The use of solid-state devices such as magnetic sensors is very popular when necessary to sense position, velocity or directional movement. As they are non-contact and offer wear-free operation, electronics designers prefer to select them for their design. For example, the robust design of sealed Hall Effect devices make them immune to vibration, dust and water, offering a low maintenance solution for the user.

Automotive systems mainly use magnetic sensors for sensing speed, distance and position. For example, the angular position of crankshafts decides the proper firing angle of the spark plugs, air-bag control depends on position of car seats and seat belts and wheel speed detection is necessary for ABS or anti-lock braking system.

Magnetic sensors typically respond to a wide range of magnetic fields and therefore, they are used in a variety of different applications. Hall-effect sensors respond to magnetic field density around them, while generating a proportional electrical output signal. Magnetic fields show two important characteristics, the flux density and the polarity. When activated beyond a preset threshold, the hall-effect sensor develops a voltage linearly proportional to the flux density impinging upon it. However, hall-effect sensors are susceptible to external magnetic fields and/or the presence of metal objects nearby.

Replacing hall-effect sensors with LVDT or Linear Variable Differential Transformers offers superior immunity to noise and interference, while improving the sensitivity tremendously. By using inductive technology, designers avoid the use of magnets, thereby improving immunity to interferences. Now, with LVDT-on-PCB, the inductive sensor IC based on LVDT makes these sensors suitable for use in the automotive and industrial fields.

The device, LVDT-on-PCB, is suitable for several applications related to industrial automation and control systems. Among these are specific applications such as linear displacement measurement. Therefore, such sensors simplify sensing of fluid levels, gear position for transmission actuator positioning and proximity detection of brake lamp switch. Additionally, LVDT-on-PCB sensors are also useful in sensing angular motion such as in rotary controls and measuring pedal positions, rotating shaft positions and robotic arm positions.

As the LVDT senses without making contact, the reliability offered is high. For example, the associated IC LX3301A, from Microsemi, has an embedded 32-bit processing engine running on an internal oscillator of frequency range between 1 and 5 MHz, along with a 12 KB program memory. It offers two sensor input channels with integrated demodulators and two 13-bit ADCs with sample rates up to 2 KHz. The user can save their configuration in the user-programmable non-volatile configuration memory of size 16×16 bits.

The LX3301A processes signals that the inductive sensors generate. As the inductive sensors work on LVDT principles, the IC includes an integrated exciter to drive the PCB-based sensor coils of low inductance. A matched analog channel pair processes the sensor signals as a pair of sine/cosine waves, thereby rejecting the noise sources both internal to and external to the sensor assembly.

You can use the LX3301A for measuring displacement such as linear and/or angular/rotation and proximity in electromechanical systems. The resolution offered is excellent, for example, in applications involving 360-degree rotation, the device can achieve a measurement resolution up to or less than 0.5-degree. You can retain the configuration and calibrations for the sensor system in its internal EEPROM.

Protecting Pedestrians Using Ultrasound Techniques

With vehicular traffic increasing on the roads, pedestrians are shifting to the status of endangered species. Frequent news reports of pedestrians falling victims to collisions with motor vehicles bear testimony to the statement. Now, researchers want to provide a remedy. At the Frankfurt University of Applied Sciences or FRA-UAS, researchers have developed a pedestrian detection sensor that can differentiate a human being from among inanimate matter.

At FRA-UAS, Professors Andreas Pech and Peter Nauth have developed the pedestrian detection system utilizing highly sensitive and efficient ultrasonic sensors. It can discriminate a human being from an object in areas where a collision is likely. Typically, vehicles use such highly cost-effective ultrasonic sensors at their rear to help in parking. The researchers have added an algorithm for recognizing patterns from the signals coming from these sensors. The algorithm, the actual innovation from the researchers, generates a situational analysis within half of a second. This is then used to activate specific protection systems.

In a collision situation, there can be two possibilities. The first could be a vehicle-to-vehicle collision, where the system activates airbags and belt pre-tensioners as it detects an imminent collision with another vehicle. However, if the system determines that the collision situation involves a pedestrian and not a vehicle, it initiates measures that will reduce the impact. These measures could vary, such as, heightening the bonnet to mitigate the impact, providing an exterior airbag to be deployed prior to collision or even reducing the rigidity of the body of the vehicle.

According to the researchers, this pedestrian detection system is relatively more cost-effective in comparison to other systems available in the market. It is possible to retrofit this system even in lower priced vehicles. Moreover, such a pedestrian detection system is also useful in other areas of application. For example, in case of a building fire, where smoke detectors trigger fire alarms, the pedestrian detection system from FRA-UAS can help to locate human beings trapped inside the burning house or apartment.

Application of such a pedestrian detection system can be seen in the crosswalk flasher system installed at the Weaver Lake Elementary School in Maple Grove, Minnesota. The school added the automatic detection system to increase the safety of children who occasionally forget to push the button to activate a flashing beacon before starting to cross the road. The pedestrian detection system uses ultrasonic sensors for detecting the presence of pedestrians waiting at the curb and automatically activates a flashing beacon to alert the approaching vehicles to the presence of the pedestrian.

Ultrasonic detectors emit sound waves of frequency ranging beyond the hearing capabilities of humans. In the presence of moving pedestrians or vehicles, part of the transmitted sound waves reflects back to the receiver. The associated electronics computes the distance and speed of the object from the time and strength of the reflected signal. Ultrasonic detectors detect objects as far away as 30 feet.

The amount of sound energy reflected from the pedestrian depends on the nature of clothes the person is wearing. It also depends on the temperature, pressure, humidity and wind speed at the location.

Long Lasting Solar Aqueous Flow Battery

Yiying Wu, Professor of chemistry and biochemistry at the Ohio State University, Ohio State, and his team has combined a solar cell and a battery to form a single device. A novel solar panel on top of the battery captures energy from sunlight. The battery is able to source 20% of its energy from sunlight. Although the design is pending a patent, the researchers have published their findings in the Journal of the American Chemical Society.

Tests conducted by the researchers show that their solar flow battery produces the same output as a lithium-iodine battery does, even when the solar flow battery had a lower charge. They charged and discharged both batteries 25 times. Each time, they discharged the batteries until the terminal voltage fell to 3.3 volts. Conventional lithium-iodine batteries have high energy densities, approximately twice that of lithium-ion batteries. Hence, lithium-iodine batteries have the potential to fulfill the needs of long-driving-ranged electric vehicles.

In the experiments, lithium-iodine batteries had to be charged up to 3.6 volts, before they could be discharged down to 3.3 volts. Comparatively, solar flow batteries produced the same energy output with a charge of only up to 2.9 volts, as the solar panel made up the difference in their terminal voltage. That represents an energy saving of nearly 20 percent.

The team has made two changes to their earlier design from 2014. The solar panel, which was a mesh earlier, is now a solid sheet. Additionally, they now use a water-based electrolyte within their battery. With water circulating within the battery, the team has assigned the new design to an emerging class called the aqueous flow batteries. Yiying Wu claims their solar battery with aqueous flow is the first of its kind.

The water-based solar battery is compatible with the current battery technology and is easy to maintain. The environmentally friendly technology can be very easily integrated with existing technology.

According to Wu, the design of the solar flow battery is adaptable and can be applied to grid-scale solar energy conversion and storage. In the future, electric vehicles might also benefit from the electrolytic fuels used in the solar flow batteries.

In the earlier design, Wu and his team had designed the solar panel with a titanium mesh, which passed air to the battery. The new design using water based electrolyte does not require air to function, and hence, the solar panel is now a solid sheet.

The solar panel has a red dye so that it can tune in to a specific range of wavelengths of solar light to capture and convert to electrons. The team calls their solar panel dye-sensitized and the electrons it produces serve to supplement the energy stored within the lithium-iodine battery.

The electrolyte within the battery helps to absorb the electrons produced by the solar panel. A typical electrolyte is actually part solvent and part salt. Earlier, the researchers had used the organic solvent dimethyl sulphoxide to dissolve the salt lithium perchlorate. They have now changed over to lithium iodide salt dissolved in water, as this is more eco-friendly and offers higher energy storage capacity at lower cost.

PIR Sensor: Let Raspberry Pi Guard your Home

With a versatile platform such as the Raspberry Pi or RBPi, prototyping a project is very simple. The scale does not matter for you can start with a single blinking LED and move on to complex quad copters. If you have the necessary components, simply add a little amount of imagination, and RBPi can work wonders for you.

A practical use for the RBPi is to sense the surrounding environment. Not only is this interesting, but also gathering this data is useful in myriad ways. For example, a weather station uses different sensors to measure pressure, humidity, wind speed and temperature. The main objective in recording and manipulating such data is to predict future weather conditions. Anyone technically savvy can store this data and manipulate it to produce tables and graphs for importing into other applications or projects.

Using a PIR or Passive Infra-Red sensor with an RBPi can be an effective guard for your home. These inexpensive sensors are used with motion activated air fresheners from which, you can easily harvest a couple for building this project. The PIR and RBPi combination can act as an effective burglar alarm in homes and offices.

The PIR sensor effectively sends out a beam of infrared light into the area that it is monitoring. As long as there is no movement in the area, the beam remains undisturbed. However, the slightest movement causes the beam to change, which the PIR sensor can sense. The PIR sensor, when connected to the RBPi, sends it a signal once it detects movement. The RBPi responds to this signal in a manner defined by its program.

For this project, the PIR sensor is set up to watch over an area for any movement. As soon as it detects movement, it triggers the RBPi, which responds by capturing a picture of the event on its camera, including recording a 10-second video at a resolution of 640 x 480 pixels.

Additionally, the RBPi will send out a text message to the owner’s phone, thereby alerting the user of an intruder or whatever that triggered the event. The text message includes the picture and the video. After sending the text, the RBPi will wait for 30 seconds before resuming its watchful stance.

Apart from being an effective burglar alarm, you can use this combination of PIR sensor and RBPi with its camera in many innovative ways. For example, those who like to study birds and their habitat, can set it up near the nest to record the coming and goings of the parent birds.

Using a text message to alert the user is effective, as all phones are capable of receiving SMS. Other methods using emails or tweets usually rely on 3G or Wi-Fi coverage and may not be always useable. Additionally, you can use several alerts from the project simultaneously. The RBPi stores the pictures and video it captures in its memory. You can retrieve them later via any means convenient.

To set up, install the OS in the RBPi, enable the camera via raspi-config and test its working. Use the command “raspistill -o test.jpg” for testing. This produces an image file by the name test.jpg.