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

PCB routing considerations

One of the hardest tasks when fabricating PCBs is a Printed Circuit Board(PCB) routing. There are no unified rules on how properly board should be routed, and it would be impossible to write them as the situation on each board is different. One of the general rules is that the shortest routes are the best because longer routes tend to generate more noises or pick them up from different sources. Every conducting material acts as an antenna, no exception with PCB routes. No secret that each route acts as a small transmitting and receiving antenna. So one thing is to keep in mind when routing PCB is to route short as possible. Another concerning area is a cross-talk or cross-coupling between routes. This effect appears when two traces run along with each other, and energy from one trace route couples to another. This effect is obvious in high frequency digital and analog circuits. This effect can make the device dis-functional because only of the cross-coupling effect. These defects are hard to determine as the electrical circuit board is correct. If this effect is noticed – the only solution is to cut traces off and run separate wires instead. It is…

Continue reading

Pulse Width Modulator in LPC2000 ARM7 MCU

In ARM7 microcontrollers, PWM is designed as a separate module, but it has all features as general-purpose timers have; just limited pins are associated. PWM module has improved match module, allowing six single edges controlled PWM or three double-edge controlled PWM. There are seven match registers used with improved update logic. PWM modulator has additional shadow match registers that perform the latching effect. This means that you can instantly update match registers, but new values are taking effect only at the beginning of the new cycle. This mechanism ensures that all updates are performed at the beginning of a new cycle through the latch enable register(LER). In general-purpose timers, match registers take effect immediately after they are updated.

Continue reading

Timer Counters in LPC2000 microcontrollers

LPC2000 microcontrollers have at least two 32 bit timer counters. Let’s take the LPC2148 microcontroller, two general-purpose 32-bit timers that are identical except the peripheral base address. These timers are for general purposes that can perform timer and counter operations. Timers have many features: Programmable 32 bit pre-scaler; Up to four 32 bit capture channels that can take snapshots with interrupt generation ability; Four 32 bit match registers that allow generating interrupt on the match, generate interrupt and stop the timer, generate interrupt and reset the timer; Up to four output pins that can be set LOW/HIGH/TOGGLE on compare match;

Continue reading

General purpose ports in ARM MCU

NGX technologies LPC2148 development board

Microcontrollers aren’t imaginable without interacting with other devices like indicators, input devices, or other off-chip devices. For this, every MCU has I/O pins that are used to interact with the external world. General-purpose I/O ports can be accessed via registers that provide enhanced features or simply via port registers. Port registers are allocated to the ARM bus so that fast possible timing can be achieved. Control of individual bits is possible using a single instruction. All port registers are byte and half-word addressable. After MCU reset, all I/O ports are set to input. Let’s take the LPC2000 series ARM microcontroller LPC2148. It has two 32 bit general purpose I/O ports PORT0 and PORT1. PORT0 has 30 pins for input/output operations, where one is only for output. PORT1 has 16 available pins for GPIO.

Continue reading

Microcontroller Simulators and emulators

Sometimes you haven’t the ability to flash a microcontroller to test program functionality in the development phase. For this, there may be many reasons, like you don’t have a prototype ready or you need to test parts of code, and so on. For this, there are software simulators used that simulates microcontroller work without microcontroller itself. Simulators usually don’t have a connection to the real-world all operations are simulated in software. A microcontroller simulator is a program model that imitates its work. Modern simulators now simulate arithmetic operations and I/O operations and even peripherals like timers, ADC, USART, I2C, and so on. In many cases, it is possible to prepare the whole project using the simulator and then burn compiled code to a real microcontroller. Simulators usually allow: debugging at source code level; follow operation time in slow motion but with real-world values; connect stimulus signals like they are real-world signals. The simulator can be expressed as several blocks interconnected with each other:

Continue reading

Protect you car from rusting using cathode protection

Car owners know that small scratches may cause rusting, which will expand even under painted areas. Fighting rusting is a pretty hard task. There are lots of methods that car keepers are using to prevent rusting. Many are using anti-rust coating, but it has shortcomings – success depends on how good it has been done. The rusted area needs to be cleaned with care and sometimes requires disassembling some pieces of a car. Such an operation requires a decent amount of time and constant control. The car is always in a stressed environment: cold, salt, water, vibrations, stones, and other harsh conditions. There is still a chance of damaging surface coating. For constant prevention from further rusting, there is an electronic device used which requires only one installation.

Continue reading