Skip to main content
Version: FILS English

Turret with object identification

A smart turret using a Raspberry Pi Pico 2W, with servo control, ultrasonic object detection and live radar

info

Author: Purcarescu Eduard-Gabriel
GitHub Project Link : https://github.com/UPB-PMRust-Students/project-EduarditoRealG Youtube Project Link : https://youtu.be/9hobQLP9Fqw

Description​

The project uses an ultrasonic sensor to help the user see the objects within a certain radius on a display and if an object is closer than a set distance, it uses a servomotor to shoot it. Another servo is used to constantly rotate the turret. After shooting, it stops and waits for a button to be pressed in order to reset.

Motivation​

Since I was little, I've always liked shooting games and I can say I wanted to do this project in order to remember my childhood and also something in order to gain more knowledge in software and hardware domain. I didn't like the games which didn't have a radar or a minimap, that is why I integrated also the lcd display.

Architecture​

  1. Raspberry Pi Pico 2W: the brain of the operation. It receives information from the sensor and analyses what to send to the display and servomotor
  2. Micro servomotor: shooting function
  3. Metallic servomotor: used for automatic rotation of the turret
  4. Ultrasonic sensor: measures the distance to an object and then sends it to the microcontroller
  5. LCD display: displays objects seen by the ultrasonic sensor, behaving like a mini radar
  6. Push button: serves as a reset function after an object has been shot
  7. Breadboard: interconnects all the pieces Smart_Turret

Log​

Week 28 April - 4 May​

Started working on the documentation for the project. I bought every necessary component and started to connect them on the breadboard, in order to be able to make the schematics and understand how they interact with eachother.

Week 5-11 May​

I began assembling all the components. I started also to look into the programming part, what features need to be implemented and I also 3D printed the structure.

Week 12-18 May​

The exterior design is finished and fully assembled. I continue making progress with the software milestone in order to interconnect all the parts' functions.

Week 19-25 May​

The software part of the project is finished. The project is fully functional!

Hardware​

  1. Raspberry Pi Pico 2W
  2. Micro servomotor
  3. Micro servomotor
  4. Ultrasonic sensor
  5. LCD display
  6. Push button
  7. Jumper wires
  8. Breadboard
  9. Resistors

Hardware_Photo1 Hardware_Photo2

Schematics​

KiCad_schematic

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller40 RON
Debug probeDebug66 RON
SG90Servomotor12 RON
SG90Servomotor12 RON
BreadboardBreadboard10 RON
1.44' LCD dislayDisplay28 RON
Jumper wiresWiring5 RON
Push buttonReset button0.36 RON

Software​

LibraryDescriptionUsage
embassy-rpPico PeripheralsAccesses Raspberry Pi Pico W hardware like GPIO, PWM, and SPI
embassy-executorAsync RuntimeRuns async tasks on embedded systems
embassy-timeTime Management LibraryUsed for timers, delays, and async time operations
embedded-halHardware Abstraction LayerDefines traits for embedded device interfaces like SPI, PWM, and GPIO
embedded-graphicsGraphics Primitives LibraryUsed to draw text, shapes, and images on embedded displays
st7735-lcdDisplay DriverUsed to control ST7735 1.44" LCD over SPI
display-interface-spiSPI Display InterfaceProvides SPI interface support for embedded display drivers
defmtDebug FormatterEfficient logging and debug output for embedded systems
defmt-rttRTT Transport for defmtSends defmt logs over USB using Real-Time Transfer
panic-probePanic HandlerDisplays panic messages via defmt for debugging
hcsr04_asyncUltrasonic sensorMeasures distance
micromathMath crateUsed for trigonometric functions

https://pico.implrust.com/ultrasonic/index.html https://www.raspberrypi.com/documentation/ https://pmrust.pages.upb.ro/docs/fils_en/welcome