Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

hi all..

Status
Not open for further replies.

poo

New Member
i m doin project on ..


Remote monitoring of Generator using GSM modem Implemented in BTS
Introduction :
Often in the base transceiver station(BTS) there is a power failure and a generator is to be turned on to keep the BTS in working condition. Here in our project we monitor the diesel level in the BTS and send the information to the GSM modem. The information is through SMS. Information includes the BTS name and the diesel level. We further would create a virtual personal area network using four GSM modem which will monitor their respective BTS and will send the message to the controller server. Hence an immediate refill of diesel can be called and avoid failure of the system. This will avoid the failure of BTS and will provide caution before the system fails. An effective wireless network can thus be established .
Objectives :
1. Design a circuit for measuring the diesel level using float switch.
2. Interface the float switch to ATMEGA32 based development board.
3. Code the ATMEGA32 to decode the voltage level sent by the switch.
4. Further coding for generating appropriate message for transmission.
5. Interfacing ATMEGA32 to the GSM modem.
6. GSM modem will push the message to the server.

Applications :
1. The system can be efficiently made use in BTS.
2. The system can be used for remote monitoring of generator diesel level or even for that matter for water tank also.
Extension :
This project can be extended for interactive monitoring that is receiving message from sever and processing it and taking the appropriate action..

please help me with t float switch part ... t switch has 3 wires.. for 3 levels in tank ... t output of tat ll be current... those wires are connected to atmega 32 board... readin t input.. msg has to be displayed on lcd... but t current value s more.. so wat shud i do ???.. plz help.....
 
Last edited:
You'll have to describe the function and output of your float switch better.
 
hi Sceadwian,

I hav designed a circuit.. so tat the value can be made less.. max current the board can take s 20mA..
but there is more loading effect..
so can i use a buffer to reduce the loading effect ..?
 
poo, you need to describe the sensor itself and your circuit technically. We need schematics for the circuit and specifications of the sensor.
 
hello sir...
float switch has three wires to indicate each level of fuel low,mid or high every time fuel reaches a particular level particular wire gives out 5v and some 0.5amps current so we built the circuit to reduce the current since our micro controller can take only max of 20ma so...in our current reduction circuit just ttl logic 7408 and in series with a 560 ohms resistor that gave us some 8ma output current so we were happy to connect it to board but.. when we connect it the atmega32 board is driving the voltage i dont know why ?????????? what can be the best solution please reply...as quickly as possible
 

Attachments

  • user manual111.pdf
    547 KB · Views: 569
It provides 5v's it's CAPABLE of .5 amps. You don't need to reduce the current to the micro controller as it's based on voltage not current for it's input lines, no adjustment circuitry is required. You're showing a key misunderstanding of what voltage and current are, and the document you provided is nothing more than the user manual for your kit, we can't teach everything that's wrong in a paragraph or two.

when we connect it the atmega32 board is driving the voltage i dont know why
Could you explain that better it doesn't make sense.
 
sir, uc is not responding instead it driving voltage from the switch connection. sir, now that problem is solved. mistake i did was since uc has internal pull up resistors i had given +5v now i changed to -5V. and for 3 levels i hav taken first 3 pins of port A as inputs. after the running the program, its able 2 display the message as 'HIGH' which i actually wanted. :)

but if i read at other 2 pins its showing as 'EROR' .

here is the code.. sir can u please suggest if any change has to be made in this .

#include <avr/io.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <util/delay.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>



#define LED_PIN1_DDR DDC6
#define LED_PIN1 PC6
#define LED_PIN2_DDR DDC7
#define LED_PIN2 PC7
#define LED_PORT PORTC
#define LED_DDR DDRC
#define LOW(uint) (uint&0xFF)
#define HIGH(uint) ((uint>>8)&0xFF)

#define LCD_DATA_PORT PORTD
#define LCD_DATA_DDR DDRD
#define LCD_D7 PD7
#define LCD_D6 PD6
#define LCD_D5 PD5
#define LCD_D4 PD4
#define LCD_CONTROL_PORT PORTB
#define LCD_CONTROL_DDR DDRB
#define LCD_RS_PIN PB0
#define LCD_RW_PIN PB1
#define LCD_EN_PIN PB2
//important
#define SET_FUNCTION 0x28 // 8bits, 2lines
#define DISPLAY_ON 0x0C
#define DISPLAY_CLR 0x01
#define ENTRY_MODE 0x06 // Entry = increase
#define RETURN_HOME 0x02
#define CURSOR_BACK 0x10
#define SET_DDRAM 0x80
#define WRITE_DATA 1 //
#define WRITE_COMMAND 0 //
#define LCD_EN 0x80
#define LCD_LINE_TWO 0x40



