Author Archives: Andi

ATtiny Remote Power Switch for the Raspberry Pi

One of the shortcomings of most highly popular single board computers such as the Raspberry Pi (RBPi) is the lack of an on/off power switch. The board springs to life as soon as you insert the micro USB power cable into its socket. If you simply switch off power or pull out the micro USB cable off the RBPi, you stand the risk of not only losing data but also of corrupting the file system. Therefore, to shutdown the RBPi safely, you need to call a shutdown command, which closes down the file system and takes the RBPi into a safe state, allowing you to remove the USB cable.

The above has been the reason for several projects to incorporate a switch with the RBPi that will safely switch it off without corrupting the file system. Most of the projects incorporate a board sitting on the GPIO header of the RBPi along with a micro USB connector and a toggle switch to control the power supply for the RBPi. The entire control of the power supply comes from a tiny microcontroller on the add-on board, which monitors the state of the toggle switch and the RBPi. In turn, the microcontroller switches a MOSFET and an LED indicates the status of power. This also precludes the necessity of unplugging the RBPi from the power module after switch off.

This power switch from Nanomesher, using an Attiny85 microcontroller, adds a new dimension to controlling the RBPi—it has a remote that you can use to remotely control power to the RBPi. The entire arrangement comes as a kit, and you get a hack able and smart power switch for the RBPi that a removable Attiny85 microcontroller controls. There are also four jumper cables that allow the board to connect to the RBPi GPIO, a high quality micro USB cable 20 cm long, and an infrared remote control.

The project is hack able in the sense you can remove the ATtiny85 microcontroller and reprogram it to provide any type of functionality with the remote. Of course, reprogramming the ATtiny85 will require an Arduino-compatible platform such as the Uno. Other Arduino devices with switches are available, and you may already own some, or you may buy them for experimentation. The ATtiny requires wiring up with the Arduino on a breadboard for the programming.

You can use the included remote or any other remote already available with you. Since the kit is hack able and reprogrammable, you can make it recognize many more signals, changing the timings and functioning of the shutdown. For instance, you may add another button for a hard reset, and reprogram the Attiny85 to recognize it.

Although the kit does a fine job of shutting down the RBPi safely, the presence of the jumper wires to connect to the RBPi makes the kit somewhat cumbersome to use. The project would have been much more useful if the kit could be fitted onto the RBPi in the form of a HAT. Of course, the presence of jumpers does make the kit more flexible since one can select the GPIO pins for connection.

Low-Side & Hi-Side Current Sensing

Electronic systems tend to manage their power consumption to reduce the production of heat as waste. This calls for optimizing the system efficiency by effectively distributing power. As the voltage applied to the circuit is usually a constant, engineers monitor power consumption by keeping track of the current drawn by the circuit—power being the mathematical product of the current and voltage fed to the circuit. Current sensing has additional advantages, mainly that of maintaining the health of the system, preventing circuit faults from turning disastrous, and preventing batteries from over-discharging.

Engineers use two basic methods to monitor electric current. The first method follows Ampere’s law, and engineers measure the magnetic field surrounding a current-carrying conductor. The second method follows Ohm’s law, and engineers measure the voltage drop across a small resistor inserted in series with the circuit. The first is a non-intrusive method, but useful only for regularly changing currents, such as alternating current. It is also an expensive method, rather prone to temperature coefficient errors and effects of non-linearity. The second method is simpler, but introduces an element of insertion loss.

The semiconductor industry offers resistive-sensing techniques that are cost-effective and accurate, while making measurements suitable for various applications running on direct current. The resistive-sensing technique relies on sensing the current on the low-side or on the high-side of the circuit, the optimal approach depending on the application.

In resistive sensing, engineers insert a low-value resistor in series with the current path. This produces a small voltage drop in proportion to the current the circuit is consuming and which passes through the resistor. An electronic sense amplifies this tiny voltage to make it easier to process further. However, the sense resistor’s placement depends on the environment of the application and this can present some serious challenges for the sense amplifier.

If the position of the sense resistor is between the load and the circuit ground, a single operational amplifier, acting as a sense amplifier, is adequate to amplify the resulting voltage drop. Engineers call this low-side sensing, and is different from high-side sensing, where they place the resistor between the positive lead of the supply and the load.

