Petoi Doc Center
🇺🇸English
🇺🇸English
  • Welcome to Petoi Doc Center
  • Getting Started Guide
  • 🙋‍♂️FAQ(Frequently Asked Questions)
  • Petoi robot joint index
    • Joint Pins on NyBoard
      • Nybble
      • Bittle
    • Joint Pins on BiBoard V0
      • Bittle X
      • Bittle X+Arm
    • Joint Pins on BiBoard V1
      • Bittle X
      • Bittle X+Arm
      • Nybble Q
  • Bluetooth Connection
    • BiBoard
    • NyBoard
  • Upload Firmware
    • NyBoard
    • BiBoard V0
    • BiBoard V1
  • Joint Calibration
  • Infrared Remote
    • Remote Controller
  • Mobile App
    • Introduction
    • Calibrator
      • Nybble
      • Bittle
    • Controller
  • Desktop APP
    • Introduction
    • Firmware Uploader
      • NyBoard
      • BiBoard V0
      • BiBoard V1
    • Joint Calibrator
      • NyBoard Preparation
      • BiBoard Preparation
      • Nybble
      • Bittle / Bittle X
        • Bittle (NyBoard)
        • Bittle X (BiBoard V0)
        • Bittle X (BiBoard V1)
      • Bittle X+Arm
        • BiBoard V1
        • BiBoard V0
    • Skill Composer
      • NyBoard Connection
      • BiBoard Connection
      • Interface
        • Nybble
        • Bittle / Bittle X
        • Bittle X+Arm
    • Tools
  • Block-based programming
    • Petoi Coding Blocks
      • NyBoard Preparation
      • BiBoard Preparation
    • Block-based Coding Curriculum - Learn Quadruped Robotics for Beginners
    • Python coding mode in Mind+
    • Generic Arduino Uno Blocks
    • Install Mind+ on Chromebook
  • Arduino IDE
    • Upload Sketch for NyBoard
    • Upload Sketch for BiBoard
    • Calibrate the joints with Arduino IDE
    • Serial Monitor
    • C++ Curriculum: Learn Quadruped Robotics for Beginners
    • Install Arduino IDE on Chromebook
  • Free Curriculum
    • 📚Download
  • APIs
    • 🖇️Serial Protocol
      • Feedback servos
      • Nested task queue and signal generator
    • 🐍Python API
    • 🐛8266 MicroPython controller
      • Run MicroPython on ESP8266
      • Setup WebREPL
      • Using the ESP-NOW protocol
    • 🦎8266 Arduino C Controller
    • ©️C++ API
    • 🍓Raspberry Pi serial port as an interface
      • For BiBoard V1
    • 💻Set up Development Environment on Chromebook
    • 🤖ROS
  • Nyboard
    • Overview
    • NyBoard V1_0
    • NyBoard V1_1 & NyBoard V1_2
  • BIBOARD
    • BiBoard V0 Guide
    • BiBoard Extension Hat
    • Demo Applications
      • 1.GPIO port
      • 2.Serial port
      • 3.Analog-digital converter
      • 4.Digital-Analog Converter
      • 5.EEPROM (Electrically Erasable Programmable read only memory)
      • 6.Gyro IMU(MPU6050)
      • 7.Infrared remote control
      • 8.PWM(Pulse Width Modulation)
      • 9.Servo(under construction)
      • 10.Classic Bluetooth serial port SPP
      • 11.Bluetooth low energy (BLE) serial port pass-through
      • 12.File system SPIFFS
      • 13.Add hardware partition configuration option in Arduino IDE
      • 14.Play MP3
      • 15.The usage of Wi-Fi OTA(Over-The-Air)
    • BiBoard V1 Guide
  • Communication Modules
    • Introduction (For NyBoard)
    • USB Uploader (CH340C or CH343G)
    • Dual Mode Bluetooth
    • WiFi module ESP8266
      • ESP8266 + Python Scripts Implement wireless crowd control
  • Extensible Modules
    • Introduction
    • MU Camera
    • Ultrasonic Sensor
    • Light Sensor
    • Touch Sensor
    • Gesture Sensor
    • PIR Motion Sensor
    • IR Distance Sensor
    • Voice Command Module
    • Petoi AI Vision Module
    • Advanced development and application of AI vision modules
      • Model Training
      • Model quantification
      • Model deployment
      • Training on the COCO DIY dataset
    • Robot Arm
      • Upgrade your older Bittle/Bittle X for the robotics arm gripper
    • 🎮Joystick with Micro:Bit
  • Applications
    • Melody Creation
    • Skill Creation
    • OpenCat Imitation Tutorial
    • Programmable Puppet Character
    • Tutorial for simulating Bittle In Isaac Sim
  • History
    • Upload Sketch For NyBoard (software 1.0)
  • Technical Support
    • 💾Supporting Application and Software
    • 🔧Burn Bootloader for NyBoard
    • 🛠️Useful Tools
    • 🔋Battery
  • Useful Links 🕸
    • 🔭Home of Petoi Robots
    • 🛒Shop Coding Robots
    • 💿GitHub of OpenCat
    • 🎪PetoiCamp (Forum)
    • 📽️Petoi Robot Videos
    • 📬Users' repositories
