Author Archives: Andi

Focus Stacking with the Raspberry Pi

If you are into photography, a flatbed scanner and the popular single board computer, the Raspberry Pi or RBPi, can help you to focus stacking images in macro photography. After re-purposing an old flatbed scanner, David Hunt is using it as a macro-rail controlled by the SBC, RBPi.

Those who shoot macro photography are aware of the common issue of depth of focus limitation that shows up as the depth of field limitation in the photograph. Depending on the magnification you are trying to achieve and the camera settings, the depth of focus can be as small as 0.5mm. One solution is to stack together several images of a subject, with each image focusing on a different part of the object.

To do this with commercial solutions may set you back by as much as $600. The difficulty lies in moving the camera closer to the subject in extremely small increments, but with great accuracy. The sharp parts of the images are combined together using free software such as CombineZM, resulting in a completely sharp image of the subject right from front to back.

David Hunt decided to solve the problem with an old flatbed scanner that was lying in his attic gathering dust. Capable of 2400 dpi, the scanner had not been used for over a couple of years.

Even the drivers available for it worked only on Windows XP. Although accurate enough, David was doubtful if the machine would be capable of moving a 3Kg camera and lens combination. He decided to use the stepper motor and drive the scan element in very small increments, with the camera attached to it – it would be ideal for macro photography.

Scanners typically come with a nice flat platform on which a camera can be placed. Driving the platform forward and back requires a stepper motor that has its own drive electronics and has to be driven externally. The drive is slow, so it will let the camera remain steady while it moves. A camera with a shutter release mechanism will be useful, as you will have to take a number of snaps.

H-bridge stepper motor drives are efficient and easy to use. David used a drive capable of handling 2 DC motors or 1 stepper motor with two coils. For powering the motors and the drive, David used 3x AA type batteries. Therefore, he was able to connect four GPIO pins from the RBPi to control the drive and the motor. However, driving the motor through opto-couplers would have provided more safety for the RBPi.

The binary sequence of 1000, 0100, 0010 and 0001, when repeated, will drive the motor forward one-step at a time. The same sequence, repeated in reverse, will allow the motor to move back one-step at a time. David programmed the RBPi to generate these sequences repeatedly while he added an additional circuit for releasing the camera shutter between each movement of the platform.

With the above contraption, David can move his camera forward towards the subject in the smallest increments of 0.02mm, and take images at each increment.

Different Types of Interface Pressure Measurement Techniques

Precise measurement of interface pressure and force between two surfaces is always a challenge to engineers. However, several specific technologies exist for sensors dealing with interface force and pressure. Parameters such as form factor, precision and environment influence the selection and capabilities of such sensors.

A variety of applications requires measurement of pressure. These range from product development to medical research. Typically, pressure is the measurement of applied force over an area. With two objects held in contact, both exert force on the other. Therefore, the average interface pressure is the total force divided over the interface area. However, this interface pressure may not be distributed uniformly, creating the necessity of measuring localized interface pressure.

For measuring the force or interface pressure, chiefly three technologies are considered suitable – load cells, pressure indicating films and tactile pressure mapping systems. Although each sensing technology has some overlapping information, they all provide unique values when solving problems. Additionally, as the shape of the target becomes increasingly uneven, the ability of the sensor to match the overlap with the surfaces applying the force also becomes critical.

Load Cell

A load cell is the most common force or pressure sensor with which most engineers are familiar. The load cell has many varieties, the most useful being strain gages, piezo-electric elements and variable capacitance. Load cells may be utilized in multiple form factors depending on the force applied and the mechanics of the application. For example, measuring the deformation of a beam for qualifying the force of the load applied relies on load cells. Such compression, S- or Z-beam and shear beam load cells are all dependent on strain gages. Most reliable load cells utilize a full bridge of strain gages bonded on to the load-bearing structures.Force applied to the load cell deforms the structure and places a mechanical stress on the strain gages. This changes the resistance of the strain gages affecting their output signal. With calibration, the output voltage can correlate to the force applied on the load.

Pressure Indicating Film

