Category Archives: Guides

Play Chess with the Raspberry Pi

You could be an ardent chess player searching for a worthy opponent. A human opponent may not always be conveniently present, but a computerized player can be relied upon to be available at any time of your choosing. With the Single Board Computer, the Raspberry Pi, or RBPi, you can now play a complicated game of chess, provided you are willing to build a chessboard first.

You will need an Arduino to control the chessboard and an RBPi to run the actual chess engine Stockfish, along with Chessboard, which is the chess rules library. The entire arrangement is completely automated – plug in the different parts, press the green button and you start playing. If there is no automated arm, you must move the pieces manually and the computer signals its move by flashing LEDs. You get 21 levels of play along with the ability to set the personality of the computer – coward or aggressive.

Apart from the personality setting and the 21 levels, Stockfish allows several features. Choose to play with black or with white pieces, and play against the computer or another human. Along with providing hints if stuck, Stockfish recognizes and makes special moves such as Castling, En Passent, and Pawn Promotion. It validates all moves against all rules of chess, signaling errors and allowing re-moves. The chess engine has a maximum rating of GM and an ELO level of 2900.

Although you can use the RBPi alone to control the board and play the chess engine, using an Arduino relieves the RBPi of many functions, speeding up the chess engine running on it. Since the Arduino does not use an Operating System, it is not possible to run Stockfish on it. Although there are chess programs to run on the Arduino, none is as strong as the Stockfish. Moreover, if you are using a computerized arm, the Arduino can take care of operating the motors. The combination of RBPi and Arduino for the chessboard works efficiently.

You can make the board out of wood or plastic according to the materials readily available. A chessboard has 64 squares with alternate black and white colors. To sense the pieces, you need reed switches under each square. These will be wired in the form of a matrix with eight rows and eight columns, with a single reed-switch straddling each junction. By numbering the rows as 1-8 and the columns as A-H, a command E2E4 tells the computer to move the piece from the E2 square to the E4 square.

To let the computer signal its move with LEDs, you will need a second matrix similar to that of the reed switches. Only this time, instead of reed switches, you must place LEDs at the junction points. Using sockets for both the reed switches and the LEDs is advisable as it becomes easy for maintenance. Unlike reed switches, LEDs are polarized, and need to be properly oriented to function. Placing them in sockets helps to re-orient them if they are inserted the wrong way. The Arduino controls both the matrices with data from the RBPi.

Emulating Brain Functions with a Memristor Computer

Chip designs at the atomic level may require emulating the functioning of the human brain, while upholding Moore’s Law. In fact, this might be the only way forward. All forward-looking semiconductor design organizations such as Intel, HP, Samsung, and others know this and this has sparked an exponential interest in the study of memristors.

Among all known electronic components, memristors alone are capable of emulating the brain. It is common knowledge now that a human brain performs far better than the fastest supercomputer, while consuming only about 20 watts of power. Supercomputers cannot emulate, rather only simulate the brain, but they consume thousands of watts and are expensive to the tune of millions of dollars.

At Santa Fe, N.M., Knowm Inc. has expanded its portfolio by adding three different types of memristors. They offer a new high-density die-only option, along with all the raw data manufacturers will need to perform their characterization. Although another organization HP/Hynix is also trying to build commercial memristors, Knowm has beaten them to the market by diversifying its offering of memristors. Knowm is now offering three models with slow, medium, or fast hysteresis, based on the material they are made of – tungsten, tin, or chromium.

Regardless of the basic metal-ion used for its manufacture, all memristors work in the same way. The device consists of two electrodes, with a layer of metal located close to one of them. As a voltage is applied across the electrodes, metal ions move through the device towards the electrode with the lower potential. The device has a layer of amorphous chalcogenide material, which is also its active layer. Metal ions moving through this active layer form a conductive pathway between the electrodes. As the pathways spin through the active material layer, the device resistance drops. When the direction of the applied potential is reversed, the conductive channels dissolve and the device resistance increases.

This characteristic makes the memristor a bipolar device. The memristor also emulates the way neurons in the brain learn. Neurons send pulses through their synapses to strengthen them, equivalent to lowering the resistance, or they do not send pulses, thus causing the synapses to atrophy, equivalent to increasing their resistance.

