I am generally of the school that you shouldn't vary your opening bet size unless the stack sizes change. I play mostly cash for 100BB or more, and so all things being equal, I open for 2.5BB. I have been experimenting with changes to this in specific situations. In tables that are generally loose, especially loose and passive (I play 6max, so with 3-4 players with VPIPs over 30), I am now changing my standard opening to 3BB, and might bump it up to 4BB. I can't imagine that'll change their calling/3betting range, but over many iterations it should make me more profitable (assuming I am not dramatically outplayed post-flop).
Another thing I'm trying, and I'm not as confident about this one, is adjusting my preflop bet sizing to target the blind of players that are too sticky from their blind. When I see a player call an opening bet from early position with 3-5 off in the BB, I might continue to raise 2.5 in all other situations, but raise 3 or 4 when they are in the blind. Apart from being exploitative, which I like, it also has the potential advantage of making people start guessing about why I'm changing my raise sizing, as it would take lots of iterations to make it obvious that it was targeted toward a specific position. It might also feel like a personal attack on the BB player, which could tilt them and cause them to start to make worse decisions.
Apart from that, I agree with what some others are saying. The smaller the stack, the smaller the opening bet size, usually varying between 2.5 and 2. There are lots of good free sources for poker fundamentals (which this question is) though, including the free course they offer here. Better, I would suggest, than trying to figure out which advice in this thread is good and which is bad (because IMO, some of the advice in this thread is solid and some of it is horrendous). I think I already had pretty good fundamentals, but I thought I'd try out the Cards Chat course, and while I don't think I really learn anything from the first 4 weeks of the course, I think it teaches fundamentals very well, although I can't remember if it specifically talks about opening bet sizes. I am getting something out of the last couple of weeks of the course too, so that's a bonus. Almost didn't stick around that long.