Thursday, August 17, 2017

Towel Revival (2016)

My first Towel RC airplane flew many good years. It was a great introduction to flying, though I later found out by comparison with other planes that it was actually not such an easy plane to fly. It was relatively stable, yes, but the control surfaces weren't that authoritative; it didn't have enough power to get itself out of a jam, and it pretty much always flew at high alpha, which made it tricky in the wind. Moreover, my lack of proper control horns and pushrods made it imprecise.

Despite these flaws I still very much enjoyed that plane, and when the body gave out from excessive wear I decided to build a new one with slightly upgraded hardware. Here's what the plane looked like after quite a few outings:

All banged up after a few years of flying. Time to retire!

The nose was pretty much crushed, repaired many times over.
I had eventually reinforced the leading edges with dowels to make it a bit more robust, though I was wary of this modification because it made the plane a bit more dangerous for passersby. I made sure never to fly it anywhere near unsuspecting people.

For the rebuild, other than improving on the pushrod/control horn situation, I wanted to change the nose shape to make it much more sturdy while also doubling as a decent platform for FPV. I was also hoping to change the overall look to something a bit more stylish. I was partly inspired by the magazine cover that got me into RC to begin with:

The picture that inspired me to go through all this trouble!
And I drew up the following in Sketchup:
Sketch of the new model.

Underside sketch.
As you can see, the plane now has skids as well. I wanted to keep a bit of space on the underside for some future bomb drops. Also, once I added the massive bumpers to the front (which I altered when building the plane), I had to add skids to keep the plane horizontal when it was on the ground. Plus... well, I just liked the style. :-)

I got to building.
Making one super-sheet of foam.

Cutting out a rough shape.

Moving along.

Side-by-side with the original Towel.

Starting to put the electronics on deck.

Close-up of the new bumper design, which does not stick out from the body.

Underside of the plane; the bumpers stretch much further back.

Finished topside.
Notice the proper control horns, pushrods, and linkages in the above picture. They made a huge difference in precision when compared to the dowel and nail setup in the original plane.

Finished underside.

Sitting on the table of a rented cottage, before an outing with the Tiny Trainer.
The plane really turned out great! The flight dynamics are similar to the original Towel, though the control precision is much improved by the new hardware, and the nose is virtually indestructible. I don't crash as much as I used to when I started out, but I've had a few downright terrible nosedives right into hardpack soil because of interference with a cell phone tower, and the plane barely has any scratches to show for it. I've put a RunCam 2 between the bumpers, and the plane flies quite well, with nothing to obstruct the view (unlike on the Tiny Trainer). "Great success!"

Tuesday, August 15, 2017

Bluetooth Mod for Vintage Radio (2017)

A while back, I noticed a really cool-looking vintage radio at my downstairs neighbour Alex's place. It was a vintage Radione from the early 50s:

Cool-looking radio with a cateye.
It sported a tube amp and a nice, warm sound. Plus it had a cat eye to help with tuning in the center, which just looked out of this world:

Tuning cat eye.
I'd never seen one. It's basically a tiny CRT where the "pupil" gets narrower as you get closer to the exact tuning frequency of a station. There is a cool video of this in action here.

As cool as it was, the radio was not exactly modern, and it couldn't be tuned to much interesting material. Thus, Alex and I thought it would be cool if it could be modified to support Bluetooth. And thus began a saga that would wind up spanning over two years and two revisions.

My first idea was simply to order a cheap Bluetooth radio on the Internet and connect it to the radio's speaker. I ordered a cheap module and set to taking it apart as soon as I received it.

Cheap BT radio from China.

What you seen when you open the radio.

A bit further inside, the battery can be found.

Taking stuff apart.
The first thing I wanted to do was to try to get rid of the LiPo battery. There would be no use for it in the final product, and I was hoping the board would run without it if plugged into a decent 5V supply. Having the battery around seemed like a source of problems; I knew it would be permanently charging, which is not great, and I didn't want the circuit to conk out (or worse, catch fire) if it eventually died.