IBM, together with DARPA or the Defense Advance Research Agency, is developing programs to simulate the process with digital computers. Their software will span the spectrum of accuracy in modeling the way synapses work. However, memristors are the only true emulators of the brain and its functions, so far. Some researchers are going to the extent of erecting scaffoldings for connecting memristor-based emulators to large-scale models. This is creating the need for components such as those Knowm is now offering.

Knowm’s offer is a treasure trove for researchers, being raw data from over 1000 experiments. It helps tremendously, as there is actually no well-defined specification to characterize the memristors properly. That allows researchers to generate their own characterization data, based on the properties of their choice from among the slow, medium, or fast hysteresis types. Knowm offers 16 memristors packaged in a ceramic single dual-in-line package. Their die only option holds 180 memristors.

What is the MHL Specification?

A present, we are inundated with a plethora of digital devices. For example, we have set-top boxes or STBs, Blu-ray players, AVRs, automobile information systems, monitors, TVs, tablets, smartphones and others making up this large and diverse ecosystem. For getting all these to plug-and-play together is no mean feat and the latest standard connector that manufacturers are adopting for compatibility is the USB Type-C.

The protocol that the USB Type-C will be using for the delivery of audio, video, data and power is the MHL Alt Mode for the superMHL and MHL 1, 2 and 3 specifications. MHL Alt Mode over USB Type-C will allow interconnections of more than 750 million MHL devices. With USB Type-C, you can never plug-in a device in the wrong way – this is a reversible connector.

Backward compatible with USB 2.0 and USB 3.1, both Gen 1 and Gen 2, MHL Alt Mode for USB Type-C features power charging and Immersive audio such as DTS:X, Dolby Digital, Dolby Atmos and more. It allows transmission of 4K data at 60fps over a single lane or 8K data at 60fps over 4 lanes. You can use your existing remote to control existing MHL phones, as there is backward compatibility with existing MHL specifications.

The MHL Consortium has developed and published the MHL Alternate Mode for the superMHL and MHL 1, 2 and 3 specifications. They have established a liaison with the USB-IF and USB 3.0 Promotion Group for obtaining the official SVID and for ensuring the development of the specification confirms to USB Type-C, USB Billboard and USB Power Delivery specifications.

MHL Alt Mode over USB Type-C presents a single, small form factor connector, an ideal for many devices for delivering audio, video, data and power. You can simultaneously charge your smartphone, tablet or notebook when you connect them with larger displays such as car information systems, projectors, monitors and TVs
.
You will know your USB Type-C port on your host and device supports MHL if you see the USB-IF logo near the port. Smartphones and tablets with the MHL Alt Mode can easily connect to existing car infotainment systems, projectors, monitors and TVs. With MHL cables and MHL-to-HDMI adapters supporting USB Type-C, you can connect to HDMI Type A devices as well. For this, you will need a simple, thin MHL cable that has an HDMI Type A connector on one end and a USB Type-C connector on the other.

A user can use his existing TV remote to control the device as the MHL Alt Mode supports Remote Control Protocol as well. In contrast, an alternative technology DisplayPort from MPEG-LA does not offer the same compatibility. With the DisplayPort Alt Mode, the user would have to actually go to the connected device and manually control it.

Protocol adapters for the DisplayPort Alt Mode will not work for the MHL Alt Mode and vice-versa. Manufacturers will have to use proper labeling to identify DP Alt Mode or MHL Alt Mode on adapters to avoid consumers from being confused. Proper protocol adapters are necessary for the MHL Alt Mode to support VGA, DVI and HDMI displays.

How to Safely Grab an Ant

Any child can confirm that ants are not delicate creatures. Their size makes it difficult for us to grab an ant without harming it. Unless you happen to be an Entomologist, wrangling with an ant may not fall into your general activities. However, if for some reason you have to pick or hold something as small or smaller, a micro-tentacle would be the best way to go.

Traditional tweezers are no good when grasping tiny delicate objects such as blood vessels. The process can be painstaking as putting a little too much pressure might crush the object – deciding how much pressure is adequate may also be difficult to gage.

At the Iowa State University, scientists have developed a micro-tentacle or a miniature coiling tentacle, which is just suited for holding tiny objects such as an ant, without causing it any harm. According to the researchers, such micro-scale soft-robots hold a lot of promise as safe handlers for delicate micro-objects. However, to adopt them for wider applications requires easily fabricated micro-actuators of great efficiency.