extern void lcd_init(void);
extern void lcd_gotoxy(unsigned char x,unsigned char y);
extern void lcd_putc(unsigned char c);
extern void lcd_print( unsigned char * ptr );
extern void lcd_print_p( PGM_P ptr );

//typedef enum _BOOL { false = 0, true } bool;
typedef unsigned char BYTE; // 8-bit
typedef unsigned int WORD; // 16-bit
typedef unsigned long DWORD; // 32-bit

typedef union _BYTE_BITS
{
BYTE byte;
struct
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
} bits;
} BYTE_BITS;

typedef union _WORD_BYTES
{
WORD word;
BYTE bytes[2];
struct
{
BYTE low;
BYTE high;
} byte;
struct
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
unsigned char bit8:1;
unsigned char bit9:1;
unsigned char bit10:1;
unsigned char bit11:1;
unsigned char bit12:1;
unsigned char bit13:1;
unsigned char bit14:1;
unsigned char bit15:1;
} bits;
} WORD_BYTES;

typedef union _DWORD_BYTE
{
DWORD dword;
WORD words[2];
BYTE bytes[4];
struct
{
WORD low;
WORD high;
} word;
struct
{
BYTE LB;
BYTE HB;
BYTE UB;
BYTE MB;
} byte;
struct
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
unsigned char bit8:1;
unsigned char bit9:1;
unsigned char bit10:1;
unsigned char bit11:1;
unsigned char bit12:1;
unsigned char bit13:1;
unsigned char bit14:1;
unsigned char bit15:1;
unsigned char bit16:1;
unsigned char bit17:1;
unsigned char bit18:1;
unsigned char bit19:1;
unsigned char bit20:1;
unsigned char bit21:1;
unsigned char bit22:1;
unsigned char bit23:1;
unsigned char bit24:1;
unsigned char bit25:1;
unsigned char bit26:1;
unsigned char bit27:1;
unsigned char bit28:1;
unsigned char bit29:1;
unsigned char bit30:1;
unsigned char bit31:1;
} bits;
} DWORD_BYTES;

// mac address structure
typedef struct _MAC_ADDR
{
BYTE byte[6];
}MAC_ADDR;

// ethernet header structure
typedef struct _ETH_HEADER
{
MAC_ADDR dest_mac;
MAC_ADDR src_mac;
WORD_BYTES type;
}ETH_HEADER;

// IP address structure
typedef struct _IP_ADDR
{
BYTE byte[4];
}IP_ADDR;

// IP header structure
typedef struct _IP_HEADER
{
BYTE version_hlen;
BYTE type_of_service;
WORD_BYTES total_length;
WORD_BYTES indentificaton;
WORD_BYTES flagment;
BYTE time_to_live;
BYTE protocol;
WORD_BYTES checksum;
IP_ADDR src_ip;
IP_ADDR dest_ip;

}IP_HEADER;

// ARP packet structure
typedef struct _ARP_PACKET
{
WORD_BYTES hardware_type;
WORD_BYTES protocol_type;
BYTE hardware_length;
BYTE protocol_length;
WORD_BYTES opcode;
MAC_ADDR src_mac;
IP_ADDR src_ip;
MAC_ADDR dest_mac;
IP_ADDR dest_ip;
} ARP_PACKET;

// ICMP packet structure
#define ICMP_MAX_DATA 32
typedef struct _ICMP_PACKET
{
BYTE type;
BYTE code;
WORD_BYTES checksum;
WORD_BYTES identifier;
WORD_BYTES sequence_number;
BYTE data[ICMP_MAX_DATA];
} ICMP_PACKET;

// TCP Header
typedef struct _TCP_HEADER
{
WORD_BYTES src_port;
WORD_BYTES dest_port;
DWORD_BYTES sequence_number;
DWORD_BYTES seqack_number;

union
{
struct
{
unsigned char reserved:4;
unsigned char value:4;
}nibble;
unsigned char byte;
}data_offset;

union
{
struct
{
unsigned char FIN:1;
unsigned char SYN:1;
unsigned char RST:1;
unsigned char PSH:1;
unsigned char ACK:1;
unsigned char URG:1;
unsigned char reserved:2;
} bits;
unsigned char byte;
} flags;
WORD_BYTES window;
WORD_BYTES checksum;
WORD_BYTES urgent_pointer;
} TCP_HEADER;

typedef struct _TCP_OPTION
{
BYTE kind;
BYTE length;
WORD_BYTES max_seg_size;
} TCP_OPTION;

typedef struct _UDP_HEADER
{
WORD src_port;
WORD dst_port;
WORD length;
WORD checksum;
} UDP_HEADER;

