There is no other tool available which helps in easy prototyping like the Arduino does.
Transmitter code
volatile int meter_reading = 0;
int reedsensor = 6;
void setup()
{
attachInterrupt(1, data_tx, RISING);
Serial.begin(600);
pinMode(reedsensor, INPUT);
}
void loop()
{
do
{
while(!digitalRead(reedsensor));
delay(10);
}while(!digitalRead(reedsensor));
meter_reading ++;
do
{
while(digitalRead(reedsensor));
delay(10);
}while(digitalRead(reedsensor));
}
//========== ISR ============//
void data_tx()
{
detachInterrupt(1);
Serial.print("AM");
Serial.print(meter_reading);
Serial.print('R');
attachInterrupt(1, data_tx, RISING);
}
The arduino board has all the required circuitry to get the built-in AVR micro-controller running. The AVR micro-controller boards which are provided with all the basic circuitry for the operation of the micro-controller which has been flashed with the Arduino boot-loader are called Arduino boards. The Arduino IDE is so simple to use that anyone who has basic knowledge of c programming can quickly get started with it.
This document discuss about the development and working of a prototype of an AMR (Automatic Meter Reading) using Arduino board. The AMR is now a general term for all kind of meters that can read the data, store the reading and transmit the reading wireless on request to another device.There are already water-meters available which allow the interfacing of reed-switch. This project uses a reed-switch along with a rotating magnet to demonstrate the working of AMR.
Circuit Description:
The AMR basically has two units, a data-storage- transmitter unit that is fixed on the meter and a handheld receiver unit. The transmitter unit has a reed-switch using which it reads the meter and a RF-transmitter which transmits the data. The handheld unit has a RF-receiver which receives the data and a 16*2 LCD in which the data gets displayed.
In this project, both the Transmitter and the Receiver are realized using Arduino pro-mini boards and 433Mhz RF transmitter-receiver pair.The main peculiarity of the Arduino pro-mini board is its size, and its capability of operating in the 3V supply. It is small in size, breadboard compatible pins and can easily be plugged into prototype circuit boards. The communication between two devices is wireless UART communication with a baud rate of 600 only.
Transmitter
The transmitter unit has a reed-switch using which it reads data from the meter. It has an Arduino board which keeps the data, a micro-switch for the user to start sending the data and a transmitter module which is directly connected to the serial port of the Arduino board. The unit is powered by two AA batteries.
The magnet in the meter comes near the reed-switch, it makes a contact and the digital input pin of the Arduino board where it is connected will read logic high. Each and every time the pin goes high, the Arduino increment a variable in the code. Whenever the user presses the micro-switch, the
board receives an external interrupt and it will start transmitting the value of that variable serially to the RF module, which will transmit it wireless. To receive the data without error at the receiver end the transmitter unit transmits the data in the following format.
Receiver
The receiver unit has another Arduino board with a RF receiver module connected to its serial port. It also does the serial communication with the same 600 baud rate so that it can receive the data transmitted from the transmitter unit. The Arduino board in this unit can display the data on a 16x2 LCD.
Each and every time the switch in the transmitter unit is pressed the data will get updated in the LCD. The handheld receiver unit works on a 9V battery. The code in the receiver unit waits for an ‘A’ to arrive at its serial port from the RF receiver unit, and confirms that it is a data from the transmitting meter when the next receiving character is ‘M’. The code will update the rest of receiving data into the LCD till it receives the character ‘R’ from the transmitting meter, represents the end of data transmission.
Working
The prototype appears to work normally with AA battery on the meter transmitter unit. The data can be received using the handheld device at a range more than 10 meters, without any antennas, other than PCB tracks on both the transmitter and receiver units. The PCB track antenna made on the meter transmitting unit is equivalent to a wire antenna of length 60 cm
To demonstrate the working, a round magnet is glued into a plastic disc, slightly shifted from its center. The disc is then connected to a dc motor shaft so that it can either be powered on, or can be rotated manually. A Reed switch is placed near to the rotating magnet, as the magnet is slightly offset from the center of the disc; it comes close at one point and away at some other point from the Reed Switch as the disc rotates. Hence the Reed switch gets open and close continuously as the magnet rotates, simulating a meter with Reed switch connected. At any point of time the user can press the switch in the meter transmitter unit and the meter reading will get updated in handheld the receiver unit.
This document discuss about the development and working of a prototype of an AMR (Automatic Meter Reading) using Arduino board. The AMR is now a general term for all kind of meters that can read the data, store the reading and transmit the reading wireless on request to another device.There are already water-meters available which allow the interfacing of reed-switch. This project uses a reed-switch along with a rotating magnet to demonstrate the working of AMR.
The AMR basically has two units, a data-storage- transmitter unit that is fixed on the meter and a handheld receiver unit. The transmitter unit has a reed-switch using which it reads the meter and a RF-transmitter which transmits the data. The handheld unit has a RF-receiver which receives the data and a 16*2 LCD in which the data gets displayed.
The transmitter unit has a reed-switch using which it reads data from the meter. It has an Arduino board which keeps the data, a micro-switch for the user to start sending the data and a transmitter module which is directly connected to the serial port of the Arduino board. The unit is powered by two AA batteries.
board receives an external interrupt and it will start transmitting the value of that variable serially to the RF module, which will transmit it wireless. To receive the data without error at the receiver end the transmitter unit transmits the data in the following format.
The receiver unit has another Arduino board with a RF receiver module connected to its serial port. It also does the serial communication with the same 600 baud rate so that it can receive the data transmitted from the transmitter unit. The Arduino board in this unit can display the data on a 16x2 LCD.
The prototype appears to work normally with AA battery on the meter transmitter unit. The data can be received using the handheld device at a range more than 10 meters, without any antennas, other than PCB tracks on both the transmitter and receiver units. The PCB track antenna made on the meter transmitting unit is equivalent to a wire antenna of length 60 cm
Programming
Receiver code
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int led = 13;
char x;
char dat[6];
int i = 0;
int o;
void setup()
{
lcd.begin(16, 2);
delay(1000);
Serial.begin(600);
delay(1000);
pinMode(led, OUTPUT);
digitalWrite(led, HIGH);
lcd.setCursor(5, 0);
lcd.print("A M R");
lcd.setCursor(4, 1);
lcd.print("0000000");
}
void loop()
{
i = 0;
do
{
do
{
while(!Serial.available());
x = Serial.read();
}
while(x != 'A');
while(!Serial.available());
x = Serial.read();
}
while(x != 'M');
do
{
while(!Serial.available());
x = Serial.read();
if(x != 'R')
{
dat[i] = x;
i ++;
}
else;
}
while(x != 'R');
dat[i] = '\0';
lcd.setCursor(5, 0);
lcd.print("A M R");
lcd.setCursor(4, 1);
for(o = 0; o < (7 - i); o ++)
lcd.print('0');
lcd.print(dat);
}
Transmitter code
volatile int meter_reading = 0;
int reedsensor = 6;
void setup()
{
attachInterrupt(1, data_tx, RISING);
Serial.begin(600);
pinMode(reedsensor, INPUT);
}
void loop()
{
do
{
while(!digitalRead(reedsensor));
delay(10);
}while(!digitalRead(reedsensor));
meter_reading ++;
do
{
while(digitalRead(reedsensor));
delay(10);
}while(digitalRead(reedsensor));
}
//========== ISR ============//
void data_tx()
{
detachInterrupt(1);
Serial.print("AM");
Serial.print(meter_reading);
Serial.print('R');
attachInterrupt(1, data_tx, RISING);
}
No comments:
Post a Comment