-
In-Depth Look at the Pulling Mechanism
08/23/2022 at 16:00 • 0 commentsThe spring is necessary to balance the upward force of the fixture's internal mechanism; otherwise the servo stalls out when it tries to pull the chain down. The spring is hooked to a piece of 3mm plywood that I cut out when I was prototyping. The plywood could easily be replaced with a 3D printed part, though.
The chain is attached to the servo arm using a bead chain connector heatset into the PLA. I also friction welded some PLA around and through it with a Dremel, and since then it has stayed put. This allows the light chain to be easily detached from the puller.
The puller seems to work on the first try about 70% of the time. I have added some code to move the servo part of the way before moving it the whole way, and that seems to help it. If the problem persists or the servo breaks, I may try using an MG90 servo (with metal instead of plastic gears) for higher torque and better durability.
-
Light State Detection
08/23/2022 at 15:12 • 0 commentsIn order to be truly smart, the chain puller needs to know if the light is on or off. I'm using two voltage dividers to accomplish this: one with normal resistors and the other with photoresistors.
With two photoresistors, the state of the fluorescent fixture can be detected regardless of the amount of external light. As a photoresistor is exposed to more light, its resistance decreases. When there is much more light on the photoresistor facing the fluorescent light than the one facing away, the voltage on pin A0 is close to +1v. When there is less or the same amount of light on the photoresistor facing the fluorescent tubes, the output voltage is under +400mv. The ESP8266 is able to read this voltage and update the HomeKit state accordingly.
The second voltage divider with the normal resistors is needed to keep the voltage output range between 0-1v, which is what the ESP8266 is able to read on its A0 pin.
The photoresistors face in opposite directions, and light from the fluorescent tubes is mostly blocked from reaching the second one by the wood support.