Simplest 128 atmega programmer

Atmega 128 is like other AVR microcontrollers. They are ISP – is in-system programmable. Earlier I wrote an article about an AVR ISP programmer where 74HC244 buffer is used. Using buffer is safer for your AVR. But what if you need 128 atmega programmers without any parts? Then you can connect your microcontroller directly to the LPT port or use protection resistors (220R) just in case. of course circuit works without resistors, but you put your LPT port at risk. Just connect GND, SCK, MISO, MOSI, and RESET to adequate LPT pins, and you can program atmega’s flash memory without removing it from a socket. Programming software can be PonyProg

Continue reading

TWI (I2C) interface on AVR

Two-wire serial interfaces are included in the following AVR microcontroller families: ATmega8x, ATmega16x, ATmega163x, ATmega32x, ATmega323x, ATmega64x, and ATmega128x. TWI interface is a “Philips” standard I2C. Using the TWI interface, you can connect up to 128 devices using only two wires: clock (SCL) and data (SDA). Only two pull-up resistors on each line are needed for this interface to work properly. The I2C interface circuit is an open collector. This means if one of all devices has a low-level signal on a line, then it is ‘0’, and if all devices have a high impedance state, then the signal is considered to be great ‘1’—more details about TWI interface you can find on any ATmega datasheet. One of my examples Interfacing AD7416 digital temperature sensor you can find here: Analog Devices Digital temperature sensor AD7416

Continue reading

Using buttons and switches with AVR microcontrollers

In most designs, you might want to put buttons and switches to control your program flow. This is not very difficult to read the button state. You can connect the button between pin and ground with an internal pull-up enabled. Then when the button is pressed, the pin value will be 0 when released – 1. Of course, you can use an external pull-up resistor. In fact, all mechanical contacts have their shortcomings – they generate multiple micro connections that can confuse AVR. The Delay of this effect depends on the quality of buttons or switches and can vary from 10 to 100ms.

Continue reading

Control 7 segment LED displays with AVR

LED displays are nothing more than sets of Light Emitting Diodes. The difference is that they have different shapes to display specific information. So driving LED displays is the same as regular LEDs. This is a simple connection when there are enough microcontroller Pins. But if you want to connect more displays, you will need more microcontroller pins than it can give you. Then it would help if you made a more advanced circuit with dynamic control.

Continue reading

Drive LED or Opto-isolators with AVR

This might seem very simple to many of you, but I still get questions about simple microcontroller interfacing. So I will put a thread of notes about interfacing AVR microcontrollers to devices like LED’s, relays, I2C, etc. As you might know, Diodes require a pretty small current. This current depends on diode type and can be from 3mA up to 20mA and more. Working voltage is from 1.5 to 4V. One AVR pin can sink up to 20mA of current; it is convenient to connect the diode directly to it with a current limiting resistor. Never connect the diode to the pin without a resistor – you may damage your AVR as your current may exceed the 20mA limit!

Continue reading

Life-giving to Atmega8

I have got two ATmega microcontrollers from my friend. He stated that they are burned and can be thrown into the garbage. He also mentioned that they stopped responding after they were programmed. So I asked him to give those to me to try them. I had in my mind that this is a result of a bad usage of security bits. There is always confusion in these bits because of writing ‘0’ values program security bits and unprogrammed with ‘1’. I didn’t really expect to make them working again as my friend did quite rude experiments with them. What can I say – he was right by saying they are burned. But I guess some of you will like to see what I was doing to recover them. I decided that he unprogrammed all four security bits ( CKSEL0, CKSEL1, CKSEL2, CKSEL3 )by writing ‘1’ to them. This situation means that Atmega8 has to be clocked from an external clock signal. I was supposed to program those bits to work ATmega normally with a quartz resonator.

Continue reading

Interfacing MPXV5100 pressure sensor to Atmega8

The MPX5100 series piezoresistive transducer is a state-of-the-art monolithic silicon pressure sensor designed for many applications. Still, particularly it is convenient to interface to a microcontroller or microprocessor with ADC inputs. This is thin-film metallization and bipolar processing to provide an accurate, high-level analogue output signal proportional to the applied pressure. More details can be found here MPXV5100 This sensor measures differential pressure comparing to atmospheric so when there is no pressure applied it shows 0kPa;

Continue reading

Analog Devices Digital temperature sensor AD7416

There are many situations when you might need to measure temperatures or trigger some events due to temperature changes. It is very convenient to have these values in a digital format. Then you can transfer digital values to the microcontroller to process data or just to display on the LCD screen. AD7416 Sensor description This is a 10-bit digital temperature sensor that can measure temperatures in the range interval -40 to 125ï‚°C). Temperature conversion ADC has 15 conversion times. The sensor can be supplied from 2.7 to 5.5V, so it is no problem to connect directly to ARM microcontrollers. Data is transferred through the I2C serial interface. The more detailed description and datasheet can be downloaded from Analog devices page: AD7416. Here you find a simple routine where the Atmega8 microcontroller reads sensor data decodes temperature value and displays it on a 2×16 LCD display.

Continue reading

AVR ISP

AVRISP is a very popular Parallel port programmer for flashing AVR type microcontrollers. Earlier I used programmer connected to com port, but frequently I needed this port for other purposes; I decided to make it work on the parallel port. The programmer on a parallel port is much simpler than connected to a serial port because there is no needed voltage adapter like MAX232. You can only connect your MCU directly to the port. But for safety reasons, there is good practice to use buffer ships like 74HC244. The header for programmer I used standard 6 pin ISP header.

Continue reading