Custom Search

Monday, September 29, 2008

Atmel ISP Programmer

It connects to the Parallel port, and can be used to program any Atmel AVR while it is still in the system, provided the system provides a standard In System Programming (ISP) connector. The PC interface is through the Parallel port, and makes use of the same pinout as the STK-200 programmer from Kanada Systems. The STK-200 programming cable is very popular, and almost every ISP download software (Except ICCAVR's inbuilt chip programmer) supports it.


The device is very simple, it only contains a single chip, a 74LS245 (a 74LS244 can also be used, with suitable modifications). Of course, a 74HC245 can be substituted. I think this is necessary when programming the ATMega series devices with the Atmel AVRISP software, since it uses some sort of 'fast-mode' that gives an error during programming. Ignoring the error doesnt seem to do harm, and the program executes correctly on the chip. Other programmers such as PonyProg( not have any problems, regardless of the device being programmed.

The standard ISP pinouts

The standard pinouts are as shown above. The pins are:
AVR-ISP pinouts
RESETUsed to reset the target system under the PC's control.
SCKThe serial data clock
MOSIMaster Out Slave In, used to send data from the PC (master) to the AVR (slave). Data is transmitted on the edges of SCK.
MISOMaster In Slave Out, used to send data from the AVR (master) to the PC (slave). Data is transmitted on the edges of SCK.
LEDThe PC makes this line high to indicate that programming is occuring. Not used in all systems.
PWRCan be used either to provide power to the target system during programming, or for the programmer to draw power from the target system during programming. I use it to allow the programmer to draw power from the system.

The circuit

The only chip used in the device is a 74LS245 octal bidirectional 3-state driver. However, a 74LS244 octal unidirecional bus driver may also be used. I just happened to have a 74LS245 lying around. The chip is used so that when the device is not being programmed, the programming interface lines are all tristated, allowing the device to function normally. The direction control is permanently grounded, making the device essentially unidirectional. The tristate enable is connected to one of the outputs of the parallel port, along with a pullup. Hence, when the programmer is not plugged into a port, or when the device is not being programmed, the '245's outputs go into tristate mode. Notice that pins 2 and 12, along with pins 3 and 11 are connected together. This is the identification method used by programmer software to determine that an STK-200 compatible programmer is attached to the parallel port. I havent used the programming LED option, and chose not to use a power-on LED, so that the device being programmed has the least load on it's power supply.
The whole device was assembled on a veroboard, nothing special. It works fine and gives no problems, except when programming an ATMega103 using AVRISP.


Software compatible with this programmer includes
  • AVR ISP from Atmel(, a very good device programmer. It can read/write the Flash and EEPROM, and set the security bits. It includes a nice "Autoprogram" command, that reloads all the device files and downloads the ones that have changed to the AVR.
  • PonyProg, by Claudio (, another nice programmer, a bit slower than AVRISP. However, it can be used to program lots of other types of devices, such as EPROMS, serial EEPROMS, etc.
  • CodeVisionAVR C compiler's inbuilt chip programmer, by HP Infotech ( , has the advantage of being a part of the compiler IDE.


Here introduce the temperature regulator(Thermostat) which used a thermistor for the temperature sensor. This circuit can control a outside system by driving a relay when the temperature of the thermistor becomes a setting temperature. The strict temperature setting can not be done with this circuit like the thermometer. The resistance value of the thermistor changes by the ambient temperature. This circuit changes the change of the resistance value into the change of the voltage using the transistor. Then, it compares that voltage and the voltage of the setting temperature using the voltage comparator and it drives a relay. It is a relatively simple circuit. With this circuit, the difficult point is to handle an analog signal (the temperature change). The characteristic of the thermistor, the transistor and so on has an influence on the performance of the equipment just as it is. Even if the thermistor or the transistor of the same name is used, the same performance (the setting temperature range and so on) isn't sometimes gotten. The design to have considered the ruggedness of the part is possible. This time, I made a circuit based on the result which measured the characteristic of each part. I think that this way becomes reference as the case when there is not data of the part.

Heat Sensitive Switch

At the heart of this heat-sensitive switch is IC LM35 (IC1),which is a linear temperature sensor and linear temperature-to-voltage converter circuit. The converter provides accurately linear and directly proportional output signal in millivolts over the temperature range of 0°C to 155°C. It develops an output voltage of 10 mV per degree centigrade change in the ambient temperature. Therefore the output voltage varies from 0 mV at 0°C to 1V at 100°C and any voltage measurement circuit connected across the output pins can read the temperature directly.

The input and ground pins of this heat-to-voltage converter IC are connected across the regulated power supply rails and decoupled by R1 and C1. Its temperature-tracking output is applied to the non-inverting input (pin 3) of the comparator built around IC2. The inverting input (pin 2) of IC2 is connected across the positive supply rails via a voltage divider network formed by potmeter VR1. Since the wiper of potmeter VR1 is connected to the inverting input of IC2, the voltage presented to this pin is linearly variable. This voltage is used as the reference level for the comparator against the output supplied by IC1. So if the non-inverting input of IC2 receives a voltage lower than the set level, its output goes low (approximately 650 mV). This low level is applied to the input of the load-relay driver comprising npn transistors T1 and T2. The low level presented at the base of transistor T1 keeps it nonconductive. Since T2 receives the forward bias voltage via the emitter of T1, it is also kept non-conductive. Hence, relay RL1 is in de-energised state, keeping mains supply to the load ‘off’ as long as the temperature at the sensor is low.

Conversely, if the non-inverting input receives a voltage higher than the set level, its output goes high (approximately 2200 mV) and the load is turned ‘on.’ This happens when IC1 is at a higher temperature and its output voltage is also higher than the set level at the inverting input of IC2. So the load is turned on as soon as the ambient temperature rises above the set level. Capacitor C3 at this pin helps iron out any ripple that passes through the positive supply rail to avoid errors in the circuit operation. By adjusting potmeter VR1 and thereby varying the reference voltage level at the inverting input pin of IC1, the temperature threshold at which energisation of the relay is required can be set. As this setting is linear, the knob of potmeter VR1 can be provided with a linear dial caliberated in degrees centigrade.

Therefore any temperature level can be selected and constantly monitored for external act ions like turning on a room heater in winter or a room cooler in summer. The circuit can also be used to activate emergency fire extinguishers, if positioned at the probable fire accident site. The circuit can be modified to operate any electrical appliance. In that case, relay RL1 must be a heavy-duty type with appropriately rated contacts to match the power demands of the load to be operated

300W 6x LM3886 bridged-paralleled power amplifier

Power Amplifier 150W(single channel)

Unbalanced to Balanced Line Converter

This circuit will convert unbalanced audio lines to balanced audio lines. Here's the schematic diagram using NE5532 dual opamp chips, some resistors and capacitors.

We all know that balanced lines have less susceptibility to noise, especially on long distances. This is common knowledge.But I'd like to point out one more benefit of balanced signals that I just realized this afternoon. And that benefit is you'll have 6db more gain in a balanced signal compared with the original unbalanced signal!!! Mathematically, we know it would happen, but seeing it as a real waveform in Sonar is proof of concept.

What's the big deal about 6db gain?
6db of gain is DOUBLE the signal strength... which means, your signal is going to be hotter, without any changes in your setup. Thus, you don't have to increase your preamp/mixer's gain as much to achieve a good loud level, and since the signal increased by 6db, it also goes into saying that you just reduced your noise by 6db too, i.e. you also reduced noise by half.

You see, MOST gear are really unbalanced inside. They just have balanced drivers at the output stage. And some mastering engineers (read Bob Katz's book) prefer unbalanced gear ( yeah, I was shocked to hear this). His reasoning that since all the gear are plugged in one room anyway, and the inside circuitry of gear are almost always unbalanced, and depending on how the balanced circuit driver was made, could degrade the signal, etc... This guy knows electronics and his statement actually makes sense.

But he also said that there are some truly balanced circuitry where you can't take away any part out, and these are almost always the best kind of gear.

Back to the topic... the circuit above can be added to any unbalanced out and make it balanced. The 2 driver opamps drive each half of the signal, one being 180-degree inverted. In this case, the rejection of EMI and RFI is between the lines of the balanced input and output gears.... not within the gear itself. If you can isolate the unbalanced-to-balanced driver circuit in a device and the device can still work, then that device is really unbalanced.

From the input transformer, all the way to the output transformer, it is balanced. i.e. I can't take away the output transformer and still have this functioning right. I can't take away the input transformer and still have it functioning. The input and output transformer makes this gear have balanced inputs and outputs, and the supporting circuitry inside relies on connecting to these transformers to do its job.

The above circuit is an ACTIVE balanced driver. i.e. it requires power.