Tag Archives: hardware

Searching for USB Power Supplies that Won’t Explode

via hardware – Hackaday

USB power supplies are super cheap and omnipresent. They are the Tribble of my household. But they’re not all created equal, and some of them may even be dangerous. I had to source USB power supplies for a product, and it wasn’t easy. But the upside is that I got to tear them all apart and check out their designs.

In order to be legitimate, it’s nice (but not legally required) for a power supply to have UL approval. Some retailers and offices and building managers require it, and some insurance companies may not pay claims if it turns out the damage was caused by a non-UL-approved device.  UL approval is not an easy process, though, and it is time consuming and expensive. The good news is that if you are developing a low voltage DC product, you can pair it with a UL approved power supply and you’re good to go without any further testing necessary.

power_supply_1_overviewIf you are going for FCC approval and are having unintentional emissions testing done (which is more likely than UL as it’s a legal requirement for products that meet certain qualifications), the testing has to be done on the whole solution, so the power supply must be included in the testing, too.

Sourcing cheap electronics in large quantities usually ends up in China, and specifically Alibaba. First, we started with a how-low-can-you-go solution. This wasn’t even a power adapter; it was a power “adapteP”, and the whole batch was mis-printed. Quality control could not be a high priority. After cutting it open, it wasn’t terrible, and it had all the necessary parts. It was surprising how much of it was through-hole, which indicates that the assembly was done mostly by people. That happens when factories are cheaper, hire inexpensive labor, don’t invest in technology, and don’t care as much about quality.

There are certain things you should look for in a power supply to determine the level of risk:

  • Isolation Distance – This is how much space there is between the primary (AC) and secondary (DC 5V) sides. UL requires a few millimeters, and often you’ll see two separate PCBs. On many single-PCB solutions you’ll see a white line meander across the board to distinguish between the two. The smaller this separation, the closer your USB power is to AC line voltage, and if the gap is bridged somehow, you’re in for a world of hurt.
  • Fuse – if there is a short, a lot of current starts flowing, components heat up, and things get dangerous. A thermal cut-off (TCO) fuse (also known as a resettable fuse or a PTC) is a component that breaks the circuit when it gets too hot, like a circuit chaperon. When it cools off, the TCO resets and you can plug the device back in with no harm done. Without the fuse, the supply heats up and current keeps flowing until a component fries, sometimes explosively.
  • Connectors – You don’t want bare leads hanging out in space where they could move and touch something. You don’t want the USB port to be soldered only by its four pins. You don’t want the power pins to be loose.
  • Decent Label – “Adaptep”? Yes, to someone who uses a different alphabet the “P” and R are very similar characters. But still. Also, fake certifications abound. Look for the difference between the CE (China Export) and the CE (Communite Europeanne) labels. And the UL Logo should have a number. So should an FCC label.

So this first adapter? Isolation distance was fine because it was two separate boards, but there was no fuse and no protective tape between components. The connectors were all secure, but the label didn’t make any promises. As for performance, output at 5.34V under my product’s load meant it was a little outside of USB spec (5.25V limit), but not dangerous. On the scope it was ringing with a peak at 5.5 V at 4 kHz.

Of course, sourcing this supply for a second batch proved tricky, and we wanted the USB plug to come out the side instead of the front so it would have a thinner profile against a wall. Additionally, we needed UL approval for a client. Our second attempt was surprisingly successful. This adapter had UL certification, with a number to look up. Note that just having a number isn’t enough; many companies will just put someone else’s number on their product and assume nobody will bother to check. So when you do look it up, and find a different manufacturer, a different enclosure, and it looks more like a refrigerator than a USB power supply, don’t be too surprised. But no, this particular one was great! The label had a company name on it, model number and specs, and certifications that could be verified. Let’s tear it open!

power_supply_2_overviewSweet sweet silicon meat inside an ABS shell! Components wrapped in protective tape, two PCBs for isolation, and even a special injection-molded plastic piece to add additional protection. Components are labeled, and what’s this, an IC to control the oscillation instead of a feedback winding on the transformer? Fancy! It’s pretty clear that this power supply is good, and I’d trust this one.

Comparing this one to the others, there were so many noticeable little details that are important and clearly thought-out. Take, for example, the connection between the prongs and the PCB. On the previous board, it was made with wires soldered by hand. Solid, but time consuming and prone to failure or quality issues. This adapter has metal contacts that snap into the case very solidly so that the prongs cannot get loose. The connection to the PCB is via the springiness of the metal, but notice that the PCB has pads specifically designed to maximize the surface area of that connection. On the next PCB you’ll see no such effort.

