Monthly Archives: January 2016

The Ultimate GPS HAT for the Raspberry Pi

If your smartphone is lost or misplaced, you can trace it using its GPS or Global Positioning System receiver. The US Department of Defense has placed 24 satellites into the Earth’s orbit making it a satellite based navigation system. Although GPS was conceived originally for military applications, in the 1980s, the government allowed the civilians to use the system as well. GPS works without any subscription fees or setup charges for 24 hours a day, covering the entire world in any weather condition.

Circling the earth twice a day in very precise orbits, the GPS satellites transmit signal information to the earth. GPS receivers calculate their exact location by receiving and tri-lateraling this signal information. GPS receivers compare the time the signal was transmitted from the satellite with the time of its reception. The difference tells the GPS receiver its distance from the satellite.

After computing the distance measurements from at least two more satellites, the receiver determines its 2-D position and displays it on the electronic map of the unit. That allows it to know its latitude and longitude and to track its movement. If the receiver is able to contact four or more satellites, it can determine its 3-D position – latitude, longitude and altitude. With this information, the GPS unit of the receiver can compute other information such as speed, track, bearing, trip distance, sunrise and sunset time, distance to destination and much more.

The popular single board computer, the RBPi or Raspberry Pi, does not have a GPS receiver built-in. However, you can add a GPS unit to the SBC by plugging in a new HAT from Adafruit. This Hardware Attached on Top board conforms to standard specifications, enabling the board to be identified by the RBPi. Once identified, the SBC configures its GPIO ports and its drivers to suit the attached HAT.

The new HAT has an Ultimate GPS on it and enables the RBPi to know its exact position and time. It fits the RBPi Models A+ or B+. If you slip in a coin cell in the holder provided, it will power its RTC, and the RBPi will keep precise time. As the GPS unit does not take up much space, the HAT has plenty of prototyping area for adding sensors, LEDs and much more.

It must be noted that the GPS HAT uses the hardware UART of the RBPi. Once you are using this HAT, you will be unable to use the Rx/Tx pins of the RBPi for any other purpose. If you plan to use the GPS HAT along with a console, you will have to change the application and use a composite or HDMI monitor and log in with a keyboard. Of course, you can still use ssh to connect to your RBPi over the network.

Adafruit has very informative tutorials for using this HAT. They offer the HAT in a fully assembled condition, with the GPS unit already soldered in along with an unsoldered 2×20 header for sitting on the RBPi GPIO. Once you have soldered in the header, you are all set to connect the GPS HAT on your RBPi. The coin battery is not included in the kit.

The Raspberry Pi Piano HAT

Not only musicians, but children also like to play on pianos. A real piano takes up too much space and is an expensive acquisition, but electronic pianos are affordable and their small size offers a great opportunity for music aficionados to practice at their leisure. Creating a piano with a Raspberry Pi or RBPi, the versatile single board computer, enables the designer to learn to program a computer as well as distinguish nuances in music.

That inspired the 14-year old Zachary Igielman to design PiPiano, and the Piano HAT is based on Zachary’s PiPiano. Where PiPiano is an add-on for the RBPI, the Piano HAT is a full-fledged Hardware Attached on Top board specifically designed for the RBPi.

Hardware Attached on Top or HAT boards sit on the RBPi models B+, conforming to a specific set of rules. HAT boards include a system to allow the RBPi to identify it. Based on the identification, the RBPi automatically configures its GPIO pins and drivers to suit the HAT board.

You can use the Piano HAT with RBPi models 2, B+ and A+. The kit comes in a fully assembled state and has a trove of software examples so that you can start playing music with it immediately as soon as you plug it in. The Piano HAT is completely touch-sensitive and you can use it to play music and generate software synthesizers using Python, control hardware synthesizers or simply be creative.

The Piano HAT kit comes with 16 touch-sensitive buttons, a full octave of 13 piano touch keys, buttons to shift the octave up or down, an instrument cycle button and 16 LEDs. You can let the program play and light up the LEDs auto-magically, or control them with Python.

You can use Python to program the 16 touch-sensitive buttons individually on the Piano HAT. Hook up the buttons to any of your projects and use them as you like. Two dedicated buttons are available to allow you to shift the music scale up or down an octave, offering a chance of expanding your playing horizons.

Using a little Python glue, it is possible to send a patch change event from your RBPi to a synthesizer such as the Yoshimi – the Instrument cycle button allows this. With the 16 LEDs available, you can light up the keys, making the Piano HAT a learn-to-play keyboard. With Python, you can use the LEDs as a visual metronome or allow your child to walk through his or her favorite tune.

