Avalanche pulse generator- part 1

I wanted to make a fast pulse generator like the one designed by the great Jim Williams1. Unfortunately, the required chip for the high voltage power supply (LT1073) is not available where I live. I found several similar circuits using different approaches to generate the required voltage. I particularly liked the one in Dangerous Prototypes2, in which an astable multivibrator made with transistors is used to drive a step-up and It got me thinking ¿could be possible to “make” the entire LT1073 with transistors?

I looked for the datasheet3 and found a block diagram of the device.


Figure 1. LT1073 internal block diagram.

Comparator A1 compares the feedback pin voltage (Fb) with the internal voltage reference. When the feedback drops below 212mV the comparator A1 switch on the oscillator. The driver amplifier boosts the signal level to drive the output NPN power switch Q1. The switch cycling action raises the output voltage and the feedback pin voltage. When the feedback voltage is high enough the comparator turn off the oscillator.


I made the oscillator with an astable multivibrator (like the one in DP). I opted for the version with waveform correction4.


Figure 2. Astable multivibrator with diodes for edge correction and a transistor to control it.

I added a transistor to control the oscillator. When the feedback voltage is lower than the reference the comparator goes low and the oscillator is activated in order to rise the output voltage. According to the datasheet the oscillator is set internally for 38µs ON time and 15µs OFF time. I calculated the resistors needed using a 1nF capacitor but later on I tweaked the values in the breadboard until I got close enough to the required ON and OFF time.


Figure 3. Oscillator output.

Voltage reference

For the reference I made a variable zener with a pair of transistors5.


Figure 4. Variable zener.

I set it to 1V and made some measurements to see how stable the reference was:

Figure 5. Reference voltage (yellow) with power supply variations (blue)

The measurements were done with the converter working making the reference voltage quite noisy. Without a 1uf capacitor between Vref and ground (not shown in the schematic) it looked even worse:


Figure 6. Voltage reference without the 1uf capacitor.

These are the measured values in a much compact graph:

Ref output_vs_vcc

Figure 7. Voltage reference output with variations in voltage supply


I build the simplest comparator I could find:


Figure 8. Comparator schematic.

For testing I connected the (-) input to a potentiometer and the other input to the oscillator output:


Figure 9. Comparator test setup.

Moving the potentiometer up and down changes the comparator output width:


Figure 10. The comparator output is the yellow trace, the potentiometer value is at the top left corner and the blue trace is the oscillator output.

It is not the best comparator you could find but it is good enough for this application. I’m not using hysteresis like the comparator inside the Lt1073 does.

Switching transistor

Tried first with a single BC548 but couldn’t get more than 30V, adding a 2N2222 in a Darlington configuration I could reach a little more than 50V:


Figure 11. Output Darlington switch.

I also added a diode-capacitor voltage step-up network (as in the original circuit with the LT1073) and this is what the final circuit looks like:


Figure 12. Complete schematic.

and the block diagram of my version:


Figure 13.

Then did some test to see if the whole thing was regulating properly and how the output changed with voltage supply variations.


Figure 14. Output (yellow) vs power supply (blue).

Again the values from the previous oscilloscope captures in a single graph:

HV output_vs_vcc

Figure 15. High voltage output from the converter with variations in the power supply. The converter is configured to output a little bit more than 82V.

I also made some captures of the output from the oscillator as the supply voltage decrease:

osc(blue)_HV output(yellow)_variable VCC

Figure 16.

It can be seen how the pulse trains increase with the reduction of voltage supply. With voltages lower than 1,7 V the converter can’t regulate properly.

I was able to source locally the 2N2369 used in the original application. I connected it in the protoboard to see if the converter could get it to avalanche. The blue trace (Figure 16) shows the voltage in the capacitor, it charges until the voltage is high enough to avalanche the transistor rapidly discharging and generating a fast rising pulse shown in the yellow trace.


Figure 17.

All this testing was done on the protoboard so is no surprise that the pulse looks like crap:


Figure 18. Collector capacitor discharge (blue) and pulse from the avalanche transistor (yellow). It can be seen that the breakdown voltage is around 67[V]

I used a 22pF capacitor but even without using one the parasitic capacitance in the protoboard where high enough to make it work anyway. Now I need to build a proper board.