Some components were covered in shrink tube, tape, or non-conductive grey adhesive. The assembly was tight with no room for components to shake loose or accidentally touch. And the output was perfect. 4.9 Volts with nary a ripple.

But this is China, and component sourcing problems are a thing, so I guess I shouldn’t have been surprised when these supplies were no longer available. In retrospect, maybe these were unsold overstock, or possibly QC rejects. That would explain why they were only slightly more expensive than the others. And so we moved on to another supplier; one that could pad-print our logo on top.

power_supply_differencesAt first glance these power supplies appeared identical. But close inspection reveals slight differences in the style around the USB and the raised ridges on the underside. The label was completely different, and gone was the number next to the UL logo. There was no company name on the supply either, and the company we purchased from turned out to be a reseller and not the OEM. Also, why was the output 4.7-5V, and why did my scope say 5.5V (but surprisingly stable)?

Inside was a completely different beast. Using a single PCB, the creep distance was about a millimeter. You can see the white line meandering through the bottom of the PCB that shows the high and low sides. The USB port wasn’t soldered to the PCB except by the four signal/power pins (see the bottom side lower left and the hanging USB connection pins), and there was a capacitor with really long uncovered leads and the positive side dangerously close to the USB shell. There was almost no protective tape, no shrink tube on the leads, and no protection in case of a short.

 

power_supply_3_top power_supply_3

In the end, I wouldn’t trust the two non-UL supplies with anything worth more than a few bucks, and certainly not my cell phone. I’d have really big reservations about reselling them to customers who don’t know the difference. The UL-approved one was great, but the other two are only good for powering low-current-draw devices that are not sensitive to voltage. Also, finding a reliable supplier in China is HARD.

Check out a much more thorough analysis of this and pretty much every USB power supply cube by [Ken Shirriff]. It’s surprising how little has changed in four years with these supplies, and his analysis goes into how the circuits behind these supplies work, identifying each component and its purpose.

We also covered a Sparkfun teardown of some power supplies with similar conclusions, and a Fail of the Week in which a faulty USB power adapter was the likely cause of a fire.


Filed under: Featured, hardware

Circuit Bender Artist bends Fresnel Lens for Art

via hardware – Hackaday

Give some mundane, old gear to an artist with a liking for technology, and he can turn it into a mesmerizing piece of art. [dmitry] created “red, an optic-sound electronic object” which uses simple light sources and optical elements to create an audio-visual performance installation. The project was the result of his collaboration with the Prometheus Special Design Bureau in Kazan, Russia. The inspiration for this project was Crystall, a reconstruction of an earlier project dating back to 1966. The idea behind “red” was to recreate the ideas and concepts from the 60’s ~ 80’s using modern solutions and materials.

The main part of the art installation consists of a ruby red crystal glass and a large piece of flexible Fresnel lens, positioned in front of a bright LED light source. The light source, the crystal and the Fresnel lens all move linearly, constantly changing the optical properties of the system. A pair of servos flexes and distorts the Fresnel lens while another one flips the crystal glass. A lot of recycled materials were used for the actuators – CD-ROM drive, an old scanner mechanism and old electric motors. Its got a Raspberry-Pi running Pure Data and Python scripts, with an Arduino connected to the sensors and actuators. The sensors define the position of various mechanical elements in relation to the range of their movement. There’s a couple of big speakers, which means there’s a beefy amplifier thrown in too. The sounds are correlated to the movement of the various elements, the intensity of the light and probably the color. There’s two mechanical paddle levers hanging in there, if you folks want to hazard some guesses on what they do.

Check out some of [dmitry]’s earlier works which we featured. Here’s him Spinning a Pyrite Record for Art, and making Art from Brainwaves, Antifreeze, and Ferrofluid.


Filed under: hardware, musical hacks

Pillaging the Wealth of Information in a Datasheet

via hardware – Hackaday

It’s a fair assumption that the majority of Hackaday readers will be used to working with electronic components, they are the life blood of so many of the projects featured here. In a lot of cases those projects will feature very common components, those which have become commoditized through appearing across an enormous breadth of applications. We become familiar with those components through repeated use, and we build on that familiarity when we create our own circuits using them.

All manufacturers of electronic components will publish a datasheet for those components. A document containing all the pertinent information for a designer, including numerical parameters, graphs showing their characteristics, physical and thermal parameters, and some application information where needed. Back in the day they would be published as big thick books containing for example the sheets for all the components of a particular type from a manufacturer, but now they are available very conveniently online in PDF format from manufacturer or wholesaler websites.