In both cases, the sense resistor must be of adequately low value to prevent it from dissipating high power, but its value must be high enough for it to generate a detectable voltage for the sense amplifier to multiply it accurately. The sense amplifier multiplies the difference of voltage across the sense resistor, but uses a common-mode voltage for the purpose.

For low-side sensing, the common-mode voltage is close to the ground, and the rest of the circuitry following the sense amplifier may run on low voltage. However, high-side sensing requires the common voltage to be close to the supply voltage, and sometimes this may be high enough to present supply voltage problems for the circuit following the sense amplifier.

Some applications are unable to tolerate the tiny voltage drop introduced by the sense resistor on the low-side. The situation aggravates as the load current increases. For them, engineers have to follow high-side sensing inevitably.

What are Ball Grid Arrays?

Initially, surface mount devices, especially ICs, came as perimeter-only packages, with pins for soldering placed along the edge of the device. As ICs became more complex, they needed more pins for external interfacing, which made the packages larger. Manufacturers soon realized there was a large unused real estate that lay just under the package. Therefore, they made the ball grid array (BGA) packaging, which, in place of pins, had solder balls aligned in a grid under the device. Soldering BGAs involves melting these solder balls onto pads on the PCB.

Using BGAs leaves a considerably larger area free on the PCB. Compared to mounting a package with pins on its perimeter, BGAs offer better thermal and electrical properties, and this has made the format popular, following the continued miniaturization of electronics.

Since their introduction, although their basic concept has remained the same, BGAs have changed in dimension and now come with far smaller pitches and smaller outlines. There are varieties as well, with some packages having connections only on the periphery and none at the center, while others have the connections distributed evenly across the bottom of the package.

For simpler BGAs, routing traces on the PCB is simple as the balls are placed well apart or there is space in the middle of the device. However, with increasing pin counts and decreasing pitches, routing between the pins becomes more difficult, resulting in increasing the layers of the board, thereby increasing the cost and reliability concerns.

As BGAs become increasingly more complex, designers have to depend on vias to connect the BGA with the rest of the circuitry on the PCB. Vias are small holes drilled through the multilayer PCB and plated with copper to provide connection between pads and traces on different layers. Some vias are through-hole types, meaning they start and end on the two extreme layers of the PCB, and may connect to other layers in between. Other vias can be blind types, starting from one of the outermost layers and ending on an internal layer, possibly connecting other layers in between. Blind vias are not visible on the PCB surface as they start and end at different internal layers, and may connect other internal layers as well. However, all the above require great precision while manufacturing, and are expensive processes.

Ordinarily, PCB designers prefer not to use vias on a pad, as during soldering, vias can wick solder from the pads leaving the joint in a dry and unsoldered state. However, with BGA pitches getting increasingly smaller, designers do not have much choice, but tenting is offering a way out. Tenting allows filling the via hole with an insulating material and covering the top with a layer of copper, thereby preventing wicking.

As the BGA pins lie in between the device body and the PCB, traditional soldering methods such as hand soldering and wave soldering are no longer useful, and assemblers rely on infrared heating or reflow ovens to solder BGAs to a PCB. This requires a pick-and-place machine placing the BGA package precisely on the pads and uniformly heating the area to form the actual connections.

How Do Power Supplies Share Current?

Those who use power supplies to run different devices often face a peculiar problem. The load may demand more power from a single power supply that it can safely provide continuously. Since the voltage to the load has to remain constant, the situation calls for using additional power supplies to supply the excess current, and inevitably, users must connect them in parallel. However, simply connecting power supplies in parallel does not guarantee they will share the load current between them in an acceptable manner to operate normally.

Although designers do design some power supplies with dedicated circuits within them to ensure proper sharing of load current when connected in parallel, this is not a generalized practice. Moreover, even if power supplies of one manufacturer can optimally share current when connected in parallel, they may not do so when operating in parallel with power supplies from another manufacturer. In fact, power supplies from the same manufacturer but different models may also not work satisfactorily in parallel.

