Translate

Friday, 24 January 2025

Improving the AliExpress AM tramnsmitter

Been a while, eh? Well, this is an accompanying write up on my latest YouTube sensation...


I purchased a cheap AM micro power transmitter from AliExpress... 



It has issues...











It's a straight forward, series-modulated affair. It's output filtering isn't utter rubbish either. My first issue is with the modulation transistor, which is that 2SD882 on the heatsink, top right of the PCB...






This one ... 


This is how I received the transmitter. Note how the transistor's metal back is not facing the heatsink! Why in god's name did they choose to fit it "upside down"? Board layout cock-up? Who knows, but we need to sort this, because as it stands, that transistor is running too hot.










The simple task of unbolting the heatsink, adding a smear of thermal compound, and putting the heatsink on the correct face of the transistor, and re-fitting the transistor results in a much cooler running modulator ... good.








The next issue is the frequency stability of the oscillator. It's touchy. You just need to stare at it for a few seconds, and it'll start hopping up or down the band by a number of kilohertz! It's also not very good thermally. We need something better.


I's previously purchased some of these AD-9833 modules very cheaply (about £3) from AliExpress. It's a DDS - direct digital synthesiser, and can create, square, triangle or sine waves upto about 12.5MHz. It has a small 125MHz crystal oscillator on board. Ideal. 












Lashing it together on a breadboard, along with an Arduino Nano, soon had a functioning sine wave oscillator.














... nice 

I was somewhat concerned about the amplitude from the oscillator, as the original (touchy) oscillator managed to swing about 7 volts into the RF driver transistor (measured at C20), and this outputs only 600mV pk-pk. 
I designed a simple 2N2222 amplifierer before my head cleared.... The output from the AD9833 is actually at 50 ohms, so it has quite some current drive, and it's feeding the base of Q2, so would it have enough drive just as-is?


Yes, yes it has :) 









Here's the output of the transmitter into a 50 ohm load, and we're managing to swing 7.5V. 













Having proved that works, the DDS was refined a bit, and made up on a piece of perfboard.

Notice the addition of the DIP switches to allow the channel to be changed, and the 7805 voltage regulator.





The code is available on my github https://github.com/andydoswell/MW-Nano

The DIP switch channel selection needs a mention, as it not only caters for us Europeans using 9 KHz channel spacing, but for those living across the pond that use 10 KHz channels. 

With bit 8 off, the binary defines which channel in 9 KHz spacing from 531 KHz to 1611 KHz. With bit 8 on, the lower bits define the 10 KHz channel from 630 to 1710 KHz. 

There's a section in the YouTube video which shows an easy way to calibrate the output from the DDS.

I've made a handy spreadsheet to look up the channels MW Channels

So now we have a cool-running, frequency stable transmitter. What about a bit of audio processing?

Enter the Teensy 4.1, and it's audio shield.
The audio shield is simply soldered onto the bottom (or top) of the teensy 4.1, and provides us with a high quality DAC and ADC, which receives and sends I2S Audio.
There's a tutorial here, which shows how to use the provided audio library.. 
After a bit of tinkering, I've come up with this audio chain, which when used in conjuction with a bit of code, provides a bit of multiband compression and filtering.

I'll come back to the code in a minute...



Now, I often get people to give my videos a bit of a test before they go live. My mate Nigel messaged ... 
Yeah... a Teensy 4.1 is about £28, and the audio board is about £13. If you just want the audio processor, the code will happily sit on a teensy 4.0, which is a bit cheaper, if you can find one. If there's someone out there who can make this all work on something cheap, like a blue/black pill or an ESP32, please do! ... and let us all know!

Just audio processing ? Well, yes... I added the synthesiser code to the teensy, so I don't have to bother with two microcontrollers...

So the teensy code can be found here.

As you can see, there's 4 variants.
Teensy AM Processor is a quite aggressive compressor. Teensy Multiband is my attempt at a multiband compressor, as shown above. There's also a variant of each, with the synthesiser control built-in.
Please feel free to hack that code about and make it your own, and share the journey with us!

Now Nigel.... he had a point ...

Yeah, OK.

Let's try a similar thing the old fashioned way....


Audio arrives at CN 1, and is passed through the first two stages of U1, forming a high-pass 4 pole butterworth sallen-key filter. Stages 3 & 4 form a high-pass 4 pole butterworth sallen-key filter. This provides adequate cut off at around 90Hz and 5.5KHz.

Audio is then passed to U3.1, which is a small amplifier, and provides enough drive for the compressor stage, U3.2. H2 connects to a GL5528 LDR which is in the negative feedback loop for the amplifier. When it's dark , the amplifier has maximum gain. As the output increases, the output is rectified, via R14 and D1 & D2 (dual package schottky, note different suffixes, this is important!) forming a bridge rectifier. This rectified output is fed to a yellow LED which is placed inside a light-proof tube, along with the LDR). As the LED's brightness increases, the gain of the amplifier is reduced. It's an age-old design. Audio is sent out via CN3. (Note, fit an attenuator here or a pot, as the output is hot at about 3V pk-pk)