These are useful when measuring interface pressure between two surfaces. A layer of polyester hides a color developing material layered next to tiny microcapsules containing staining ink. These microcapsules are designed to break under different pressures. With pressure applied to the film, the microcapsules rupture. This distributes the ink at the places where the pressure is applied. With more force being applied to a location, more microcapsules rupture increasing the intensity of color on the film. This gives an image of the force applied across the sensing area. Films are available for different sensitivities of pressure.

Tactile Pressure Sensor

Tactile pressure sensors are made of piezo-electric material. Two pieces of flexible polyester with printed silver conductors on each piece sandwich a unique piezo-resistive ink. The result is an extremely thin sensor, about a tenth of a millimeter thick. A signal is transmitted via the silver electrodes through the piezo-resistive ink. As pressure increases on the sensing area, the resistance of the ink changes and the data collected maps the pressure applied.

Different Types of Feedback Encoders

All closed loop systems use feedback to control speed and or position. This plays an important role in keeping equipment operating accurately and smoothly. When using feedback for the best benefits in an application, it is important to understand how feedback works, because a variety of devices as well as models is available for the purpose. The most popular among them are tachometers, Hall sensors, encoders and resolvers.

Tachometers
Tachometers are rotating electromagnetic devices. Typically, these are connected to the shaft of a motor, rotating when the shaft rotates and generating a voltage as a signal. The faster a tachometer shaft rotates, the larger is the magnitude of the voltage output. Therefore, the output signal is directly proportional to the speed of the motor shaft. The polarity of the output voltage indicates the direction of rotation, clockwise or counter clockwise.

Usually, analog or DC tachometers provide direction and speed information. When fed to a meter, this information can be used in servo control for stabilization. DC tachometers are the simplest of feedback encoders.

Hall Sensors
Hall sensors are solid-state electronic devices and they can sense or detect magnetic fields. The output of the sensor changes or flips whenever a magnet comes close to a Hall sensor. Therefore, a Hall sensor provides a digital output as either a high or a low voltage.

Hall sensors are used for brushless motor applications, providing information about rotor position. This works as an electronic commutation, with the controller using the information to turn on or off specific power devices applying power to the stator windings.

Encoders
Encoders are simple mechanical-to-electrical conversion devices and turn mechanical rotary motion into velocity or position information for systems controlling motion. Encoders can be rotary, digital, optical or incremental types.

In its most basic form, and encoder consists of a light source, a mask, a coded disk and a photo sensor along with related electronics. After passing through the mask and the coded disk, light from the source is detected by the sensor. As the encoder shaft rotates, light is alternately passed through or blocked, making an alternating light and dark pattern.

The associated electronics converts this into an electrical signal representing high or low corresponding to light passing through or being blocked. The resolution desired for the application governs the number of lines etched on the coded disk. By counting the number of pulses, the position of the shaft relative to its starting position is known.

There are two types of encoders, classified as incremental and absolute. Absolute encoders generate a specific address for each shaft position throughout the 360-degree rotation of the shaft.

Free Your Smart Phone and Let it Fly

You may not feel very enthusiastic about Lily, the flying camera-drone that follows you around, but a PhoneDrone is bound to change your point of view. Using your smartphone as its brains, the PhoneDrone lends it wings and allows it to fly along a predetermined path.

This is a perfectly logical situation as a smartphone already contains the necessary sensory and computing power that a drone needs. Most smartphones run on a powerful multicore processor along with several sensors on-board, so why pay for all these things over again when buying a drone. The people at PhoneDrone were also led by the same reasoning and the result is a drone that utilizes its owner’s smartphone for its brains. Users have to dock their phone into the device for each use. Not only does this approach help to keep the price down, it also makes the user exercise caution not to crash the thing.

The Indiana-based company, xCraft, has designed the PhoneDrone, which can accommodate not only iPhones 4s and above, but also the most popular Android phones as well. This same company had earlier produced the fixed-wing/hovering X PlusOne drone. Users can fly the latest PhoneDrone, a quadcopter, in a few different fashions.

By using another mobile device, users can control their flying mobile through Wi-Fi and at the same time, watch live streaming video from the camera on the PhoneDrone. A free app allows users to enter a flight path for the PhoneDrone to follow autonomously. When transporting the device, the propeller arms of the PhoneDrone will fold back.

The user can also impose a follow-me mode with the second mobile device, if required. The phone in the aircraft locks on to the signal of the hand-held device and will automatically pilot the drone to position it above the hand-held device as it moves. A folding mirror on the drone allows the camera of the phone to shoot straight ahead, down or anywhere in between. The battery in the drone gives a flight time of 20-25 minutes. According to xCraft, they are working on an ultrasonic type of collision-avoidance system.

At present, xCraft is raising product funds via Kickstarter for their PhoneDrone project. You can pledge US$199 for the product, which will be yours as soon as xCraft is ready to go.

Others have also tried their hands at making drones with brains based on smartphones. Notable among them are the University of Pennsylvania and the Vienna University of Technology. However, their attempts were mostly one-off. Qualcomm and UPenn have also combined the drone and phone earlier. They had used the electronics of the Android smartphone and its software to fly the drone. All the sensors required for providing navigational information for the drone are already present on the smartphone – accelerometer, GPS, gyroscope and others.

The present trend is to utilize the camera on the phone itself and use its visual input to steer the phone. The user has to install an app on the phone to achieve this. In future, expect more hobbyists to substitute smartphones for hardware at the heart of several other types of machinery such as drones.

ArdHat for Connecting Raspberry Pi to the Real World

Many users of the tiny, inexpensive, Linux-based single board computer, the Raspberry Pi or RBPi, would like to connect it to the outside world, but do not know how. According to Maker Jonathan Peace, ArdHat is most suitable for connecting the barebones Unix platform to the real world. Therefore, he calls it the “missing link that connects the Raspberry Pi with the real world.”

Onboard the ArdHat is an Arduino-compatible embedded MCU, the ATmega328P. Its specialty is very quick response to all real-time events, allowing the RBPi to take care of the rest of the heavy lifting. HATs or Hardware Attached on Tops are most suitable for the RBPi Model B+. These HATs conform to specified standards and make life easier for users. One significant feature of HATs is an onboard system to allow the RBPi B+ identify the connected HAT and automatically configure its GPIOs and drivers for the plugged-in board.

Real-world systems need low-power operation, real-time performance and environmental protection and awareness, all of which the ArdHat provides. As a super-compact RBPi compatible HAT, the ArdHat enhances and protects the RBPi for applications in the real world, while being accessible to everyone possessing an Arduino.

You can have the ArdHat in four different models – two with long-range radio modules and the other two without the radio. All four are packed with analog sensors, user interface controls, a real-time clock, 5V Arduino shield capability, supply monitoring, a wide operating range of voltages that includes automotive, full power/sleep management and high current outputs for driving peripherals. All these are accessible from the AVR chip on-board the ArdHat or the RBPi.

Those looking for more power can also choose between the ArdHat-W and the ArdHat-I. The first has a 15Km long-range ISM wireless node, while the latter has a 10-DOF inertial measurement unit. Both make the boards ready for IoT right out of the box.

Apart from a flat top design that allows plenty of space for placing a battery or a prototyping board, the ArdHats accept several Arduino shields. Users can also buy an optional high-capacity 1800mAh battery, especially tailored to plug-in directly into the JST standard connector. The whole arrangement fits snugly between the shield headers of the board’s flat top design.

Among the smart power management feature of the ArdHat is a power switch and charge control. That allows the RBPi to run on several types of power supplies, including LiPo batteries to automotive supplies. Therefore, the HAT can simply connect to systems operating on 5V and drive them – smart LEDs, quadcopters and servos.

Other than protecting the RBPi from external power outages and voltage spikes, the TopHat enclosure offers a physical safeguard as well. Made of laser-cut Perspex, the enclosure allows access to pins of the Arduino shield for teaching and experimental purposes. At the same time, the enclosure protects the delicate circuitry of the RBPi circuit board.

The scheduler and applications for the ArdHat are entirely open-source. Using the Arduino IDE, users can modify and update even the preloaded sketch of the real-time software on the ArdHat.

An Explorer HAT Pro for the Raspberry Pi

If you are looking for a HAT or Hardware Attatched on Top for your Raspberry Pi (RBPi) that has motor and touchscreen drivers, integrated sensors and interfaces with 5V devices, the Explorer HAT is for you. Standard add-on board HATs allow the Linux-ready SBC, the RBPi, to configure its GPIO signals and drivers to control and use external devices.