Theoretically, an ideal voltage source will supply unlimited amounts of power all the while maintaining a constant voltage level. Real power supplies have a limit to the amount of current they can supply to the load. If a load wants to draw power beyond the capacity of the supply, it will reduce its output voltage such that the power delivered remains within its capacity. Should the demand for current increase further, the output voltage reduces further until it reaches zero, and the power supply shuts down. Recovering automatically or through an external reset from an over-current situation is a design feature.

In reality, all voltage sources come with a positive and non-zero internal impedance. This drops the output voltage at the terminals as the load current increases. Power supply specifications call this change in output voltage with load current as the load regulation, and this is specific to each power supply. As the requirement is to have the output voltage change as little as possible with increasing current, some power supply designers prefer to design for low output impedances. Some power supplies have remote voltage sensing to boost the output voltage by the amount it has drooped. However, this is not desirable when sharing current.

One of the problems in connecting power supplies in parallel to supply higher current than either can supply is the current balance characteristics of the units may not match. In case the error in the initial voltage settings between the units is bigger than the depression in the output voltage at maximum load, the first unit may supply its entire share before shutting down. This leads to the second unit attempting to deliver the load current, and since it cannot do so, it shuts down as well.

One of the methods to enable proper current sharing is to enhance the output impedance of each unit so that their individual output voltage droops at full load is far more than the no-load voltage difference between the units. Although the voltage regulation of the system degrades significantly due to the intentional voltage droop, the current sharing between the power supplies is more successful.

ElectroSmash Pedal for the Raspberry Pi

Guitarists favor expensive gear. For instance, they hold online discussions about the best types of wire for guitar pickups. They even go to great lengths while selecting the type of transistors that will give them the best fuzz tone. They hold extensive discussions about the merits of the pentode rectifier over the tetrode type. While the geeks in the electronics world share several common characteristics with the guitar geeks, the ElectroSmash Pedal Pi would interest both.

Both teams are already familiar with the single board computer, the Raspberry Pi (RBPi). ElectroSmash provides a pedal that works with the RBPi Zero and allows the user to program the effects. The brains behind the project are in the code that the user has to download and compile on the RBPi.

Although it is possible to write the code afresh, but downloading the sample provided by ElectroSmash is more sensible, and gets you started faster. The community behind the Pedal Pi has contributed the code, and the user has the complete freedom to use it as it is, or to modify the parameters. ElectroSmash provides the Pedal Pi in a kit form, which means owners have to assemble it first.

Instructions for the assembly are available from the ElectroSmash website. The kit comes with all components neatly labeled, which makes the kit easy and straightforward to put together. One does not need extensive soldering experience for the assembly.

The kit has two ICs, the first an op-amp, and the other an analog to digital converter chip. Follow the instructions on the ElectroSmash site to place them on the board the right way around.

Typically, the RBPi Zero comes with the header pins not soldered to the board, and the user has to do the placement and soldering. However, one can get around this problem by using the RBPi ZWH variant, as this board comes with the header pins soldered in place.

Once you have assembled the pedal, you may find it is not as robust as the regular guitar pedals available on the market. According to ElectroSmash, the aim of the Pedal Pi project is to offer learning about guitar pedals and having fun with them. As an electronics kit, the ElectroSmash Pedal Pi kit certainly lives up to its claim.

Although the kit may seem slightly expensive, comparing it with other guitar pedals shows its true value. For instance, the distortion pedal from Ibanez, the classic Tube Screamer, costs almost twice the full kit. Although the ElectroSmash kit has about ten other effects built in, the user can add many more—in fact, only the programmer’s ingenuity, imagination, and programming skills limit the range of effects that the kit can handle.

Following the code sample that ElectroSmash provides is simplicity itself. They list the code sample in order of increasing complexity, ranging from the simple tone to the looping effect. The user can have fun playing with different types of distortion and use a processed quality on the fuzz, bit-crusher effect, and distortion. The effects are all available in the file fuzz.c and one can change a few numbers to give a new effect.

Connecting Wireless Temperature Controllers

Modern industrial temperature controllers are not just simple thermostats, as their earlier counterparts were. With the ability to control upwards of a hundred parameters, the latest industrial temperature controllers allow users to set not only temperature points, but also program alarm settings based on adjustable ramp parameters. Users can select the RTD or thermocouple they want to use for collecting data, while setting limits on the set points.

