Tag Archives: Guides

A Soundcard HAT for the Raspberry Pi

If you have been wondering how to use the popular Raspberry Pi (RBPi) single board computer for effects to be used with musical instruments such as the guitar, the Pisound board from Blokas may be the answer. With the Pisound board, any musician can connect any type of audio gear to the RBPi, and bring their project to an entirely new level. Pisound is a soundcard HAT for the RBPi.

HAT is an acronym for Hardware Attached on Top of an RBPi. HAT boards have an EEPROM that tells the RBPi the values of its variables specific to the device on the board. The HAT board will also have a GPIO connector to match with that on the RBPi, so that when plugged in, the HAT will sit atop the RBPi.

The Pisound HAT for the RBPi3 acts as a high-technology sound card. Not only does it allow sending and receiving audio signals from its jacks, but it can also send MIDI input and output signals to compatible devices. On board the card are two 6 mm input and output jacks, two standard DIN-5 MIDI input/output sockets, potentiometers for gain and volume, and a button for activating patches of manipulating audio. The Indiegogo campaign has given the Pisound board an incredibly successful start.

The Pisound website offers excellent documentation, making it a simple affair to set up the board. First, you have to mount the board atop your RBPi, matching the GPIO pins, and securing it with screws. Next, download and install a fresh installation of the Raspbian OS and set up the software according to instructions from the website. The only thing that remains now is to connect the instrument and create patches for Pure Data. This is a popular visual programming interface to manipulate media streams.

The possibilities with Pisound are endless. For instance, you can create simple fuzz, delay, and tremolo guitar effects. Limited only by your imagination, you could come up with endless ideas.

For example, the guitar effects could go into a web interface, accessible over a local network on a tablet or smartphone. On the other hand, with the characteristics of the guitar signals, you could control an interactive light show or project visualization on the stage. One of the advantages of the Pisound is you can use the audio input stream basically to generate other non-audio activities.

The compact and practical size of the project makes it convenient for embedding it within one of your instruments say the guitar. However, it is always possible to design and fabricate a custom enclosure for the board and the RBPi.

Sonic Pi, a musical community favorite, has also pledged to support the board very soon. That means even if you do not own a musical instrument, or play one, you can still make awesome sound effects with this clever little HAT.

You can load patches from Pure Data using a USB key. The button on the card makes it easier to interface with the RBPi. Moreover, it you are familiar with Automatonism, it will be easier for playing with the Pisound just as if it were a modular synthesizer.

What are Digital Circuit Breakers?

We need protection from fires resulting from an electrical overload caused by a faulty device or an accidental short circuit. The huge current from the overload heats up wires and their insulation may go up in flames. There are several ways to activate this protection.

The oldest method consists of a fuse wire. Usually, this is a thin wire enclosed in a casing. The material of the fuse wire is carefully chosen to heat up and melt (blow) when a certain current level is exceeded. Melting of the wire disconnects the circuit and interrupts the current, preventing heat buildup. Once a fuse wire blows, it has to be replaced by a similar wire to continue protection and reestablish electrical operation.

Nowadays, it is common to see switchboards where the fuse holder has been replaced by a miniature circuit breaker (MCB). The device has a bi-metallic spring holding pair of mechanical contacts, which can establish connection by throwing an external switch. An electrical overload causes the bi-metallic spring to trip and the contacts open up, disconnecting the fault from the rest of the circuit. Once the fault has been cleared up, the MCB can simply be rearmed by flipping the external switch.

Although simpler to operated compared to the fuse wire, MCBs have their own disadvantages of being slow to react and expensive, with their cost going up proportional to their trip current. Over time, the bimetallic strip tends to deform, reducing the current capacity of the breaker and its accuracy. The mechanical construction of an MCB makes it prone to wear and tear.

Opening mechanical contacts to interrupt high currents often causes an arc flash to jump across the contacts. It is necessary to quench the arc flash within a short time to prevent incidence of fires.

For overcoming the above problems, using a digital circuit breaker offers the most convenient solution. The device has an all-electronic construction involving an electronically controlled automatic switch. There are no mechanical components involved, no bi-metallic strips, and no electromagnetic coils inside.

