loading

Necessary Equipment :

- Arduino uno/mega/nano

- Ultrasonic sensor with trig and echo ports

- Radio 915MHz 3DR with transceiver and receptor (usb)

- arduino cable

- Breadboard

- Jumpers

Step 1: Code

Copy, paste this code on arduino ide and upload to your arduino.


int trig = 5;
int echo = 3;
float ttime;
float distance_cm;

void setup() {

pinMode(trig,OUTPUT);
digitalWrite(trig,LOW);
delayMicroseconds(10);
Serial.begin(57600);
pinMode(echo,INPUT);

}

void loop() {

digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
ttime = pulseIn(echo, HIGH);
distance_cm = ttime / 29.4 / 2;
Serial.print("Distance CM: ");
Serial.println(distance_cm);
delay(200);

}

Step 2: Plugging the Stuff

- Plug 3DR receiver on pc usb. Find out want com number.
- Connect the ultrasonic and the transceiver like the diagram above
- I didn’t found the 3dr radio on fritzing, so I replaced with a Bluetooth. But is the same idea. Tx 3DR on RX arduino. Rx 3DR on TX arduino.
- Open Serial monitor in arduino IDE, select the respective COM of the 3DR receptor.
- Set the same baud rate ( 57600).
- Have fun!

<p>Did you need to alter the firmware on the radios? </p>
<p>cool arduino project. </p>

About This Instructable

10,534views

26favorites

License:

More by ánegreiros:GoPro 3 / 4 Floaty Backdoor Radio 915MHz 3dr module telemetry with arduino 
Add instructable to: