AVR reads button state and indicates on LED

This is a simple demo program of reading button state, lighting LEDs, sending information via USART. 8 buttons are connected to Atmega16 port A, 8 LEDs to port B via current limiting resistors. While none of the buttons aren’t pressed, there is a running light on LEDs performed, but when any of the buttons are pressed, LEDs display the current 8 bit counter value in binary format. The same value is sent via USART – you can see a number in the terminal is connected. The program is very simple:

Continue reading

Measuring of electrical energy consumption

Electromechanical energy counters were popular for more than 50 years. Today, you can find them only in older houses or in low-budget appliances because today, electronic energy counters are taking their place. And there are many reasons to do so. For instance, measurement accuracy, flexibility, multi-rate support, memory, statistics, remote reading and control, automatic register, and so on. These features can be built into one small chip, which will serve with high reliability and low price. Let’s see how energy (active power) consumption is measured. Active power which is required in the form of alternate current (AC) can be calculated as average power over one period:

Continue reading

DIY USB to RS232 adapter

Sometimes you need to connect some device to a COM port, but the computer doesn’t have one, especially a laptop. There are two ways – go and buy a USB to COM adapter or build one. So if you decided to build a USB to COM(RS232) adapter, there is one solution. This adapter is straightforward to build as there is a single-chip USB to UART bridge (CP2102). This chip from Silicon Labs supports USB2.0 full speed. Internal Resistors are required for the USB interface, integrated clock, internal 1024 -byte EEPROM for Vendor ID, Product ID serial number, power descriptor, and other information. SP2102 USART part support almost all standard features of RS232 communication including handshaking, Databits (5, 6, 7, and 8); 1 or 2 stop bits; odd, even, mark, space, and no parities; baud rate from 300bps to 1Mbits.

Continue reading

Oscilloscope probes for accurate signal measurements

Oscilloscope Probes Measuring signals with oscilloscopes may be a challenging task especially high-frequency ones. Without proper oscilloscope probes, correct measurement of high-speed time-domain signals wouldn’t be possible. For high-speed measurement, you should consider signal parameters like amplitude, source impedance, rise time and bandwidth. There is a wide variety of probes available – passive, active, current-measurement, optical, high voltage, and differential. But let’s narrow the discussion to probes used to measure signals with wide bandwidth and short rise times. There are also many variations on what probe is proper. As probes are potential load to measured circuits, it is important to know their sensitivity to resistive, capacitive, or inductive loading. Incorrectly chosen probes (like high capacitance) can distort the fast-rising signal. Some circuits may not tolerate probes at all (high-speed amplifiers).

Continue reading

AVR based TDA7313 Audio processor control

TDA7313 audio processor has been used for more than ten years because of its simplicity, functionality, and proper parameters like low distortion and low noise. Chip is based on BIPOLAR/CMOS technology and can be used in various applications, including car radios, Hi-FI, simple mixers. TDA7313 chip has three external stereo inputs that allow multiplexing three incoming sound sources. It has a volume control with steps of 1.25dB, Treble and BASS control, Loudness function. Each of the four outputs has a distinct control that allows balancing outputs. A chip can be controlled via an I2C (TWI) interface. Description of Audio processor This project’s idea was to construct an independent audio processor that can be embedded in any sound system with the ability to control settings with a simple button interface with a menu preview in LCD. The intent was to cover all audio-processor functionality within the LCD menu.

Continue reading

Simulate KS0108 graphical LCD with Proteus simulator

Today it is common practice to use various circuit and microcontroller simulators for developing programs. Using simulators, you have several benefits comparing to real prototype boards. You don’t have to connect any hardware to test a piece of code; also, you don’t have to be in the same place when working. You can have simulator software on your Laptop and work where ever you want. Of course, you can see more parameters within the simulator like register values, memory, signals in a convenient form. So controlling graphical LCD on simulator software like Proteus is an easy task.

Continue reading

Reliable soldering with fluxes

Reliable soldering can be achieved by soldering clean surfaces. Usually, surfaces are cleaned with abrasives and solvents, but after the surface is cleaned surface immediately oxides, especially when heated. During oxidation, the surface is covered by thin oxide film, which prevents solder from contacting metal. This is why flux is used in the soldering process. To remove/deoxidize, surface flux must be applied during soldering. Flux chemically removes surface oxide when heated and makes a good metal to solder contact. There are several categories of soldering fluxes: Acid Flux (or commonly known fluxes: Zinc chloride, hydrochloric, ammoniac); Organic Flux; Rosin Flux. Each flux has its own specifics and may be used for different soldering technologies.

Continue reading

What are MEMS

Today MEMS is a common acronym among engineers. Therm MEMS stood for micro-electro-mechanical system and was started to use in 1980sin USA. MEMS are called systems because they are sensors and contain electronic circuitry inside which conditions sensor signal. Simply speaking, MEMS is usually a chip device that integrates mechanical elements, sensors, actuators, and electronics. Most interesting and important partis mechanical. Miniaturizing the mechanical parts using micro-machining technology when selectively parts are etched away, it became possible to create mechanical structures on silicon base and electronic devices. MEMS devices are used everywhere today, including automotive, industrial even computer hard drives with MEMS sensors for shock protection. The ability to integrate mechanical sensors inside the chip made it possible to design compact accelerometers, gyroscopes, pressure sensors, sensors with integrated RF, and many more. Also, technology enables the integration of more than one sensor inside the chip. One example may be 3-axis accelerometers. A major producer of inertial MEMS is Analog Devices, which produce accelerometers and gyroscopes.

Continue reading

Controlling graphical 128×64 LCD based on KS0108

HQM1286404 is a pretty old graphical LCD module, but it is still popular. KS0108 driver controls this LCD. LCD backlight color is yellow-green. I think this is an excellent choice for many projects where graphical information is needed for several reasons – you can find libraries around the internet to start working in just a few minutes. Several tools can also be used to generate character arrays and graphics. The hardest thing for me was to find the correct wiring as the datasheet I have was for the next PCB revision (HQM1286405) as mine are HQM1286404, so don’t be mistaken as I did. Here is the correct pin-out of LCD:

Continue reading