union flag1
{
BYTE byte;
struct
{
unsigned char key_is_executed:1;
unsigned char update_display:1;
unsigned char lcd_busy:1;
unsigned char key_press:1;
unsigned char send_temp:1;
unsigned char syn_is_sent:1;
unsigned char syn_is_received:1;
unsigned char send_temp_timeout:1;
}bits;
}flag1;

union flag2
{
BYTE byte;
struct
{
unsigned char key_hold:1;
unsigned char unuse:7;
}bits;
}flag2;


void lcd_send_nibble(unsigned char data)
{
data &= 0xF0;
LCD_DATA_PORT &= 0x0F;
LCD_DATA_PORT |= data;
_delay_us(1); // 1us
LCD_CONTROL_PORT |= _BV(LCD_EN_PIN);
_delay_us(2);
LCD_CONTROL_PORT &= ~_BV(LCD_EN_PIN);
}

void lcd_send_byte( char data_or_cmd, char data )
{
LCD_CONTROL_PORT &= ~_BV(LCD_RS_PIN);
if(data_or_cmd)
LCD_CONTROL_PORT |= _BV(LCD_RS_PIN);
else
LCD_CONTROL_PORT &= ~_BV(LCD_RS_PIN);
_delay_us(50); // 1us
LCD_CONTROL_PORT &= ~_BV(LCD_EN_PIN);
lcd_send_nibble(data & 0xF0);
lcd_send_nibble(data << 4);
}

void lcd_init(void)
{
char i;
LCD_DATA_DDR |= (_BV(LCD_D7) | _BV(LCD_D6) | _BV(LCD_D5) | _BV(LCD_D4));
LCD_CONTROL_DDR |= (_BV(LCD_RS_PIN) | _BV(LCD_RW_PIN) | _BV(LCD_EN_PIN));

LCD_DATA_PORT &= ~(_BV(LCD_D7) | _BV(LCD_D6) | _BV(LCD_D5) | _BV(LCD_D4));
LCD_CONTROL_PORT &= ~(_BV(LCD_RS_PIN) | _BV(LCD_RS_PIN) | _BV(LCD_RS_PIN));

_delay_ms(15); // 15 ms
for(i=1;i<=3;++i)
{
lcd_send_nibble(0x30);
_delay_ms(5); // 5 ms
}
lcd_send_nibble(0x20);
lcd_send_byte(WRITE_COMMAND, SET_FUNCTION);
lcd_send_byte(WRITE_COMMAND, DISPLAY_ON);
lcd_send_byte(WRITE_COMMAND, DISPLAY_CLR);
lcd_send_byte(WRITE_COMMAND, ENTRY_MODE);
}

void lcd_gotoxy( unsigned char x, unsigned char y)
{
char address=0;

if(y!=1)
address = LCD_LINE_TWO;
address += x-1;
lcd_send_byte(WRITE_COMMAND, SET_DDRAM|address);
}

void lcd_putc( unsigned char c)
{
if(c == '\f')
{
lcd_send_byte(WRITE_COMMAND, DISPLAY_CLR);
_delay_ms(2); // 2ms
}
else if(c == '\n')
lcd_gotoxy(1, 2);
else if(c == '\b')
lcd_send_byte(WRITE_COMMAND, CURSOR_BACK);
else
lcd_send_byte(WRITE_DATA, c);
}

void lcd_print( BYTE *ptr)
{

while( *ptr )
{
lcd_putc(*ptr++);
}
}

void lcd_print_p( PGM_P ptr )
{
unsigned char c;

while( (c = pgm_read_byte ( ptr++ )) )
{
lcd_putc(c);
}
}
delay()
{
while ( (TIFR & _BV ( TOV1 )) == 0 );
TIFR |= _BV(TOV1);
TCNT1 = 1536;
}







int main (void)
{
unsigned char float_switch_read;
char msg[4];
int i;
TCCR1B = 0x01;
lcd_init ();
DDRC|=0xf8;
PORTC|=0x07;
PINC &=0x07;
switch(PINC)
{
case(0x04):
delay();
msg[0]='h';
msg[1]='i';
msg[2]='g';
msg[3]='h';
break;
case(0x02):
delay();
msg[0]='h';
msg[1]='a';
msg[2]='l';
msg[3]='f';
break;
case(0x01):
delay();
msg[0]='l';
msg[1]='o';
msg[2]='w';
msg[3]=' ';
break;
default:
msg[0]='e';
msg[1]='r';
msg[2]='o';
msg[3]='r';
break;

}
for(i=0;i<=3;i++)
{
while ( (TIFR & _BV ( TOV1 )) == 0 );
TIFR |= _BV(TOV1);
TCNT1 = 1536;
lcd_putc(msg);
}








return 0;
}


thank u
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top