The micro-actuator for the miniature coiling tentacle developed by the researchers at the Iowa State University is actually a pneumatic actuator based on an elastomeric micro-tube. It is a highly deformable, long and thin micro-tube, based on a new technique called direct peeling. While building the semi-analytical model for shape engineering, scientists use them in combination, amplifying the pneumatically driven bending of the micro-tube into inward spiraling multi-turns.

The result is a micro-tentacle with a grabbing force of nearly 0.78 mN and a final radius as small as 185 µm. That makes it ideally suitable for non-damaging manipulations capable of handling fragile micro-objects. With this spiraling micro-tentacle based grabbing modality, scientists have given the field of soft-robotics several new concepts such as direct peeling, micro-tube shape engineering and the elastomeric micro-tube fabrication technique.

Applications such as vivo biomedical manipulations are increasingly turning to elastomer-based soft-robots for handling delicate objects. Although a lot of headway has been achieved for their micro-scale miniaturization, finding suitable and efficient actuators has remained a difficult task so far. Tentacle actuators composed of polydimethylsiloxane or PDMS elastomers are the answer.

Researchers dip a rod-shaped cylindrical template in a bath containing liquid PDMS. The PDMS clings to the template as researchers pull it out of the bath. They leave the PDMS-coated template in a horizontal position for curing. Most of the gelling elastomer collects on the underside of the template, because gravity pulls it down. That makes the coating on the top much thinner than at the bottom.

When the PDMS sets to a soft and rubbery consistency, it is peeled off the template. That results in a hollow micro-tube, with an uneven wall that is thicker on one side and thinner on the other. Scientists then plug one end of the tube. When they pump air in through the other end, the tube as a whole coils towards on its thinner side and the higher air pressure makes it stiffen. For accentuating the coil formation, scientists add a lump of PDMS to the base of the micro-tube on the outside of the thinner side.

Driving Steppers with the RasPiRobot Board

The Raspberry Pi or RBPi is an inexpensive, tiny single board computer running the Linux operating system. As such, the standalone RBPi is not suitable for running motors, but when combined with an expansion board such as the RasPiRobot Board, you can easily run DC motors as well as Stepper motors off the RBPi. For this, you must use the version 2 of the RasPiRobot or RRBv2 board. Please note you can run only 5V steppers with the RBPi RRBv2 combination, as this board does not support 12V motors.
In practice, the RRBv2 board sits over the RBPi fitting over the latter’s GPIO connector. The stepper motor wires connect to the RRBv2 board, using its L & R screw terminals. To do that, you must first strip the wire ends of their PVC insulation, until about 10 mm of bare copper wire is exposed. Unscrew the terminal sufficiently to allow insertion of the copper part of the wire into the hole. Turn the screw clockwise to let the jaws hold the wire firmly.
One of the advantages of using the RRBv2 board is you can run the stepper motors from a battery pack. The board has a switch-mode power circuit to provide stable power to the motors. Additionally, you can even run your RBPi from this on-board power supply. That makes the entire arrangement completely portable.
When connecting the battery pack to the RRBv2 Board, take care to observe the correct polarity of the flying leads from the battery pack. Some battery packs terminate the wires on a plug. Therefore, you must use a matching female socket adapter that has flying leads. In either case, connect the positive or red lead to the screw terminal marked Vin on the RRBv2 board. Connect the negative or black lead to the screw terminal marked as GND on the RRBv2 board. Powering on/off through a battery pack becomes simpler if there is a built-in switch.
If you have connected your RBPi to the RRBv2 board, throwing the switch to the on position will allow the RBPi to start booting. To run the stepper motor with commands from the RBPi, you will need to download the RRBv2 Python library codes. For this, you will have to connect your RBPi to the Internet.
You can use the Ethernet connection to connect your RBPi to the Internet. Alternately, you may use a suitable Wi-Fi dongle. Once online, use SSH to establish connection to the RBPi from a PC and proceed to download the RRBv2 Python library from here and install it.
To run a stepper motor, you can write some simple Python codes, following the tutorial here. For example, you will have to provide the delay between the steps, the total number of steps you want the stepper motor to move and the direction of rotation – backwards or forwards.
The delay between the steps governs the speed of rotation of the stepper motor. For example, as you make the steps larger, the motor turns more slowly to make the total number of steps.

