I recently ordered some samples from TI, which included the TMP275 digital sensor. The sensor has some nice features which I quote from it’s datasheet:

The TMP275 is a 0.5°C accurate, Two-Wire, serial output temperature sensor available in an MSOP-8 or an SO-8 package. The TMP275 is capable of reading temperatures with a resolution of 0.0625°C. The TMP275 is SMBus-compatible and allows up to eight devices on one bus. It is ideal for extended temperature measurement in a variety of communication, computer, consumer, environmental, industrial, and instrumentation applications. The TMP275 is specified for operation over a temperature range of −40°C to +125°C.

The easiest way to get the temperature out of the TMP275 seemed to be I2C. So I started by designing a board which has all the components needed: the sensor, an atmega8 brain, and some other components needed for the display and for powering the board. The display is a 4 digit 7 segment display from kingbright product code CA56-12GWA. As for the display part of the board, I used PNP transistors on the common anodes and resistors on the segments to limit the current draw on the atmega’s pins. The transistors are not current limited so the display will alaways light-up the same no matter how many segments are turned on.

TMP275 digital thermometer board

For the supply part of the board, I choose to make it portable and power it from a 9V battery, so I needed to use a voltage regulator. The choice was the good old 7805 because it’s cheap and easy to find.

I2C is a pretty common protocol so various libraries can be found on the web. I chose Peter Fleury’s I2C library because it was very well documented. The only external components needed by the TMP275 are a bypass capacitor between VCC and GND and two pull-up resistors required on SDA and SCL lines.

All the I2C stuff is handled by the library, so I only had to write a couple of lines of code to get the temperature out of the sensor:

 i2c_start_wait(sensor+I2C_WRITE);	// set device address and write mode
 i2c_write(0x0);			// write pointer register 00000000 to select temp register
 i2c_rep_start(sensor+I2C_READ);	//set device address and read mode
 temp_high=i2c_readAck();		// Read high byte of temperature
 temp_low=i2c_readNak();		// Read low byte of temperature

After reading the temperature from the sensor I had to display it on the 4 digit display. For that I had to write a display macro, which figures out the numbers and how to display them, basically I used software multiplexing. I even tested it on negative temperatures by placing the sensor in my fridge :) . The readout was correct because I checked with another thermometer.

These new type of digital sensors are great, because you don’t have to worry about analog to digital conversion, all the  ADC is done inside the sensor. I mainly started working with this sensor because I want to incorporate a temperature reading function into a future project. Now that this part is done, is time to move onto the next one, ultrasonic range finder, which I’m guessing wont be as easy as the temperature reading.

I tried to comment every line of my code, but if you feel you don’t understand something, just post a comment and I’ll reply.

router-roundover

In the first part i presented some of the woodwork on the satellite speakers and a first schematic of the crossover. These days i had time to finish the front baffles, made the edges round, cover the speaker with dark colored carpet and install the drivers and crossover for testing and voicing.

The rounding of the baffle’s edges is done using a 8mm round-over bit on the router. Make sure you get the board fixed so that u can push the router in the edge.

roundover bit 8 mm router bit

Once this is done i applied the first layers of black paint and glued the baffle on the rest of the cabinet. While i was waiting for it to dry i carpeted the back plate. When you chose to use carpet it’s a good idea to install the back plate a little inside the cabinet and this way to leave an edge. This will allow you to glue the carpet and not leave any visible marks at the joints. After the back plate the sides, top and bottom will be carpeted in one piece.

backplate-spkr spkr back plate 2 spkr side spkr side 2

The front baffle was cut with 3mm more on each side so that the carpet would go right at the same level

The satellite speakers are almost done at this point, it is time to install everything inside for the first tests. I chose to fill the cabinet about 70 to 80 % with wool and this way lower the total Q of the speaker to somewhere around 0.8. This can be a high value but since i will use active filter on the subwoofer matching will be easier.  The first version of the crossover network was done in air just for testing. It seems the waveguide gain was slightly higher than expected so the initial L-pad had to be changed. Also the cut frequency was little too high for the tweeter. Since i wanted the option of bi-amping i decided to add a tweeter protection circuit i had in my schematics notebook which I’ve seen used in some professional speakers. After these changes in crossover came another session of listening tests. There was still a part in the upper midrange (voice sibilance) i found to be too emphasized. Adding a resistor of about 1.5ohms in series with the inductor in the high pass filter lowered the Q and smooth the sound.

filtru1 filtru 2 zobel

In the last picture you can see the Zobel network which is an impedance equalization

These are 2nd order filters so you need to reverse polarity of the tweeter, connect the plus of the tweeter to the minus of the filter and vice versa. Otherwise you will have a big dip in the frequency response caused by the phase shift of the filters. Another thing to be careful about is not to connect ground of the high pass and low pass filters if you’re using bi-amp connector. The strap at the connector takes care of that. The radiator i used on the TIP transistors may be an overkill but better safe than sorry.

