Internal microcontroller ADC

Many microcontrollers contains internal on-chip ADC. Typical devices would be Atmel Atmega series microcontrollers like Atmega8 and further. Internal ADC are successive way to integrate analog world in to your embedded systems using only one microcontroller die. Many applications doesn’t require high speed or high accuracy ADC conversions, thus on-chip ADC is best choice. Lets look at Atmega8. It contains 10-bit approximation ADC with analog input multiplexer of 8-single-ended input voltage (refers to 0V) channels. Atmega microcontrollers have separate analog supply voltage pins – AVCC (Atmega8 has known bug – digital and analog grounds are interconnected inside chip). Reference voltage is provided inside chip. It is nominally 2.56V or AVCC. AREF pin is used to decouple voltage reference by a capacitor for better noise performance. The reference voltages nay be selected between: Internal reference 2.56V; AVCC (must not differ from VCC more than ±0.3V); Or reference voltage can be connected to external pin AREF. If we have 8 bit ADC, then our conversion would look like this: Digital Code=(Vin/Vref)x256 Lets say we use 5V reference and we measure 3.2V input signal. So result: Result=(Vin*256)/Vref=(3.2V*256)/5V=163=0xA3 Just remember, that on-chip ADC accuracy isn’t perfect. Atmega8 datasheet states that absolute accuracy is ±2LSB.…

Continue reading

How to measure wind direction

I found this wind direction measurement circuit simple and interesting. If you are doing some home automation project, this might be another sensor that can be included in you project. For Wind direction measurement you will need a circle from some material (you might even use CD disc.) Then stick an arrow on top. One end of arrow should have a fin. Other end of arrow sould have piece of magnet. Then put eight magnetic sensors around the circle in the magnets way. See drawing: I think working of this sensor is very obvious. Turning Arrow depending on wind direction turns ON magnetic switches. Circuit has 8 outputs corresponding to wind direction. These outputs can be connected to simple indication circuit, which can be in your room: Depending on switch turned on the led indicator shows where the wind blows. Of course this sensor can be easily adapted to any embedded system and display results on LCD or log changes in EEPROM memory for further analysis.

Continue reading

Creating custom LCD characters using WinAVR

Standard LCD modules come with built-in Character MAP stored in LCD ROM memory. There is plenty of characters for your needs, but still, you may need some special ones like backslashes, or some symbols that are in different languages. For this LCD has a reserved RAM area for storing eight 5×7 dot matrix character patterns. In the table above this area is in the first column with addresses starting from 0 to 7 (from 0b00000000 to 0b00000111). This means that you can define any characters in these 8 fields as you like and use them by calling them by addresses from 0 to 7. To define one character, you will need to write eight bytes in a row to CGRAM memory For 0 character address (DDRAM=0): So for the first character creation procedure would be: The cycle of 8 iterations: Send command to LCD with CGRAM address from 40h to 47h; Send bytes to selected CGRAM address Because characters are 5×7 dots. You only need to modify the first five bits of each byte. Other areas fill with zeros(Marked blue in picture). For the other 7 characters, the procedure is the same. Continue on next 8 CGRAM addresses 48h-4Fh. The…

Continue reading

Always read newest datasheets

Reading of datasheets is or should be an important part of designing electronic devices. Reading datasheets is necessary in writing device requirements, planning budget, and selecting suitable components. Datasheets of each component may be found in manufacturer’s website. Once you’ve selected suitable component be sure that you read the datasheet and understand everything in it. Otherwise you may miss some critical parts that could ruin all your plans. It is better to find errors before you start designing than after. Another important issue is that always check for newest datasheets and errata – datasheet bug lists. It is not good practice to use your old datasheets from your hard drive archive or other places. These datasheets may contain bugs. Just download newest Atmega8 or other semiconductor data sheet and compare to yours downloaded lets say a year ago. Errata’s and datasheet changes are usually listed at the end of datasheet. You may look at this and find out what would you miss with old datasheets. The electric characteristics maybe are the same, but there may be configuration bugs or even discovered bugs in hardware and proposed workarounds to avoid them. So be critical and don’t relay blindly on everything. Always…

Continue reading

How to read electronic circuits

In electronic circuit drawings there are two types of objects: component symbols and nets. Nets represent wires connecting the components – which represent physical devices. In a example bellow we see component type MAX3232. U2 is a reference label of component. Electronic component usually has pins. Pins always have their numbers starting from 1. Pins also have their names. They are usually written inside component block like C1+. Fig1. Component Reading For this particular component we used U2label. U (or IC) label applies to all semiconductors. But you know that resistors usually are labeled as R1, R3. Capacitors C1, C2, Diodes – D1, D2, Transistors Q1, Q2, Crystals – X1, X2, X3, Jumpers J1, J2, J3, Inductors L1, L2.

Continue reading

Generic PCB design guidelines

How repeatedly make good PCB? Many hobbyists faces this issue every time they are prototyping their ideas. Designing the PCB layout (doesn’t matter is it a through hole or surface mount) may be tricky task especially when dealing with dimensions like 0.2mm tracks or 0.5mm surface mount pitches. Laser printer, plotting or other similar transfer technologies can’t deal with such dimensions. After I have tried photographic method of PCB artwork transfer, I don’t even want to touch Iron and laser printer. Using photosensitive laminate and single transparent media I can repeatedly make any number of PCBs. Benefits of using photographic methods are as follows: Transferred artwork is very clear, edges are smooth; Track thickness may be up to 0.2mm or even less with good mask quality, which can be made with good laser printer (usually new one). After printer cartridge refill – printing quality drops down; With one artwork mask I can clone many PCBs; Pay the biggest attention to artwork fabrication. Without good artwork you won’t be able to make good PCB. From My experience I can say, that I always do small mistakes with PCB artworks and I spot them usually after PCB is etched. Devote more time…

Continue reading

Design and Implementation of DTMF Detector

Basic Extension Module for Embedded System Prototype By: Ivan Christian adn Daniel Widyanto < p class=”Section1″> Introduction Telephone units are ubiquitous. They can be found in almost every house. In some houses that has many rooms a line is paralleled so that anybody can receive and make call from different rooms. Their presence could be used for other purposes instead of making call per se. Application of this module can be found in smart home automatic system which incorporates telephone unit as input module. By using telephone unit somebody can make a control action to a remote system, as far as the telephone line can reach. To do so, such an interface between telephone line and the control system is needed. DTMF Detector 2.0 is designed for the purpose. 1. Description DTMF Detector 2.0 is a microcontroller system extension module which detects the presence of DTMF tones, and then decodes the tones to coded binary digits. By using DTMF Decoder 2.0 design engineer could interface the analog signal of telephone line with digital logic of microcontroller system in straight ahead manner. 2. Module Specifications The module specifications are as follows: 1. Input: · DTMF tones from telephone line (analog signal)…

Continue reading