The Piano HAT and RBPi combination, with some Python programming thrown in, allows creation of Piano-controlled contraptions. This includes a variety of synthesizers, both hardware and software types. MIDI examples included in the kit let you play music with synthesizers such as the Yoshini, Sunvox and others. The kit also includes a PyGame example that can generate a few octaves of great piano and includes drums as well.

Python on your RBPi allows your Piano HAT to output regular MIDI commands, with which you can use your MIDI adapter over USB to take control of your hardware synthesizer gear.

How do you select a Tactile Switch?

We find tactile switches almost everywhere – on keyboards, on mice, beside the monitor, on TV sets, on set-top boxes, on toys and on mobile phones. These tiny switches give a distinctive feeling when pressed. We are so used to using tactile switches; we press them a dozen times a day and never think twice about them – that is, as long as they work. However, tactile switches can also stop working, and engineers must select tactile switches with great care so they last long. After all, most feel that a bad or nonfunctioning switch equals a bad device.

Therefore, to avoid the possibility of a quality black eye, you must essentially select the right switch. Deciding what it is that exactly makes a tactile switch right of the job, may depend on a host of factors, of which two are most important. One is the actuation force and deflection characteristics necessary to meet the requirements of the application. The other is the reliability with which the switch must work during the life of the host electronic gadget.

Thinking of switches as commodity items selected straight off a datasheet, is an expensive mistake that many engineers do make. In reality, picking a durable switch with the right feel does require somewhat more than a mere glance at its specifications. Here is what you should be looking for.

Click ratio

The click ratio of a switch expresses the relationship of its actuation and contact forces. A higher click ratio is indicative of a snappier or crisper switch feel. The deflection or travel distance of a pressed switch also contributes to its overall feel.

A typical datasheet holds the force and travel specifications and these can be a starting point for selecting a switch that feels just right in its intended application. However, the ideal switch depends on the application – an important thing to remember.

For example, users of portable consumer electronic devices prefer crisp tactile switches that have a relatively high click ratio and shorter travel distances. On the other hand, tactile switches for the automotive industry need lower click ratios and longer travel distances. This prevents accidental actuation while driving. Therefore, each electronic application needs to reach a unique balance between the travel distance and the actuation forces.

Sealing

Consumer electronics and medical applications need tactile switches that are protected against ingress of liquids and other contaminants – IP 67. Usually, these sealed tactile switches reach their maximum lifecycle, because of the sealing.

Manufacturers have traditionally used a bonded silicone membrane to seal the innards of a tactile switch. Now, technologically improved IP67 rated tactile switches use a patented laser welding process that seals the switch with a thin nylon film. This goes over the actuator rather than under it, giving a better seal. The seal not only preserves the crisp feel, but also protects the switch against side loads.

Reliability

Protecting the switch with the nylon film improves its inherent reliability by not allowing ingress of contaminants. The best switches will typically offer a life expectancy of above one million press-and-release cycles.

How do AC Current Sensors Work?

You can sense current using a series resistor and measuring the voltage drop across it. According to Ohm’s law, the current through the resistor is then the voltage drop divided by the resistance value. That makes the voltage drop proportional to the value of the resistance and the current flowing through it. The disadvantage is obvious – to prevent the voltage drop from affecting the circuit parameters, one needs a very low value resistor when the current involved is high. Additionally, as the current reduces, so does the voltage drop. That involves amplification of the voltage drop, creating additional circuit complexity.

Ideally, current sensors should not use any power when detecting the current in the circuit. However, real current sensors do require a part of the energy from the circuit for providing the information. For sensing AC currents, current sense transformers are typically useful. A single wire from the circuit acts as the primary of the transformer or the primary may be a single turn winding on the transformer.