Room Automation and Raspberry Pi

Most people prefer to come back to a cozy room after a full day’s work. For many, this may not always be possible, unless someone turns on the AC at the right time. For those living alone, help is available in the form of a single board computer, the Raspberry Pi or the RBPi. In addition, the RBPi operates the blinds and you can control it from anywhere in the world – the RBPi is connected to the Internet.

For this project, you will need an RBPi with a suitable SD card, a Wi-Fi dongle, a stepper motor. You will also need a power source capable of driving the RBPi and the motor, a stepper motor driver board, an IR receiver, an IR LED and an NPN transistor.

Controlling the AC is a simple affair, with the RBPi simulating the infrared information the remote control normally uses. You need to use the LIRC library for the RBPi to record this IR information via the IR receiver. The infrared LED driven through the NPN transistor duplicates the signal sent by the remote control of the AC. Initially, you must let RBPi learn the IR codes by recording those using commands in the LIRC library. LIRC produces a configuration file that holds the IR codes for your AC. Playing back these codes through the IR LED allows you to control the AC just as its own remote does.

The RBPi and the motor driver board control a stepper motor for driving the blinds. The RBPi merely drives a GPIO pin to let the motor driver board know if it must operate the stepper. The driver board already has the necessary parameters stored within it for driving the motor. By default, the motor remains off so that it does not waste power when it is not needed. The software takes care of this by turning off the Enable pin on the stepper driver board. When you need to operate the blinds, a script on the RBPi turns the GPIO pin on and off.

To operate the unit from remote, you need to connect the RBPi to the Internet via a wireless network. Use the Wi-Fi dongle for this, configuring the RBPi to switch on the wireless connection immediately after booting. Web access to the stepper motor controller is through Nginx and PHP.

The entire setup works when the RBPi connects wirelessly to the network. You access a web interface and use it to send commands to the controller script running on the RBPi. Depending on the commands sent, you can access either the blind opener or the AC control. For opening the blinds, the RBPi sends on or off signals to the stepper motor controller board.

On the other hand, the RBPi sends the appropriate commands to the air conditioner via the IR link. Depending on the code transmitted over the IR link, the AC will switch either on or off. Additionally, with proper codes transmitted from the RBPi to your AC, you can even set the temperature of the room before returning at the end of the day.

Is the Odroid SBC Better than Raspberry Pi 3?

The world of inexpensive SBCs or single board computers has been taken by a storm with the unveiling of the new Raspberry Pi board or the RBPi 3. The claim being it blows the competition away, and that no one can match its price. However, that may not be entirely true, as the Odroid C2 SBC seems to best the RBPi 3.

Hardkernel promotes its Odroid C2 as another cheap and speedy SBC with a 64-bit ARM-based quad core processor. A comparison of the specifications shows the C2 may be giving the RBPi 3 a run for its money. Compare for instance, the BCM2837 of the RBPi 3 with the Amlogic S905 SoC of the C2. Although both are quad-core ARM Cortex-A53, the C2’s processor runs at 2GHz to the 1.2GHz of the RBPi 3. At 2GB, the C2 has double the RAM of the RBPi 3, which has only 1GB. Moreover, the C2 comes with a Mali-450 GPU, able to deliver 4K video.

Although the C2 does not have the on-board wireless and Bluetooth features of the RBPi 3, it has a high-speed Gigabit Ethernet port directly wired into the SoC. The RBPi 3 also has Ethernet on-board, but as this is a 100-megabit port and is on a USB interface, its speed is likely to be limited.
The two boards share a very similar form factor and are nearly identical in their GPIO capabilities. In addition, for both the boards, you can choose the storage to be either the usual micro SD card or eMMC. However, it is worth stating that the C2 comes with a built-in ADC or analog to digital converter. When it comes to operating systems, the C2 can operate with Ubuntu 16.04, or Android lollipop.

The RBPi family, just like Apple products, has always faced competition. However, most look good only on paper, but their prices always let them down in the end, and we never hear of them after some time. The price of $40 for the C2, being very close to that of the RBPi 3, may just escape this fate. Of course, there is the matter of adding shipping and customs to the price, as the origin of C2 is Korea.

