A Tiny Steering Wheel You Can Print

Racing games are a great way to test drive that Ferrari you can’t quite afford yet, and the quality of simulations has greatly improved in the last 30 or so years. While there are all manner of high-quality steering wheels to connect to your PC or home console, many gamers still choose to play using a typical controller, using the thumbstick for steering. What if there was something in between?

What we have here is a tiny steering wheel you can print for an Xbox One controller, that mounts to the controller frame and turns rotational motion into vaguely linear horizontal motion on the thumbstick. It does come with some pitfalls, namely blocking a button or two and it also obscures some of the D-pad. However, for those of you driving in automatic mode without using the buttons to shift gears, this could be a fun device to experiment with. Files to print your own are available on Thingiverse.

It’s a neat hack, and there’s plenty of room to take the idea further and personalise it to suit your own tastes. While you’re there, why stop at steering? You could make your own custom buttons, too!

[via Gizmodo, thanks to Itay for the tip!]

The Wonderful World of USB Type-C

Despite becoming common over the last few years USB-C remains a bit of a mystery. Try asking someone with a new blade-thin laptop what ports it has and the response will often include an awkward pause followed by “USB-C?”. That is unless you hear “USB 3” or maybe USB 3.1. Perhaps even “a charging port”. So what is that new oval hole in the side of your laptop called? And what can it really do? [jason] at Reclaimer Labs put together a must-read series of blog posts in 2016 and 2017 plumbing the depths of the USB 3.1 rabbit hole with a focus on Power Delivery. Oh, and he made a slick Easy Bake Oven with it too.

A single USB Type-C connector

When talking about USB-C, it’s important to start at the beginning. What do the words “USB-C” entail? Unsurprisingly, the answer is complicated. “USB Type-C” refers only to the physical connector and detail about how it is used, including some of the 24 pins it contains. Then there are the other terms. “USB 3.1” is the overall standard that encompasses the Type-C connector and new high-speed data busses (“USB SuperSpeed” and “SuperSpeedPlus”). In addition there is “USB Power Delivery” which describes power modes and even more pin assignments. We’re summarizing here, so go read the first post for more detail.

The second post devotes a formidable 1,200 words to providing an overview of the electrical specifications, configuration communication, and connector types for USB 3.1.

A GIF of a flipping USB Type C connector
Marketing at its finest

The third post is devoted to USB Power Delivery. Power Delivery encompasses not only the new higher power modes supported (up to 100W!), but the ways to use the extra 10 or 13 pins available on the Type-C connector. This is both the boon and bane of USB-C, allowing apparently identical ports to carry common signals like HDMI or DisplayPort, act as analog audio outputs, and provide more exotic interfaces like PCIe 3.0 (in the form of Thunderbolt 3, which is a yet another thing this connector can be used for).

It should be clear at this point that the topics touched by “USB Type-C” are exceptionally complex. Save yourself the trouble of a 90MB specification zipfile and take a pass through [jason]’s posts to understand what’s happening. For even more detail about Power Delivery, he walks through sample transactions in a separate post.

Turning Cheap WiFi Modules Into Cheap WiFi Swiss Army Knives

When the ESP8266 was released, it was sold as a simple device that would connect to a WiFi network over a UART. It was effectively a WiFi modem for any microcontroller, available for just a few bucks. That in itself is awesome, but then the hackers got their hands on it. It turns out, the ESP8266 is actually a very capable microcontroller as well, and the newest modules have tons of Flash and pins for all your embedded projects.

For [Amine]’s entry to the Hackaday Prize, he’s using the ESP8266 as the ultimate WiFi Swiss Army knife. The Kortex Xttend Lite is a tiny little WiFi repeater that’s capable of doing just about anything with a WiFi network, and with a bit of added hardware, can connect to Ethernet as well.