With the advent of digital temperature controllers, users can configure them with a physical interface. Although, initially, the design of some models allowed them to connect to nearby computers through a wired link, the later models of temperature controllers come with Bluetooth enabled.

Traditionally, the physical interface of temperature controllers featured two to five buttons that allowed the user to set the various parameters for the controller. With the limited three to four character LED display on the controller, the user had to either know the button combinations or refer to a manual during the process of setting up the parameters.

Connecting earlier temperature controllers to PCs through wired serial interfaces presented other problems. It required the PC to be near the controller, as the interface and cable could cover only limited distances. This meant the PC had to operate in the noise and dust of the industrial environment, reducing its operational life. Cables connecting the two were prone to electromagnetic interference, and a tripping hazard. Most modern PCs come with only USB connections, and do not have serial interfaces any more, complicating the situation further.

Bluetooth enabled industrial temperature controllers have solved the above problems with ease. Several controller can connect to one mobile device with an app using Bluetooth—a short-range connecting technology. As the user brings the mobile device within range of the controller, he or she can ping the controller to confirm the specific device to interact. The app on the mobile allows the user to interact with the controller for viewing and setting all its parameters and for reviewing any of its error messages.

With the app interface offering greater graphical flexibility, the user can read the error messages and parameter names in plain text. Moreover, he or she can access in-line help for further understanding the function of each parameter and its permissible settings.

The graphical app interface allows the user to set up the temperature controller easily. It does not require the user to page through a manual or memorize the settings. No cables or other inconvenient interfaces are necessary for using these modern mobile interfaces.

With the unprecedented growth of cloud-enabled devices and the Internet of Things, there are concerns about information security in wireless connectivity. Using Bluetooth technology in industrial interconnections has its own advantages. Bluetooth is currently unable to connect to LAN, industrial Ethernet, or to cloud services, and is therefore, secure to that extent.

Furthermore, Bluetooth technology functions over short distances, and communications are limited to within 70 feet, limiting long-range interference. Moreover, users can protect controllers with passwords. Users can select the parameters on the controller that the password will protect, and a remote user cannot change them through the app.

Do You Need EMC Testing?

Any electronic product faces a necessary hurdle before it goes to the market. It must clear the Electromagnetic Compatibility (EMC) test. This being a critical test in the design journey of an electronic product and passing this crucial test proves the design is right.

However, most designers relegate this important emissions testing to a late part of the design lifecycle of the product. This unnecessarily increases the risk of cost overruns and project delays shortly before the planned launch. Therefore, it is necessary to test for emissions at various stages of the product design plan.

When testing for EMC, you are actually minimizing the possibility of the radiated or conducted emissions from your device interfering with other electronic products nearby. Simultaneously, EMC testing ensures that the product under design is impervious to electromagnetic emissions coming from other sources in the vicinity.

Electromagnetic emissions are the energy the product emits in the radio frequency (RF) range. The device may emit these energies in either conducted or radiated form.

Below about 30 MHz, conductors and cables are not very efficient as antennas. At these frequencies, they are rather good at conducting the RF energy through shared loads and power sources. The conducted emissions, when passing through them may start interfering with other electronic equipment.

As the frequency goes up, beyond 30 MHz, conducted emissions are no longer an issue. At these high frequencies, cables and conductors start behaving more as antennas radiating the energy, thereby causing interference with other equipment.

Engineers use different test procedures and equipment for measuring conducted and radiated emissions. Although they use almost similar filter components for mitigating their effects, the electrical values involved are different.

Standards for measurement and testing electromagnetic emissions for both the conducted and radiated type differ in the US and Europe. While the US uses FCC Part 15, Europe uses CISPR 22/EN 55022. However, both approaches are very similar, and if the equipment meets the requirements of one of the standards, you can rest assured that it will meet the needs of the other standard as well.

Both the US and European standards set separate specifications for conducted and radiated emissions. The two types of emissions have their own limits applicable to the final system and its power supply.

Manufacturers making internal mountable power supplies often test them to meet regulations as standalone products. However, this is not enough if your design is using one of these power supplies with a load. In such a case, it is necessary that the complete system meet the EMC regulations. As a metal box encases the power supply, meeting the EMC challenges requires using external components.

