I would like to construct a set $E\subset [0,1]$ whose essential boundary is the Cantor set $C$.
More precisely, let us denote by $d_E(x)$ the limit $\lim_{r\to 0+} \frac{\lambda(E\cap (x-r, x+r))}{2r}$ (when the limit exists; $\lambda$ is the Lebesgue measure). Setting $E^t := \{x\in [0,1]: d_E(x) = t\}$, the essential boundary of $E$ is defined by $\partial^e E := [0,1]\setminus (E^0\cup E^1)$.
So, I'm looking for a set $E\subset [0,1]$ such that $\partial^e E = C$.
Any hint or reference will be appreciated.
At the end, I think this example can work.
Let $C\subset [0,1]$ be the usual Cantor set, obtained removing at the first step the interval $I_1^1 := (1/3, 2/3)$ from $[0,1]$, then at the second step the intervals $I_2^1 := (1/9, 2/9)$ and $I_2^2 := (7/9, 8/9)$ from the two remaining intervals, and, in general, removing at the $n$-th step $2^{n-1}$ intervals $I_n^k$, $k=1,\ldots, 2^{n-1}$, of length $3^{-n}$. Let us consider the set $$ E := \bigcup_{j=1}^\infty E_{2j}, \quad\text{where}\quad E_n := \bigcup_{k=1}^{2^{n-1}} I_{n}^k\,. $$ (In other words, $E$ is the union of the open intervals removed at even steps.) It is not difficult to check that $\partial E = C$.
We claim that the following estimates hold: $$ \frac{1}{54} \leq \liminf_{r \searrow 0} \frac{|B_r(x) \cap E|}{2r} \leq \limsup_{r \searrow 0} \frac{|B_r(x) \cap E|}{2r} \leq \frac{53}{54}\,, \qquad \forall x\in C. $$ Namely, let $x\in C$, let $r \in (0, 1/3)$, and let $N\in\mathbb{N}$ be such that $3^{-2N-1} \leq r < 3^{-2N+1}$. Clearly, the interval $B_r(x)$ contains at least one of the intervals of length $3^{-2N-2}$ removed at step $2N+2$, so that $$ \frac{|B_r(x) \cap E|}{2r} \geq \frac{3^{-2N-2}}{2\cdot 3^{-2N+1}} = \frac{1}{54}\,. $$ A similar argument shows that $$ \frac{|B_r(x) \cap E|}{2r} \leq \frac{53}{54}\,, $$ and the claim follows.
As a consequence of the above claim, we can conclude that $\partial^e E = C$.