The hardware on this board sports an ESP8266-07S module, with two free GPIO pins for multiple functions. There’s a USB to UART in there, and a voltage regulator that’s capable of outputting 600mA for the slightly power hungry radio. There’s also an integrated battery management and charge controller, allowing this board to charge an off-the-shelf lithium cell and run for hours without any wires at all.

So, what can this board do? Just about everything you would want for a tiny little WiFi Swiss Army knife. There’s traffic shaping, port mapping, packet sniffing, and even support for mesh networking. There’s also an SMA connector on there, so grab your cantennas — this is a great way to extend a WiFi network, too.

This is a well-designed and well-executed project, and what makes this even more amazing is that this was done as one of [Amine]’s high school projects. Yes, it took about a year to finish this project, but it’s still amazing work for [Amine]’s first ‘high-complexity’ design. That makes it an excellent learning experience, and an awesome entry to this year’s Hackaday Prize.

Circuit VR: A Tale Of Two Transistors

Last time on Circuit VR, we looked at creating a very simple common emitter amplifier, but we didn’t talk about how to select the capacitor values, or much about why we wanted them. We are going to look at that this time, as well as how to use a second transistor in an emitter follower (or common collector) configuration to stiffen the amplifier’s ability to drive an output load.

Several readers wrote to point out that I’d pushed the Ic value a little high for a 2N2222. As it turns out, at least one of the calculations in the comments was a bit high. However, I’ve updated the post at the end to explore what was in the comments, and talk a bit more about how you compute power dissipation with or without LTSpice. If you read that post, you might want to jump back and pick up the update.

Back to Our Program

As a reminder, the LT Spice circuit we started with appears below. You can download that file and others on GitHub.

Output Z

Last time, we went over the design equations and even looked at a spreadsheet for figuring out the values. That spreadsheet assumed you wanted to pick a few items including the normal collector current for the device. In some cases, though, your driving design goal will be a certain output impedance. In that case, pick RC accordingly, and go through the same steps but you’ll compute Ic instead of selecting it and skip step 4. You can use this same procedure when the actual load you are driving is the collector resistor, which isn’t uncommon.

It is easy to see that RC is the output impedance if you do a little logic. Remember, this amplifier inverts. So Q1 is as close to off as it is going to get when the input signal is large. Assume Q1 turned all the way off. What would the output circuit look like then? A voltage divider made up of RC and RL. Like any voltage divider, the maximum power in RL is going to occur when RL=RC. If you have more of an engineering mindset, you can think of it as the amplifier’s Thevenin equivalent is a voltage source with RC as the resistor. Or, if you are more graphical, think of a voltage divider with a 10V input and a 100 ohm “top” resistor (R1). If you try values for the bottom resistor (R2) ranging from 1 to 200, it looks like this:

The voltage in R2 keeps going up, but the current goes down. When R2 is 100 ohms, the power maxes out at about 250 mW. This is why you try to match, say, a transmitter with an antenna or speakers with an amplifier.

You might want to control input impedance as well. For the input impedance case, you would have to control the values of Re, R1, and R2 which is quite a bit harder without setting up a lot of simultaneous equations or just iterating. It also will depend on beta, which is notoriously unreliable. If the product of Re and beta is a large number, you can approximate it as R1 and R2 in parallel, and that’s often good enough.

Note that in the above circuit example I just put a large resistor in as the load so it didn’t affect things much. But what if that resistor had been a 16-ohm speaker, perhaps?

Back to Capacitors

So why are capacitors important? Because the transistor needs a very specific set of DC voltages on its terminals and connecting an input or output to it is going to perturb that. However, we can isolate the circuit from any DC effects using a capacitor on the input and the output. That means we can’t amplify very low-frequency signals well — the capacitors will act like large resistors. But at higher frequencies, it won’t be any problem. You can see that in the simulation where some capacitors guard the inputs and the outputs.

If you want to see the effect in a less distracting way, check out this simulation. Here an input signal is riding a DC level. A voltage divider sets another DC level. With a capacitor between them, the circuit essentially shifts the input to a new DC level, like this:

