Kick start guide to start working with Programmable Logic Devices from Altera

Probably everyone knows what logical IC’s and how to use them in the design are. But if the design is more complex, electronics enthusiasts are more likely to choose microcontrollers as they minimize the count of external components. But the problem is that not everything is possible with microcontrollers. They have many disadvantages when a fast response to input signals is needed. Microcontrollers execute operations one by one in sequence (conveyor). So output results will occur after some number of clock cycles. One way is to use hard logic IC’s. But when complexity grows – the number of IC packages also increases. This way design board becomes tremendous. So where programmable logic devices (PLD) comes to help. CPLD devices have many base elements (gates) without strict electrical interconnection. So designer can program these connections to combine any logical combination. Programmable logical devices allow the construction of any logical device, including counters, triggers, etc. The limit is only the number of base elements and connection lines. So it is better to start with learning tools that allow the construction of logical circuits, simplify them, and avoid many mistakes. One of them is MAX+plus II BASELINE and CPLD from ALTERA. This software…

Continue reading

DIY simple band-pass filter

This filter was designed to filter the 1kHz frequency of the telemetric signal from environmental noise. The filter itself is straightforwardly built with acceptable electronic parts worldwide. This filter can be used in any circuit because of its simplicity. The circuit contains a minimal amount of parts, including one general-purpose NPN transistor with coefficient 50…70 and more. Such filter blocks may be connected in series directly one to another(second IN first OUT). This way, filter gain may increase up to 1,2…2.

Continue reading

Testing AVR universal bootloader on Atmega128

After the project source code is developed, there is always a need to flash it to the microcontroller. There are a few ways to program AVR microcontrollers. Usually, we used to flash AVR’s with an ISP adapter (or another programmer) that is not always handy, especially when designing a device for the end-user who doesn’t have an ISP adapter or doesn’t know much about flashing MCU. So it is better to flash a bootloader program AVR MCU once with a programming adapter and later load firmware interactively when starting AVR. The bootloader allows updating the firmware without a programmer and enables different programs for different purposes depending on the situation flexibly. But enough about this. So my purpose today is to test AVR universal bootloader, which Shaoziyang is developing. He aimed to create a universal bootloader that works on different AVR microcontrollers with minimal code modifications. Bootloaders you can find on the Internet are mostly available for particular microcontrollers, and nobody wants to do a lot of modifications to adapt to different MCU when needed. This AVR universal bootloader can support most AVR microcontrollers (Mega series), which have the self-programmable capability, boot section, and UART. If the device has many…

Continue reading

Easy way to measure motor torque

Motor torque (momentum) is one of the motor ratings used to indicate the rotary motor force produced on its output shaft. The motor torque rating is usually captured at the point when the motor is stalled. The torque measurement unit is (Nm) in the metric system or (ft-lbs) in the US system. But the principle is the same torque is a multiplication of lever length (r) and force(F) applied to lever: I=r x F So there is a simple experiment on how to measure motor torque quite accurately without any fancy measuring tools. All you need is a motor of which torque will be measured, a nominal power supply of motor, thread long enough, a mass of known weight, ruler, and a table or other lifted surface where the motor will be fixed.

Continue reading

Testing pulse transformer with an oscilloscope

Pulse transformers are a little different from regular AC transformers. In AC transformers, magnetic flux alternates between negative and positive values in the core, while in pulse transformers, magnetic flux is unipolar. Pulse transformers are used in TV, computer power supplies. If you need to test a pulse transformer, it may be almost impossible to do this with an ohmmeter, even a digital one, because the windings of impulse transformers have meager active resistance except for high voltage ones. One way to test is to measure the inductance of windings and compare them to values in specifications. Still, not everyone has the ability to measure inductance, and not always you have transformed specifications near by. So there is another way to test pulse transformers, which may be acceptable to almost everyone radio-hobbyist, using a low-frequency generator that works at the resonance frequency of contour, which consists of external capacitor and pulse transformer winding.

Continue reading

How to describe embedded software design using diagrams and pseudo-code

When designing embedded hardware, you probably want to visually express what embedded software will be performing and how different functions depend on each other. How to make software documentation simple, clear, and informative. If you are a developer, you may want to explain your ideas understandably without loads of code text. Depending on what level of information has to be provided, you may choose any of the following. Data Flow Diagram Data flow diagrams are used to see the processes and what data is transferred between different functions. This way, each process or function is expressed as a block (or any other shape), while lines show what information passes between processes. As you can see in the example figure simple data flow diagram is presented. Without program code, it is easy to read how the program operates:

Continue reading

Microwire compared to SPI and I2C

Microwire is a three-wire serial interface used by National Semiconductor in its COPS processor family. The three signals are SI (serial input), SO (serial output), and SK (serial clock). SI and SO are input to and output from the processor, respectively. The processor clocks data to the peripheral on SO and receives data on SI. Data in both directions is captured on the rising clock edge. Peripheral devices that transfer data in only one direction (such as display drivers that are only written, never read) may implement only one data line, SO, or SI. Microwire is an older protocol than SPI, and it has some differences from it. Original Microwire has fixed clock polarity and clock phase. At the same time, SPI can be configured to any clock polarity and phase. Unlike I2C, the Microwire protocol has no device addressing built into the serial bitstream. Microwire peripherals require a separate chip select input, one per device. This allows data to be transferred more quickly since address information is not needed. However, it requires more port bits since one chip select, using one port bit, is needed per peripheral. Each Microwire peripheral has a unique protocol based on the application. The…

Continue reading

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