Additionally, as most power supplies use switching topologies, they produce high levels of radiated and conducted emissions. Although the manufacturers may have already mitigated these emissions during the design phase, adding load to the power supply may produce further emissions. Therefore, it is necessary to test the combined system to ensure it meets the requirements of the EMC standards. Usually, a certified lab using calibrated test kits does the final testing. However, certain in-house testing is also possible, not requiring much equipment.

Tracking Micro-Fluidic Flows

Scientists have taken analytical chemistry to such advancements that it can detect the effects of extremely tiny amounts of liquids—triggering the requirement of a need to measure such microflow of liquids. NIST, the National Institute of Standards and Technology, has produced such a microflow measurement device, the size of a nickel, and has filed a provisional patent application for it. The device is capable of measuring movements of nanoliters (nL) of liquid per minute. A nanoliter is a billionth of a liter, a volume best understood with an analogy—if allowed to flow at one nanoliter per minute, a one-liter bottle of water would take 200 years to empty completely.

Micro-fluidics is a rapidly expanding field, where such an invention as above could fill an urgent need for critically measuring tiny flow rates precisely. For instance, medical drug-delivery pumps often need to dispense saline at the rate of tens of nanoliters per minute into the bloodstream of a patient, where 50,000 nL may be required to make up a single drop of water.

Apart from medical applications, continuous-flow micro-manufacturing, cell soring and counting, chemical research, and clinical diagnostics are some applications that require increasingly accurate measurements of very small volumes of liquids.

Current devices available on the market, even the state-of-the-art types that profess to measure flow at that scale, suffer one or numerous operational limitations. Some of them require frequent calibration, some use microscopes and other complex imaging systems, while others average the data collected over several minutes, missing out on tracking dynamic changes. Some devices cannot be traced to the International System of Units.

Greg Cooksey invented the optical microflow measurement device. He is a biomedical engineer in the Physical Measurement Laboratory at NIST. Cooksey’s device avoids the above complications. Fabricated at the Center for Nanoscale Science and Technology at NIST, the optical microflow measurement device monitors the speed of fluorescent molecules within a liquid as they flow down a channel nearly the width of a human hair. Two separate laser pulses help to determine the time interval between the responses of the molecules.

When exposed to a specific wavelength of a blue light laser, the fluorescent molecules in the liquid emit green light. In actual practice, a chemical coating modifies the molecules to prevent them from fluorescence. As the fluid travels down the micro-channel, an ultraviolet laser strips off the chemical coating of some of the molecules. At the same time, some distance away on the channel, a blue laser excites these exposed molecules to make them fluoresce. The flow rate is the time elapsed between the removing of the chemical coating and the molecules beginning to fluoresce.

According to Cooksey, the ultraviolet laser pulse, with a wavelength of 375 nm, marks the start-time reference point. Fired down an optical waveguide into the channel, the pulse hits the chemically protected fluorescent molecules moving with the stream, destroying their protective cage and turning them on to respond to excitation by light.

250 micrometers downstream in the channel, the activated molecules cross the path of a blue laser, which makes them emit green light. An optical power meter measures the change in the light intensity 250,000 times per second to estimate the time interval.

The Latest in Li-Fi

Newly developed technologies are allowing wireless networks to operate several hundred times faster than Wi-Fi—one of them is Li-Fi or Light Fidelity. Simply by switching on a light bulb, it is possible to encode data within the visible light spectrum rather than allow them to ride on radio waves as traditional wireless technologies such as Wi-Fi do.

So far, research labs had confined Li-Fi within their closed doors. Of late, however, several new products using the Li-Fi technology has started to appear on the market. While the majority of the wireless industry focused their attention on developing 5G or the fifth generation wireless technology, PureLiFi presents a new dongle for laptops and computers that uses the latest light fidelity technology. Another startup company, Oledcomm from France, offers their Internet lighting system for hospitals and offices.

Light bulbs use LEDs, which are semiconductor devices able to switch at very high speeds, unlike the incandescent or fluorescent bulbs, which are rather slow in turning on and off. Li-Fi technology interrupts the electric current through the LEDs at high speeds, making them flicker and at the same time, encoding the light they produce with parallel streams of data. The analogy here is the process is very much like producing the Morse code in a digital manner, the difference being the flickering is much faster than the human eye can follow.