The reactance of the capacitor, of course, depends on the frequency, according to 1/(2*π*f*C). That means the higher the capacitance, the lower the reactance at a given frequency. In this case, the 100 Hz signal sees the 10 uF capacitor as about 160 ohms of reactance. At 47uF, that drops to about 34 ohms. At 1 kHz, that will divide both of those values by another 10 (16 and 3.4 ohms).

Gain

The emitter resistor essentially introduces negative feedback which reduces our dependence on beta and makes things generally more stable. However, it also limits gain. If you suppose you have RE as a short-circuit — 0 ohms — you might think you could get infinite gain. But, in fact, you really just get a small internal resistance that is temperature- and current-dependent. At room temperature, though, it is generally just a few ohms at most. It would still increase the gain quite a bit if we could just short the emitter — in theory, up to the beta of the transistor. But without the negative feedback, we get all the other undesirable features we tried to avoid.

However, just as we use capacitors to isolate the input and output, why can’t we use a capacitor to short the signal to ground even if the DC path is through the resistor? As it turns out, you can. Try adding a capacitor across RE and watch the output go higher. Below, you can see the same output with a 47 uF capacitor across RE. Look at the scales. That 0.2V input signal now produces an output of over 5V, peak-to-peak. That’s a gain of about 25, or 5 times the DC gain.

Gain with bypass cap

The effect varies on the value of the capacitor and, of course, the frequency. Here’s the output with 10uF, 47uF, and 100 uF capacitors (first graph, below). The second graph shows the effect versus frequency. You typically want the reactance of the capacitor to be about 1/10th of the emitter resistance at the frequency where you will accept a 3dB drop off.

Three values of bypass cap
Three different frequencies

Note that the capacitor works so well, that at some frequencies, we go beyond the allowable gain and clip (see the last graph). Depending on your design goals, you may need to be careful with that.

Selecting Coupling Capacitors

To know what value to assign the coupling capacitors, you need to know the impedance of the amplifier. That’s fairly easy to estimate, but with LT Spice we can do better. If you look at V2, you know it is putting out 50 mV and you can measure the current drawn from it. Ohms law will tell you that .05 divided by that current must be the resistance V2 “sees.” With C1 set ridiculously high (1F) and V2’s internal resistance set to zero, the circuit draws about 1.75 mA from V2. That’s about 28.6 ohms. So if you know the 3dB frequency you want you simply have to compute the capacitance using the familiar 1/(2*π*f*R) formula. Assume we want 10 kHz as the 3dB point. Since R is 28.6 you need at least 0.6 uF of capacitance. Of course, you can also reverse the formula and determine what your 3 dB point should be given a certain value of capacitor.

Here’s a little WolframAlpha tip. If you try to do the above calculation, you get the answer in scientific notation: 5.56 x 10-7. Sure, you can just shift the decimal point two to the right to get the exponent to -9… or is that to the left? However, you can also just add the words “engineering form” to your query, and you’ll get the answer to the nearest exponent that’s a multiple of 3.

Output Loading

The other problem you’ll often see is that you need to drive a low impedance load which can limit your gain since matching that impedance will prevent you from using a large RC. One answer is to use an output transistor as an emitter follower or common collector amplifier. This is a very simple setup where the input to the base appears practically unchanged on the emitter. So the gain of the stage is nearly 1. That might not seem like a great thing until you realize that the output impedance of such an amplifier is roughly the source impedance divided by beta. Remember, lower output impedance is good because you can drive a wider range of load.

Suppose your RC in the main amplifier is 1600 ohms and you would like to drive a 16-ohm speaker. If the emitter follower beta is 100, the effective impedance seen from the main amp will be 1.6K ohms and the output impedance of the stage will be very low. But because in this case, the emitter resistor is probably the load itself, you won’t want to put a capacitor in the output because it would block the path to ground.

Have a look at this design:

