AVR analog comparator and avr-gcc example

An Analog comparator is a pretty simple peripheral, but it can give big benefits. Comparator module is included in all Mega series of AVR microcontrollers. Simply speaking, Comparator allows comparing voltage values applied to two pins of microcontrollers. The comparison results are a logical level, which can be read by the program(ACO- Analog Comparator Output bit). There is also the ability to generate an interrupt, which depends on the comparator resulting level. And more- timer T1 can capture this level what allows measuring the signal length of analog signals. To use pins as comparator inputs, they must be prepared and configured as input(DDRx=0), and pull-up resistors must be disconnected (PORTx=0). In some models like Atmega48x/88x/168x, Atmega165x, Atmega325x,3250x,645x/6450x, and Atmega640x/128x/1281x/2560x/2561x, there is the ability to disconnect digital buffers of AIN0 and AIN1 pins that allows the use of these pins only for analog signal input – this minimizes overall power consumption.

Continue reading

JTAG wiggler clone for ARM microcontrollers

The Olimex ARM JTAG clone is well known as there are many schematics on the internet available. Circuits are straightforward and seem to be reliable. This adapter can also be set up to work with WinARM tools: obdremote and gdb/Insight-gdb. In the circuit, there is a critical part that needs to be considered – 74HC244 buffer IC. Family of HC support less than 4.8V if powered with 3.3V. But reality shows that Parallel port voltage usually is lower than 5V so that HC will fit. But of course, it is better to measure the HIGH state of parallel port pins. To be more sure, HC should be replaced by 74LVP244 or 74LPT244. These chips support 5.5V in entry with a 3.3V supply, but sometimes they are hard to find in the market.

Continue reading

What is DebugWire interface

Debug wire is an interface that enables debugging AVR microcontrollers by using one wire. All new AVR microcontrollers with less than 16kByte memory have a built-in one-wire bidirectional debugging interface that allows debugging devices in real-time. Like the JTAG interface, DebugWIRE can handle full execution and program flow control. It also supports an unlimited number of breakpoints, adjusting memory contents. The good thing is that interface doesn’t require additional pins as only the RESET pin is used for debugging purposes.

Continue reading

Major programmer types for 8 bit AVR microcontrollers

AVR microcontrollers have many ways to be programmed. One type of adapters are used only to program AVR memory others are used to program and debug. AVRISP The most known and common programming adapter is AVRISP, which is the basic tool and can be used to program Flash, EEPROM memory, most of the fuses, lock-bits for probably all 8bit AVR MCU’s. The programmer connects to a computer via an RS232 serial interface powered from the target board with no need additional power supply. The programmer connects to the target board via one of two headers – 6 or 10pin. AVRISP from Atmel Corporation is designed to work from AVRStudio as front end software and is upgradable. However, AVRISP is discontinued due to the newer adapter appearance –  AVRISP MKII. There are cheap third party clones available. But most of them aren’t compatible with AVRStudio but work well with programs like PonyProg or AVRDUDE.

Continue reading

How to solder SMD at home even better-Part two

This is continuing of part one. The following advice is for how to solder SMD parts with improved technology. Soldering Oven isolation As an isolation material, their glass insulation can be used. In this case, glass insulation was packed in aluminum foil: Inspected improvement in heating speed: 0.95% without isolation; 1.50% with isolation only inside oven; 1.72% full isolation.

Continue reading

How to solder SMD at home-Part one

Soldering SMD parts isn’t a hard task, and there are many methods of doing this. Let’s go through several SMD soldering methods and examples. Method 1: using the soldering iron For this you will need: Good sight or magnifying glass. Better one and another; Soldering iron with small tip ~10W; solder wire with a diameter of about 0.6mm Steps to follow: cut solder wire in pieces in the length of element width:

Continue reading

Very simple IR detector that controls relay

This Infrared(IR) detector circuit is a simple light relay that triggers when infrared light is applied to phototransistor Q1. This device can be used in control systems. When infrared light is OFF, the Q1 transistor and relay K1 are normally closed. When the IR diode is transmitting IR light, phototransistor Q1 opens and thus relays K1 triggers because current starts flowing through the Q2 transistor. Construction can easily be modified when circuit output is connected to a microcontroller or another device. Sensitivity so the distance can be controlled by changing IR diode D1, using more sensitive phototransistor Q1, and adjusting the R2 resistor.

Continue reading

Quality music sound in the car

Most of the driver’s car is more than a vehicle. Sometimes people spend hours in the car every day and listens to the news radio broadcast and listens to music. Having good quality music sound in the car requires more than good speakers and power amps, but some smart solutions are also needed to make it sound better. There are plenty of publications on how to DIY a good car sound system at home in the current time. Even the best power amplifier does not guarantee that car music will sound like Hi-Fi class. The main problem is the hard installation of the audio-system inside the vehicle. In many cases, speakers are installed where ever they fit in the car. But there is also no clear answer where it is the best place to install speakers and how. The most common mistake is to place powerful high-quality speakers in the rear shelf while the speaker’s front position is installed or not at all. Such an audio system installation gives a feeling like he is sitting back to the scene.

Continue reading

Real time clock of LPC2148

LPC2000 series of microcontrollers have a built-in Real Time Clock (RTC) unit, which may be used for counting time to maintain a calendar and clock. RTC is designed for low power designs that enable use in battery-powered designs. The real-time clock can count time in Seconds, Minutes, Hours, Days of Month, Months, Years, Days of the week, and Days of Year. The real-time module can be clocked using a distinct 32kHz clock oscillator or internal prescaller from the VPB clock. The real-time clock unit has additional power supply pins (3.3V) that allow the RTC clock to work when the system is off – actually power-down mode operated from the clock battery. As there are many functions in clocks like time units(seconds, minutes, etc.) and alarms, there are quite some registers to cover clock functionality. There are several groups of registers:

Continue reading

How PCB files are transfered to circuit boards

When you are done with a clean period of task – designing, drawing a circuit, and tracing a PCB, you need to transfer a design to a real board. Here starts what I call a messy part of the design. When designing at home, there are several options – to use prototyping boards or make PCB by yourself. You have to transfer the PCB image to a board with a copper layer in the second option. There are several methods of doing this: direct transfer with glossy paper where the image is printed with a laser printer or more advanced ultraviolet exposure. This way, the PCB image is printed on paper or film directly from the program window without keeping in mind PCB file formats. A different situation is when fabricating professional PCB’s. Each company that fabricates PCB boards always announce what type of file formats they support. So if you are going to order a PCB, better check with them to save your time. The most common and standard format is the so-called Gerber file format. Almost all layout tools can produce Gerber files. If you want to preview your generated Gerber files, there is a nice free Gerber…

Continue reading