The thing's lashed up on a piece of breadboard, and it's a bit "in-your-face" compression-wise, but it works well enough. The only issue is, as the output becomes quieter, the gain of the compressor tends to induce a bit of noise. This just doesn't happen with the software compressor.





A PCB is created if you fancy building one for yourself... files are on my git here.










On with the build...

First up was to tidy up the transmitter PCB by removing now unnecessary components from the board. There are five to remove, the polyvaricon, a small ceramic cap, the coil, the pot and the oscillator transistor, as indicated by the white arrows below. Add some pin headers where indicated with the blue arrows. 


The two pins where the pot used to connect are the audio input, and the two pins where the coil was are where the frequency synthesiser now connects. Connect two wires to the underside of the PCB where the power jack is. The ring (nearest the outer edge of the PCB) is the negative. 

The (now removed) pot also had a switch, on the outer two large contacts. You need to short these out with a small wire link.

I purchased a nice enclosure from eBay. Sadly, I'm unable to recommend the seller, as they promised "3 to 5 day courier delivery", which would have been fine, but it took the seller 3 weeks to dispatch.








I decided to 3D print a front panel. This is to include an LED for power indication, a power switch, a VU meter, a level control and a switch to select or bypass the compressor/filter.



I'm not going to describe the VU meter circuit here, as the one I put to use is, quite frankly awful. Take a look here for better inspiration. I just wanted some sort of level indicator.

The rear panel is drilled and two binding posts fitted, one for the aerial wire (insulated from the chassis
with a bushing), and one for ground (connected to the chassis, scratch some paint off first).







I added an eBay buck converter set to 9V, and mounted to the rear panel to provide power.








The PCBs are fitted, and wired up, and after a bit of debugging of software, the unit works really well...


A quick note about power supplies and antennas. 
The unit is better powered by a linear power supply, doesn't need to be regulated. Aim for anywhere between 12-20V at about 300mA. Switching power supplies tend to cause noise as they have a safety capacitor between the primary and secondary, which can cause a ground loop, and induce hum. Same goes for the audio source. Works great from a mobile phone or MP3 player, until you plug in a charger. You could fit a ground loop isolation transformer (see eBay car audio pages for such things) to avoid the issue with the audio. 
For an antenna I use a few feet of wire. It gives reasonable coverage of my house, but rapidly disappears into the noise a few feet outside, which is ideal. Don't go connecting this to some huge length of wire in your garden, along with a decent ground. Yes, you'll get some range out of it, but you're also likely to get into trouble with the local authorities. If you're in the USA, there's part 15 regulations which let you do this sort of thing, but this transmitter is capable of exceeding those regulations. Backing the buck converter down to a minimum of 7V will also reduce range. 

If you want to see a couple of videos about this, they can be found on my youTube channel. The video also shows you how you can easily calibrate your frequency. Do me the favour of a like & subscribe ;)



Monday, 20 January 2025

Linearising a classic Mini Fuel Gauge when fitting an ETB gauge.

 Julian rang....

"Can you tell me whether this fuel gauge I've got will work in my Mini"

I thought to myself "This is going to be horrible" ... it was.

Connecting the gauge to the tank sender, a 12V supply and hooking the tank float about with a bit of wire gave empty and full, and garbage in between.

I took some measurements of the resistance of the tank sender at Empty, 25%,50% and 100% full

TankR sender
1007.5
7530
5065
25125
0200

R sender is in ohms...

Having got home with the gauge, I wired it up to a pot and took the same values

I lots these when I did this, but it was quite clear that bodging this up with some analogue electronics wasn't going to be easy.

What about a microcontroller? Hmmmm.

I tried connecting the tank connection of the gauge to a 2N7000 fet, via a 4.7 ohm resistor to round, and PWMing it.... yep, that works. I took note of the PWM values vs indications on the gauge.

TankPWM %
100244
75222
50174
25144
0123

Now to mash the two together.....

Get an arduino nano to measure the voltage developed across the sender in series with a 200 ohm resistor. Calculate the resistance of the sender, calculate the required PWM.

Except for neither graph was a straight line ...

A bit of messing about inn google sheets later had two equations I could implement in my code to flatten it all out a bit. https://docs.google.com/spreadsheets/d/1W5jGL7obq-l499up6gbHa-PL1yinc2bq0epixeFbGJ8/edit?usp=sharing

A circuit was quickly conjured up...


... and built up on a piece of perfboard.

To make it a bit smaller I chose a Pro-mini clone, and changed the 7805 for a Traco TSR-1-2405 switching regulator, to keep the heat down.





Next up was to make a case in tinkercad, and get it printed.













... and once that was done ...












It's put in it's box, sealed with a little RTV, and connected up for test.







All works great!