One year ago approximately, I have in my hand the Ping Sonar altimeter and echosounder. The sonar works just fine, I am obtaining data from it (with rasp). But, in the protocol, there is a command to obtain continuously profile data from the sonar, but when I program to do that, the sonar cannot send me the approx 267 data array, and then when I ask for information (distance ID) the sonar is no longer working. Perhaps you have a solution, I plan to obtain data value every 50 seg or even less (if its possible), without asking for the response data, that why I start to know the response data from profile message, then go to 1400 continuous_start message. Here is the data i am sending:
uint8_t* profile(){
msgDat[0] = 'B'; //0 66dec
msgDat[1] = 'R'; //1 82dec
(uint16_t&)msgDat[2] = 27; // payload size ----2-3
(uint16_t&)msgDat[4] = Profile; // id =1300
msgDat[6] = 0; //6 ist immer 0
msgDat[7] = 0; //7 ist immer 0
(uint16_t&)msgDat[8] = 1; //payload
(uint16_t&)msgDat[10] = 0; //
(uint16_t&)msgDat[12] = 0; //
(uint16_t&)msgDat[14] = 0; //
(uint16_t&)msgDat[16] = 0; //
(uint16_t&)msgDat[18] = 0; //
(uint16_t&)msgDat[20] = 0; //
(uint16_t&)msgDat[22] = 0; //
(uint16_t&)msgDat[24] = 0; //
(uint16_t&)msgDat[26] = 0; //
(uint16_t&)msgDat[28] = 0; //
(uint16_t&)msgDat[30] = 0; //
(uint16_t&)msgDat[32] = 0; //
msgDat[34] = 0; //
(uint16_t&)msgDat[35] = checksum_num(msgDat,35);
for(i = 0 ;i <37 ; i++){
// serialPutchar (fd, msgDat[i]) ;
printf("%d\n",msgDat[i]);
}
return msgDat;
}
void update_todate(){
send(profile(),37);
delay(1500);
read(107);
// if(checksum_proof(read(36),36) != 0){
distanc_l = memory[9]<< 8 | memory[8];
distanc_h = memory[11]<< 8 | memory[10];
distanc_t = distanc_h <<16 | distanc_l;
cout << "Distancia: "<<(int)distanc_t <<" mm"<< endl;
confidence = memory[13]<< 8 | memory[12];
cout << "Confidencia: "<<confidence <<" %"<< endl;
dur_transmit = memory[15]<< 8 | memory[14];
cout << "Duracion de transmision: "<< dur_transmit <<" us"<< endl;
pingnumber_l = memory[17]<< 8 | memory[16];
pingnumber_h = memory[19]<< 8 | memory[18];
pingnumber_t = pingnumber_l <<16 | pingnumber_h;
cout << "Medicion de pulso: "<< pingnumber_t << endl;
beginscan_l = memory[21]<< 8 | memory[20];
beginscan_h = memory[23]<< 8 | memory[22];
beginscan_t = beginscan_l <<16 | beginscan_h;
cout << "Inicio de scan: "<< beginscan_t <<" mm"<< endl;
length_scan_l = memory[25]<< 8 | memory[24];
length_scan_h = memory[27]<< 8 | memory[26];
length_scan = length_scan_l <<16 | length_scan_h;
cout << "Distancia de la region de scan: "<< length_scan <<" mm"<< endl;
gain_l = memory[29]<< 8 | memory[28];
gain_h = memory[31]<< 8 | memory[30];
gain = gain_l <<16 | gain_h;
cout << "Ganancia: "<< gain << endl;
profile_length = memory[33]<< 8 | memory[32];
cout << "Profile data length: "<< profile_length << endl;
profile_data = memory[34];
cout << "Profile data: "<< profile_data << endl;
limpiar_memoria();
// }
send(voltage_5v(),12);
delay(50);
read(12);
volt = memory[9]<< 8 | memory[8];
cout << "Voltaje: " << volt<< " mV"<< endl;
limpiar_memoria();
send(processor_temp(),12);
delay(50);
read(12);
temp = memory[9]<< 8 | memory[8];
cout << "Temp de procesador: " << temp/100.f<< " °C"<< endl;
limpiar_memoria();
}
And the response is:
as far as I understand is that after the 0x00 from response[07], the payload it seems 226 (does is the actual data that I am going to read?), also, as you see in the code I processed the data received but when I ask again for voltage_5v and temperature, there is no coherent response from the sonar.