This turned out to be quite a rabbit hole; the board was clearly not designed for this. When fed 5V directly, the board would just repeatedly power up and down as it seemed to attempt to charge a non-present battery. So, in an attempt to fool the board into booting up, I replaced the battery with a stocky capacitor.

Battery replaced with a fat cap.
This worked - but not perfectly. The board booted up, connected, and played music. I was able to verify that the BT radio could drive the vintage radio's speaker, which sported a 5 ohm nominal impedance. I had suspected that a small amp wouldn't have quite enough power to drive such a low impedance cleanly, but as it turned out, the results weren't too bad! I don't have a picture of the test setup, but a short video gets the idea across well.


In more extended testing, however, the cap was not enough to keep the circuit happy. The board would eventually disconnect, reboot, cut out, etc. It was just generally unreliable. I tried connecting in a gigantic 6.8mF cap to see if I could improve things but nothing really made the situation perfect.

So... I backed up and went to the idea of using the battery again, at least for the time being. I put it back in the circuit and wired everything up again. There was a bit of an annoying repetitive clicking sound that wasn't there when the capacitor replaced the battery; it was produced by the LiPo charger probing the battery to see if it needed an extra bit of trickle.

I was not super satisfied with this state of affairs, but the setup did meet Alex's functional specs, so I put things back together temporarily for a field test and sent the radio back downstairs for a few weeks.

Temporary setup with the BT radio on the outside, along with its power supply. The white cables are connected to the speaker.
The test didn't last overly long. I recommended he run the radio off the battery as much as possible, not only because that avoided the clicking sound, but also because it was also presumably the scenario for which the device was engineered.

Other than the fact that his radio was now effectively limited by the life of the tiny battery, we rapidly discovered another limitation of the system. One night shortly after I gave him the radio back, Alex went to bed peacefully, after having used his radio during the evening. In the middle of the night, the radio blurted out a huge, loud BLEEP BLEEP BLOOP BLOOP sound effect to indicate that the battery was getting low. Alex woke up with a start and asked me shortly afterwards if I thought there was a way around the issue.

This was the perfect opportunity for me to go back to the drawing board and think things over, so I did. I decided to hunt for a Bluetooth radio that would be a better fit for our situation. The root issue with the original BT ratio was that I was trying to shoehorn a device built for low-power, mobile applications into a permanent fixture with high power requirements; all the problems I ran into stemmed from that. Thus, I went on the hunt for a standalone BT board as well as a small amp to drive the speaker.

This was an on-again, off-again hunt for some time. I wound up buying a handful of cheap PAM8403 boards I thought I might be able to use. I was sort of starting to think about getting just a regular BT retrofit adapter that just needs a 5V supply and outputs to an 1/8" jack when I stumbled upon a nice sub-$10 board that not only included Bluetooth but also a 25W+25W TDAP7492 on-board amp. Bonus! I ordered a pair right away and tested them as soon as they came in.

Testing the BT/TDAP board.
I had replaced all the problems with the original board with a legitimately interesting new one: this board was meant to output stereo, but I only had a mono channel to drive.

In order to figure out how to best do so, I had to learn a bit about how the TDAP7492 works. As it turns out, it sports what is called a "Bridge-Tied Load" configuration. This basically means that for each channel, there are two amplifiers producing mirror images of the amplified source signal. The "load" (in this case, a speaker) is "tied" between the outputs of these mirror-image amplifiers. Compared to a channel where one end of the speaker is tied to a single amplifier and the other is tied to ground, a bridge-tied load sends double the voltage into the load.

As it turns out, the board I bought actually has two amplifiers on-board, because there is a NE5532 pre-amplifier before the TDAP7492. Thus, this left me a few possibilities for mono output.