Pimoroni has two models of HATs for the RBPi – the Explorer HAT and the Explorer HAT Pro. They support the HAT standard set by the Raspberry Pi Foundation, matching requirements for the RBPi 2 Model B, including the first-generation Model B+ and Model A+ boards as well.

To integrate inputs from 5V Trinkets or Arduino boards, the Explorer HAT offers four buffered 5V inputs. In addition, four powered 5V outputs on the board can supply 500mA to drive stepper motors, relays and or solenoids. The Explorer HAT also has a mini-breadboard, four capacitive touchpads, four LEDs and four capacitive alligator clips.

In addition to all the above features of the Explorer HAT, the Explorer HAT Pro has analog inputs and two motor drivers in H-bridge configuration to drive micro-metal geared motors and similar. The Explorer HAT Pro also comes with plenty of 3v3 features from the GPIO. However, these are unprotected.

According to the specifications defined for the Explorer HAT, each board has four inputs each 5V tolerant including 5-channel buffers with 2-5V support. There are four 5V powered Darlington-array outputs capable of 500mA per channel, limited to 1A total. The front edge of the board has four capacitive touch pads along with four LEDs, controlled independently. Including the mini-breadboard, the dimensions of the Explorer HAT are 65x56x13mm.

The Explorer HAT Pro version adds four analog inputs including two bi-directional motor drive outputs of the H-bridge type capable of handling 200mA per channel. It supports soft-PWM for full speed control. Additionally, there are the unprotected 3V3 GPIO features.

Compared to the Pibrella, another board made by Pimoroni, both the Explorer HAT and the Explorer HAT Pro share many similarities, but also add a lot more besides. For example, the analog and digital inputs are a great help, especially since you can connect inexpensive and simple sensors such as the TMP36, while taking advantage of the built-in ADC.

The capacitive touch buttons of the Explorer HAT not only allow interfacing with connected components, but also allow independent working. For example, you can send a tweet, an email or a text message by simply tapping one of the buttons. There are many other possibilities with these capacitive touch buttons. You can connect crocodile clips and brass contacts for using fruits as buttons. Of course, the software will have to be tweaked somewhat to get the proper sensitivity.

Plugging HATs on the RBPi invariably causes loss of access to some GPIO pins. The Explorer HAT breaks out the most useful pins from the GPIO, making them easily accessible. Pimoroni provides intuitive Python libraries and a built-in tutorial for all to use.
Overall, both the Explorer HAT boards are a great value for money not only for kids playing and learning to interface with the RBPi, but also for grown-ups.

All about electrical wires

Recent advancements in wireless technology may have led many people to believe that soon, we would be able to do away with these squiggly, snaking, long implements we call wires. However hard we may try to hide them by burying them within walls and under the ground, the time is not yet ripe for a life entirely without wires. While we have to put up with wires all around us, it would be interesting to know something more about them.

Use of wires can be broadly categorized into two main classes of requirements – mechanical and electrical. While the mechanical requirements deal mainly with load carrying strength/capacity of the wire under use, the electrical requirements can be further subdivided into power and signal carrying capabilities. In this article, we will be talk about wires and their electrical requirements only. The materials with which wires are made, their dimensions and the nature of protection used depends to a large extent on whether the wire is required to carry power or signal.

Most wires within our houses and those carrying power are made of copper. Conductivity, malleability and cost are the main considerations that govern the choice. Copper is a good conductor of electricity, meaning it presents a low resistance to the flow of electricity through it. The metal is easy to bend and mold in the form of wires of different diameters. Since copper is abundantly available, the price is reasonable for residential use. Some wires are made of aluminum, which is cheaper than copper. However, its conductivity is lower than that of copper. For carrying the same amount of electricity, you need an aluminum wire with a larger diameter compared to that of a copper wire.

The nature of protection used on wires carrying electrical power depends on the voltage it is carrying and the environment in which the wire is used. For example, special cladding and fire-retardant protection is required for wires carrying high voltage electricity passing through an area with plenty of oil.

Compared to power handling wires, signal-carrying wires are of more varied types, depending on the application. For example, there can be connecting wires, RF coaxial feeders, screened cables, ribbon cables, data cables and many more. For most of these applications, the governing factor is the frequency of the signal rather than the voltage and current carrying capacity. Waveform distortion, crosstalk, noise and signal loss are more important rather than the amount of power transferred.