This is very nearly the same amplifier as before, but there’s no coupling capacitor on the output. In addition, the component values changed a bit. When Q1 is turned off, the maximum voltage will go to the load and this will transfer the most power when RL=RC so the output impedance at Q1 is 1600 ohms. This is a poor match for a 16 ohm speaker, but Q2 can get us in the neighborhood in the emitter follower configuration. It is true that beta isn’t reliable, so the match probably won’t be perfect, but it should be good enough for most purposes.

Here’s the output:

Compare that with the output of the original amplifier driving a 16-ohm load. You’ll need to reduce the input drive down to 50mV, but even then the output from the original circuit will be very disappointing.

Of course, Q2 is going to need to be a power transistor. You won’t be able to quite get all 15V on the base of Q2, but you could get close. After the emitter drop, you could have a Ve of about 14V and that’s a little less than 900 mA or around 13 plus watts. Picture a big device with a heat sink. Luckily, the simulation doesn’t care. But, of course, that’s also one of the dangers of simulation is that you can overstress the models and they don’t care.

The End?

As much as we’ve talked about the common collector amplifier, there’s a lot more to it. What if the collector load is a tuned circuit? Or the emitter bypass? You can construct lots of things including multistage amplifiers using this as a building block.

By the way, you might think that bipolar transistors are old-fashioned compared to FETs, but they do have their uses. Also, all of these amplifier configurations have corresponding FET designs. The ideas are the same but, of course, the design equations are a bit different. FETs operate on voltages and there are other peculiarities. For example, some types of FETs are normally on, so you’ll need a negative bias voltage to get them to turn off. FETs — especially MOSFETs — have very high input impedance which makes input circuits easy to design. However, they also introduce capacitance which can be tricky at higher frequencies. But that’s a topic for a future Circuit VR.

Semi-automated Winder Spins Rotors for Motors

What’s your secret evil plan? Are you looking for world domination by building a machine that can truly replicate itself? Or are you just tired of winding motor rotors and other coils by hand? Either way, this automated coil winder is something you’re probably going to need.

We jest in part, but it’s true that closing the loop on self-replicating machines means being able to make things like motors. And for either brushed or brushless motors, that means turning spools of wire into coils of some sort. [Mr Innovative]’s winder uses a 3D-printed tube to spin magnet wire around a rotor core. A stepper motor turns the spinner arm a specified number of times, pausing at the end so the operator can move the wire to make room for the next loop. The rotor then spins to the next position on its own stepper motor, and the winding continues. That manual step needs attention to make this a fully automated system, and we think the tension of the wire needs to be addressed so the windings are a bit tighter. But it’s still a nice start, and it gives us some ideas for related coil-winding projects.

Of course, not every motor needs wound coils. After all, brushless PCB motors with etched coils are a thing.

Continue reading “Semi-automated Winder Spins Rotors for Motors”

Getting An RF Low-Pass Filter Right

If you are in any way connected with radio, you will have encountered the low pass filter as a means to remove unwanted harmonics from the output of your transmitters. It’s a network of capacitors and inductors usually referred to as a pi-network after the rough resemblance of the schematic to a capital Greek letter Pi, and getting them right has traditionally been something of a Black Art. There are tables and formulae, but even after impressive feats of calculation the result can often not match the expectation.

The 30MHz low-pass filter, as QUCS delivered it.
The 30MHz low-pass filter, as QUCS delivered it.

Happily as with so many other fields, in recent decades the advent of affordable high-power computing has brought with it the ability to take the hard work out of filter design, Simply tell some software what the characteristics of your desired filter are, and it will do the rest. The results are good, and anyone can become a filter designer, but as is so often the case there remains a snag. The software calculates ideal inductances and capacitances for the desired cut-off and impedance, and in selecting the closest preferred values we modify the characteristics of the result and possibly even ruin our final filter. So it’s worth taking a look at the process here, and examining the effect of tweaking component values in this way.