A quick google search rapidly revealed that the BT module on the board (a CSR8635) supported mono output via software configuration. The cleanest way to handle the issue would have been to activate this mono mode. However, I would also have needed to purchase a custom programmer worth around five times the price of the board. In addition, there was a chance I'd need to take the BT module off the board to be able to successfully reprogram it, which would have meant a decent amount of awkward desoldering and resoldering. That seemed like asking for trouble. Seeing as how I had a few analog options around this issue, I thought I might try my hand at these before going down the software route.

The first thing I tried quickly was simply to tie the speaker between the non-inverting output of one channel and the inverting output of the other. Here is a video of this test.


This worked, but there were two problems. Firstly, when cranked too loud, the amp would cut out. I'm far from being an amplification expert, and I don't know exactly why this happened, but I suspect it's because the stereo signal is not identical across both channels, resulting in some kind of unwanted and unexpected asymmetric power draw. For example, normally, since the speaker is being driven by voltages which are exactly the opposite of one another, there is a no net DC bias in the signal. However, the slightest difference in DC bias between the left and right channel will actually show up across the speaker when it is tied across channels. This unexpected flow through the amplifier probably caused a failsafe to kick in momentarily.

The other issue was that I could hear much more noise from the amp in this configuration. Though not as major a problem as the intermittent cutout, it was still annoying.

My next idea was to try to downmix the stereo to mono somewhere on the board, either between the BT module and the NE5532 or between the preamp and the TDAP. I saw a comment on the page of the product that suggested it was possible to short the op-amp outputs on this board. This didn't sound like a great idea to me without involving any kind of resistor bridge, but I figured it was simple enough to try out with a few probes, so why not - I had two boards. :-) It was apparent very quickly that this approach was terrible. There was a tremendous buzzing noise and the amp just didn't sound happy.

I switched tacks and had a look at the preamp input instead of its output. I knew the input on the NE5532 was high-impedance, so it seemed possible to downmix upstream, but I couldn't find much documentation about the output stage on the CSR8635 so I decided to just try it out. I shorted the left and right channel inputs together pairwise, inverting with inverting, non-inverting with non-inverting. There were resistors between the NE5532 inputs and the CSR8635 outputs, so I was hoping they'd help me with the downmix without having to lift components off the board and start jumpering stuff.

Downmixing between BT module and preamp.
This gave an interesting result; the signal was definitely mono, but it lost a tremendous amount of its quality. Fail. Again, I don't know enough about amps to know exactly what was going on here, but I suspect perhaps the resistors on the board were not sufficiently large to prevent the CSR8635's output stage from getting overworked. Normally the CSR's outputs were being fed into the high-impedance NE5532 inputs, which meant the had to pump very little power, but with the shorts in place, there was an effective load placed on the CSR's output drivers any time the two stereo channels didn't match. I backed off this idea and went back to the drawing board.

I started thinking a bit about ways to tie the load across the two channels without imparting a DC bias on the signal, and came up with a simple resistor bridge configuration that would allow me to downmix after the power stage. The trick would be to select resistors that were large enough to prevent overworking the amplifiers outputs (because the two channels are effectively working against each other to reach an average voltage), but low enough to prevent the speaker volume from dropping too low. It would also be important to get the four required resistors to match just so, to avoid any bias.

Simple resistor bridge configuration.
I made a bunch of tests with the resistors I had on hand and determined that 28 ohms per resistor was just about what I needed. In order to reach this value precisely, I tied 10 resistors together (8 301-ohm resistors and 2 220-ohm resistors) four times over, for a total of 40 resistors. (Statistically, the intolerance of my resistors cancelled out reasonably well.)

4 10-resistor bundles weighing in a 28 ohms each.
This worked perfectly! Time to put things together. I used a three-pole, dual throw switch to toggle the power to the board and multiplex the connections to the speaker at once. In one position, the BT amp is on, and the speaker is connected to it; in the other, the BT amp is off, and the original radio circuitry is connected to the speaker.