1. Application Note 72, APPENDIX B, Measuring Probe-Oscilloscope Response
2. Avalanche pulse generator, and some scope porn
3. LT1073 Micropower DC/DC Converter Adjustable and Fixed 5V, 12V
4. Transistors Tutorial, Part 7: “Oscillators”
5. Simple Transistor Circuits For Experimenting, Fun and Education. Variable Zener Diode

Constant Current Electronic Load

I’m building a power supply and an electronic load might be useful for testing it, so I made one.

Electronic Load/ Carga electrónica

The design is based on some of the various diy electronics loads out there (like the one from Dave Jones). The mosfet is a P45N03LT , most likely I took it from some of the PC power supply I’ve “recycled”.  I’m using two 25k potentiometers, one for coarse adjustment and the other for fine adjustment (10 turn pots are kind of expensive…). The control voltage varies between 0 and 5 volts and is divided by two with a couple of 10k resistors. The op-amp is an OPA2336, It has rail to rail output so the load can sink roughly up to 2,5. The op amp is powered with a 7805.

Electronic Load/ Carga electrónica

The sense resistor is made with a series of 10 0.1 ohm, 1[w], 1% resistors. I made two “resistors” soldering 5 of them and then I put these two back to back and used kapton tape to keep them electrically isolated.

Electronic Load/ Carga electrónica

Finally a heat sink (scavenged form a PC supply as well) for the mosfet and some female banana plugs. The heat sink is too small and it gets really hot, I will have to find a bigger one or put some kind of cooler fan.

Electronic Load/ Carga electrónica

A few components for a very handy piece of equipment.

Electronic Load/ Carga electrónica

MSP430 and a HC-SR04 Ultrasonic Ranging Module

A while back I bought an HC-SR04. It sat in a box until yesterday when I tried to use it with an MSP430G2553 but unfortunately it wasn’t working. I used Energia to program the Launchpad but I wasn’t getting any response from the device. I hooked up my Logic analyzer to see what was going on and….

hc-sr04…the trigger pulse (channel 1) is there but the device will produce essentially the same echo (channel 0), regardless of whether I put an object in front of the module or not. It wasn’t working.

A quick visual inspection and a comparision with other boards photos showed that two components where missing, a capacitor and a SOT-23 device.


The capacitor was easy to replace. The device near it is a MAX232 used to drive the piezo tranducer and the capacitor is connected between GND and the VCC pin. Acording to the datasheet a 1uF decoupling cap is used.


For the SOT device I made a search looking for a module similar to the one I have but I needed a photo in which the device markings were readable. Eventually I found one with the marking J3Y which turned out to be a S8050LT1 NPN transistor and I replaced it with a PMBS3904.


A quick test with the Launchpad and….It’s working!!!!… now the module responds (now is channel 1) to the trigger (channel 0) with a longer pulse proportional to the distance being measure and the MSP430 is sending data. The Analyzer is showing an echo of 7,206 mS and that translate to 124,24 cm, quite a difference with the value calculated with the Launchpad. The MSP430 is using the internal oscilator as the main clock and is not as accurate as the crystal used for the clock in the Logic analyzer. The error quoted in the datasheets for the MSP430 give the calibrated DCO frequencies a tolerance over temperature and any other changes of ±3%.  The difference in this case is close to 10% and I don’t think it can be entirely explained by the clock source.


Interfacing the ADS8328 to an MSP430

The ADS8328 is a high-speed, low power, successive approximation register (SAR) analog-to-digital converter (ADC) that uses an external reference. The ADS8328 has an internal clock that is used to run the conversion but can also be programmed to run the conversion based on the external serial clock, SCLK.

The ADS8328 has two inputs. Both inputs share the same common pin—COM. The ADS8328 can be programmed to select a channel manually or can be programmed into the auto channel select mode to sweep between channel 0 and 1 automatically.

The ADS8327/28 can operate with an external reference with a range from 0.3 V to 4.2 V. A clean, low noise, well-decoupled reference voltage on this pin is required to ensure good performance of the converter. A 10-µF ceramic decoupling capacitor is required between the REF+ and REF– pins of the converter. These capacitors should be placed as close as possible to the pins of the device. REF– should be connected to its own via to the analog ground plane with the shortest possible distance. The test was performed on a breadboard with poor decoupling. The goal was to test the library and the SPI interface to be used in the final setup.

The ADS8327/28 has an oscillator that is used as an internal clock which controls the conversion rate. The frequency of this clock is 10.5 MHz minimum. The oscillator is always on unless the device is in the deep power-down state or the device is programmed for using SCLK as the conversion clock (CCLK).

