DIY

Non-pixel ring displaying “health” in a computer game + vibration sensor for each wound

Non-pixel ring displaying  Non-pixel ring displaying Non-pixel ring showing To put it simply, this is an LED ring with a vibration motor that reacts to every hit in the player's character. Those. if you are “shot” in the game on the computer, then the LEDs will change the color of the glow, and the vibration motor will start working for a short time.
For the manufacture of such a device, the master used the following
Tools and materials: – Esp-12E; – Vibration motor 4 mm x 8 mm; – AMS1117 3.3 V regulator; – Battery 3.3 V 800 mAh (1 A); – Velcro tape; – Pin connector; – Angular pin connector; -Wires; -USB board – TTL; -Printing board; -Soldering accessories; -Screw terminal; -Resistor; -Tp4056 charging module; -MT3608 boost module; -Non-pixel LED strip; -Non-pixel RGB ring; -MCU module ; – breadboard + power supply; – 7805 voltage regulator; – DC connector; Step one: Python Gamer Assist application
This is an application that reads data from the game and sends it to the microcontroller.
 Non-pixel ring displaying Non-pixel ring displaying To run the program, you will need a csv configuration file contain the location of the health bar in the game and other information for data processing. So the first step is to create a config file.
The program is easy to use with a graphical interface and can be customized for any game.
First you need to take a screenshot of the game when the game is in full screen mode and the health value is clearly visible. Press the Alt + tab key combination, and go to the python application. Then click on Edit config. We make a capture (rectangle) around the health value. We save the file. This is a one-time operation and may need to be done for each game.
Now you need to go back to the home page and download the configuration file. You just need to press the launch button, and the program should read the data on the screen and send it to the device.
Non-pixel ring showing Non-pixel ring displaying Non-pixel ring displaying  Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying Step Two: Addressable RGB LED
The main part of this project is driving RGB LEDs. Unlike conventional LEDs, RGB can be controlled by each LED individually.
To control LEDs, the wizard assembles the following circuit.
Non-pixel ring showing  Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying Non-pixel ring displaying Non-pixel ring displaying The LED strip is powered by a 12V power supply. The 7805 regulator lowers this voltage to 5V and sends it to the NodeMCU.
Several libraries can be used to program these addressable LEDs, the most popular of which are FastLED and the adafurit_Neopixel library. The wizard uses the FastLED library for the LED strip.
To test the work, you need to open an example FastLED sketch. Here are two important points to keep in mind. First, you need to know what LED drivers are used in the strip and how many LEDs are in the strip. In this case there are 5. These data are indicated in the code.
Step three: code for LEDs
The esp-now protocol is used for wireless data transmission.
To get the code, you need to go to the repository and download the gamer assist project. Then open the folder with the arduino code and upload the find_MAC_address sketch. After downloading the code, you need to open the serial port monitor and write down the MAC address of the NodeMCU, it will come in handy later. After receiving the MAC address, you need to load the health_value_ambient thumbnail, which will control the color of the LEDs depending on the health value. Please make sure the IC driver name and number of LEDs are set correctly before downloading. In this case it is GS1903 and the number of LEDs is 5.
Find_MAC_address.inoHealth_Value_Ambient.ino
Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying To check if the non-pixel ring is working, we need another NodeMCU that can receive serial data from a python application and transmit data via the esp now protocol.
Open the Serial file in esp_now.ino. In this file, we enter the MAC address that was recorded earlier and then simply compile and load the code. We can now run the Python application. If the user is playing a game, the LED bar should change from green to red, depending on the health in the game.
Serial_to_ESPNOW.ino
Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying Non-pixel ring displaying Step four: vibration motor
For tactile feedback about the state of health, the master decided to install two vibration motors.
First you need to solder wires to the RGB LED ring. Then the ring is mounted on the board. According to the diagram, it mounts esp12E, vibration motor and driver. Then he solders the boost converter and TP4056 charging circuit on the back of the PCB. Finally, mounts the 3.3V stabilizer.
Installs the battery.
Non-pixel ring displaying Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying Non-pixel ring displaying  Non-pixel ring displaying Non-pixel ring displaying Step five: code for vibration sensors
Now can load the code into esp12E. The master is connected through the FTDI module. Once the connection is established, you need to download the MAC address code to search.
Then you need to disconnect the ground wire from GPIO-0 and restart esp12E. Next, you need to open the serial code for esp now and change the MAC address to the device address, and then upload the code to NodeMCU.
Ring_code.inoFind_MAC_address.ino
Non-pixel ring showing  Non-pixel ring displaying Step six: using your device
Open the game config file in your Python application and then just click Start.
You can also try games that display a health bar instead of a health value, simply by selecting the appropriate option in the editor window. You just need to establish that only one white line is visible during image processing. The white line shows the division between lost and remaining health. The python application then uses this information on a string to determine the remaining health.
Non-pixel ring showing Non-pixel ring showing  Non-pixel ring displaying Non-pixel ring showing  Non-pixel ring displaying Now only fasten the Velcro tape to the device and put it on your hand.
Non-pixel ring displaying

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button