SRF04 + Bargraph

Azaruk

New Member
First - I am very, very new to PICs and don't feel confident to develop this project all on my own. Hence this request to you amazingly clever and innovative people!

I work in the heavy transport industry. Reversing a 13 metre trailer up to a loading dock is more often than not done by touch! Trailers and loading deck get damaged.

I want to develop a simple parking sonar device, using a pair of transducer modules (one on each side of the trailer rear to take care of non-parallel approach) and a bargraph showing the distance from each module to the loading dock.

I thought of using a pair of SRF04 modules, a PIC and two bargraph displays.

Once I had come up with the concept, I realised I haven't the faintest idea of how to implement the idea.

Can anyone help?
Thanks
 
I'd recommend downloading Proton Lite, and having a read through the help file and Protons Forums, this would be a very easy program to create with PIC Basic.

**broken link removed**

This device would also be very easy to interface with, and it offers quite a lot of features;
**broken link removed**


* 0 - 255 inches range with 1 inch resolution
* 42kHz Ultrasonic sensor
* New LV version operates from 2.5-5.5V
* Low 2mA supply current
* 20Hz reading rate
* RS232 Serial Output - 9600bps
* Analog Output - 10mV/inch
* PWM Output - 147uS/inch
* Small, light weight module

To read how far away the object is would be as simple as;

Video: https://www.box.net/shared/q6mhhh4bu8

Code:
Device = 16F877
XTAL = 4
 
Dim Distance as Float

DECLARE ADIN_RES 10 		' 10-bit result required 
DECLARE ADIN_TAD FRC 		' RC OSC chosen 
DECLARE ADIN_STIME 50 		' Allow 50us sample time

LCD_DTPIN = PORTB.4
LCD_RSPIN = PORTB.2
LCD_ENPIN = PORTB.3
LCD_INTERFACE = 4
LCD_LINES = 2
LCD_TYPE = 0

ADCON1 = %10000000 			' Set analogue input, Vref is Vdd
Input PORTA.0
Input PORTA.1

DelaymS 100
Cls

Main:

        Distance = ADIN 0                           ' Grab the digital value of PORTA.0
        
        Distance = Distance * 5 / 1023          ' Convert to volts
        
        Distance = Distance / 0.010               ' Find out how many 10mV go into it
        
        Print At 1, 1, "D1 = ", Dec1 Distance, 34, "  "
		
        Distance = ADIN 1                            ' Grab the digital value of PORTA.1
        
        Distance = Distance * 5 / 1023             ' Convert to volts
        
        Distance = Distance / 0.010                 ' Find out how many 10mV go into it
				
        Print At 2, 1, "D2 = ", Dec1 Distance, 34, "  "
        
        Goto Main

For more information on any command, simply have a look at the Proton help file for that command
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…