A 2N3904 in a TO92 through-hole package
A 2N3904 in a TO92 through-hole package

Datasheets are a mine of information on the components they describe, but sometimes they can be rather impenetrable. There is a lot of information to be presented, indeed when the device in question is a highly integrated component such as a DSP or microprocessor the datasheet can resemble a medium-sized book. We’re sure that a lot of our readers will be completely at home in the pages of a datasheet, but equally it’s a concern that a section of the Hackaday audience will not be so familiar with them and will not receive their full benefit. Thus we’re going to examine and explain a datasheet in detail, and hopefully shed some light on what it contains.

The device whose datasheet we’ve chosen to put under the microscope is a transistor. The most basic building block of active semiconductor circuits, and the particular one we’ve chosen is a ubiquitous NPN signal transistor, the 2N3904. It’s been around for a very long time, having been introduced by Motorola in the 1960s, and has become the go-to device for a myriad circuits. You can buy 2N3904s made by a variety of manufacturers all of whom publish their own data sheets, but for the purposes of this article we’ll be using the PDF 2N3904 data sheet from ON Semiconductor, the spun-off former Motorola semiconductor division. You might find it worth your while opening this document in another window  or printing it out for reference alongside the rest of this article.

Let’s take a look at all the knowledge enshrined in this datasheet, and the engineering eye you sometimes need to assign meaning to those numbers, diagrams, and formulas.

The front page of the ON Semiconductor 2N3904 datasheet.
The front page of the ON Semiconductor 2N3904 datasheet.

Give it to Me Straight

The front page of a data sheet will have the information the manufacturer considers to be most important. This should include the basic electrical properties of a device, a succinct description of what it does, and assuming it is not a device with a myriad pins, information about its external connections. Unfortunately some manufacturers seem more driven by marketing considerations than technical ones, so from time to time you will find data sheets whose front pages feel more like sales brochures, leaving you to have to hunt through the pages for the most basic of information. Happily the folks at ON Semiconductor seem to have a good understanding of what an engineer really wants from the front page of a data sheet, so straight away you have a table of the 2N3904’s maximum electrical ratings and an identification of its external connections.

In the case of a transistor, that table of maximum ratings is probably the single most important set of information for the designer in the whole sheet. You may have special requirements for which you need to know more about the device, but these are the most fundamental parameters that tell you a lot about what the transistor is suitable for, and those that (should you ignore them) can result in it releasing its inner store of magic smoke and costing you the price of another transistor. These are the voltage, current, and power dissipation figures you will have in front of you when you calculate the DC bias circuit for your application, in order to ensure that you’re operating the device within its electrical capabilities.

You needs these when you are selecting a device, for example if you are building an audio amplifier you might be interested in the device power dissipation for an idea of how much power it might be capable of delivering to a loudspeaker. In the case of a 2N3904 you’ll see that after allowing for the heat dissipation inherent to a transistor operating in a linear mode it can only yield a few hundred milliwatts, so a more powerful transistor might be a better choice as an audio power amplifier.

I Want All the Data

datasheet-3904-characteristicsTurning the page, on page 2 of the datasheet we find a much more comprehensive table of parameters for the 2N3904. Off characteristics, on characteristics, small-signal characteristics, and switching characteristics.

The off characteristics relate to the device in the off state, which is to say when the voltage between base and emitter is below the roughly 0.7 volts required to start current flowing between collector and emitter. The breakdown voltages are the same ones that were in the table of maximum ratings on the previous page, they are the maximum voltages a 2N3904 can take before it is damaged. The cutoff currents though are different, they release no magic smoke, instead they are the tiny currents that still flow even when the transistor is turned off. You’ll notice they are measured in nA, nano-amperes, a very tiny figure indeed.

What is an ‘h’ Parameter?

The h parameter model. User Rohitbd [GFDL or CC-BY-SA-3.0 ], via Wikimedia Commons
The h parameter model. User Rohitbd [GFDL or CC-BY-SA-3.0 ], via Wikimedia Commons
Moving to the on characteristic table, we encounter our first h parameter, the current gain hFE. The h parameter model is a mathematical model for describing the operation of a transistor. It’s something first-year electronic engineering students agonize at length over, but fortunately to use the figures it generates you do not need to know it in detail. In the case of hFE, this figure is the current gain of a transistor, or the ratio between the base current and the collector current it generates for a constant collector-emitter voltage. You will often see the hFE figure simply referred to as the transistor’s gain. In the case of the 2N3904 this has a maximum value of 300, so in a transistor with that hFE value if you put 1mA into the base you will be able to measure 300mA flowing into the collector if the collector-emitter voltage is 1 volt. It’s a slightly artificial figure in the way mathematical models sometimes can be, but it gives a straightforward idea of how good an amplifier this transistor is likely to be.