The idealised graph produced by QUCS for our filter.
The idealised graph produced by QUCS for our filter.

The filter we’re designing is simple enough, a 5th-order Bessel filter, and the software is the easy-to-use QUCS package on an Ubuntu Linux machine. Plug in the required figures and it spits out a circuit diagram, which we can then simulate to show a nice curve with a 3dB point right on 30MHz. It’s an extremely idealised graph, and experience has taught me that real-world filters using these designs have a lower-frequency cut-off point, but for our purposes here it’s a good enough start.

As previously mentioned, the component values are not preferred ones from a commercially available series, so I can’t buy them off the shelf. I can wind my own inductors, but therein lies a whole world of pain of its own and I’d rather not go there. RS, Mouser, Digikey, Farnell et al exist to save me from such pits of electronic doom, why on earth would I do anything else but buy ready-made?

My revised filter circuit with off-the-shelf component values.
My revised filter circuit with off-the-shelf component values.

So each of the components in the above schematic needs moving up or down a little way to a preferred value. What effect will that have on the performance of my filter? Changing each value and re-running the simulation shows us the graph changing subtly each time, and it can sometimes be a challenge to adjust them without destroying the filter entirely. Particularly with the higher-order filters with more components in the network you can observe the effect of individual components on the gradient at different parts of the graph, but as a rule of thumb making values higher reduces the cut-off frequency and making them lower increases it. In my case I always pick higher values for that reason: my nearest harmonic I wish to filter is at double the frequency so I have quite some headroom to play with.

The revised curve from the filter with preferred values.
The revised curve from the filter with preferred values.

Having replaced my component values with preferred ones I can run the simulation again, and I can see from the resulting graph that I’ve been quite fortunate in not damaging its characteristics too much. As expected the cut-off frequency has shifted up a little, but the same curve shape has been preserved without any ripples appearing or it being made shallower.

If I were using this filter with a real transmitter I would ensure that I designed it with a cut-off at least a quarter higher than the transmission frequency. In practice I find the cut-off to be sharper and lower than the simulation leads one to expect, and for example, were I to use this one with a 30 MHz transmitter I’d find it attenuated the carrier by more than I’d consider acceptable. It must also be admitted that changing the component values in this way will also change the impedance of the filter from the calculated 50 ohms, however in practice this does not seem to be significant enough to cause a problem as long as the value changes are modest.

We haven’t made this filter, but in the past we’ve featured another one I did make, and by coincidence it was in the same frequency range. When I wrote a feature on automating oscilloscope readings, the example I used was the characterisation of a 7th-order 30 MHz low-pass filter. It might even be one of the ones in the header image, pulled from my random bag of filter boards for the occasion.

What’s Behind the Door? An IoT Light Switch

We’re not sure who designed [Max Glenister]’s place, but they had some strange ideas about interior door positioning. The door to his office is right next to a corner, yet it opens into the room instead of toward the wall. Well, that issue’s been taken care of. But the architect and the electrician got the last laugh, because now the light switch is blocked by the open door.

Folks, this is the stuff that IoT is made for. [Max] here solved one problem, and another sprang up in its place. What better reason for your maiden voyage into the cloud than a terrible inconvenience? He studied up on IoT servo-controlled light switching, but found that most of the precedent deals with protruding American switches rather than the rockers that light up the UK. [Max] got what he needed, though. Now he controls the light with a simple software slider on his phone. It uses the Blynk platform to send servo rotation commands to a NodeMCU, which moves the servo horn enough to work the switch. It’s simple, non-intrusive, and it doesn’t involve messing with mains electricity.

His plan was to design a new light switch cover with mounting brackets for the board and servo that screws into the existing holes. That worked out pretty well, but the weight of the beefy servo forced [Max] to use a bit of Gorilla tape for support. He’s currently dreaming up ways to make the next version easily detachable.

Got those protruding American switches? [Suyash] shed light on that problem a while back.