wireless smoke detector system

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

wireless smoke detector system

Postby fatimah » Fri Oct 29, 2010 11:09 pm

actually my project mainly on rf transmission in PR 16, but i want to do some adjustment, where input is smoke sensor(analog)....in programming....what i should do to transmit this signal?in original programming....it send array data right....is it i need to put sensor signal in array data?if yes...can u give example...?
fatimah
Novice
 
Posts: 24
Joined: Tue Aug 10, 2010 2:09 pm

Re: wireless smoke detector system

Postby shahrul » Sat Oct 30, 2010 3:06 pm

You can put sensor data in the sending data packet.
Ex send: 0x00 0x00 0x00 0x00 0x00 0x00 [start] [data1] [data2] [error check]
data1 and data2 is your smoke meter reading. If read ADC, it might be 10bit data.
error check it might be 1 byte or 2 bytes, depends on you. I have use CRC-16 error check, same as in the modbus PLC.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: wireless smoke detector system

Postby fatimah » Thu Nov 04, 2010 9:48 pm

thank you for your clear explanation, it's much help,if u don't bother, may i have your coding for that plc...as you said before?can u email to me...
fatimah
Novice
 
Posts: 24
Joined: Tue Aug 10, 2010 2:09 pm

Re: wireless smoke detector system

Postby shahrul » Thu Nov 04, 2010 10:30 pm

This is 2bytes checking error CRC-16
CODE: SELECT_ALL_CODE
int CRC16(int DataLength){
unsigned int i,j,CheckSum;
CheckSum=0xFFFF;
for (j=0;j<DataLength;j++){
   CheckSum=CheckSum^response[j];
   for(i=8;i>0;i--){
      if((CheckSum)&0x0001==1) CheckSum=(CheckSum>>1)^0xA001;
      else CheckSum=CheckSum>>1;}}
CRC_high=(CheckSum>>8)&0x00FF;   
CRC_low=CheckSum&0x00FF;
return CheckSum;
}

DataLength is no of byte data
for this 0x00 0x00 0x00 0x00 0x00 0x00 [start] [data1] [data2], it have 9 DataLength
The [CRC_high] [CRC_low] as checking error
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor


Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 13 guests

cron