The collector-emitter and base-emitter saturation voltages are the voltages at which those connections are at maximum forward bias and will go no further in terms of voltage. The base-emitter path, and the collector-emitter path when the transistor is in the on state can both be considered as though they were forward biased diodes. One of the properties of a forward biased diode is that the voltage across it remains nearly constant no matter the value of the current flowing through it, and it is that constant voltage which is being referred to for the two paths through the transistor. If you think a constant voltage might cause the transistor to cease amplifying though, think again. The bipolar transistor is a current amplifying device, so once the junctions are at their saturation voltages the current flowing in the collector will still be hFE times that flowing in the base and amplification will still occur.

3904-datasheet-small-signalThe small-signal characteristics relate to how the transistor performs as an AC amplifier. First up is the gain-bandwidth product, fT. It might be tempting to think that since the fT of a 2N3904 is 300MHz that the device might be usable up to that frequency, but this is a misleading figure. In fact it refers to the frequency at which the gain drops to 1, so the likely maximum frequency at which the device is useful will be considerably lower. In the case of a 2N3904 you would find it to be useful somewhere beyond 100MHz, for example.

Below the fT figure are the capacitances of the different parts of the transistor which will probably be of little importance in the majority of applications, followed by the rest of the h parameters. Again these are likely to be of little interest unless you are putting a 2N3904 into a modelling package. You will notice hfe, the small-signal AC counterpart of the DC hFE we mentioned earlier.

And finally in this section we have the noise figure. This is not a figure that will trouble you in the majority of applications but it is worth taking a moment to consider. If you are working in an environment in which noise considerations are important – perhaps a radio receiver or a demanding audio application – you will need to pay close attention to ensuring that this number is as low as you can make it in particular in the early stages of amplification. In this case the 2N3904 with a 5dB noise figure is not a particularly low-noise transistor, but then again it’s a general purpose workhorse rather than a high-performance thoroughbred.

How Well Does It Switch?

Below the small-signal characteristics is a table of the switching characteristics. If you imagine a perfect square wave, you might imagine it would appear on your oscilloscope screen as a sequence of sharp right angles. Every transition should be instantaneous from low to high voltage. In practice of course it doesn’t work that way. it takes a short time to traverse the gap. These are the parameters that give you those timings, and ultimately that tell you what the fastest logic signals a 2N3904 can handle are. You’d play close attention to these if you were designing fast logic circuitry, but for simple DC or analogue use they would not be something you’d need to know.

Rise and fall time test circuits for the 2N3904
Rise and fall time test circuits for the 2N3904

On page 3 of the 2N3904 datasheet you’re into the really irrelevant stuff for most Hackaday readers. Surprisingly, in many sheets this page would be further towards the back of the bundle. Ordering information, something that will interest you if you are buying ten million 2N3904s from ON Semiconductor, but since you are likely to get your transistors from a stockholder like RS, Farnell, Mouser, or DigiKey this section has little relevance. Below that are the circuits used to measure the switching characteristics, yet again something of great interest to a designer using the device in fast logic circuitry but not so gripping for others.

The next three pages have all the transistor’s parameters expressed as graphs. Now you might think that this would be the main event of a datasheet, and in some sheets you’d be right, but in the case of a transistor sheet it’s all very interesting in an Art of Electronics kind of way but you don’t need to bury yourself in them. You already know the pertinent information surrounding a 2N3904 from the first couple of pages, these graphs fill in the edge cases and tell you in more detail about how the device behaves. Fascinating if you are learning about how transistors work, but in most cases of straightforward transistor design you will not gain much from studying them.

And finally at the back of the datasheet, the package information. You’d expect the ordering information to be here too, but for some reason ON Semiconductor put that on page 3. Package information is something you might not consider important, however if you are creating a PCB you may find yourself spending a lot of time in this part of a datasheet. If your PCB CAD package doesn’t already have the device in its library you may have to create it. Even if there is a CAD footprint you had better ensure the dimensions match the part you are sourcing. It is the dimensions on this page that will ensure you get it right. If your device is surface-mount you will usually find a recommended area for its PCB lands with full dimensions, something that can save you a lot of trouble with wrongly-dimensioned boards.

Beyond this Datasheet

We hope this piece has helped demystify the manufacturer datasheet for you if you were intimidated by them. It’s a shame we only have a Hackaday article in which to cover this topic, for if we had looked at all the graphs in detail this would have made a decent sized book chapter. The 2N3904 is hardly an accomplished device, but with luck you’ll now know a little bit more about this most basic electronic building block.

