So as I've absolutely no knowledge on that vaping stuff I cannot help you with your specific project whatsoever any further. However, we can still discuss the electronics part from the perspective of design and engineering aspects in general.
Here are some rules that I like to apply to my personal projects:
Actually there are several things that could be improved ...
2) Missing decoupling caps at the ATMega and on the LED.
The WS2813 LEDs don't need a capacitor, they have them build into them. For the Attiny I will add a capacitor on the input - but I am not that familar with capacitors yet and am not sure how to properly select one
RULE1 (At least for prototypes and on-offs): When you can fix a potential problem with a dirt cheap component, simply do it. A hour of your time wasted on debugging is three to four magnitudes more valuable!I only managed to find a data sheet (
https://www.elecrow.com/download/WS2813_LED_Datasheet.pdf) that does look quite ... yeah whatever.
No mentioning of a built in decoupling capacitor at all there.
Simply add one (or at the very least ad a footprint onto the board). A good value would be 100n. Maybe add another 1u as the led might draw some current. See Daves video on decoupling capacitors.
RULE2: Select proper components matching your design parameters and keep reasonable margins.That LED is not! Yes, it might work at 3.3V on the bench at cozy 21°C. But will it still work in the cold outside or when it is very hot?
It is specified as a 5V device and their test conditions are given for a range of 4.5V < VDD < 5.5V (see datasheet, page 4). Which is funny in itself as their absolute maximum rating for VDD is 5.3V
But 3.5V is specified as the absolute minimum allowable voltage to stay within specification. "Absolute Maximums Ratings" are given as absolute extremes and NOT as general conditions for device operations. That said, even if your supply would stay above 3.6V on average that would still be insufficient due to transients and noise etc. etc. So keep your margins and make them as large as possible!
In this specific case I would simply ask myself it I really need an "intelligent" LED and not just a simple single, or bi-color one.
6) Your design seems not to be safe for firmware updates. Never do firmware updates with that circuit when the load is connected. It might go up in flames :-)
Again, I don't know what you mean by this one If I update the firmware, the heating element on the output can be removed. And the MOSFET has a pull down resistor, so there shouldn't be any problems even if the Pins of the Attiny are floating. Or what do you mean by that?
Looking at your circuit diagram, your MOSI line is used to switch the power transistor during normal operation. Hence, when doing a firmware update with any load connected, the transistor will turn on and off repetitively during the time programming. The switching losses would then probably quickly destroy the device (with smoke & flames) if a load is connected.
RULE 3: Use components that ease your design, even if they are slightly more expensive. No need to skimp off cost in the cent range. Just select a larger microcontroller that has enough pins so you don't need to use the programming pins for other purposes. Alternatively make absolutely sure that the programming operation cannot have any bad side effects.
7) Does your cell have internal protection? If not, add one ... and if you don't trust that one - add a real fuse, too.
No battery protection. I will think about it
From my perspective an absolute MUST. LiPo cells cannot handle uncontrolled high (or fault) currents and further cannot handle deep discharges either.
RULE 4: Use common industry-accepted solutions/practices to well known problems. Protecting LiPo Cells is such a common task that there are tons of specialized components on the market to do so.
Optional:
8 ) Debounce of the switch: Simple R/C
I wanted to do that in software, but I will do some testing and might do it with a simple RC circuit
Apply rule number 1. Why make your life any harder than it needs to be?
9) External pull-ups. Resistors practically cost nothing - so why take any chances?
You don't trust the internal ones?
Oh yes, I do trust them. But I don't trust myself :-) I want all my projects to operate safely even in the event of stupid programming mistakes as far as possible. Forgetting to turn on an internal pullup might even go undetected during initial bench testing but will lead to erratic behaviour later on.
Again, apply rule 1.
Then some general thoughts and hints:
1) Get yourself a very good cad package and learn how to use it. KiCad is absolutely free of cost (and open source, too) and will serve you well for most of the projects that can be done on a hobby level (and even more).
2) There is this old quote apparently from Einstein: "Everything should be made as simple as possible, but no simpler." Thus, skimp on unnecessary complexity (e.g. multicolour digital controlled LEDs) but not on decoupling, debouncing etc.
There is one
fundamental advantage on building your own stuff: You don't have any pressure on cost! Now take advantage of that. Therefore, your devices can be (and should be) better than the ones on the market,
because you can take your time to come up with the best possible design for you, select the best possible components, build the most rigid/safe/nice-looking enclosure. All your design artefacts (like schematics and PCB layouts, CAD drawings) should look as a piece of art to you (it is sometimes called PCB artwork for a reason).
Anything less is a complete waste of time and resources ...