Atom Power is proposing a solid-state digital circuit breaker to replace the traditional types and thereby avoiding the related problems. Currently awaiting approval from the Underwriters Laboratory (UL), Atom Power has two models, one each for AC and DC circuits.

So far, Atom Power was producing only a few numbers of their digital circuit breakers, using their in-house 3-D printers for producing the plastic parts of the housing. With increase in production, they will use the resources of an external rapid manufacturing company, and will move to injection molding for higher volumes of commercial operations.

The Atom Switch, within the breaker, responds to a digital signal generated whenever the current exceeds a certain level, whether due to overload or short-circuits. With tripping speeds exceeding 16,000 times those of its mechanical counterparts, the arc flashes simply do not happen.

Another technique used to prevent arc flashes is to switch the device off when the AC voltage passes through zero. This is called zero voltage switching or ZVS, and is a very useful technique to prevent arcing across the open ends of the circuit.

Raspberry Pi Controls the Cardboard Dog

This is a project for beginners using the Raspberry Pi (RBPi) single board computer. The RBPi is used to control a servo for turning the head of a cardboard dog away whenever a person is looking at it. This is to mimic a begging dog that seems ashamed of its begging nature.

This project requires the SBC RBPi, its power supply with the 5 V micro-USB cable, a USB keyboard and mouse, a display, and an HDMI cable. For storing the OS, an 8 GB micro SD card is also necessary. Another computer will be necessary to write the OS to the micro SD card and edit the files in it. The official PI camera will help to recognize the faces looking at the dog, and a micro servomotor is required to turning the head.

The RBPi will be controlling the servo through its GPIO pins. The servo has three wires that need to connect to the GPIO pins using female connectors. The camera has a ribbon cable, which goes into the port labeled camera on the RBPi. The HDMI cable goes into its port on the outside of the RBPi, and its other end goes to the HDMI-compatible TV or monitor.

Download and install the latest version of the Raspbian (with Pixel) from the official website of the RBPi. While installing the image on to the micro SD card, the process will destroy all data on the card, so be sure there is nothing of value before you begin.

Once the OS is installed on the micro SD card, insert it into the slot on the reverse side of the RBPi. If the power cord is now plugged into the RBPI socket and the power turned on, there should be some code running on the monitor screen, with the desktop showing up at the end. At this time, right click anywhere on the desktop and select “Create a New File.” Name the file Dog Turn.py, and select it to open with Python 2 IDLE.  Now open IDLE, and paste the code from here into it.

To make the code in the file to work, the RBPi will need additional Python modules to be installed. These are the libopencv-dev, python-opencv, python-dev, and you must use the sudo apt-get install command to download them.

The cardboard dog for this project uses four 9×6 inch cardboard rectangles, and two 6×6 inch squares, which form the main body. A hole at the top of the box allows the servo to go through. Another 5-inch cardboard cube forms the head, and attaches to the servo. Some cardboard legs make the dog look more realistic.

The entire electronic hardware can fit within the body of the dog. It may be necessary to use standoffs to hold the RBPi in place. The camera should look out from one of the eyeholes in the dog head. Fix it in place so that the cable has sufficient play when the servo moves the head. Simply running the python code should be enough to let the dog do its trick. To stop, turn off the power.

What are Current Sense Resistors and how do they work?

Efficiency has become the keyword in global trends in meeting demands for lower carbon-di-oxide emissions. Whether it is the smartening of the electrical supply grid or the electrification of our automobiles, the global trend is driving the need for electronic circuits to become more efficient. Knowing the level of current flowing through the circuit and reaching the load accurately is an important factor in gauging its efficiency for circuit designers and systems operators. This knowledge helps in maximizing operating performances of a battery, hot swapping server units, controlling motor speeds, and many more. Current sense resistors are inexpensive components that provide optimal solutions helping OEMs create more efficient circuit designs for a wide range of applications.

Current sense resistors are components helping to improve system efficiency by reducing losses. They have high measurement accuracy compared to other technologies, and they are ideally suited for helping developers measure currents precisely in automotive, industrial, and computer electronic designs.