I did an experiment with a baffle step circuit. From a certain frequency the directivity of the speaker becomes focused and this may appear as an increase in sound pressure level. A baffle step attenuates the response a little from that frequency up. Usually i don’t use it for i didn’t find it necessary. In this case however i got better response on bass at the expense of overall efficiency. However once i will add the subwoofer to the system this circuit might not be necessary. In this case the circuit is made of a 2.7mH inductor in parallel with a 8 ohm resistor connected before the crossover. Baffle step circuit is impractical when using bi-amping though.

Here is simulated baffle step responses using Edge software:

baffle step uneq baffle step eq

To be continued:

- Measurement of on-axis and off-axis frequency response

- Building the subwoofer

Bookshelf Speakers

I will present you here a 2.1 speaker project made from some leftover materials. Nothing fancy but i will try to get the most out of everything. In this first part i will give information about the overall design and the first work on the satellite speakers. Drivers i used were those i had laying around, a pair of 8″ woofers with nothing written on them, probably Chinese stuff (I will have to measure some of its parameters), a pair of 6.5″ mid-bass drivers i saved from some commercial speakers and a pair of horn-loaded soft dome tweeters from PAudio model PCT-300.

I plan on using the two 8 inchers for a subwoofer, i will have to measure some parameters to determine what box to build. The satellite speakers will have one mid-bass driver and one tweeter in a closed box. The box should not be bigger than 10l in volume.

Some of the Thielle – Small parameters of the 6.5 incher mid-bass are as follows:

Fs: 65.41Hz, Qts: 0.62, Qes: 0.76, Qms: 3.43, Vas: 18.9l, Sd: 150 cm^2, Xmax: 3mm, Re: 7.4 ohms, SPL: 90dB/w/m, RMS Power Handling: 50W

6.5 inch mid-bass

A closed 10l speaker models with a -3db band starting 85Hz with a Qtc little over 1. Below 85hz there is a 12db per octave attenuation so it will be pretty easy to match it with the subwoofer. I can lower the Qtc with heavy fill hopefully to a value below 1. Because of small dimensions of the cabinet the driver will never exceed maximum excursion.

predicted lf response

Predicted low frequency response in WinISD

Now off to the wood work. Tools needed: Router, Jig Saw, Circular Saw, Electric Drill, Clamps, Screws, Glue, etc.

Lucky me i found a pair of old speakers measuring about 9l of internal volume. Almost perfect for my application. I only kept the top, bottom and the side panels. I make a new back panel and cut hole for the speaker terminals. I want the option of using separate amplifiers on highs and mids so i use bi-amp speaker connectors. I plan on painting the front baffle black and finish the rest in some dark colored carpet.

9l old speaker router back panel back panel connector

You can see here what i kept from the old speakers, the router getting ready, the back panel in position and the back panel with the connectors installed.

Now follows the routing of the front baffle. I use MDF for it’s easy to work with and has pretty good acoustical properties. First i prepare the router. I make the compass from a thinner board of MDF and i attach it to the bottom plate of the router. After this i measure the desired radius and make a hole in the board. This hole will be the center of the circle being routed.

router w/ compas cutting baffle baffles front baffle

Better measure 5 times and cut once…

The drivers are flush mounted and the front baffle’s edges will be rounded to minimize diffraction. The distance between the acoustical centers of the two drivers is 17cm. This distance corresponds with the wavelength of approximately 2kHz, which will be pretty much in the middle of our crossing point. This alignment avoids phase problems in this region. Also loading the tweeter with horn provides time alignment with our woofer.

Before talking about crossover lets look at the high frequency driver a bit:

pct-30

As you can see it is pretty sensitive at 93dB, mine actually reaches flat region at 92 dB. Because of the waveguide there is a big boost on the higher mid-range. Also note the fs of 1.4Khz. This means we should cross this tweeter not lower than 2.8khz. I decided to cut it at about 4Khz with 12db/ octave slope and this way make it linear down to approximately 2kHz. Considering the gain provided by waveguide i will cross the woofer at about 1.4kHz 2nd order Butterworth again.

This is how crossover looks like… on paper for now:

xover schematic xover graph 1 xover graph 2

In schemtic you will see the Zobel network in parallel with the woofer for impedance equalization and the L-pad on the tweeter to adjust for the increased sensitivity.

To be continued:

- Finishing cabinets, round-over the edges of baffles

- Building crossover, install and voicing

Seven segment display

In this article I intend to explain the functionality and usage of the seven segment display, probably you have seen many projects with these type of displays, however the price drop of LCD’s tend to overtake the market, there are a still few applications for which these devices are more suited. For large numeric displays, like clock’s, railway station displays, low-cost measuring devices or very stressing environments the led based displays are better, and cheaper.  The most simple led display available is the seven segment display, it consists of 7 led stripes arranged forming the number 8, because of its simple construction it is very robust and can function in very low or high temperatures, can withstand vibrations,  mechanical shocks without problems, for what the LCD would fail to work or even get permanently damaged.

single sevene segment

If we look at one digit we can see 10pins each segment and the small dot are LED’s, each of them has one terminal connected to a common pin, from this comes the name common anode or common cathode, and the other terminal is connected to a standalone pin, since the common pin is doubled, we have the 10 pins for each digit.

seven segment config

Lets take as example the common anode type, to light the segments we need to connect the positive supply rail to the common pin, and pull to ground the segments, each segment depending on its size can handle a few miliamps, after all we are talking about LED’s not bulbs. That’s fine if you need just one number to display, but how can these digits be connected to form a multi-digit display? The first approach is to connect each segment to a micro-controller pin, this way for each digit you need 8 pins and isn’t elegant at all.

The other solution is to connect each corresponding segment from the digits to a common bus, and power the digits one at a time, thus multiplexing the data.

seven segment schematic

This multiplexing probably sounds more complicated than it really is, look at the next picture:

illustrated seven segment operation

Since the digits share the same data bus, each digit will have the same number displayed, like the wheel on the picture, to change the number the “data guy” rotates the wheel. So how can we display 1234 you might ask, well wee need another guy, the selector, which will leave only one digit to be seen, all the others are shut off, by synchronizing the “data guy” and the “selector guy ” so they operate at the same time, when the wheel is at the 1111 position, the selector opens the first window, when at 2222 it opens the second and so on. By changing the data and selecting the digits at many times per second the human eye will see a steady image with 1234, the display refresh rate should be above 50 times in 1 second, otherwise the image may flicker.

In the schematic the “selector guy” is implemented by the PNP(BC327) transistors and the “data guy” is the data bus (PORTB0..7). For the practical demonstration I used my own avr development board with ATmega88, four HD1131R type seven segment digits which I rescued from an old TV a few years ago, the connections are made on a prototyping pcb with scrap wires. The data port is PORTB, for selection the PD4..PD7 pins where used.

Like I mentioned earlier we need a periodic data update with digit selection to have a steady image, and since the entire display refresh should be above 50Hz and we have four digits we need to change the digits at frequencies greater than 200Hz. Since the amount of time which one digit is turned on is 1/digit count, as the display has more digits the light intensity gets weaker, in our case the HD1131R has 1.6V voltage drop, by powering from 5V and trough 330Ohm results 10mA trough each segment, but since we have 4 digits the average current received by each segment is 10/4=2.5mA, this will result in a very fade light. For the demo application I used 220Ohm values, with the on board 100Ohm resistors the average current is 2.5mA/segment, although I could have used only the on board resistors, thus having 8.5mA average current, but the peak would be 35mA, and the micro-controller can handle at maximum 25mA/pin, off course the pin won’t get blowed right away from 35-50mA, but you should be careful when designing similar circuits.

That’s enough about the hardware, let’s see the software, for the periodic refresh I used a timer interrupt with 244Hz, resulting in 61Hz refresh rate, in Europe we have 50Hz AC power, so that’s fine, but in the case of 60Hz AC power the refresh rate should be at 70Hz to avoid the stroboscopic effect.

For the display data I used 4 byte buffer from which the interrupt reads and sends to PORTB, the buffer index can be used also for digit selection(see void DisplayData(uint8_t* Display) ).

Because of the seven segment data format by directly writing 5 to PORTB, won’t result in displaying 5, so the numeric data must be converted first, because there isn’t any easy algorithm to mathematically make this conversion, we must use another method, for a one digit display you could make if-else or switch statements, but with 2 digits you already need 100 lines of code, for 3 digits 1000 lines and so on. A very handy solution is a look-up table:

const uint8_t DigitCharTable[] = { DigImage0, DigImage1, DigImage2, DigImage3, DigImage4,\
DigImage5, DigImage6, DigImage7, DigImage8, DigImage9, };

By indexing the table with the numeric value 0-9 we get the needed data format, example PORTB = DigitCharTable[5]; results in displaying 5;

The void NumToDispValue(int16_t Number, uint8_t* DataBuffer) function uses this method to convert 16bit signed value into display compatible string.

After the conversion made, the actual display buffer needs to be updated with the new value, here is a tricky part, by converting 1234 into display compatible data we will have [DigImage1, DigImage2, DigImage3, DigImage4], by having DigImage1 at the first position and my display has  D4,D3,D2,D1 physical configuration the data displayed will look like this: 4321, it gets reversed. This can be overcome by reversing the selection lines PD4..PD7, or by copying the reversed string into the display buffer(see void StrUpdateDisplay(uint8_t* DisplayBuffer, uint8_t* UpdateData, uint8_t InvDir)  ).