Powered by GitBook
On this page
  • Function introduction
  • NyBoard
  • Hardware setup
  • Software setup
  • BiBoard
  • Hardware setup
  • Software setup

Was this helpful?

Export as PDF
  1. Extensible Modules

Ultrasonic Sensor

PreviousMU CameraNextLight Sensor

Last updated 10 months ago

Was this helpful?

Function introduction

Petoi RGB Ultrasonic Sensor is a new module that integrates RGB LED and ultrasonic ranging. Only one GPIO is needed to operate the ultrasonic transceiver. While the ultrasonic probe measures the distance, the other GPIO pin can drive RGB LEDs with various light effects.

The previous one:

NyBoard

Hardware setup

Connecting to the NyBoard with wire as shown in the following picture:

The previous one:

Software setup

Petoi Desktop App

Arduino IDE

Use the latest OpenCat code to finish the setup. For example, to modify the code for Nybble as shown below:

If you have already uploaded the latest OpenCat code to make Nybble walk, you only need to uncomment the #define ULTRASONIC at the beginning of OpenCat.ino, then upload the code.

Arduino code demo

Ultrasonic module code realization function: The probe inside the ultrasonic module lights up with different-colored lights according to the different distances monitored by the ultrasonic module in real-time, and Nybble will make different action responses at the same time.

The demo video is as follows:

Mind+ demo code

BiBoard

Hardware setup

Connecting to the BiBoard with wire as shown in the following picture:

The dial switch on the bottom of the BiBoard extension hat is dialed to UART2 .

Software setup

Petoi Desktop App

Arduino IDE

Mind+ demo code

Attach the ultrasonic sensor to .

You can use the within the Petoi Desktop App. Please select the correct Product type, Borard version, and Serial port. The mode should be Ultrasonic, so press the Upgrade the Firmware button. for example, Nybble, NyBoard_V1_2, COM5 as follows:

You can use to upload and modify the source code.

If you are unsure, you need to finish the (Step 1 to Step 10) to ensure everything is configured correctly, then upload the code in the Ultrasonic mode.

If the Ultrasonic code is uploaded correctly, you can see success messages printed on the of Arduino IDE. As shown below:

You can use the within the Petoi Desktop App. Please select the correct Product type, Borard version, and Serial port. The mode should be Standard, so press the Upgrade the Firmware button. for example, Bittle, BiBoard_V0_2, COM5 as follows:

After uploading, and use the serial command "XU" to switch to using the ultrasonic sensor mode.

You can use to (OpenCatEsp32.ino). Use the latest OpenCatESP32 code to finish the setup. For example, to modify the code for Bittle as shown below:

After uploading, and use the serial command "XU" to switch to using the ultrasonic sensor mode.

Nybble's eye
Firmware Uploader
Arduino IDE
upload process for the standard mode
serial monitor
https://github.com/PetoiCamp/Petoi_MindPlusLib/blob/main/examples/NyBoard/avoidObs_NyBoard.mp
Firmware Uploader
Arduino IDE
upload the sketch
https://github.com/PetoiCamp/Petoi_MindPlusLib/blob/main/examples/BiBoard/avoidObs_BiBoard.mp
open the serial monitor
open the serial monitor