Current sense resistors detect and convert current to voltage, using Ohm’s law. According to this law, the product of the current and the resistance value through which it is passing gives the voltage developed across the resistor. As these resistors feature very low resistance values, the voltage drops are equally insignificant, of the order of 10 to 150 mV in specific applications.

Design engineers place the current sense resistor in series with the electrical load, which causes the entire current to be measured to pass through it. As the voltage drop across the resistor is proportional to the current through it, measuring this drop provides an estimate of the load current. Measuring the voltage drop is usually accomplished through various amplifier options such as operational, differential, and instrumentation amplifiers. Selecting the right current sense resistor amplifier for a specific application involves looking at the input common-mode voltage specification. This is the average voltage present at the input terminals of the amplifier.

With the current sense resistor sitting in series with the load, they can directly measure the current. Contrast this with indirect current measurement techniques using coils. Here the voltage is induced across a coil and is proportion to the current. As a series resistor senses current directly, it dissipates power. Therefore, series resistors tend to have very low resistance values.

Current sense resistors also feature a very low temperature coefficient of resistance or TCR. This feature defines its low drift with varying ambient temperature and its long-term stability. These characteristics make temperature dependency of current measurement to be very low, while increasing the accuracy.

However, when using very low ohmic resistors of the surface mount type the resistance of the solder pad and the copper tracks of the printed circuit board can be uncertain and more than the resistance of the current sense resistance itself. This can lead to inaccuracies in the current measurement. In addition, the TCR of the tracks of the PCB can be much higher than that of the series resistor element.

Therefore, it is necessary to use current sense resistors implementing the 4-wire Kelvin principle, as these employ additional leads for measuring current more accurately.

Why Smart Home Tech Adoptions Need Switches

Most modern homes now use connected devices for entertainment, access control, and several other daily tasks. Their rapid increase can be gauged from the growth of the US market for smart homes, which has reached 29 million and is still rising.

The amazing features and efficiencies products related to smart homes offer to households naturally mesmerize consumers. However, this also necessitates engineers keep in mind the physical interfaces. While customer satisfaction is a long-standing effect, the immediate look and feel of the device dictates its price. This implies details are an important aspect, where the choice of every component matters and that includes switches and buttons.

Most people tend to ignore switches and buttons, forgetting they are responsible for driving the technical movement known as smart homes. However, a few important reasons establish engineers designing home products must give them a serious thought.

The connected devices in a smart home depend critically on their hardware designs. These include switches, sensors, screens and other components used on smart televisions, smart thermostat controls, connected door locks, and more. Most importantly, a user’s overall satisfaction comes from the way a product feels or the tactile sensation it generates.

Most of the time, a customer’s first interaction with the control of a product comes from its on/off switch, which a user physically touches. Unless the switch creates a delightful experience, the customer is likely to search for another product that offers a better feeling.

Cameras working on the Internet Protocol are now commonly available in smart homes. The reason for this is easy to figure out, as according to the statistics provided by iControl Networks, there is a burglary happening every 14.1 seconds in the US. With an IP camera installed, a person can monitor the activity at home from a remote location on their smartphones, laptops, or any other smart device. The very presence of IP cameras act as a deterrent to crime, apart from helping the police apprehend criminals, while simply providing a piece of mind to a homeowner.

However, smart cameras need the right switch to power and protect them. Usually, this is a miniature tactile switch, suitable for meeting the shrinking form factors of the device. Often smaller than the small lens display used by these cameras, the switch must be robust enough to prevent intruders from breaking it and rendering the camera useless.

While IP cameras capture images of unwelcome intruders whom people are not suspecting of entering their homes, access controls offer an additional level of security to the majority of consumers concerned with privacy and security in their smart homes. Access controls are usually equipped with internet doorbells with built-in cameras, and smart door locks.

While the camera shows an image of the person at the door, the smart lock allows unlocking the door remotely. This arrangement can be handy if the door has to be opened for the baby sitter or for the teenager who has misplaced his keys. Usually, the smart lock has a miniature switch to set or reset it. This switch has to be small but long lasting, and able to withstand harsh conditions such as humidity and rain.

Charlieplexing on the Raspberry Pi

If you suddenly find the need to control many LEDs and do not have the requisite electronics to do so, you can turn to your single board computer, the Raspberry Pi (RBPi) and use it to charlieplex the LEDs.

