Implementation of Ohmmeter Using ZKit-51
Resistance is the reluctance or a kind of friction in a carrier which opposes the flow of current through it. The resistance of an element is measurable and it is represented by an unit known as Ohm. Ohmmeter is a device used to measure the electrical resistance. This project shows how to construct a simple ohmmeter using 8051 microcontroller.
Theory & Design
The resistance of an element can be measured by building a voltage divider circuit with a known input voltage (`V_i`), a known resistor value (`R_k`), and the unknown resistor (`R_u`), as shown in the figure below. By measuring the output voltage (`V_u`), it is possible to determine the value of unknown resistance.
The output voltage `V_u` is given by, the voltage divider equation.
`V_u=V_i*R_u/(R_u+R_k)`,
The equation is re-arranged to obtain the unknown resistance `R_u`.
`R_u=V_u*R_k/(V_i-V_u)`,
From the above derivation, we find that the unknown resistance is measured with the known resistance `R_k` , input voltage `V_i` and the voltage `V_u` across the unknown resistor. Since `R_k` and `V_i` is known already, only the `V_u` has to be measured. In our design of a digital ohmmeter using ZKit-51, we use an ADC to measure the voltage `V_u` in the above circuit, to calculate the resistance `R_u` using the above formula in software.
The range of resistance to be measured will vary based on the known resistor used in the circuit.
Known resistor |
Measurement range |
10 ohms |
< 30 ohm |
10 kilo ohm |
31 ohm - 41 kilo ohm |
1 mega ohm |
18 kilo ohm - 4 mega ohm |
What you need
-
FRC 10 cable
-
Resistors - 10K - 2 nos
Hardware
-
Build the voltage divider circuit as shown in the diagram.
-
Connect voltage divider circuit to ZKit-51 ADC module to measure the voltage across unknown resistor.
-
Connect ZKit-51 ADC module with ZKit-51-motherboard using FRC connector.
-
Calculation of the unknown resistor value will be done in software part.
Software
The code for resistance measurement using ZDev library is given below,
#include <board.h> #include <stdio.h> #include <adc.h> #include <lcd.h> #include <delay.h> #define KNOWN_RESISTANCE 10000 /* Input volt=5.1, adjusted for non-floating point value manipulation. */ #define INPUT_VOLTAGE 5070 /* Calculate unknown resistance from measured voltage. */ uint32_t resistance_value(uint8_t digi_volt, uint32_t res, uint16_t vin) { uint32_t resistance; uint16_t analog_volt; analog_volt = (digi_volt * 16); resistance = ((analog_volt * (res / 1000)) / ((vin - analog_volt) / 10)); return (resistance * 100L); } int main() { uint8_t volt; uint32_t resistance; uint8_t prev_value = 0; board_init(); board_stdout(LCD_STDOUT); lcd_init(); adc_init(); adc_enable(2); delay_init(); while (1) { volt = adc_read8(2); if (volt == prev_value) continue; prev_value = volt; resistance = resistance_value(volt, KNOWN_RESISTANCE, INPUT_VOLTAGE); lcd_clear(); printf("%ld ohms", resistance); mdelay(1000); } }
Categories: 8051, Project, ZKit-51 | Add Comment

Follow
Categories
- 8051 (14)
- Android (2)
- ARM (3)
- Careers (5)
- Design Pattern (1)
- Java (4)
- Jobs (15)
- Linux (1)
- Mobile (4)
- News (7)
- Product (8)
- Project (9)
- Python (1)
- Tutorial (8)
- ZigBee (1)
- ZKit-51 (11)
- ZKit-51-V664 (2)
- ZKit-ARM-1343 (1)
Archives
- 2012 May
- 2012 April
- 2012 January
- 2011 December
- 2011 November
- 2011 September
- 2011 August
- 2011 July
- 2011 June
- 2011 May
- 2011 April
- 2011 March
- 2011 February
- 2011 January
- 2010 December
- 2010 November
- 2010 October
- 2010 September
- 2010 June
- 2010 May




