How to divide a Sine wave into n equal power/area sections? I'm working on an electronics project which involves using a small micro-controller to dim an AC Mains light bulb. I want to keep it simple and instead of having a continuous dimming adjustment I'll limit it to 'n' settings. So Off, 1/10th brightness, 2/10th brightness... on up to 9/10ths and 10/10 full brightness, always on. I can't do that by simply dividing the sine wave in 10 equal durations, as in 1/10th the period, 2/10ths the period etc. Brightness is related to power which is related to the area under the curve.
I only have to consider one positive sine half period section. The same time values would be used for the negative half of the wave's period.
Area under the curve involves integrating the sine wave, if I remember my school calculus correctly, which is a cosine function, but the dividing it into equal areas has me stumped. I think I have 0%, 50% and 100% brightness figured out, but that's about it ;)
This question has probably been answered already, but I'm probably asking it wrong. There's probably a maths way of expressing the question in a way a search engine could find.
 A: Almost there. The area under the first half-period is $2$. You're therefore looking for the constants $a_i$ such that
$$\int_{a_i}^{a_{i+1}} \sin x dx = \frac2n$$
The integral is indeed (negative) cosine: the left-hand side is
$$-\cos x\big|_{a_i}^{a_{i+1}} = -\cos(a_{i+1}) + \cos(a_i)$$
Now, the first segment starts at $a_0 = 0$, so we have
$$-\cos(a_1) + \cos(0) = \frac2n$$
so that $a_1 = \cos^{-1}\left(1 - \frac2n\right)$.
Can you take it from here?
A: Hint & caution:
If the load is constant (and just resistive), the instantaneous power is proportional to the square of the sine wave, and the power average over a period will be proportional to the integral of the $\sin^2$.
Additional note:
If you intend to use a modern led lamp, then you have to radically change your approach!
A: After getting electronics sorted and finally getting to the numbers this is where I got to. I used that number I calculated from integrating the sin wave and it certainly wasn't 1/4 brightness.
So lets try integrate the $\sin^2$ function. There was a suggestion here to that integral in terms of $\sin \theta \cos \theta$ but [1] gave me:
$1/2x–1/4\sin2x + c$
So if I'm looking for the area under the first quarter of the sine wave, from 0 to $\pi /2$:
$(1/2 * \pi /2 - 1/4 \sin \pi +c) - (1/2 * 0 - 1/4 \sin 0 +c)$
c's cancel out and I get $\pi / 4$
So if I want to split that area under the first quadrant in two equal parts I want to get the area for half that or $\pi / 8$:
$(\theta /2 - 1/4 \sin 2\theta +c) - (1/2 * 0 - 1/4 \sin 0 +c) = \pi /8$
$\theta /2 - 1/4 \sin 2\theta = \pi /8$
The easiest way for me to solve that is put the two sides of the equation into a graphing tool [2]. Which gives me a solution of 1.155 Radians. This is for a 50Hz mains power supply so $\pi$ represents 10mSeconds of time. That 10 mSeconds is the positive part of the wave and I was only working till the first peak at $\pi /2$ which is 5mS. But either way $\pi$ represents 10mS so 1.155, (the solution above) represents?:
$1.155/ \pi * 10 mS   =  3.673mS$
So:
3/4 brightness 3673 uS
1/2 brightness 5000 uS
1/4 brightness (10,000 - 3673) = 6324 uS
That actually appears to work! Just want to double that up now to have more possible shades.
Thanks everyone with your help in getting me to a solution! Still kinda pleasently surprised the numbers worked for me. After all that I hope I've not actually made a basic error in this.
[1] https://www.emathzone.com/tutorials/calculus/integration-of-sin-squared-x.html
[2] https://www.desmos.com/calculator