Channel selection can be done both manual or automatically if auto channel select mode is enabled. The manual conversion mode is used and the conversion cycle starts with selecting an acquisition channel by writing a channel number to the command register (CMR).

The end of acquisition or sampling instance (EOS) is the same as the start of a conversion. This is initiated by bringing the CONVST pin low for a minimum of 40 ns. After the minimum requirement has been met, the CONVST pin can be brought high. A conversion can also be initiated without using CONVST if it is so programmed (CFR_D9 = 0). To have more control over the whole process the CONVST pin is used to start conversion.

The status pin is programmed as EOC and the polarity is set as active low, with this configuration the pin works in the following manner: The EOC output goes LOW immediately following CONVST going LOW when manual trigger is programmed. EOC stays LOW throughout the conversion process and returns to HIGH when the conversion has ended (as seen in the last picture).

Internal Register

The internal register consists of two parts, 4 bits for the command register (CMR) and 12 bits for configuration data register (CFR).

Command Set Defined by Command Register (CMR)


The following table shows the Configuration Register (CFR) Map.


To start the communication first the CFR data is sent.


Then the converted values are read. The ADC reference is connected to 3,4 V and the channel is reading the 2,5 V from a DAC7564 internal voltage reference.



ADS8328 Datasheet


Interfacing the DAC7564 to an MSP430

In this article I’ll try to show how to use an MSP430 with a DAC7564. This is probably the first from a series of articles showing different devices I plan to use in a project.

The DAC7564

The DAC7564 is a low-power, voltage-output, four-channel, 12-bit digital-to-analog converter (DAC). The device includes a 2.5V, 2ppm/°C internal reference. The device is monotonic, provides very good linearity, and minimizes undesired code-to-code transient voltages (glitch).  A DAC is said to be monotonic if the output either increases or remains constant for increasing digital inputs such that the output will always be a nondecreasing function of input. The DAC7564 architecture consists of a string DAC followed by an output buffer amplifier. An N-bit string DAC simply consists of 2N equal resistors in series and 2N switches (usually CMOS), one between each node of the chain and the output. The output is taken from the appropriate tap by closing just one of the switches. The string DAC is inherently monotonic—even if a resistor is accidentally short-circuited, output n cannot exceed output n + 1.

Linearity error of a converter is a deviation of the analog values, in a plot of the measured conversion relationship, from a straight line. The string DAC it is lineal if all the resistors are equal.

A glitch is a switching transient appearing in the output during a code transition. The worstcase DAC glitch (in R-2R) generally occurs when the DAC is switched between the 011…111 and 100…000 codes. In sting DACs only two switches operate during a transition, resulting in a low-glitch architecture Also, the switching glitch is not code-dependent.

The DAC7564 uses a versatile 3-wire serial interface that operates at clock rates up to 50MHz. The interface is compatible with standard SPI, QSPI, Microwire, and digital signal processor (DSP) interfaces.

The DAC7564 input shift register is 24 bits wide. Bits DB23 to DB16 are used for control and configuration and bits DB15 to DB4 for data. Bits DB0, DB1, DB2, and DB3 are ignored by the DAC. All 24 bits of data are loaded into the DAC under the control of the serial clock input, SCLK.

The DAC7564 receives all 24 bits of data and decodes the first eight bits in order to determine the DAC operating/control mode. The 12 bits of data that follow are decoded by the DAC to determine the equivalent analog output.

The write sequence begins by bringing the SYNC line low. Data from the DIN line are clocked into the 24-bit bits wide shift register on each falling edge of SCLK. After receiving the 24th falling clock edge, the DAC7564 decodes the eight control bits and 12 data bits to perform the required function, without waiting for a SYNC rising edge. A new write sequence starts at the next falling edge of SYNC.

Data Input Register Format

The first two control bits (DB23 and DB22) are the address match bits. The DAC7564 offers hardware-enabled addressing capability, allowing a single host to talk to up to four DAC7564s through a single SPI bus without any glue logic, enabling up to 16-channel operation. The state of DB23 should match the state of pin A1; similarly, the state of DB22 should match the state of pin A0. If there is no match, the control command and the data (DB21…DB0) are ignored by the DAC7564. That is, if there is no match, the DAC7564 is not addressed.  Both pins are connected to ground therefore those bits are 0.

Data Input Register Format

Data Input Register