Charlieplexing is named after Charlie Allen, the inventor of the technique. Charlieplexing takes advantage of a feature of the GPIO pins of the RBPi, wherein they can change from outputs to inputs even when the RBPi is running a program. Simply setting a GPIO pin to be low does not allow enough current to pass through an LED or influence the other pins set as outputs and connected to the LED.

Using Charlieplexing, you can control up to six LEDs with three GPIO pins. For this, you will need three current limiting 470Ω resistors on each GPIO pin. The program charlieplexing.py defines a 3×6 array, which sets the state and direction of the three GPIO pins. The state defines whether the pin is set as digitally high or low, and the direction defines whether the pin is an output or an input.

Since LEDs are also diodes, they will light up only if their anodes are at a higher potential than their cathodes are, and not otherwise. Therefore, to light up a single LED, the program has to set the pin connected to its anode as output and drive it high. Next, the program must set the pin connected to the anode of the LED as input, while it sets the third pin as output and drive it low. Various combinations of the state and direction of the pins will drive all the LEDs on and off sequentially.

The array in the program holds the settings for each GPIO pin. A value of 0 means the pin is an output in a low state, 1 means the pin is an output in a high state, and -1 means the pin is set as an input.

In charlieplexing, it is easy to calculate how many LEDs each GPIO pin can control. The formula for this is, LEDs = n2-n, where n is the number of pins used. According to the charlieplexing formula, three GPIO pins can charlieplex 6 LEDs; four pins can control 12 LEDs, while 10 pins would allow control over a massive 90 LEDs.

Charlieplexing is good for not only lighting one LED at a time, but it is capable of lighting more at the same time also. For this, the program must run a refresh loop to keep the desired state of the LEDs in the array. While refreshing the display, the program must turn on other LEDs that need to be on, before moving on to the next. However, persistence of vision plays a large part here, and the program must be sufficiently fast to make it appear that more than one LED is on at a time.

However, there is a downside to lighting more LEDs at a time. Since more number of LEDs are now on to make it appear that more than one LED is on simultaneously, each LED is actually lit for a lower amount of time, which makes each LED glow less than at its full brightness.

Dimming LEDs with PWM Generator

nlike incandescent bulbs, dimming Light Emitting Diodes (LEDs) is not an easy task. Incandescent bulbs operate on alternating voltage supply, whereby using Triacs, one can control the effective RMS voltage applied to the bulb. Moreover, since the incandescent bulbs are resistive elements, a simple reduction is voltage is sufficient to reduce the current through it, thereby reducing its light and heat output.

LED operation is different, as they work on direct voltage. Each LED requires an optimum load current to produce light, while dropping a fixed voltage across its terminals. Therefore, it is impossible to dim the LED light output by decreasing the voltage across it or by limiting its current load.

However, an LED responds much faster, switching on and off at a much higher speed than an incandescent bulb does. This feature allows switching an LED on/off rapidly to change its light output. For instance, if the LED is repeatedly switched on for the same amount of time that it is switched off, the resultant average intensity from the LED is halved. By continuously changing the ratio of the on-to-off period, the LED can be made to traverse from zero output to its maximum light output. Engineers call this technique the Pulse Width Modulation (PWM), and this has become the de facto mechanism for dimming LEDs.

Linear Technology makes different types of PWM controllers for LEDs, and they have designed the LT3932 for dimming a string of LEDs efficiently. A monolithic, synchronous, step-down DC/DC converter, the LT3932 utilizes peak current control and fixed-frequency PWM dimming for a number of LEDs connected serially.

The user can program the LED current of the LT3932 using an analog voltage, or control its duty cycle of the pulses from the CTRL pin. A resistor divider on the FB pin of the LT3932 sets its output voltage limit.

One can use an external clock at the SYNC/SPRD pin of the LT3932 to control the switching frequency, which is programmable from 200 KHz to 2 MHz. Alternatively, an external resistor connected to the RT pin can also serve the same purpose. To reduce EMI generated by the switching frequency, the LT3932 features an optional function of frequency modulation involving spread spectrum that varies the frequency from 100 to 125%.