So, which of them is preferable – the C2, or the RBPi 3 – and why? The faster processor of the C2 and its faster wired networking would make it attractive to someone working on network-attached data processing applications. Although one can add a USB wireless network adapter for only a few dollars, the onboard Wi-Fi and Bluetooth of the RBPi 3 makes it so much more attractive. Therefore, the RBPi 3 would be coveted by anyone who is a home user or planning to use a computer on a platform that will remain unfettered by wires.

Although the C2 may be more impressive when compared to the RBPi 3, the latter will likely outsell the C2 many times over. This may not be because of the massive publicity advantage that the RBPi 3 is receiving from the Pi foundation, but more likely due to the wide ecosystem of hardware and software developers the RBPi family has at present.

What are Optically Isolated Relays?

Popularly, relays are known to be electromechanical devices. However, engineers today have access to solid-state relays that operate without any electromagnetic or moving parts. Where reliability and performance is paramount, engineers prefer to use solid-state relays to their electromagnetic versions. However, solid-state relays are more expensive.

While traditional relays have several mechanical failure modes associated with moving parts, solid-state relays offer several advantages in performance and design. These include low power consumption, low leakage current, stable on-resistance, high reliability, extremely long life, small size, fast switching speeds, high vibration and shock resistance, and no switching noise from contact bounce.

Another important feature of solid-state relays is they are optically isolated. That means the relays use an LED or light emitting diode on their input side, MOSFETs or metal oxide semiconductor field effect transistors on their output side, and an array of photo sensors isolating the two.

The design and packaging affect the relay’s performance crucially. Translucent resin molds the electronic and optical components – the LED, photo array, and the MOSFETs – allowing light to pass through, while applying a dielectric barrier between the input and the output.

That means you only need to drive a switchable voltage directly to the input pin of the solid-state relay through a resistor to limit the current through the LED and control the relay. The value of the resistor has to be selected carefully, so the LED can reach its full intensity without being overdriven.

Optically isolated relays are increasingly used in sophisticated test and measurement systems. However, these systems require solid state relays to have characteristics such as low capacitance, low on-resistance, physical isolation, and high linearity. As data acquisition devices become faster and more precise, the above characteristics play an increasingly important role.

Low capacitance results in improved switching times and better isolation characteristics when switching high-frequency load signals. You need low on-resistance for reducing power dissipation when switching high currents. This also improves switching speeds improving the precision of measurement. Temperature range of the relay is an important factor when considering on-resistance values, as rising temperatures drive up the on-resistance.

To enhance precision by minimizing noise, physical isolation between the input and the output of a relay plays an important part. Expect isolation voltages as high as 5 KV AC for optically isolated relays as these offer a truly physical separation between their input and the output. Solid-state relays also offer high linearity leading to accurate measurements.

Industrial applications also benefit from using optically isolated relays, although the requirements here are different. For instance, an industrial plant using several relays, the low power consumption of optically isolated relays offers substantial savings. Where an electromagnetic relay requires 50-100 mA to actuate, a typical optically isolated relay requires only 5 mA.

Latching-type models of solid state relays have built-in protective circuits that safeguard power supplies, motors, and other industrial devices susceptible to disturbances from the output side. Such disturbances come from voltage peaks or overcurrent conditions arising from short circuits or improper use. Their reliability and small form factor saves space, while speeding up development.

Do You Need A 2K Display on your Smartphone?

One of the biggest selling points of flagship smartphones is their display resolution. A high resolution allows for better rendering of images and text on the screen and enhances the overall viewing pleasure. While grainy displays have become a thing of the past, with even sub $100 smartphones touting qHD and HD displays, the question now is, how much is too much.

Phone manufacturers are constantly striving to equip their devices with the sharpest displays, outperforming rivals in terms of clarity and accuracy of color reproduction. While shopping for a new smartphone, you might have come across terms like retina, HD, 2K and 4K displays. However, post a certain figure, it is doubtful if there is any discernible improvement in the clarity.

