Categories
3D Printer CS:GO bomb

Wrapping up the CS:GO bomb project

The making of

In the last post about the project I left you off with a picture of the yet to be finished 3D print of the bottom of the case. I’m glad to tell you that the bomb has been finished, and works perfectly!
If you haven’t read the last (and first) post about this project, I highly suggest having a look at the post here.

So: at this point all the parts have been 3D-printed. It was time to see if everything fits in the bottom part of the case! Remember, I designed (or rather: remixed) this model on my own, so there was a great chance that the dimensions would be a bit off. Luckily, everything fit together nicely at the first print. The most critical holes were the defuse-button hole, the XT60-shaped hole and the hole for the battery voltage indicator. The other 2 holes for the wires and the battery strap weren’t really that critical, since it’s fine if there’s a little wiggle room.

Fitting all parts in the bottom of the case for the first time.

As you can see from the picture, I have also soldered the D1 mini board to some perfboard, with lots of connectors on it and once single resistor (which is a pull-up resistor for the defuse button).

Closeups of the perfboard.

The block-terminals are used for power (+5v and ground), data pins (LEDs and beeper) and the button connectors. The male pin-headers are used for the keypad and the LCD screen. The D1 mini board is also installed using female pin-headers, so the board can be removed if needs be.

After hot-gluing the 5v buck converter and the custom-made perfboard in place, it was time to place the buzzer and lots of LEDs on the outside of the bomb. The LEDs are individually addressable WS2812B LEDs, so I can easily control each LED while only using one data wire. In the end I did not add any code to control each LED independently, but I can add this in the future if I want to.

After wiring and gluing the LEDs and beeper to the outside, the bomb was done! Well, the physical side of it at least. The firmware still needed some changes, more on this later.

Photos of the finished product.

Like I said, the firmware still needed some adjustment. I wanted to be able to change the time after which the bomb would explode, and I also wanted to be able to change the defuse time on the fly. I thought about making these changes over the air using my laptop, but I have an LCD and a keypad on the bomb.. Might as well use it! So I made a little menu with which I can change a couple of parameters. These values are stored in the built-in EEPROM of the ESP8266.

And with this, the project is done. With the web server the bomb is hosting, I can write a program on my laptop to keep track of the state of the bomb. This way I can play certain audio files when, for example, the bomb explodes. I could connect my laptop to a big audio installation and a subwoofer, for example, to make it sound like an actual bomb exploded!

Bill of materials (BOM)

A full BOM for the bomb (get it?). I bought almost all parts from Banggood, but I’m sure the parts can also be found on websites like Amazon. I had most parts laying around at home which made it a bit cheaper for me.

Possible revision 2

There are a couple things that I could have done better. If there will ever be a rev. 2 of my bomb design, these are the things I would change:

  • Built-in battery with a charging circuit to allow charging from a USB port. I used a drone battery, battery strap and XT60 connector to save cost because these are things I have laying around at home;
  • Change the loudness of the beeper in the menu, the beeper I got can’t be adjusted in loudness;
  • Use a microcontroller with more pins. I would love to have controlled the LED in the defuse button through the microcontroller as well, but I couldn’t because there are simply not enough pins on the D1 mini board;
  • Make a case design using the real bomb model in the game. I found the model of the in-game bomb here, but my design skills are simply not good enough to make changes to a model this complicated.

Links

Case design: https://www.thingiverse.com/thing:4543891
Arduino code: https://github.com/WouterGritter/CSGO-Bomb

And now..

The project is done! Now I’ll have to start finding something else to make.. However, we can start playing some CS:GO matches in our garden using laser guns!

It was a lot of fun to make a CS:GO bomb simulation in hardware, in real life. I learned a lot, especially how to do more advanced 3D model design. I hope you’ve enjoyed reading these 3 blog posts as much as I did making the bomb!

Categories
CS:GO bomb

How I got the CS:GO bomb beep pattern

The formula

In short, here is the formula for the beep pattern of the CS:GO bomb:

    \[f(t)=1.05\cdot\exp\left(0.0054t+0.000871t^{2}\right)\]

Where f(t) gives the BPS (Beeps Per Second), and t (0 ≤ t ≤ 45) is the time in seconds (the in-game bomb explodes after 45 seconds).

For a more generalized formula:

    \[g(p)=1.049\cdot\exp\left(0.244p+1.764p^{2}\right)\]

Where g(t) gives the BPS (Beeps Per Second), and p (0.0 ≤ p ≤ 1.0) is the percentage of the time that has passed since the bomb has been armed. This is more useful when you don’t want to be stuck using the 45 second explosion time frame.

A plot of time v.s. beeps per second

The length of each beep is fixed at 125ms per beep.
These formulas approximate the beep pattern of CS:GO’s bomb very accurately.

For information about the note(s) of the bomb beeping, I suggest taking a look at this reddit post. Apparently the notes are different depending on if the bomb is planted on bombsite A or B, fascinating stuff!

How I got the formula

The interval between the beeps are very clearly exponential, so I needed to find or generate a matching exponential formula. After some digging online I couldn’t find any
At first I tried estimating the beeps per second from a YouTube video of the bomb sound roughly every 5-10 seconds, and filling this data into an excel table. When I got this data, I tried to let excel guesstimate the (exponential) formula for it. This was without any luck; the beep pattern still seemed a bit off. Looking back at it, it was pretty obvious seeing as I was just loosely guessing the beeps per second of the original sound.