Dongles, smartphones, and other devices with built-in photo detectors can receive this light encoded with data. This manner of communication is not new, as remote controls have been using this technology using infrared lights. The remote sends tiny data stream commands to toys and televisions, and they interpret the information, process it, and change their functioning accordingly. Li-Fi uses visible light spectrum, as it can reach intensities capable of transmitting much larger amounts of data than infrared light can. For instance, it is common to find Li-Fi networks operating at speeds around 200 gigabytes per second.

The only downside to Li-Fi is it works on line-of-sight. As light does not bend around corners, the transmitter and receiver must physically see each other to communicate effectively. According to Harald Haas, the professor of mobile communications who introduced the world to Li-Fi, this handicap is easy to overcome by fitting a small microchip in every potential illumination device. The microchip would serve to combine two basic functionalities in an LED light bulb—illumination and wireless data transmission—one need only place the microchip embedded LED light bulbs in sight of one another to act as repeaters in between the transmitter and the receiver.

Haas spun out PureLiFi, whose initial products had a throughput of 10 Mbits per second, making them comparable to Wi-Fi versions available at the time. Since then, PureLiFi has advanced the technology to produce LiFi-X, an access point connecting LED bulbs and dongles and providing 40 Mbits per second for both downloads and uploads speeds.

Another company from Estonia, Velmenni, has already demonstrated Li-Fi technology in their products that offer speeds around one Gbits per second. Oledcomm has developed kits for retrofitting Li-Fi into existing LED light bulbs, useful for communication within supermarkets and retail stores.

A Smart Development Board for the Raspberry Pi

The Raspberry Pi or RBPi single board computer when fortified with Cloudio makes a personal IoT computer that users can play with or use for prototyping. Cloudio, the add-on board suitable for the RBPi, offers advanced features such as sensor monitoring and displaying on dashboard, providing custom notifications with image and video, unlimited cloud services, one tap upload for multi-boards, voice assistant capabilities, IFTTT integration, drag and drop programming for Android and iOS, and much more.

As a smart development board kit, Cloudio offers drag and drop programming using the included GraspIO Studio app. Users get a block-based approach that is fairly intuitive. For IoT developers, this approach allows them to reach their goals faster, as the simple but powerful mobile IDE simplifies the complexity of software development.

On the hardware side, the Cloudio kit includes an OLED display, a light sensor, temperature sensor, a mini servo port, a tactile switch, three ADC ports to handle external sensors, three ports for digital outputs, an RGB LED, and a buzzer. This provides the user nearly all the tools necessary for an IoT project. On the software side, the kit comes with the GraspIO, which provides unlimited cloud service, allowing the user to program and manage Cloudio from their mobile devices.

GraspIO provides the user with a block-based feature. Users can treat program modules as blocks, dragging and dropping the blocks as necessary to combine them to achieve various functionalities. This feature offers users with an intuitive mobile interface.

Users can monitor the sensors they attach to the RBPi and arrange their response to be studied in a dashboard. They can set up sensor monitoring projects easily and configure the dashboard to exhibit their response in an intelligent and responsive manner. The kit allows plotting the sensor response in real-time graphs on a mobile device, and exporting data for IoT analysis.

Users can manage several Cloudio kits at the same time, as they can connect their mobile devices to the IoT Cloud Service. Therefore, users can connect to, program, control, monitor, and manage several kits with a single smartphone. The IoT Cloud Service comes with a lifetime offering of 100 daily non-cumulative calls, along with a bunch of 50,000 free preloaded calls.

The IoT Cloud Service also helps in voice control and speech recognition. Users can create their own voice assistants, and add custom voice commands including their own wake-word.

For instance, with the Cloudio Smart Development Board hooked up with the RBPi, a user can interface the RBPi and a USB camera, using the in-app camera block to capture images, videos, and even create GIFs or time-lapse videos. The user can add several features to their projects, including custom email, images, and video notifications.

The Cloudio kit enables features such as adding speech outputs to projects. Therefore, users can make their projects respond with voice outputs, using the easy to use in-app speak block that comes along with the kit. Other features the kit offers are creating real-time speech notifications, custom messaging, or playing recorded audio from the board.