The LT3932 features an external high-side transistor rated for 3.6-36 V, 2 A, and a synchronous step-down PWM LED driver for dimming an LED string. This uses an internal signal generator for controlling the analog PWM dimming in the absence of an external PWM signal. LT3932 regulates the LED current to ±1.5%, while regulating the output voltage to ±1.2%. The IC achieves a 5000:1 PWM dimming at 100 Hz, and the internal PWM achieves a 128:1 dimming ratio with a maximum duty cycle of 99.9%.

The LT3932 protects the LED string from open/shorts while offering fault indication, as it has an accurate LED current sensor with a monitor output. Along with thermal shutdown, the IC features an accurate under voltage lockout threshold and an open-drain fault reporting for open circuit and short-circuit load conditions. With its silent switcher topology, the LE3932 is well suited for several applications including automotive, industrial, and architectural lighting.

Replacement for Flash Memory

Today flash memories or thumb drives are commonly used as devices that store information even without power—nonvolatile memory. However, physicists and researchers are of the opinion that flash memory is nearing the end of its size and performance limits. Therefore, the computer industry is in search of a replacement for flash memory. For instance, the National Institute of Technology (NIST) conducted research is suggesting resistive random access memory (RRAM) as a worthy successor for the next generation of nonvolatile computer memory.

RRAM has several advantages over flash. Potentially faster and less energy hungry than flash, it is also able to pack in far more information within a given space. This is because its switches are tiny enough to store a terabyte within a space the size of a postage stamp. So far, technical hurdles have been preventing RRAM from being broadly commercialized.

One such hurdle physicists and researchers are facing is the RRAM variability. To be a practical memory, a switch needs to have two distinct states—representing a digital one or zero, and a predictable way of flipping from one state to the other. Conventional memory switches behave reliably when they receive an electrical pulse and switch states predictably. However, RRAM switches are still not so reliable, and their behavior is unpredictable.

Inside a RRAM switch, an electrical pulse flips it on or off by moving oxygen atoms around, thereby creating or breaking a conductive path through an insulating oxide. When the pulses are short and energetic, they are more effective in moving ions by the right amount for creating distinct on/off states. This potentially minimizes the longstanding problem of overlapping states largely keeping the RRAM in the R&D stage.

According to a guest researcher at NIST, David Nminibapiel, RRAMs are as yet highly unpredictable. The amount of energy required to flip a switch may not be adequate to do the same the next time around. Applying too much energy may cause it to overshoot, and may worsen the variability problem. In addition, even with a successful flip, the two states could overlap, and that makes it unclear whether the switch is actually storing a zero or a one.

Although this randomness takes away from the advantages of the technology, the researcher team at NIST has discovered a potential solution. They have found the energy delivered to the switch may be controlled with several short pulses rather than using one long pulse.

Typically, conventional memory chips work with relatively strong pulses lasting about a nanosecond. However, the NIST team found less energetic pulses of about 100 picoseconds, which were only a tenth of the conventional pulses, worked better with RRAM.  Sending a few of these gentler signals, the team noticed, was more useful not only for flipping the RRAM switches predictably, but also for exploring the behavior of the switches.

That led the team to conclude these shorter signals reduce the variability. Although the issue does not go away totally, but tapping the switch several times with the lighter pulses makes the switch flip gradually, while allowing checking to verify whether the switch did flip successfully.

Difference between AC, DC, and EC Motors

People have been using different types of motors for ages. Primarily, motors can be broadly classified into AC and DC types, depending on the power source they require to operate. However, the basics of operation remain the same for all types of motors. Current running through a wire generates magnetic fields around it, and if there is another magnetic field present such as from an external magnet, the two interact to generate a mechanical force on the wire capable of moving the wire. This is the basic principle on which all motors operate.

AC and DC Motors

AC induction motors have a number of coils controlled and powered by the AC input voltage. This input voltage also creates the stator field, which then induces the rotor field. Another type of AC motor, a synchronous motor, can operate with precision supply frequency.

An AC motor operates at a specific point on its performance curve, which coincides with the peak efficiency of the motor. If forced to operate beyond this point, the motor runs with a significant reduction in efficiency. As the magnetic field in an AC motor is created by inducing a current in the rotor, AC motors consume extra energy from the input. This makes the AC motors less efficient than DC motors are.