When launching the iPhone 4, Apple had claimed that a resolution of 960×640 pixels on a 3.5″ screen (translating to 326 pixels per inch) was as much as a normal human eye could discern when viewing from a distance of 9″. Going by that statement, a screen resolution north of 326 ppi would not cause any tangible improvement in clarity, while increasing production costs. Though iPhones have bigger screens now, their ppi remains constant at 326, whereas some other manufacturers have been pushing increasingly higher resolution screens on their latest releases. Most smartphones launched in the past year by tech giants like Samsung, LG and newcomer Oppo have panels with pixel densities of and above 415. The first smartphone to feature a 2K display was the Xplay 3S, launched by Vivo with a 6″ screen that sported 491 ppi. Soon after, Oppo launched the Find 7 smartphone, also with a 2K display of 2560×1440 or an astronomical 538 ppi. These figures are way ahead of retina displays, but in case of smartphone displays, after a certain point, more might not always be merrier.

Of course, the screen size has a huge role in determining how many pixels need to be packed in per square inch for delivering the perfect viewing experience. Moreover, a lot depends on the distance at which the screen is kept from the eyes, as closer viewing distances mean that more pixels can be resolved by the human eye. However, in no way is the average smartphone user going to be able to appreciate the difference between say, a 350- and a 500-ppi display. Stuffing more pixels per inch into an LCD panel is only more taxing on the battery. Therefore, an ultra-high resolution 2K display needs to be powered by a bigger battery as well, along with a superfast CPU to provide juice for all those extra pixels.

A 2K display, or the absence of it, should not be the only factor to consider when looking for a new smartphone. While it does make for a great viewing experience, it is more than likely a slightly less ppi count will not cause any noticeable decrease in clarity. It is a good feature to have on a smartphone to boast about, but it comes at the cost of battery life and processing speed.

Why Does My Motor Need A Capacitor?

Motor CapacitorIf you are using an AC pump to raise water from a sump to an overhead tank, chances are it uses a squirrel-cage type motor, which needs a capacitor to make it work. This is true for single-phase motors, where the capacitor creates an artificial second phase necessary to generate the rotating magnetic field and make the rotor start spinning. Once the rotor starts rotating, the interaction between the stator and rotor keeps the magnetic field spinning.

A single-phase motor has a primary winding and a secondary winding. If connected to the AC supply without the capacitor, both windings produce magnetic fields of the same phase resulting in zero torque. With a capacitor connected in series to the secondary winding, the magnetic field it produces lags behind the magnetic field generated by the primary winding. This difference in phases creates a starting torque and the motor starts to rotate.

Capacitors that allow a motor to start rotating are called start capacitors. Smaller motors usually have the start capacitor permanently connected in series to the secondary winding. Big motors require a larger capacitor to help them generate the starting torque, but they run more efficiently with a small capacitor in place, called run capacitor. Often both capacitors are housed in the same can, which then has three terminals in place of the customary two. Such motors have a centrifugal switch to disconnect the start capacitor when the motor has reached 70-75% of its full speed. Start capacitors are typically of high value of 100 or more microfarads, while run capacitors are smaller, of about 25-47 microfarads.

You will find motors with large start capacitors being used for several applications where it is necessary to generate considerable torque to begin moving the load. Such applications include mechanical conveyors, belted blowers and commercial garage door openers. These are mostly electrolytic capacitors, housed within a plastic or metal can. Inside the can are two metal foils rolled up with a flexible paper-like insulation separating the sheets. The paper, soaked with an electrolyte, forms the dielectric of the capacitor. The two metal foils are connected to two terminals. The assembly is sealed with epoxy and the two terminals are available for external electrical connection.

Large HVAC units sometimes need two run capacitors, because they have both a fan motor and a compressor motor. To save space, manufacturers combine the two physical capacitors into a single can. Such dual capacitors have three terminals and they are usually marked as Common, Fan and Compressor.

You will find a variety of combinations for dual capacitors, for example, 40 + 5uF, 370V or 100 + 25uF, 440V and others. Their shapes can be cylindrical with a round or oval cross-section. A capacitor’s ability to hold charge is measured in microfarads. As electrolytic capacitors age, their capacity reduces. That results in the motor failing to start or run at less than full speed.

Motors are not fastidious about the capacitance value of the capacitor used for starting. However, when replacing a faulty capacitor, you must never use a replacement that has a lower voltage rating. Always use a part with a voltage rating that is the same or higher than the rating of the capacitor you are replacing. Of course, it’s always preferred to replace a capacitor with another that has the exact electrical specifications for the best results – both in performance and safety.