As long as the signal frequency is low, say below 1000 Hz or so, the material or construction of the wire does not matter greatly. However, as the frequency of the signal increases, the wire starts to behave like a non-linear entity and its inherent inductance and capacitance start to cloud its performance. With still higher frequencies, the signal is unable to retain its original waveform. To retain the high-frequency performance, people need to use special types of RF coaxial feeders, ribbon cables, screened cables, etc.

For example, to prevent loss of signal in screened cables, a low-loss insulator often surrounds the wire conductor. A braided sheath on the outside of the insulator acts as a shield and a PVC jacket protects the entire package.

A drone camera to follow you around

Unlike Mary, most of us are fortunate or unfortunate enough not to have a little lamb following us around. However, that does not mean we cannot have a camera drone following us wherever we go. A California-based startup firm has pioneered an easy-to-use, self-flying drone as the world’s unique throw-and-shoot camera that flies itself.

To use the device, you simply throw it into air. Lily, the drone camera, immediately deploys its four propellers to provide thrust and directional vectoring. No controller is required as Lily automatically follows its owner. You are free to continue to focus on your activity as Lily captures your adventures, flying itself while grabbing high definition images and video. It is impossible for you to outrun Lily, because it can fly at speeds of up to 25 mph. Therefore, you can employ Lily to film you while snowboarding, kayaking or cycling.

The camera inside Lily is specially engineered to withstand robust handling in tough aerial as well as water environments. Anyone who wants to share their everyday activities can use Lily as a simple, fun way to record their outdoor action sports. Lily can track its owner intelligently, following his or her every move by using GPS and advanced computing algorithms. Lily can provide additional creative shooting opportunities for those wanting to move beyond the single point-of-view of handheld and action cameras.

What makes Lily follow you around and not wander off with some stranger? Well, Lily comes with a tracking device that the owner has to wear on his or her wrist. In reality, Lily is wirelessly tethered to this tracking device, while recognizing the owner using computer vision to follow your features optically. Over time, the tracking accuracy improves as Lily learns on-the-job. With Lily, you can get exciting close-range photos as well as wide, cinematic shots just as professional filmmakers can.

Lily captures still shots at 12MP resolution, slow motion at 720p at 120fps and HD video at 1080p at 60fps. The tracking device uses a built-in microphone for recording high-quality sound, which Lily automatically synchronizes with the video being recorded. Lily has a companion app to which it streams low-resolution live video. This helps the user to frame the shots.

Lily works best in outdoor conditions at a height of 10-30ft. A proprietary computer vision algorithm drives the core technology of Lily’s camera. Although Lily works comfortably in winds exceeding 20mph, the manufacturer advices its use in winds below 15mph, to be safe.

Lily complies with FAA guidelines, while communicating with the tracking device worn by its owner. It relays speed, distance and position back to the built-in camera. The user can direct Lily via either the tracking device or the mobile app. According to the program used, Lily can follow, hover, loop, zoom and do more at an average flying speed of 15 mph. Depending on the way Lily’s owner uses it, a full charge allows Lily to operate between 18 and 22 minutes.

It takes two full hours to charge up fully. As the battery runs low, the tracking device warns you with vibrations. You can summon Lily to make it land on your palm gracefully.

What are Counterfeit SD Cards?

Many of us use SD or Secure Digital memory cards, but seldom do we check if the total capacity actually matches that specified on the card. According to the Counterfeit Report, several dishonest sellers on Alibaba, Amazon, eBay and other reputed sites offer deep discounts for high capacity cards. They use common serial numbers with cards and packaging nearly identical to the authentic products from all major SD card brands.

According to tests conducted by the Counterfeit Report, although the cards work, buyers usually purchase a card based on the specifications printed on it. What they think and buy as a 32GB SD card, may turn out to be a counterfeit with a capacity of only 7GB. Counterfeiters usually overwrite the real memory capacity, imprinting a false capacity figure to match any model and capacity they prefer. Usually, the actual memory capacity cannot be determined by simply plugging the card into a computer, phone or camera. Only when the phony card reaches its limit, it starts to overwrite files, leading to lost data.

