BerrySonar is a Linux-based C# application developed for the Raspberry Pi, designed to act as a DIY LIDAR-like system—similar in concept to the object detection systems used in autonomous vehicles like Teslas. It uses trigonometry and an ultrasonic sensor rotated by a stepper motor to scan a 180° field, detect and display nearby objects. The data is transmitted securely to a Firebase Realtime Database for monitoring and analysis. The GUI of the application is served as a React based application called berry-sonar-view that is getting the LIDAR metadata in real time using Firebase real-time database and rendering the data in a sonar UI element that is drew and rendered dynamically in the browser
BerrySonar-ezgif.com-gif-maker.mp4
-
🧠 LIDAR-like Scanning – Scans a 180° arc using a rotating ultrasonic sensor.
-
🔄 Stepper Motor Rotation – Uses a 28BYJ-48 stepper motor to rotate the sensor precisely.
-
🧰 Raspberry Pi-Controlled – All hardware is interfaced and controlled via GPIO pins.
-
☁️ Firebase Realtime Database – Secure, cloud-based storage of distance and angle data.
-
🔐 Secure Writes – Only the super-admin can write data.
-
👀 Read-Only Access – A restricted admin account can read data.
-
Programming Language: C# (.NET Core)
-
Platform: Linux (Ubuntu Server)
-
Cloud: Firebase Realtime Database
-
Security: Firebase Authentication & Realtime Database Rules
-
Communication: GPIO with PWM for motor control & timing for ultrasonic pulse detection
-
🧠 Raspberry Pi (any model with GPIO support; tested on Raspberry Pi 3/4)
-
📏 HC-SR04 Ultrasonic Sensor – For distance measurement
-
🔁 28BYJ-48 Stepper Motor with ULN2003 Driver Board – For rotating the sensor
-
🪛 Breadboard & Jumper Wires – For circuit connections *🔌 5V Power Supply – To power the motor and sensor
Install the required GPIO drivers using APT.
sudo apt install gpio -y || sudo apt install wiringpi -y && sudo apt install libgpiod-dev -y
Download the application from the repository Release section and run the application as sudo
sudo -i && ./BerrySonar
🌀 Tiny but mighty! This 5V stepper motor rotates the ultrasonic sensor to scan the surroundings.
🧠 The brain behind the motor! Controls the motor's stepping sequence and power delivery.
👀 The “eyes” of BerrySonar. Sends sound waves and listens for echoes to measure object distances.
🔩🧰 Hardware Configuration and Wiring