Transforming Toy Guns with ESP32: A Comprehensive Guide

Transforming Toy Guns with ESP32: A Comprehensive Guide

Project Name: Smart Gun [CyberGun]

Project Author: Geek Fantasy

Introduction

What is more attractive than a toy gun is modifying a toy gun!

Transforming Toy Guns with ESP32: A Comprehensive Guide

Step-by-step guide to installing a set of smart devices based on ESP32-Pico-D4 on the launcher (Senbo Long Gecko 2.0)…

Netizens commented:

Transforming Toy Guns with ESP32: A Comprehensive Guide

01
Project Features/Highlights?

Transforming Toy Guns with ESP32: A Comprehensive Guide

1

Display Ammunition Capacity

2

Chamber and Firing Detection

3

Shooting Stability Detection

4

Gun Stability Training

5

Launcher Data Reporting

To achieve the above functions, how should the circuit be designed?

02
Circuit Design

The entire project is divided into three parts: main control board, sensor board, and programming board.

Transforming Toy Guns with ESP32: A Comprehensive Guide

Main Control Board integrates MCU, MPU6050, LCD, and battery management chip, running the main control program.

Transforming Toy Guns with ESP32: A Comprehensive Guide

Main Schematic Diagram

Transforming Toy Guns with ESP32: A Comprehensive Guide

Main PCB Diagram

Sensor Board integrates an 8-bit GPIO expansion chip, connected to the main board via IIC. Eight GPIOs are connected to eight Hall sensors to detect bullet count and chamber status.

Transforming Toy Guns with ESP32: A Comprehensive Guide

Sensor Schematic Diagram

Transforming Toy Guns with ESP32: A Comprehensive Guide

Sensor PCB Diagram

Programming Board integrates a serial port chip and automatic programming circuit for programming the main control board and serial communication, connected to the main control board via UART bus.

Transforming Toy Guns with ESP32: A Comprehensive Guide

Programming Schematic Diagram

Transforming Toy Guns with ESP32: A Comprehensive Guide

Programming PCB Diagram

Ammunition Capacity + Chamber and Firing Detection Implementation?

Ammunition capacity detection—using seven Hall sensors fixed next to the magazine, to detect the position of a round magnet fixed on the bullet board.

Chamber detection—using a Hall sensor fixed at the front of the gun’s mouth, to detect whether it is chambered.

Transforming Toy Guns with ESP32: A Comprehensive Guide

Installation Diagram 1

Transforming Toy Guns with ESP32: A Comprehensive Guide

Installation Diagram 2

Transforming Toy Guns with ESP32: A Comprehensive Guide

Installation Diagram 3

This circuit is located on the sensor board, installed on the side of the magazine of the launcher. To reduce the number of lines to the main control board, here an I2C interface GPIO expansion chip is used to expand 8 GPIOs, connected to 8 Hall sensors.

Among them, seven Hall sensors correspond to magazine positions 0-6, with a round magnet fixed on the bullet board to trigger different Hall sensors. As the ammunition decreases, the magnet moves up, triggering different Hall sensors, reporting GPIO status through PCA9554W, allowing the main control to collect ammunition capacity.

Programming Board Principle

The main control board has limited space, so the programming board operates independently.

It uses CP2102, combined with two transistors, to achieve automatic programming and automatic switching of LOG mode.

Transforming Toy Guns with ESP32: A Comprehensive Guide

03
Other Notes
01
Device Code

The software part is open source and continues to be updated.

Refer to 【Chapter 4】 for guidance to check the open-source website

02
Firmware Programming

Use IDE to program, the program is developed with PlatformIO, you can download the program and compile it for direct programming.

04
Open Source Website

This project is open source!

——Want to replicate ? Want to give a thumbs up to the author ? You can copy the open-source website to go to the original text.

Open Source Website: https://oshwhub.com/anbin/fish-customh552

Transforming Toy Guns with ESP32: A Comprehensive Guide

Note: This project is from the 【Spark Program】 activity organized by Lichuang, which will be awarded at the end of the year. Giving the author a thumbs up + collecting is like casting a vote, welcome you to cheer for the author!
Transforming Toy Guns with ESP32: A Comprehensive Guide
PS: This project materials are provided by the Spark Program, each project registered in the Spark Program can reimburse up to 20,000 yuan, and there is also a chance to share 600,000 yuan in bonuses after completion.
Activity Details: https://oshwhub.com/activities/spark2024

Transforming Toy Guns with ESP32: A Comprehensive Guide

Transforming Toy Guns with ESP32: A Comprehensive Guide

*This article is reprinted from the “Lichuang Open Source Hardware Platform” user creation. If there is any infringement, please contact to delete

If you are watching, please give me a thumbs up!
Transforming Toy Guns with ESP32: A Comprehensive Guide
Click here to view the original project

Leave a Comment