According the Craig Crosby, publisher of the Counterfeit Report, such fake cards also come in capacities that do not exist in any product line and counterfeiters target mostly cards above 32GB. They make a great profit on selling fake cards, with practically no consequence.

Usually, people cannot make out counterfeit cards from real ones, until these stop working. Usually, the blame falls on the manufacturer for making faulty products. This may happen even if you buy from a major retailer, as counterfeiters buy genuine items, only to exchange them unopened with their fakes.

Although software packages are available to test whether the card capacity matches the specifications on its packaging, organizations find it time-consuming, especially if they have bought cards in bulk. Additionally, the problem is not with SD cards alone, counterfeiters make fake portable flash drives including USB sticks as well.

Although the SD Association does make standards and specifications for SD cards to promote their adoption, advancement and use, they do not monitor the trade of products such as SD memory cards. The responsibility of counterfeit SD cards falls in the realm of law enforcement.

Manufacturers of SD memory card products can contract with several SD standards-related organizations for different intellectual property related to SD standards. Additionally, SDA member companies can resort to compliance and testing tools for confirming their products meet the standards and specifications, providing assurance to users about interoperability with other products of similar nature.

Consumers, especially bulk purchasers, should be careful to buy from authorized resellers, distributors and sellers. The best resource for any enquiry is the manufacturer of the SD memory card product.

This malaise is not restricted to counterfeit SD cards alone. It is a part of a larger problem. According to the Counterfeit Report, several other items face the same situation. Phony items exist for iPhones, other smartphones, airbags and many other peripherals such as chargers. It is very difficult for consumers to make out the counterfeits and many are even unaware of the existence of such phony high-end items.

Energy Monitoring with the Raspberry Pi

If you are looking for an all-in-one device for monitoring your home energy needs, a low-cost single board computer such as the RBPi or Raspberry Pi along with an add-on shield is all you need. The emonPi board is a low-cost shield that is bereft of any enclosure, HDD and LCD.

However, when connected with an LCD for status display, hard-drive for local logging and backup and a web-connected RBPi, the emonPi makes a high-quality and robust unit. Enclose it in a suitable enclosure and you have a stand-alone energy monitoring station.

The design of the emonPi allows it to be a perfect fit for those who install heat-pump monitoring systems. Usually, these systems require several temperature sensors that must also be wired up along with power monitoring. Accompanying modules offer a myriad of options.

For example, the emonPi can also act as an emonBase, as it has options for radio (RFM12B/RFM69CW) to receive data from other wireless nodes. These nodes include emonTH, for measuring room temperature and humidity. Another energy-monitoring node, the emonTX V3 can send the current time to the LCD, emonGLCD.

The status LCD makes it easy to install, setup and debug the emonPi system as an energy monitor sensing mode and an all-in-one remote posting base station. This makes the emonPi a great tool for remote administration, since, with a proper networking configuration the RBPi can be accessed remotely. Thus, you may check its log files and even upload firmware onto the ATmega328 of the emonPi.

The emonPi monitors energy through a two-channel CT or current transformer along with an AC sample input. It can power up the RBPi and an external hard disk drive without using an external USB hub. Additionally, the emonPi can function even without a hard disk drive being connected to it.

The RJ45 breakout board makes it very easy to attach several temperature sensors to the RJ45 on-wire temperature bus provided by a DS18B20. This is eminently suitable for multi-sensor setups such as in heat pump monitoring applications. The RJ45 also has IRW and PWM I/Os.

The emonPi is compatible to all models of the RBPi and its options for RFM21B and RFM69CW along with an SMA antenna makes it capable of receiving or transmitting data from other sensor nodes. One can control remote plugs with the OOK or On-Off keying transmitter.

All hardware, firmware and software are open-source and the ATmega328 on the emonPi can remotely upload sketches via the serial port of the RBPi. However, compared to the emonTX V3, emonPi has some disadvantages.

The emonPi module is not capable of making measurements on three-phase systems as there is only one CT monitoring two channels. As the RBPi has high power requirements, it is not possible to power the emonPi from batteries. You cannot also use an AC-AC adapter, because, for measuring real power, you must use both a 5VDC and a 9VAC adapter. Remote location of the utility meter requires Ethernet connection or Wi-Fi connectivity. Additionally, the emonPi requires a larger enclosure as compared to what an emonTX V3 uses.