Compact dual oscillator and power on reset for MCU

Would you consider connecting an IC with a dual-speed oscillator and a power-on reset to your MCU? This is what MAX7378 does. This is a good replacement for ceramic resonators, crystals, and other oscillator modules, and discrete reset circuits. The good thing here is that at any time, you can select either low-frequency 32.768kHz or a high frequency from range 600kHz to 10MHz.The clock frequency can be switched at any time without glitches. MAX7378 can be powered from 2,7V to 5,5V, so it is suitable for most MCU types. Comparing to Crystal resonators, it is resistive to vibrations and EMI. It is a good solution for the automotive and industrial environment. High-frequency oscillator error reaches ±2% at 25°C at 5V power supply. In other words, speaking oscillator frequency stability is about ±325ppm (when crystal stability is from ±10ppm to ±100ppm). So it doesn’t correspond to crystal accuracy, but it suits most non-time-critical applications. 32.768kHz oscillator is more accurate with an error of 1%, but it still a bit much for time measurements.

Continue reading

IR remote control signal receiver using AVR microcontroller

IR remote control is a device you can find everywhere to find a TV, VCR, or home theatre. Why not use one of them for controlling your own devices like light, air conditioning, etc. As we know, remote control devices use IR light. This is invisible light of about 950nm wavelength. One most significant problem in using IR light is that there many other sources of it like the sun, light bulbs, fire. To exclude other sources, the IR signal is modulated by some frequency. The receiver has to be tuned for this frequency. Mostly remote controls transmit IR signals using 36kHz frequency signals. Transmitting and coding is one part that can be done more efficiently than receiving and decoding. Decoding is usually performed by using microcontrollers. First of all, the receiver has to get rid of the 36kHz carrier frequency. This is not a simple task to demodulate the signal; this is why particular IR receiver IC’s are produced. One of them is TSOP1736:

Continue reading

Characteristics of sensors and transducers

A sensor or transducer is a device that converts one type of energy to another – usually electric. They are used for various purposes, including measurement or information transfer. Generally speaking, a sensor or transducer is a device that converts a signal from one to another. Let’s go through transducer characteristics that describe the performance of sensors. One of the characteristics that describe the functional relationship between physical input and electrical output is the Transfer Function, which shows the relationship between the input and output signal. Depending on the details of this characteristic, it may be a complete description of sensor characteristics. The transfer function may be used as a calibration curve. For instance, let’s take an example of the infrared temperature sensor.

Continue reading

Generate true random numbers on microcontroller

Sometimes there is really a problem of how to generate truly random numbers using your microcontroller. Usually, a computer processor or any other MCU can generate a Pseudo-Random Number (PRN). These numbers are generated by algorithms, so-called Pseudo-Random Number Generators (PRNG). Everything that a pure algorithm produces is predictable at some level. Many PRNG algorithms generate random numbers, but there is always a defined number of iterations when a random number sequence will repeat itself. Sometimes it may be acceptable. One popular way to generate pseudo-random numbers is using Timers. The universal algorithm is the concept of the Linear Feedback Shift Register (LFSR). LSFR is an n -bit register initiated with a non-zero seed value and is clocked by shifting values to the left and loading a new bit into bit0. The new bit is calculated by XORing the bits of selected taps of LSFR. This method is used in rand() functions.

Continue reading

Neural networks and artificial intelligence in robotics

When talking about artificial intelligence(AI), many people think that neural nets should be as intelligent as the human brain. Some people don’t even imagine how widely they are used in their life. Let’s narrow us to something more simple and understandable. The most exciting usage of AI is robotics. Today isn’t tough to build a simple robot with a few sensors and a couple of motors. But the harder part is to make it react to the real-world as you expect it to be. When programming the robot brain, there is checking sensor states and reacting to particular circumstances like hitting the wall, line on the ground, etc. But more sensors robot has more complex reactions may be. Programming of more complex systems may be painful without using simple neural networks.

Continue reading

AVR-DDS signal generator in-line ASM explained

I have got a couple of questions (in fact, not the first ones) for the AVR DDS generator I have built: “that’s all the asm code that I don’t understand. Could you explain it? Is it possible to do it with inline asm (only in C)?” I decided to explain this part more deeply because it took me to figure this all out. First of all, what we have to do, it is to implement simple DDS algorithm. In a few words, Direct Digital Synthesis(DDS) is known as a Numerically Controlled Oscillator. Simple rule: NCO-based DDS is a point(memory location)-skipping technique (and a constant interpolation of the stored signal) and runs at continuous update(clock)-rate. As the DDS output frequency is increased, the number of samples per waveform cycle decreases. Practically speaking, let’s have some math. We have a clock generator connected to MCU. In my case, F_CPU=16000000Hz. This is our Clock In.

Continue reading

ARM7 exception modes

This is an important part of understanding ARM operation modes and handling them. ARM7 supports seven types (0x00000014 address is reserved) of exceptions: As you can see in the table, each exception has its own name and fixed address, so-called exception vectors. When an exception occurs, execution is forced from a fixed memory address corresponding to the type of exception. When an exception occurs, R14 and SPSR registers act like this:

Continue reading

ARM7 MCU registers

ARM has 31 general purposes 32-bit registers where 16 of these are visible at any time. Other registers are used to speed up the processing of exceptions. There also are 6 32bit wide status registers. Let’s see how it looks like. Registers are arranged in partially overlapping banks with a different register ban of each MCU mode. As I mentioned, 15 general-purpose registers(R0 to R14) and one or two status registers and PC are visible at any time. Basically, R0-R12 registers are user register, that doesn’t have a special purpose. Registers R13 – R15 has special functions. R13 is used as stack pointer (SP), R14 is used as link register (LR), and R15 is as the program counter (PC):

Continue reading

Alternatives of MAX232 in low budget projects

Sometimes when you work on low-budget projects or don’t want to go shopping for max232 or similar IC, you can save your time and money by using other TTL to RS232 converter. We usually used to use a MAX232 chip like this: Max232 IC is a specialized circuit that makes standard voltages as required by RS232 standards. This IC provides the best noise rejection and very reliable against discharges and short circuits. If your project is more advanced and has to reliable you must use specialized RS232 to TTL converter IC’s. As I said Specialized is more expensive than other solutions.

Continue reading

Easy H-Bridge on MOSFET IRF7105 transistors

I think I don’t have to explain what is H-Bridge circuit. Well, it is mainly used to drive DC motors that they could be run forward and backward. The circuit is often used in robotics. Usually, there is a need to build a small, powerful, and with good characteristics H-Bridge. One solution is to use IRF7105 p and n channel MOSFET pair coated in the SO8 SMD case.

Continue reading