The AC current sense transformer develops a current in the secondary, proportional to the sensed primary current. The secondary current is allowed to flow through the terminating resistor to produce an output voltage. As the turns ratio of the transformer decides the secondary current, a low turns ratio (pri/sec << 1) minimizes the current through the terminating resistor. A balance of the transformer ratio and low-enough current through the terminating resistor ensures adequate output voltage. You select the appropriate AC current sensor based on the frequency range and current rating of the sensor for the conditions of your application. The highest flux density to prevent saturation of the sensor core will then depend on the worst-case current and frequency conditions in the circuit. The requirement is to generate a voltage output from the sensor that will vary linearly with the current being sensed. If the core saturates, the output becomes non-linear, and the output voltage is no longer strictly a representative of the input current. Sensors come in surface mount or through hole types, with different turns ration and overall dimensions. As noted earlier, you can have a sensor only type, which has a conductor integral to the application serving as the primary. The other is a current transformer type, where the primary is an included winding. Current transformer manufacturers offer online selection tools for selecting the right current sensor for the specific application. Initially, the user selects either an SMT sensor or a leaded type of sensor. The tool then requires the user to input the maximum sensed current expected, the input frequency, the duty cycle of the primary current waveform and the desired output voltage. The output voltage being the desired output voltage for the maximum input current the user expects. Based on the maximum input current, the number of secondary turns and the output voltage necessary, the tool suggests the required terminating resistor value. For this calculation, the tool assumes a single-turn primary. The tool also provides the maximum flux density based on the above parameters and the maximum operating frequency, making sure the value does not exceed 2K Gauss to ensure linearity.

Different Types of E-Bike Motors

The major difference between electric bikes is the various types of drive systems they use. These include shaft drives, mid-drives, geared and gearless hubs. In addition, there are differences between the motors, chiefly brushed and brushless. Therefore, if you are looking for an e-bike for a specific use, this article will help you to understand and focus on finding the right one.

The shaft drive

This system works more like the arrangement in an automobile, with the motor positioned more towards the center of the bike and driving the rear wheel with a shaft. These are not popular nowadays, because of the customized frames required to support the motor and shaft. The entire arrangement is awkward and difficult to service.

A mid-drive motor

Mid-drive motor systems are used in e-bikes meant for climbing. You will find this design close to the bottom bracket, at the point near the pedals. The system drives the chain forward rather than the wheel, benefitting from mechanical drivetrain systems such as use of gears for going fast or for climbing. Therefore, when approaching a hill, the rider can shift to a lower gear, making it easier to pedal and climb.

The geared hub motor

There are two types of hub motors – geared and gearless. The geared hub motor provides mechanical advantage with smaller and lightweight motors. However, they also produce more friction and hence more noise and wear out faster. A built-in flywheel mechanism unlatches the shaft from the axle while the rider is coasting, preventing addition of any resistance.

The gearless hub motor

The simplicity of the gearless hub motor delivers smooth and quiet performance, much eulogized by shops selling e-bikes. These motors rely greatly on electromagnets and most do not even include a freewheel mechanism. That may be due to the extremely low magnetic resistance to be overcome when the electromagnets are powered off. Usually, such motors are also called direct drive systems, enabling regeneration of electricity from repelling magnets within the motor.

Gearless hub motors are generally larger than other types, because they need to accommodate magnets, ultimately making them weigh more. However, improvements in technology are helping to produce small and lightweight direct drive hub motors nowadays.

Hub motors usually operate even when the rider is not pedaling. Whether geared or gearless, the system can fit in the rear or the front wheel. However, with increased unsprung weight, hub motors can experience reduced traction, limited efficiency and strain the spokes and rims of the wheel.

The drive system you select will affect the overall weight and weight-distribution of your electric bike. The cost will depend on whether you need a customized frame, regeneration and special sensors for shifting gears. Motorized e-bikes provide improved efficiency, help in riding fast, in climbing and in navigating bumps. For lightweight around-the-town transportation, geared hub motors are fine. If you like quieter rides with more power and regenerative braking, go for direct drive hub motors. However, if you ride your bike more in the mountains and do lots of hill climbing, you definitely need mid drive motors.

Extracting Precious Metals from Discarded Electronics

Scientists at the University of York have worked out an innovative technology to recover precious metals like gold, silver and others from electronic gadgets that users have disposed. The technique involves the use of a gel to draw the metals from the waste and change them into nanoparticles that are conducting in nature. Eventually, these are transformed to make up a hybrid nanomaterial, which can be adapted for use in various new electronic applications.

Many of the electronic gadgets that are thrust aside by users when they are not suitable for usage contain small amounts of gold, silver and several other expensive metals. Though these metals are present in minute quantities in each of the devices, the abundance of electronics cast off every year makes for a significant amount that can be collected by efficient extraction techniques.

Self-assembling gels derived from simple sugars

Professor David Smith of the university teamed up with a PhD student Babatunde Okesola to derive a gel from sorbitol, a type of sugar alcohol that is popular as a low calorie sweetener in food and pharmaceutical industries. Being hygroscopic or water absorbing nature, sorbitol finds use in certain other applications, too. Hydrogenation of glucose can produce sorbitol commercially, as it is present in several fruits.

Sindhu Suravaram and Dr. Alison Parker of the Department of Chemistry assisted in the research, the results of which they published in Angewandte Chemie.

Selective removal

Sorbitol’s hygroscopic property allows it to form a gel easily on contact with the water vapor in the atmospheric air. The gel structure allows the precious metals to adhere to the surface so that they can be removed with ease. Furthermore, the stable nature and anti crystallizing properties of the gel makes it an ideal material for extracting the metals. The scientists found that the sorbitol-based gel could draw out these elements from intricate structures deep within the gadgets. Amazingly enough, the researchers found that the gel appeared to have an affinity for these metals, which allowed for the extraction of these valuable elements from among various other substances. This selective separation makes the extraction process cost effective.

Additional benefits

The researchers discovered that apart from recovering the precious metals from the electronic devices, the Nano fibers within the gel convert the metals into nanoparticles over a period. These minute particles implanted within the gel make it electrically conducting.

Okesola explains that since gels add in the properties of both liquids and solids, they can be used to bridge the gap between hard word of electronics and the soft world of biology. This interface could be exploited in future electronics and other technologies. In fact, the researchers are currently working on techniques to produce renewable energy from bacteria using the conducting gel nanoparticles.

The researchers also hope to utilize these conducting sorbitol gels in more ambitious projects involving the integration of biological organisms and electronics through the concept of cybernetics. One can loosely define cybernetics as the science of communication and control between animal and machine worlds. Cybernetics can throw light on various puzzling facts in nature.

What are Wearable PCBs Made of?

The Internet of Things market is growing at a tremendous speed. Among them, wearables represent a sizeable portion. However, there are no standards governing the small size PCBs or Printed Circuit Boards for these wearables. The unique challenges emerging in these areas require newer board level development and manufacturing experiences. Of these, three areas demand specific attention – surface material of the boards, RF or microwave design and RF transmission lines.

Surface material of the boards

PCB materials are typically composed of laminates. These can be made of FR4, which is actually fiber-reinforced epoxy, of polyamide, Rogers’s materials of laminates, with pre-preg as the insulation between different layers.

It is usual for wearables to demand a high degree of reliability. Although FR4 is the most cost-effective material for fabricating PCBs, reliability is one issue the PCB designer must confront when going for a more expensive or advanced material.

For example, with applications requiring high-speed and high frequency operation, FR4 may not be the best answer. While FR4 has a Dk or dielectric constant of 4.5, the more advanced Rogers series materials can have a Dk of 3.55-3.66. The designer may opt for a stack of multilayer board with FR4 material making up the inner cores and Rogers material on the outer periphery.

You can think of the Dk of a laminate as the capacitance between a pair of conductors on the laminate, as against the same pair of conductors in a vacuum. Since there must be very little loss at high frequencies, the lower Dk of 3.66 for a Rogers’s material is more desirable for high frequency circuits, when compared to FR4, which has a Dk of 4.5.

Typical wearable devices have a layer count between four and eight. With eight layer PCBs, the layer structuring offers enough ground and power planes to sandwich the routing layers. That reduces the ripple effect in crosstalk to a minimum, while significantly lowering the EMI or electromagnetic interference. For RF subsystems, the solid ground plane is necessarily placed right next to the power distribution layer. This arrangement reduces crosstalk and system noise generation to a minimum.

Issues related to fabrication

Tighter impedance control is an important factor for wearable PCBs. This results in cleaner signal propagation. With today’s high frequency, high-speed circuitry, the older standard of +/-10% tolerance no longer holds good and signal-carrying traces are now built to tolerances of +/-7%, +/-5% or even lower. This influences the fabrication of wearable PCBs negatively, as only a limited number of fabrication shops can build such PCBs.

High-frequency material such as Rogers require to have a +/-2% of Dk tolerance and +/-1% is also a common figure. In contrast, for FR4 laminates it is customary to have Dk tolerances of +/-10%. Therefore, Rogers’s material presents far lower insertion losses when compared to FR4 laminates.
In most cases, low cost is an essential factor. Although Rogers’s material offers low-losses with high-frequency performance at reasonable costs, commercial applications commonly use hybrid PCBs with FR4 layers sandwiched between Rogers’s material. For RF/microwave circuits, designers tend to favor the Rogers’s material over FR4 laminates, because of their better high-frequency performance.