Interfacing Ultrasonic Sensor

Home Forums Drona Aviation – Drone for Education Interfacing Ultrasonic Sensor

Viewing 3 reply threads
  • Author
    Posts
    • #4898
      billawariteish
      Participant

        Hie, is there any way I can link an ultrasonic sensor with the Pluto X and build the X ranger projects?
        If Yes, please let us know how we can connect the API for it or how we can create another simple program to run it.

      • #4899
        prasanna.shevare
        Participant

          Hi,
          You can interface Ultrasonic sensors using Analog input APIs. However I would not recommend it, as ultrasonic sensors are pretty heavy for Pluto. You may still try it.

        • #4908
          billawariteish
          Participant

            Hey, thank you for the reply.
            Can you also help me out with the function to program the ultrasonic sensor on the Pluto?
            It will be really great if you could share the complete program itself.

          • #5139
            shally1986
            Participant

              Hi,

              Which Ultrasonic sensor do you have ? assuming its HCSR04 , I can help you with code . I have used the same in micro python . The logic is as below .
              code used in micropython
              def get_distance():

              pcf.pin(0,0)
              utime.sleep_us(2)
              pcf.pin(0,1)
              utime.sleep_us(20)
              while pcf.pin(0)==0:
              pass
              t1=utime.ticks_us()
              while pcf.pin(0)==1:
              pass
              t2= utime.ticks_us()
              cm= (t2-t1)/58.0
              print(cm)
              return cm

              i will receive the my drone tomorrow then may be can help with Pluto blocks

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.