Since we feel that the information contained in electronic component data sheets is often buried and not always fully understood, we’d like to feature more articles like this one. The example here is a transistor, but there is no reason why any of the other devices we use every day could not also be explored in depth, analog ICs, digital ICs, even passive components. Which devices would you like to see given this treatment? What are some of your favorite quirks and tidbits from other datasheets? Let us know in the comments below, and send in a tip for future articles.


Filed under: Featured, hardware

A Simple And Educational Brushless Motor

via hardware – Hackaday

Sometimes there is no substitute for a real working model to tinker with when it comes to understanding how something works. Take a brushless motor for example. You may know how they work in principle, but what factors affect their operation and how do those factors interact? Inspired by some recent Hackaday posts on brushless motors, [Matt Venn] has built a simple breadboard motor designed for the curious to investigate these devices.

The rotor and motor bodies are laser-cut ply, and the rotor is designed to support multiple magnet configurations. There is only one solenoid, the position of which relative to the magnets on the rotor can be adjusted. The whole assembly is mounted on the edge of a breadboard, and can be rotated relative to the breadboard to vary the phase angle at which the drive circuit’s Hall-effect sensor is activated by the magnet. The drive circuit in turn can have its gain and time constants adjusted to study their effects on the motor’s running.

[Matt] has made all the design files available in his GitHub repository, and has recorded a comprehensive description of the motor’s operation in the YouTube video below the break.

[Matt Venn] has been featured on these pages quite a few times in the past. Whether it’s his home-made cargo bike, his webcam-based home energy meter, or his halftone G-code generator, he’s one to watch! Meanwhile, here’s the brushless motor we featured in 2015 that inspired him.


Filed under: hardware

IntelliServo

via hardware – Hackaday

Servos are extremely versatile actuators used in a large number of applications which need controlled mechanical movement. The usual way of driving them is by using a PWM output from a micro-controller. But if you’re building a robot or a drone which requires a large number of servos, then it makes sense to add smarts directly to the servo.

[Alvaro Ferrán Cifuentes] did just that by building IntelliServo – an add on board which makes regular servos smart by giving them enhanced capabilities as found in high-end versions. His approach is different compared to other takes on this theme. The IntelliServo is designed to replace the electronics in any regular servo and is not limited to any particular make or type. Once upgraded, it’s possible to read the servos position, temperature and current consumption. This allows interesting uses, such as controlling one servo by moving another one, or detecting collision or stalling by monitoring the servo current. Multiple servos can be daisy-chained and controlled over I²C from a micro-controller, or over USB directly from a computer. Each board features an LPC11U24 32-bit Cortex-M0 micro-controller, a DRV8837 motor driver, a TMP36 temperature sensor and a PCA9508 I²C repeater.

The project is open source and the Github repository contains the board design, Arduino library and examples, servo firmware and mechanical parts as well as use instructions. It’s a modular design which allows using either an external controller or running it directly via the on-board micro-USB socket. Check out the videos after the break to see the IntelliServo in action.


Filed under: hardware

[Sprite_tm] Gives Near Death VFD a Better Second Life

via hardware – Hackaday

[Sprite_tm] picked up some used VFD displays for cheap, and wanted to make his own custom temperature and air-quality display. He did that, of course, but turned it into a colossal experiment in re-design to boot. What started out as a $6 used VFD becomes priceless with the addition of hours of high-powered hacking mojo.

You see, the phosphor screen had burnt-in spots where the old display was left static for too long. A normal person would either live with it or buy new displays. [Sprite_tm] ripped off the old display driver and drives the row and column shift registers using the DMA module on a Raspberry Pi2, coding up his own fast PWM/BCM hybrid scheme that can do greyscale.

He mapped out the individual pixels using a camera and post processing in The Gimp to establish the degradation of burnt-in pixels. He then re-wrote a previous custom driver project to compensate for the pixels’ inherent brightness in firmware. After all that work, he wrapped the whole thing up in a nice wooden frame.

There’s a lot to read, so just go hit up his website. High points include the shift-register-based driver transplant, the bit-angle modulation that was needed to get the necessary bit-depth for the grayscale, and the PHP script that does the photograph-based brightness correction.

Picking a favorite [Sprite_tm] hack is like picking a favorite ice-cream flavor: they’re all good. But his investigation into hard-drive controller chips still makes our head spin just a little bit. If you missed his talks about the Tamagotchi Singularity from the Hackaday SuperCon make sure you drop what you’re doing and watch it now.


Filed under: hardware