At this time I had the choice to go all-in and find the exact formula or to make do with the relatively bad formula I had figured out. Of course I chose to get the exact formula!

So, it was time to download an mp3 file of the bomb sound of the game. Luckily I found one pretty easily on YouTube, even without any background music. I imported the file into Audacity and started to find the exact beeps per second for some timestamps, roughly 5 seconds apart and 2 seconds apart when the bomb was about to explode. To find the beeps per second, I selected the part between the start of a beep and the start of the beep after that one. Audacity told me the length of the selection in milliseconds which is accurate enough for what I’m trying to do. Dividing 1 by the length of the selection in seconds gave me the bps at that time.

After gathering 17 data points, it was time to figure out an exponential equation that fits the given data. After using a really old-school application called CADRE Regression, it figured out the values for A0, A1 and A2 for a second degree exponential function:

I used these values in my in-real-life CS:GO (fake!) bomb project to match the in-game beep pattern.

Code snippet of the CS:GO bomb project which calculates beep time between beeps. Note that the A1 and A2 values are different because I adjusted the formula to accept time t in milliseconds instead of seconds.

Categories
3D Printer CS:GO bomb

Advanced CS:GO in-real-life bomb

So, my dad has gotten this crazy idea to play an in-real-life match of CS:GO in our backyard, being a fan of the game himself just like me.
But where’s the fun in CS:GO with (laser) guns, even a bomb-site A and B, but no bomb?

Having done some Arduino/ESP projects before, I started the task to make a hardware simulation of the bomb in the game. The bomb needed to fulfill a couple of things:
– A keypad to enter the code to “arm” the bomb.
– A (loud) beeper, just like in the game.
– An LCD to show the status of the bomb.
– Has to be able to communicate with a computer, to indicate the status of the bomb (for future things like a large projector screen, or a large audio installation).
– Lastly, of course: fancy lights!

Being all hyped, I ordered the parts we did not have lying around at home from Banggood and waited for it to arrive. As soon as it arrived I started connecting the parts together and writing some software. I got a basic CS:GO bomb simulator up and running pretty quickly!

Very early stage of the bomb.

I got the LCD connected and running pretty soon afterwards. In the mean time I was printing an enclosure for it all with my (well, actually, my dad’s) Creality3D Ender 3 3D-printer. I found a nice model made by NightfuryGamer on Thingiverse: https://www.thingiverse.com/thing:3085333.
This model contains a hole for the same keypad I am using for my bomb. However, it does not have any hole for an LCD display which I of course wanted to use. I haven’t done any real 3D model designing in the past, so I wasn’t looking forward to designing or editing the enclosure.

The software I had written for the board (in my case: a D1 mini clone, based on an ESP8266 chip) was far from done, so I put the thought of having to do 3D-designing in the back of my mind. In the mean time, it was time to give this bomb it’s own IP address so it can communicate with my laptop wirelessly!

Shortly after this I found myself having a very unique problem I’d never thought I have. Being a CS:GO player for a long time, you develop a good sense for when the bomb is going to explode in the game, based off of the beeps you hear. See, there is no timer in the game that tells you when exactly it’s going to explode. When trying some basic “algorithms” for the time between beeps, everything just felt a bit off. I tried some basic linear functions, even exponential functions, but nothing worked. I needed to get the exact timing. I couldn’t find anything on Google, so I took the task upon me to find the exact mathematical function for the beeps (can you tell I’m a computer/math nerd yet?). More about this on my other blog post. In short: it involved Audacity, a weird program that fits an exponential curve on a data-set and a lot of time. In the end I managed to get it done!

With the software and hardware part being mostly done now, it was time to start thinking about the enclosure again. Like I mentioned before, I have never really touched 3D modeling before, so I wasn’t looking forward to this part. I have access to a full student version of solidworks, so this is what I was going to use. After half an hour and a ton of struggles, I was finally able to remove some existing features in the model of the top-plate of the existing design. Another half an hour later, I was able to make a hole for the LCD screen. Victory!

Five hours of printing later, it fits perfectly!
Now it was time for the next task: changing the design of the bottom part of the enclosure to remove all existing holes, and make a few of my own. Mainly:
– A hole for the defuse button.
– An XT60 shaped hole for the XT60 connector (more on this in a bit).
– Two holes for a battery strap.
– A hole for the battery voltage meter.
– A tiny hole for the wires for all the lights and the beeper.

The bomb will be powered by an FPV drone battery. This is because I own one, and I have a couple of batteries for it. This way it’s a bit cheaper because I didn’t have to buy extra batteries. And there’s another bonus: the final product will look bad-ass with a battery mounted on the side and wires coming out of it! One disadvantage of this is that the batteries do not have any protection circuit on them, and LiPo batteries need to be handled with care. This is why I needed to put a battery voltage meter on the design as well.
My plan is to wire the buzzer and all LEDs with the wires visible and sticking out, to make it look more like the CS:GO bomb.

Anddddd… That’s it! This is my progress on this project so far. The new bottom design should be done printing in about 10 hours. When it’s done I can start assembling the bomb in its final form!

The models I designed/remixed can be found on Thingiverse: https://www.thingiverse.com/thing:4543891

A screenshot of OctoPrint, the software I use to manage the 3D printer. Note that the printed time left is way off for some reason..