LD1 (DB21) and LD0 (DB20) control the loading of each analog output with the specified 12-bit data value or power-down command. In the final setup the DAC will need to update each channel individually and at different times so Single-channel update will be used which implies having DB21 = 0 and DB20 = 1.  The final control bit, PD0 (DB16), selects the power-down mode of the DAC7564 channels as well as the power-down mode of the internal reference. In this application there is no concern over power savings so bit SB16 will be 0.

Load commands

Load commands

Bit DB19 must always be ‘0’.The DAC channel select bits (DB18, DB17) control the destination of the data (or power-down command) from DAC A through DAC D.

The final control matrix to be used is as follow;

Control matrix

The initial test are done using the internal voltage reference enabled by default. The DAC7564 includes a 2.5V internal reference with 0.004% Initial Accuracy (typ) and 5ppm/°C Temperature Drift (max). In the future a 4.096 V reference will be used and for that the internal reference need to be disabled. To do that a serial command that requires a 24-bit write sequence must be used.

The software

An MSP430 is used to send the data and the SPI communication is done by bit-banging. A library provides functions to send, receive and transfer data using SPI protocol. Being a bit-bang communication there is no particular hardware module necessary and any MSP430 would work, in this particular case a MSP430F2274 is used. The function send 8 bit at a time and the data needs to be rearranged before sending. The first byte (DB23…DB16) corresponds to the address, the load command, power down bit and the channel selection. The second byte (DB15…D8) corresponds to the eight most significant bits of the 12 bits DAC value. In the third and last byte the remaining 4 bits of the DAC value is sent. The image below shows a capture of the data pattern made using a logic analyzer.



A Launchpad was used as an oscilloscope to see the DAC’s outputs (I don’t have a scope, I’m saving for one. If you have found the site useful, please consider making a donation and help me buy one 🙂). For the test the internal 2.5 V voltage reference was used and the microcontroller generated a ramp style signal and a couple of sine waves. The picture shows the DAC’s outputs (sampled at 55[Hz]).


The sine waves are generated using a 256 points look-up table. For the green one the value from the table is divided by two.



The data conversion handbook. Analog Devices Series Electronics & Electrical. Walter Allan Kester. 3 Ed. Newnes, 2005.

DAC7564 Datasheet.


Recycling electronics component

Electronics components can be recycled from discarded gadgets. The problem resides in identifying the parts. The passive components might be labeled like the resistors or resistor networks.

Recycling electronics component
Others might not, like capacitors or ferrite beads but you can easily find out the value measuring them. The active devices can be quite difficult to find and sometimes even impossible, for example if you happen to come across a chip with a custom marking code.

Here I’ll show how I do it using a motherboard as an example.

Recycling electronics component
The big parts (SOIC, TSSOP, TQFP, etc.) are relatively easy to find, just Google the marking on the top of the chip. It doesn’t need to be the complete code name; some of the numbers and the package type or the manufacturer could be enough. The board has several of these big chips but the most useful parts would be:

A29040BL: 512K X 8 Bit CMOS 5.0 Volt-only, Uniform Sector Flash Memory


74HCT14D: Hex inverting Schmitt trigger

93C46: Atmel, Three-wire Serial EEPROM

RT9214: 5V/12V Synchronous Buck PWM DC/DC Controller

There are a lot of D-PACK devices. This package is intended for high power dissipation so these might be some sort of transistors or diodes. One of them has the code “09NG” and the ON Semiconductors logo. In this case is a well-known company but in case you find some weird logo there are several sites that might help you identify the manufacturer’s name by the logo. So, we have a code, the package and the manufacturer, anything else? Well, yes. The PCB’s silkscreen has the letters S, D and G around the device and this tells you that the part is a FET (Source, Drain and Gate). After googling all that information that part turns out to be a NTD4909, Single N−Channel Power MOSFET (30 V, 41 A).

Recycling electronics component

The other D-PACK has the code “65A3” and the same letters in the silkscreen so it has to be another FET. This one was somewhat tricky to find but eventually I did, is a CEP65A3 N-Channel Enhancement Mode Field Effect Transistor.

Recycling electronics component
There are also a couple of SOT-223 chips. Whenever I’ve found these parts in the past they usually were some sort of voltage regulator and this is not the exception. The silkscreen is a big giveaway, the pins are labeled I, O and A, that is Input, Output and Adjust and the code number correspond to a AZ1117, 1A LOW DROPOUT LINEAR REGULATOR with adjustable output.

