Page 1 of 1

ultrasonic sensor

PostPosted: Sat Dec 08, 2012 1:08 am
by fzul90
hi,
what is the output of the ultrasonic sensor SN-LV-EZ1 if use RS232 Serial Output. i want to use it to detect water for 8 different level and use vhdl coding to program it. what is the sequences for the first 8 output in ascii code? thanks

Re: ultrasonic sensor

PostPosted: Sat Dec 08, 2012 1:25 am
by zhenning
Did you read this: http://tutorial.cytron.com.my/2011/08/0 ... ge-finder/

CASE 3 : UART READING

Maxsonar-EZ1 in UART mode are directly given an ASCII value to the microcontroller which start with an “R”, then follow by 3 value of range such as 255-inch in “2”, “5”, “5” and then lastly is the carriage return which is totally of 5 data to be received.

If (RCREG == ‘R‘) data[k=0] = RCREG;
Check if the RCREG are ASCII value ‘R’. if yes then save the data at data[0] by reset the k = 0.

if (data[0] == ‘R‘) data[k++] = RCREG;
After make sure the data[0] is ‘R’. Then next step is to save the next RCREG value in data[1], data[2], data[3] by increasing k by 1 at the time.

send_lcd_data(1,data[1]);
By referring to LCD library, by sending a 1 will toggle ON the RS of the LCD which is read as an character for LCD. Then send the ASCII data that given by the Maxsonar-EZ1 to the LCD.

Re: ultrasonic sensor

PostPosted: Sat Dec 08, 2012 8:30 am
by shahrul
MaxSonar output in UART. You can see output on serial monitor ex Maxsonar Lesson.

Re: ultrasonic sensor

PostPosted: Sun Dec 09, 2012 10:56 am
by fzul90
i'm using VHDL to program the output. do i need to convert the output to binary first. for example i want to set '000' as level 1 and so on until '111' as level 8

Re: ultrasonic sensor

PostPosted: Sun Dec 09, 2012 11:34 am
by yonghui
i think it has the analog output also that u can use ADC to read it.
VHDL means ur using FPGA board?
u need to check whether ur FPGA development board has the RS232 or UART module or ADC converter.

Re: ultrasonic sensor

PostPosted: Mon Dec 10, 2012 1:38 pm
by fzul90
i'm using de2 board. it has rs232 port. so i think iwant to use rs232 serial output as the input. but my concern is can i receive the data from the sensor if i connect directly to de2 board?

Re: ultrasonic sensor

PostPosted: Tue Dec 11, 2012 8:54 am
by robosang
Not really use the ultrasonic in that way because I do not have RS232 port any more on laptop :)

Anyhow, it should work :mrgreen:

But the VHDL in the FPGA is not my field.... sorry.

Re: ultrasonic sensor

PostPosted: Tue Dec 11, 2012 10:38 am
by yonghui
i think u need to find the usermanual of DE2 board then look into RS232 part and see how to read from the port. the data from sensor should be 8 bits data. probably u will need to write some code to read from the buffer of the port, so seek also the address.

Re: ultrasonic sensor

PostPosted: Sun Oct 20, 2013 12:27 am
by chingfa
Hi, anyone know how to simulate the ultrasonic SN-HC-SR04 in protues??? :cry: HELP!!!

Re: ultrasonic sensor

PostPosted: Sun Oct 20, 2013 12:30 am
by chingfa
Hi, anyone know how to simulate the ultrasonic SN-HC-SR04 in protues??? :cry: HELP!!!