Lots o' wires into that 3P2T.
I took apart the DC switched-mode power supply and soldered some leads directly to its board.

Taking apart the DC SMPS.

Soldering leads directly to the DC SMPS.

Putting the SMPS back together.
Then, I shunted some power from the radio's main supply. This was actually a tricky soldering job because of the way the radio was put together; I couldn't take the whole thing apart without considerable effort, so I made use of creativity to reach the solder points I required.

Jacking up the amp circuitry so I can reach the AC input stage.

Another angle to the madness.

Gotcha! My black and red leads can feed power to the DC power supply.

I kept on assembling stuff.


Coming together.

3P2T switch mounted in the corner of the radio backplate.

Mounting DC PSU and BT radio to the inside of the radio case.

Routing wires, with a particularly creative job involving foam on the resistors. (I found my cable tiedowns after the project was completed.)

Final cable routing.

Another view of the final routing.
Finally it was time to close everything up.
Closing things up.

Final external appearance change.
And there you have it! Here are a pair of videos demonstrating the final product.



Saturday, August 12, 2017

bElt Buckle - bEHAVIOUR Christmas Party (2014)

In 2014 my good friend Pierre-Luc and I were looking for a cool Christmas project to put together for the company Christmas party. We initially wanted to go all out with lit-up suits that could be controlled by finger movements, but we relatively rapidly downscaled the project to a pair of simple belt buckles with red and green LEDs. (It was Christmas after all.)

Pierre-Luc had just bought an Ultimaker 2 so we thought we would put it to good use by printing out the buckle itself. After putting together the design in Sketchup and painstakingly flipping triangles around for an hour, the printer produced this great mounting plate:

Printing out the LED mounting plate.

Finished mounting plate.
(Today, I would definitely model that in Fusion 360, it would take five minutes.)

The idea was to multiplex 24 red and green LEDs onto 10 Arduino pins in a 6x4 matrix, then PWM them in software to light up the buckle with interesting patterns. I prototyped this successfully on a breadboard:

Driving 24 individually-addressable LEDs with software PWM using 10 pins.

PL hard at work drawing schematics.

A finished LED matrix, ready to be connected to the microcontroller.
At this point everything looked good. We thought using enameled wire would make things easiest since we could easily strip off short segments of insulation just where the LEDs needed connecting, leaving the enamel everywhere else on the wire to avoid shorts. In retrospect this might have been our failure point.

We were quite happy with the progress. However, things got a bit more complicated when we started having to connect everything to the microcontroller.

Connecting things to the controller...

Oh man this is going to be a mess...

Total mess.
I should mention at this point that we were extremely short on time: the party was the next day. We were working fast and loose, and this is where things broke down. The matrix was a complete tangle of wires, and the addressing didn't work anymore, very likely due to a handful of shorts. Combined with the fact that we had to cram all that circuitry into a belt buckle, we thought there was no way we could make the circuit reliable in time.

We had to make a call, so we decided that we would simply remove the microcontroller and wire up a slide switch and a momentary pushbutton to the full array of LEDs. This would allow us to leave the buckle on, or flash it manually to the beat of the music.

With very little time to go, we switched tacks, cut everything leading to the MCU and tested the LEDs directly from a static power source:

Light it up!
At this point everything worked, we just needed to put it into the case. This was a challenge in and of itself.

Gluing everything in place.
Underside of the buckle, before it was closed.

We were sad to lose the MCU and LED animations, but in the end, the belts turned out great.

Finished belt buckle.

Close-up of the finished belt buckle

We wound up finishing the project at work the next day, after work hours but before the party. I had brought in my soldering station and other gear to work, and we wired up the batteries and switches during cocktail hour. The buckles brought lots of great smiles to people's faces. They were great conversation starters, and we enjoyed dancing and flashing them to the beat throughout the evening!