Recycling electronics component
Moving on to the smaller devices you’ll see a lot of SOT-23 parts. For this sort of devices there are a couple of sites that will help you to identify them;

(1) http://www.s-manuals.com/smd

(2) http://clivetec.0catch.com/SMD_Codes.htm

In some cases different devices could have the same or very similar codes, that’s where knowing the package or the possible function pays off.

There is one with the marking code “12W” and the silkscreens shows that it is supposed to be a MOSFET. Looking for the code mark in (1) shows that it is a 2N7002 60 V, 300 mA N-channel Trench MOSFET. There is another part that should be a MOSFET and has the marking “L1”, from (1); SI2301BDS P-Channel 2.5 V (G-S) MOSFET.

Recycling electronics component
A couple of devices have the letters E, C y B around them showing that these are bipolar transistors. The markings code are T06 and T04, form (2) these devices are a PMBS3906 PNP and a PMBS3904 NPN general purpose transistor respectively.

Recycling electronics component
Another part has the letters A, K and AK around the pins but I didn’t realized at first was this might means. I looked for the marking code “A7W” in (1) and found out that is a BAV99 High-speed switching diodes. I searched for the datasheet and the letters made sense, it has two diodes inside with the anode of one connected to the cathode of the other forming that “AK” pin.

Recycling electronics component

I couldn’t find one of this SOT-23 parts in neither of the sites with the “EB2” marking. I recognized the logo on top of the package but only because I saw it a just moment earlier while searching for the “bigger parts”. It is not very clear but that’s the logo of Advanced Analog Circuits (I saw it in the AZ1117 datasheet). So, after doing a search with all this information I found the part; it’s an AN431, adjustable precision shunt regulator.

Recycling electronics component
Well, that’s all. This is all the stuff I managed to desoldered.


I leave several parts on the board and destroyed a few in the process, at one point I lost my patience and increased the hot air gun temperature melting some of the plastic parts and damaging a couple of capacitors. The excessive heat increased the capacitor’s inner pressure and a lot of gas came out of the capacitor valve. It might be a good idea to keep your face away from the capacitor pressure valve while desoldering…now I know that.

Hopefully someone will find some of this useful.

Adding Bluetooth to the MSP430 Launchpad

The National Semiconductor LMX9838 Bluetooth Serial Port module is a fully integrated Bluetooth 2.0 baseband controller, 2.4 GHz radio, crystal, antenna, LDO and discreets; combined to form a complete small form factor Bluetooth (BT) node[1] . I made a board (not my best soldering job) to connect an LMX9838 to a Launchpad and test it out. The circuit is really simple, the module needs a couple of resistor to set the baud rate (9600) and 3.3 volt, that it’s!


The basic circuit (just sending data) use  three wires; VCC, GND and the TX->RX connection.

Adding Bluetooth to the MSP430 Launchpad

After powering up the module is recognized by the PC as a Bluetooth Serial Port Device and the installation was pretty straight forward.Sin5

I programed the Launchpad (LP) using Energia but I wasn´t receiving the right data using the BT module. The circuit seemed to be fine so I tried with a simpler program that just send “hello world” every time I press the S2 switch. This is what I got:


D is an MSP430G2452 using the LP serial interface to send the message, C is the same MCU with the BT module. The data was there but for some reason the BT module wasn’t sending the whole message. Then I changed the MCU and used an MSP430G2553 instead and A shows the LP serial interface and B shows the data received through the BT module.  It seemed like the BT module doesn’t like the software UART implemented in the MSP430G2452 but works fine with the hardware UART in the MSP430G2553. I connected the Open Bench Logic Sniffer to see what’s going on and the signals seemed to be the same with both microcontrollers. I analyzed the data stream with the software and there was a little difference between the signals.

uartsw uarthw

The first image shows that the baud rate using the MSP430G2553 with hardware UART is 9523, pretty close to 9600. The other one is the software UART and the baud rate there is 9090, a 5.31% difference that the BT module seems to not be able to handle.

Making an FM radio-Part 2; the incremental encoder