DC motors generate their secondary magnetic field using permanent magnets rather than windings. They rely on commutation rings and carbon brushes to switch the direction of the current and the polarity of the magnetic field in the rotating armature. The interaction between the magnetic field from the fixed permanent magnets and the magnetic field from the internal rotor induces rotation in the rotor.

Although DC motors run at high efficiency, they suffer from specific losses. The initial resistance in the rotor, brush friction, eddy current losses cause the motor to lose efficiency.

EC Motors

To achieve higher energy efficiency and control the energy output, engineers have designed the EC or electronically commuted motors. They combine the best of both AC and DC motors by removing the brush and slip ring system of commutation, and replacing them with solid-state devices. This electronic control allows them to operate with a higher efficiency.

EC motors are also called brushless DC motors, and they are controlled by external electronics, which may be an electronic circuit board or a variable frequency drive. Permanent magnets are on the rotor, while the fixed windings are on the stator.

The circuit board keeps the motor running by switching the phases in the fixed windings as necessary. This supplies the armature with the right amount of current at the right time, resulting in the motor achieving higher accuracy and efficiency.

EC motors offer several benefits. Absence of brushes eliminates sparking and increases the life of the motor. As electronics controls the power to the motor, there is less wastage with better performance and controllability. This allows even small EC motors to equal the performance of larger AC or DC motors. Heat generation in EC motors is also lower than that generated in AC or DC motors.

How Do Piezoelectrics Work?

Piezoelectrics, found almost everywhere in modern life, are materials that are able to change mechanical stress to electricity and back again. One can find them in sonars, medical ultrasound, loud speakers, computer hard drives, and in many more places. However popular piezolectrics may be as a technology, very few people truly understand their way of working. At the Simon Fraser University at Canada, and the National Institute of Standards, researchers are working on understanding one of the main classes of these materials. These are the relaxors, behaving distinctly different from the regular materials, and exhibiting the largest effect among piezoelectrics. Most surprisingly, their discovery comes in the shape of a butterfly.

The team was examining two of the most popular piezoelectric compounds, the relaxor PMN and the ferroelectric PZT. These look very similar when viewed through a microscope, with both exhibiting crystalline structure comprising cube-shaped unit cells. These are the basic building blocks all crystals use, and they contain one lead atom and three oxygen atoms. The team found the essential difference only at the center of the cells. While the PZT had one similarly charged zirconium or titanium atom occupying the center randomly, the PMN had differently charged niobium or manganese atoms in the center. With the differently charged atoms, PMN produced strong electric fields varying from one unit cell to the other. They observed this behavior exclusively in PMN and in other relaxors, but not in PZT.

According to Peter Gehring of the NIST Center for Neutron Research, although ferroelectric PZT and PMN-based relaxors have been around for decades, the difficulty in identifying the origin of their behavioral difference was due to the inability in growing sufficiently large single crystals of PZT. For a long time, the researchers had no fundamental explanation for the reason relaxors exhibited greater piezoelectric effect, which could help guide efforts in optimizing this technologically valuable property.

Then scientists from Simon Fraser University discovered a way to grow crystals of PZT that were large enough to enable a comparison of the PZT and PMN crystals. The scientists used neutron beams and they revealed new details about the location of atoms within the unit cells. The scientists found the atoms in the PMN cells were not in their expected positions, whereas in the PZT cells had them in more or less rightly expected positions. According to Gehring, this accounted for the essentials of relaxor behavior.

Te scientists observed that neutron beams scattering off PMN crystals formed the shape of a butterfly. The characteristic blurred image revealed the nanoscale structure withing the PMN and in all other relaxor materials. However, when they studied PZT materials with the same method, they did not observe the butterfly shape. This led them to conclude relaxors offer a characteristic signature in the shape of this butterfly-shaped scattering.

The team conducted additional tests on both PMN and PZT crystals. These tests revealed for the first time that compared to PZT, PMN-based relaxors were over 100 percent more sensitive to mechanical stimulation. The team hopes these findings will help in better optimization of piezoelectric behavior in general.