After the conversion, the result is a string(not ascii!), so the string manipulation techniques can be easily used, the dot can be added to any digit, simply by setting the 7-th bit in that byte(see macro WITHPOINT(a) in SSDisplay.h ). There is also possible to display a limited amount of characters like E,F,c,C.., (see SSDisplay.h) it won’t be pretty but it’s readable.

Last but not least, since the refresh is done in interrupt, the display buffer update operation should be made atomic, in other words first disable the refresh interrupt, and then update the buffer, otherwise the image will flicker, and don’t forget to re-enable the interrupt after!

If you use only the refresh interrupt, than it’s easier to just disable all interrupts globally, although if you have other interrupt sources too, then disable only the refresh interrupt, this way you won’t hold back the other incoming events.

For data source I used the ADC to measure the potentiometer output, you can also tweak the macro’s used to handle the ADC, the dot in the 2th digit is activated if the ADC value  is above 512.

The demo project was made using avr-gcc and avrstudio, some variable type notations may differ from the ANSI C standard since I use the avr-gcc typedefs, the entire project among with schematics, pdf’s is available for download.

In the next article I will explain the usage of the matrix keyboard.

Seven segment display explained: [download]

rgm-3550lp-gps-modules-connected-with-asus-eee-pc

The idea behind this project was born when a friend asked me too take a look at he’s broken GPS unit (MyGuide 3000) to see if I can fix anything. I started checking various parts like voltage regulators, but found nothing wrong. The gps unit was still not powering up so I checked the cpu, an ARM9 from Samsung and found it broken. Of course I couldn’t do anything about that, because of the BGA package and the bootloader needed after replacing it so the gps unit became a source for parts. The most useful and interesting parts from the GPS were the LCD display and the GPS module.

The GPS module is a RoyalTek RGM-3550LP which has an integrated antenna and is powered by SiRF Star III technology. I immediately connected the gps module to my computer’s serial port(using a max232) to test if it was still working. To my surprise the gps module was working and sending NMEA compliant sentences. Then I had this idea of using the gps module as a navigation system together with a notebook computer, but notebooks don’t have a serial port so I had to use a UART to USB bridge.

RoyalTek rgm-3550lp-gps-module

The most common used UART-USB bridge is the FT232 manufactured by FTDI which is about $4 which is a fair price because you don’t need any external parts for this chip except some bypass capacitors and that saves you time and money. I never used the chip before but it was really easy to get it working. It even has this custom utility that let’s you program some features saved in the internal EEPROM like the maximum bus power and the product and manufacturer descriptor strings. Anyway these are the only two settings that I tinkered with, but the utility let’s you change some more stuff.

ft232rl-usb-uart-bridge

The next thing I had to worry was where to get the power for the GPS unit, because it needs 3.3V and the acquisition current is 50 mA. The FT232 has an internal voltage regulator which provides 3.3 V and 50 mA but I decided not to use that in order to extend it’s life so I ended up using the TPS2148 which is a 3.3V LDO from Texas Instruments. It’s specifically designed for USB peripheral power management, and it’s tiny package(MSOP-8) made it ideally for my application. The TPS2148 handles the current limitation so I didn’t had to worry about that either.

tps2148-msop-8-package

After figuring out the parts I was going to use and the schematic, I had to chose an enclosure for this project. The main target was to get it as small as possible but the limit was the gps module size, I couldn’t of got it smaller then the module :) . So I went and searched for a plastic enclosure, and I found one just perfect for what I needed, the PP85D from Supertronic. The gps module fits just nicely between the screw channels.

Then after I got the enclosure, I made the pcb using the photo etching technique.. I assembled and tested it, and to my surprise everything worked just fine from the first try. I’m usually not that lucky when I make stuff using new IC’s that I haven’t used before. Sometimes I don’t pay enough attention to the datasheet and I get some small stuff left behind and that messes my entire circuit. Anyway, happy as I was that everything worked from the first try, I put everything inside the enclosure and snapped some pictures of it. As a final note, this was a great project which I enjoyed making, and I really recommend you do something like this if you have a gps unit laying around.

more pictures:

parts-for-the-usb-gps-project gps-module-and-pcb ft232rl-board

board-inside-the-enclosure pcb-with-gps-module-inside-the-enclosure new-hardware-found

parts list:

  • RGM-3550LP gps module x1
  • FT232RL x1
  • TPS2148 x1
  • capacitor 10uF x3
  • capacitor 100nF x3
  • led x1

schematics and board files were designed in Eagle and can be downloaded here.



© 2007-2010 YourITronics | Any logo, trademark and project represented here are property of their respective owners | Wordpress | Privacy Policy    RSS