Despite being a digital radio capable of doing a lot of stuff I wanted a simple design with a knob for volume and another one to change station. The volume is just a potentiometer and for the stations I wanted to use an encoder, unfortunately I didn’t have one. What I did have is a hard drive motor and as it turns out you can use them as rotary encoders. I found two ways to do this; one is to use the signals from the hall sensors and the other one is to use the back fem generated by the winding. The motor has all the electronics sealed making it difficult to figure out how to use the sensors so I used the second method. I found two projects that use brushless motors as encoders taking advantage of the back EMF. In one op-amps are used as amplifiers and the outputs are sampled with a microcontroller’s ADC, in the other the op-amps are used as comparators thus generating a couple of square waves. With the second approach I could use interruptions instead of sampling both ADC channels all the time so I went for the comparator setup.
For the first tests I used only a couple of led at the op-amp outputs to see if the circuit was doing something. Then I watched the outputs with a logic analyzer and let me tell you, it wasn’t pretty. Anyway, I searched for ways to read encoder signals with a microcontroller and I found this. I copied that code and add it a few lines to have a couple of pins generating pulses depending on the direction of rotation.

Unfortunately that code was made to be used with a real encoder with a much cleaner signal. In the picture I’m moving the motor in one direction but both outputs (channel 2 and 3) are generating pulses.

If you use an optical encoder all you have to do is detect a flank (either low->high or high->low) in one signal and check the value of the other one. With my “encoder” I have to detect both flanks and check the values of the other signal in those situations to see if an acceptable sequence has occurred.  And after a few changes I got this;

The first picture shows the signals generated when I move the motor fast first in one direction and then in the other. In the second picture I’m moving the motor slower (as if I’m looking for a station) in only one direction.  The signal is worst when I turn it slower but the microcontroller managed to detect a few pulses which I’ll be using to control the radio. Finally the code;

#include <msp430g2452>;
#include "stdint";
int aux=0;
int edge=1; //0=high-&gt;low, 1=low-&gt;high
int dir=0;
int accept=0;
void main( void )
 // Stop watchdog timer to prevent time out reset
