Interfacing MPXV5100 pressure sensor to Atmega8

The MPX5100 series piezoresistive transducer is a state-of-the-art monolithic silicon pressure sensor designed for a wide range of applications, but particularly it is convenient to interface to microcontroller or microprocessor with A/D inputs. This is thin-film metallization, and bipolar processing to provide an accurate, high level analog output signal that is proportional to the applied pressure. More details can be found here MPXV5100 This sensor measures differential pressure comparing to atmospheric so when there is no pressure applied it shows 0kPa;

Continue reading

Analog Devices Digital temperature sensor AD7416

There aremany situations when you might need to measure temperatures or trigger some events due to temperature changes. It is very convenient to have these values in a digital format. Then you can transfer digital values to microcontroller to process data or jus to display on LCD screen. AD7416 Sensor description This is 10 bit digital temperature sensor which ca measure temperatures in range interval -40 to 125ï‚°C). Temperature conversion ADC has 15 conversion times. Sensor can be supplied from 2.7 to 5.5V, so it is no problem to connect directly to ARM microcontrollers. Data is transferred through I2C serial interface. More detailed description – datasheet can be downloaded from Analog devices page: AD7416. Here you find simple routine where Atmega8 microcontroller reads sensor data decodes temperature value and displays it on 2×16 LCD display. Lets connect everything to simple circuit. Don’t forget to connect pull-Ups to SCl and SDA busses: Here are few real images of prototyping: That’s it. If you would like to try to run this sensor by your own, here is source code of CodeVision compiler. And already compiled hex in archive. Also I added Eagle libray with AD7416 part in it. AD7416 Have fun 😉…

Continue reading

AVR ISP

AVRISP is very popular Parallel port programmer for flashing AVR type microcontrollers. Earlier I used programmer connected to com port, but frequently I needed this port for other purposes, I decided to make it work on parallel port. The programmer on parallel port is much simpler than connected to serial port, because there is no needed voltage adapter like MAX232. You can only connect your MCU directly to port. But for safety reasons there is good practice to use buffer ship like 74HC244. The header for programmer I used standard 6 pin ISP header. I wanted to make compact programmer, so I put circuit inside LPT head. Few pictures of it:   Programming is usually done by using PonyProg software. Bellow is its configuration:

Continue reading

AVR-GCC ABC [2]

After release of AVRStudio4 there is ability to integrate AVR-GCC compiler in it. As you know AVR studio has only assembler compiler- debugger. Integration of AVR-GCC is done by plugin. Plugin detects AVR-GCC by it self, you don’t have to bother. What do we get from it? Of course – full set of good tools comparable to commercial. Convenient user interface, automatic makefile generation, visual debugging by watching processors register, or even you can flash the chip. We can say that abilities are: 1. Compilation, setting parameters, automatic AVR-GCC detection; 2. Graphical User Interface – convenient project setting; 3. Tree like project view; 4. Project can be complied with predefined configurations; 5. Convenient error handling; 6. Ability to use external makefiles; 7. Map and List file generation; 8. Plugin inspect connections among source files(c and h files who are not part of project); 9. User can work with c or ASM projects in one environment. Other documentation can be found in AVRStudio help files. This feature is well documented. AVRLIB library Standard avr-lib library is too small to fit many common interfacing like LCD, MMC, I2C ir even Ethernet. To write all hardware routines is not always preferable. This why…

Continue reading

AVR-GCC ABC [1]

This time I decided to lay down some information on using AVR-GCC compiler. I am not going to rewrite what’s in documentation is already written, but just write down some issues, what can help you start using this amazing tool. Introduction Probably the most AVR programmers had a question in their mind what compiler to use for their designs. The choice is really big. You can use commercial ones like IAR, CodeVision, ImageCraft. These compilers come with convenient GUI’s, code generators. But you have to buy license to use them. So if you are going to make low budget project, the best choice is to use open source compiler GCC . This is the most successful open source compiler in the world. For AVR platform it is called AVR-GCC. The compiler itself has no graphical interface everything can be done in MSDOS command line or in Linux command line. To make it easier to compile project there are makefiles used. GNU compilers as usually are using UNIX style make files. This file can be run with make.exe program. In reality you don’t have to write makefiles – there are ready templates to use. Everyone maybe agrees that use of compiler…

Continue reading

C language Operators and expressions

The main thing what microcontrollers does is operates with data. There are four main operations that microcontrollers does: adds, abstracts, multiplies and divides (+,-,*,/). division can be split in division “/” and modulus operation “%”. For instance i1/i2 is integer division. Other part of operators is Relation operators. They are used for boolean conditions and expressions. Expressions with these operators return true or false values. Zero is taken as false and non zero value as true. Operators may be as follows: <, <=, > >=, ==, !=. The priority of the first four operators is higher than that of the later two operators. These operators are used in relational expressions such as: 7 > 12 // false 20.1 < 20.2 // true ‘b’ < ‘c’ // true “abb” < “abc” // true Note that the equality operator is == and not =. ‘=’ is an assignment operator. If you want to compare a and b for equality then you should write a == b, not a = b because a = b means you are assigning the value of b to a, as shown in. Next part of operators are logical operators. With logical operators results may be combined to…

Continue reading

Constants in C language

Constant value is understandable as non changeable value like PI=3.141592… value in math. Usually you use constants in your programs, but don’t realize that they are constants. For instance: x=x+3; The number 3 is a constant which will be compiled directly in addition operation. Constants can be character or string. Like in function printf(“Hello World\n”); “Hello World” is a string constant which is placed in program memory and will never changes. It is usually recommended to declare constants by using identifier with reserved word const: const int No=44; By identifying the variable as constant will cause compiler to store this variable in program memory rather than in RAM, thus saving space in RAM. If special functions used, then constants can be also stored in EEPROM memory. Few words for the numeric constants. Numeric constants can be declared in many ways indicating their base. Decimal integer constants (base 10) consist of one or more digits, 0 through 9, where 0 cannot be used as the first digit. Binary constants (base 2) begin with a 0b or 0B prefix, followed by one or more binary digits (0, 1). Octal constants (base 8) consist of one or more digits 0 through 7, where…

Continue reading