BCSCTL1 = CALBC1_16MHZ; // Set range
P1REN |= BIT1 + BIT2;  // select pullup resistors for pin 1.1 and 1.2
P1DIR |= BIT5 + BIT4;  // outputs for testing
P1OUT |= BIT1 + BIT2;  // need to set P1.1 and P1.2 to high so PULLUP resistor will be selected
P1IES &= ~ BIT2;  // select low to high transition for interrupts on all port pins (this actually the default)
P1IE  |= BIT2;  // enable interrupt for P1.2 to reader status of encoder every time Encoder sigal A goes high
P1IFG = 0x00;  // clear interrupt register
__bis_SR_register(LPM0_bits + GIE);
for (;;) {
#pragma vector = PORT1_VECTOR
 __interrupt void InterruptVectorPort1()
 if( P1IFG &amp; BIT2 ) {
     case 1://always start with the 0-&gt;1 edge
      aux=( P1IN &amp; BIT1 );//save the other channel input
      P1IES =BIT2; //Edge sensitivity
      edge=0;//the next interruption will be in 1-&gt;0
      accept=0;//reset value
     case 0:
      if((P1IN & BIT1)==aux){accept=0;}//Not a good pulse sequence;
      else{accept=1;//Good pulse sequence
      P1IES &= ~BIT2 ; // Toggle Edge sensitivity
      if(P1IN & BIT1){dir=2;}//save direction of movement
 } if(accept){//if a good sequence is detected...
    switch(dir){//output a short pulse in the correct direction
     case 2:
      P1OUT |= BIT4; // output P1.4
      P1OUT &= ~BIT4;
    case 1:
      P1OUT |= BIT5; // output P1.5
     P1OUT &= ~BIT5;
 P1IFG&= ~ BIT2;

Making an FM radio-Part 1; the TEA5767

I’ve started to build a little FM radio with one of this cheap modules with a Phillip chip, the TEA5767. I will control it with a MSP430, probably I’ll use some kind of encoder to change stations and a potentiometer for the volume.

The TEA5767 is a single-chip electronically tuned FM stereo radio for low-voltage applications with fully integrated Intermediate Frequency (IF) selectivity and demodulation. Most of the information of this devices is from the datasheet and this app note.

Module Pinout

The I2C-bus mode is selected when pin BUSMODE (PIN 3) is LOW. The serial interface use pin 1 as SDA and PIN 2 as SCL. The board is powered with 3.3V with VCC being PIN 5 and GND in PIN 6.  PIN 10 is there to connect an external antenna (just a piece of wire) and PIN 7 and 8 are the audio outputs.  Pins 4 and 9 are left unconnected.


Some basic theory

First of all let me explain some basics concepts about FM radio receivers in order to understand how to configure the different settings this chip has. I might be oversimplifying some things here, I’m just writing what I’ve read and understood while searching information to use this thing so beware of mistakes!

The superheterodyne is a circuit arrangement that is the basis of almost all modern radio receivers. Edwin Armstrong invented in 1918 the idea of a heterodyne receiver. Heterodyning is the translation of a signal from a higher Radio Frequency (RF) carrier signal to a lower Intermediate Frequency (IF). There are three important frequencies in heterodyne RX; RF Radio Frequency, the center frequency the signal is broadcast on; IF Intermediate Frequency, fixed frequency inside the RX (the RF signal is downconverted to this frequency) and LO Local Oscillator, tunable frequency inside the RX used to translate the RF signal to the IF frequency.

Structure of the Superheterodyne Receiver [c1]


The mixer uses a non-linear component to produce both sum and difference signals, each one containing the modulation contained in the desired signal. The output of the mixer may include the original RF signal at fd, the local oscillator signal at fLO, and the two new frequencies fd+fLO and fdfLO. The mixer may inadvertently produce additional frequencies such as 3rd- and higher-order intermodulation products. The undesired signals are removed by the IF bandpass filter, leaving only the desired offset IF signal at fIF which contains the original modulation (transmitted information) as the received radio signal had at fd.

The idea behind an IF Intermediate Frequency is that you need to have the rest of your sistem tuned to a particular frequency not dependent on the receiving frequency and that greatly simplifies optimization of the circuit. In the TEA5767 the IF frequency is 225kHz. The IF amplifier can be made highly selective around its center frequency fIF , a more “selective” receiver is able to select the station you want and keep out other stations. By tuning the frequency of the local oscillator fLO, the resulting difference frequency will be matched to the IF amplifier’s frequency fIF for the desired reception frequency fd.  [c2]

In a receiver, when the LO frequency is below the RF, it is called low-side injection and the mixer a low-side downconverter; when the LO is above the RF, it is called high-side injection, and the mixer a high-side downconverter.[c3]  That is

fLO= fd+fIF   high-side injection

fLO= fd-fIF   low-side injection

The TEA5767 has the ability to work with both high and low-side injection.  This is to avoid the problem of image frequencies. Other signals produced by the mixer (such as due to stations at nearby frequencies) can be very well filtered out in the IF stage, giving the superheterodyne receiver its superior performance. However, if fLO is set to fd + fIF, then an incoming radio signal at fLO + fIF will also produce a heterodyne at fIF; this is called the image frequency and must be rejected by the tuned circuits in the RF stage.

Don’t believe me? Let’s do the math;

You want to hear the station on 97,5 Mhz so the Local oscillator will have to be tune to

fLO= fd+fIF   (high-side injection) → fLO=97,5 Mhz + 225 kHz = 97,725 MHz

so, with that frequency in the Local Oscillator you’ll get

fLO fd= 97,725 MHz – 97,5 Mhz =225 kHz=fIF (you’ll hear this one)

fLO+ fd= 97,725 MHz + 97,5 Mhz =195,225 MHz fIF  (this one won’t pass)

That’s pretty simple now imaging you have an RF frequency of  fLO + fIF= 97,95 MHz and;

|(fLO + fIF)- fLO|= 97,95 MHz – 97,725 Mhz =225 kHz= fIF  here again the difference is 225 kHz and this other radio station would also be heard, though not as well as the one at 97,5 Mhz because the RF tuned circuits largely remove it. This is the image frequency.

Let’s do the same procedure but now using low-side injection;

fLO= fdfIF   (low-side injection) → fLO=97,5 Mhz – 225 kHz = 97,225 MHz

again, with that frecuency in the LO you’ll get

|fLO fd|= 97,225 MHz – 97,5 Mhz =225 kHz= fIF 

|fLO+ fd|= 97,225 MHz + 97,5 Mhz =194,725 MHz fIF  (this one won’t pass)

now there will be a frequency fLOfIF= 97 MHz with the same problem;

|(fLOfIF)- fLO|=|97 MHz – 97,225 Mhz| =225 kHz= fIF another image frequency

You have this two image frequencies at fd±2fIF that might pass through but at least you can choose to have the one that interfere less with the station you want to hear.

Tuning of the local oscillator and the RF stage may use a variable capacitor, or varicap diode. Nowadays digital tuning systems are replacing the conventional mechanical systems in AM and FM receivers. One of this digital tuning systems is the Phase Locked Loop (PLL).The PLL is often used to synthesize the local oscillators used in communication transmitters and receivers. In a typical scenario, we might have a crystal oscillator which provides an accurate frequency reference at a relatively low frequency, the TEA5767 module uses a 32,768kHz crystal. We wish to use this to derive an accurate frequency reference at a higher frequency which will be the local oscillator used at an IF or RF stage in the transceiver.[c4]

Structure of a PLL


I’m not exactly sure about how the PLL works but the important thing here is to understand that we have control over the Frequency Divider shown in the diagram. Using a simple formula a 14bit  number is calculated (the “k” value) and used in that divider in order to receive a certain station.

In case of using High side injection the following expression is used;

Ndec= \frac{4*(F_{RF}+F_{IF})}{F_{FREF}}

Talking to the TEA5767

The device has an I2C serial interface and the data sequence is as follow: address, byte 1, byte 2, byte 3, byte 4 and byte 5, both when writing and reading. The IC address is ob11o oooo.

The first two bytes are quite simple. MUTE has to be at 0 to unmute both channels and SM also at 0 because I won’t be using the search  mode. The rest of the bits are for the number I have to send for th PLL to set the station frequency. Using as an example FM 97, 5;

Ndec= \frac{4*(97,5MHz+225kHz)}{32,768kHz}=11.962=0x2EBA

In the third byte the three MSB are used in the search mode, I’m not using it so those three will be set as 0. HLSI is to choose between Low/high side injections. The formula I used to calculate the PLL frequency divider is for a High Side injection setup so that bit has to be set to 1. MS will be at 0 to choose a stereo output instead of mono. MR and ML will be at 0, otherwise right and left channel would be muted. Finally, SWP1 is for a software programmable port which I don’t have access to and won’t be using so I’ll put there a 0.

In the fourth byte there is another software programmable port and again this will be at 0.  STBY is set at 0 to avoid Standby mode. BL is set at 0 to use the US/Europe band limits (i’m in Argentina). XTAL is set at 1 because the board is using a 32,768kHz crystal.  SMUTE, HCC, and SNC will activate different functions with the intention of improving the sound quality, I’ll just ignore them for now and set those three bits to 0. The LSB is SI which is related to SWPORT1 and I can’t use it so, again, 0.

In the last byte there are only two bits to configure. PLLREF has to be set at 0 to disable the 6,5 Mhz reference and DTC is 1 to use a de-emphasis time constant of 75us. The rest of the bits are not used.

After figuring out what to send to the module I made a simple program and connected the TES5767 to a Launchpad. I’m using a MSP430F2012, the code is built in IAR and I’m using TI’s library for the I2C communication to makes things easier.


As you can see in the code there are only a couple of functions. Luckily all the time spent to understand the chip paid off and the radio worked inmediatelly.

#include <msp430x20x2.h>
#include "USI_I2CMaster.h"

int StatusCallback(unsigned char c)
return TI_USI_EXIT_LPM; // Exit active for next transfer

void main( void )
// Stop watchdog timer to prevent time out reset

BCSCTL1 = CALBC1_16MHZ; // Set range

/* Initialize USI module, clock ~ SMCLK/128 */
TI_USI_I2C_MasterInit(USIDIV_7+USISSEL_2+USICKPL, StatusCallback);

unsigned char TxDataConfig[5] = {0x2E,0xBA,0x10,0x10,0xC0};

/*Write data, configuration register
TI_USI_I2CWrite(SlaveAddress, Length, Multi, TxData) */
TI_USI_I2CWrite(0x60, 5, 0,TxDataConfig);
__bis_SR_register(LPM0_bits + GIE);



MSP430 Launchpad and TEA5767 FM radio module

MSP430 Launchpad and TEA5767 FM radio module

EDIT: I made a mistake calculating Ndec, I divided by 32678 Hz instead of 32768 Hz. The correct number for 97.5Mhz is 11929 = 0x2E99.

My first professionally made PCB

I used Iteadstudio PCB service. I’m quite happy with the result. I received the boards a while ago but I haven’t had enough time to play around with these. The boards are designed to be used whit any of the MSP430 in DIP package. Using jumper pins I can configure the board in several different ways and use them for different proyects.

msp430 PCB

It has a 2×4 header for a nRF24L01+ module.

msp430 PCB

It can be directly connected to the Launchpad for programming, I just need an extra wire for ground

msp430 PCB