Motorized Light Bulb Changer

by mattwach in Circuits > Tools

11712 Views, 69 Favorites, 0 Comments

Motorized Light Bulb Changer

light_bulb_changer.jpg
problem.jpg
Motorized Light Bulb Changer

Note: I also made a video describing the project.

Do you have hard-to-reach light bulbs? If so, then you are perhaps familiar with a device known as a Light Bulb Changer. It threads on the end of a pole and extends your reach. A problem is one of mechanics. If you can't get your pole square to the bulb, the effectiveness of the holder decreases rapidly. Imagine trying to use this thing at a 90 degree angle to the bulb. That is the exact situation I found myself in.

OK. Just get a tall ladder, move that table, make that suspicious call confirming my life insurance details and up I go. Just kidding, I instead used this as an excuse for another maker project.

I spent way more time on this than the ladder would have taken. Then again, it was quite a bit of fun and now I have a useful tool on-hand ready to square off against the next light bulb challenge. Lucky for you, all of the design, modeling, and testing steps are done so you can build one in a fraction of the time.

Of course if you want extra challenge, feel free to mod up the design below to match your favorite parts and techniques. Have it play inspirational music, add Bluetooth... Your imagination, skill, time and budget are your only limits.

If you don't have a 3D printer, hope is not lost. You can always use a project box, parts from the hardware store and plenty of zip ties to get things done old school.

Supplies

all_parts.jpg

Parts I used include:

  1. Geared brushed motor. These are around $13 on Amazon, probably cheaper other places. I went with 200 RPM which is a bit more than 3 rotations/second at 12V. This seemed about right.
  2. Flange Coupling Connector. This is needed to adapt the motor's shaft to the Light Bulb Changer.
  3. Microcontroller. I went with the ATTiny85 which cost $1-$2. Loading firmware on it can be tricky if you have not done so before, but there are dozens of video and written guides on the internet on how to do it. Once you get it working the first time, it will be turn-key after that.
  4. L293D H-bridge motor driver. This turns the puny waveforms the ATTiny85 can generate into power boosted energy waves that can drive a motor at variable speeds and in either forward or reverse.
  5. Broomstick or painters pole for mounting
  6. Wire to connect the control box at one end of the pole to the motor at the other.
  7. Zipties to secure the control module to the broomstick.
  8. Sony PS2 thumbstick which is basically a thumb-friendly potentiometer. Any 10k potentiometer will work, so long as you are OK with the ergonomics.
  9. A power source. You'll need around 12V and enough current to drive the motor. A 3S lipo battery (450-1800 mAh) works well, but you'll need a special charger if you don't already have one. You can also stack 9 (or more) AA batteries in series. A 12V DC "wall wart" could also work.
  10. Connectors for the power source. With a small 3S LIPO, I really like the XT30 connector.
  11. PCB prototyping board. Technically optional as there are many ways to construct a circuit, but a 30x70 perf board is what I used.
  12. Status LEDs. I went with a two-color LED which has red and green channels. You can also go with two separate LEDs of any color you want.
  13. Some current limiting resistors for the LEDs. Values are not critical - something in the 470 to 2k range will work.
  14. A 5V regulator. I went with the LP2950Z but nearly anything will work here.
  15. Some capacitors. The DC motor is a noisy load for the battery and the 5V regulator will see this noise on it's input. Caps on each side of the regulator will help reduce this noise to the 5V electronics. I went with 500+ uF on the input side and another 100 uF on the output side, which is likely overkill.
  16. Connectors for the PS2 thumbstick and motor wire. I used standard 2.54mm pitch headers. Anything you have could work.

Tools:

  1. A 3D printer if you want print the motor housing and controller box. As said above, you can also come up with a custom alternate solution.
  2. A Breadboard. if you want to verify operation before committing the parts with solder.

Electronics Overview

schematic.png

The ordering is not strict here but I like getting the electronics working first. A breadboard is a good way to wire things up and build some confidence that the project is on the right track.

The schematic is above. You do not need to starting wiring up the breadboard yet, as upcoming steps will break the electronics down into smaller steps.

So how does this thing work?

  • You move the potentiometer (PS2 thumbstick, top of schematic)
  • The ATTiny85 microcontroller notes the new potentiometer state (via `PB4`) and uses it to update the motor direction and speed.
  • The direction and speed are communicated with a PWM signal (via `PB0`) which tells the motor how fast to spin. The microcontroller also to sends a signal (via PB1 and PB2) that tells the motor controller which direction to spin the motor.
  • The L293D motor controller (right) takes the weak PWM signal (PB0) from the microcontroller and puts the full force of the battery pack behind it (e.g. 12V and whatever current the motor asks for - within obvious limits).
  • The bottom left of the circuit is just the 5V regulator and some supporting capacitors to filter out motor noise.

You can probably imagine the rest - adapter on motor, light bulb changer on adapter and light. Turning, problems being solved, happy time.

ATTiny85 Programming and Testing

test_clip.jpg
simplified_grounded.jpg
simplified_vcc.jpg

The code is located in my github project's firmware/ directory. This code is not Arduino so you will need to have/develop familiarity with avr-gcc to compile it. But, you don't have to compile it because there is an already-compiled light_bulb_changer.hex file attached below.

Loading code onto the ATTiny85 involves conforming to the protocol specified in its datasheet. There are several possible solutions and a large amount of websites and Youtube videos that cover the topic.

A sampling of options include:

  1. The official AVR programming tools (expensive and overkill for this project)
  2. Using an Arduino Uno (or nano) as a programmer
  3. Using the Sparkfun ATTiny85 programmer

I personally went with a variation of option #2, using an Arduino Nano and a test clip.

The guides above all have a "blinking light" example. When you execute the steps, the Arduino console will output the avrdude command it used. This can be compared to the one I used:

 /usr/bin/avrdude \
   -C./avrdude.conf \
   -v \
   -pattiny85 \
   -cstk500v1 \
   -P /dev/ttyUSB0 \
   -b19200 \
   -Uflash:w:light_bulb_changer.hex:i

Depending on the programming tools you have and the OS you are using, some flags will be different and you'll want to combine the flags from the blinking light example with the -Uflash:w:light_bulb_changer.hex:i option above.

Now that we are through all of that, I suggest simple verification on the breadboard. We will wire up a simplified version of the schematic as shown in the first breadboard image above.

This follows the original schematic but with the motor enable (pin 1 of the L293D) replaced with a white LED and the potentiometer replaced with a resistor to ground. Specifically:

  • Pin 1 (Reset) Not Connected
  • Pin 2 (Pot input) → Resistor → Ground
  • Pin 3 Not Connected
  • Pin 4 (`GND`) → Ground
  • Pin 5 (`PWM`) → Resistor → White LED → Ground
  • Pin 6 (Forward) → Resistor → Greed LED → Ground
  • Pin 7 (Reverse) → Resistor → Red LED → Ground
  • Pin 8 (5V) → Some voltage between 2V and 5.5V

What resistor values? Anything in the 400-5K range is fine for the LEDs. Anything at all is fine for Pin 2.

What we should see is the green and white LEDs lit up. The firmware thinks that the motor is in full-power forward mode because we have Pin 2 grounded.

Now lets, make one change. Instead of grounding Pin 2, connect it to power (as shown in the second image above). Now the ATTiny85 thinks it need to drive the motor full power in reverse.

Exploring the PWM Signal

breadboard_with_pot.jpg
oscilliscope_low_power.jpg
oscilliscope_high_power.jpg
oscilliscope_full_power.jpg

There is nothing you have to do for this step. It's just looking a bit deeper at what's going on for educational purposes.

I took the breadboard from the previous step and connected a real potentiometer to pin 2 (I didn't go with the PS2 thumbstick just yet because I wanted to potentiometer to stay at a certain value for the test). I also added an oscilloscope probe to pin 5.

Now the potentiometer can be used to change between forward and reverse, just like the final product. It's also possible to see the white LED getting darker and brighter but this is more obvious from the oscilloscope. Note the scope image at "low power", where the motor will turn more slowly - the signal spends most of it's time at 0V:

When the potentiometer is turned further to the left (or right since there is both a forward and reverse), the signal spends more time at 5V. More time at 5V means more motor speed.

The final oscilloscope image shows the motor at full power (where the potentiometer is pegged to the left or right), where 5V is being delivered the entire time.

Building the PCB

schematic.png
board_layout.png
wiring_top.jpg

Attached are another copy of the schematic, a kicad PCB layout that I created so I could optimize component placement, and a photo of the built-up PCB.

Of course, you can build up the electronics any way you want. Just keep in mind that the 3D printed control box is sized to house a PCB that is 30mm x 51mm. This size could (technically) be changed in the 3d_print/motor_controller_pcb.scad file by someone who is willing to do some OpenSCAD work.

3D Print Control Box and Motor Carriage

threaded_attachment.png
motor_carriage.png
motor_carriage_cover.png
pole_interface.png
control_box_pole_interface.png
control_box_bottom.png
control_box_top.png
all_parts.png

The .STL files for all of the needed parts are attached to this step.

Optional: If you want to further customize the parts, you can get the Openscad sources here. The main files of interest are control_box_assembly.scad and motor_assembly.scad Scroll to the bottom of each file and note the comments.

Attached is a photo of each modeled part. In order, we have:

The motor box:

  1. We have a threaded interface to the light bulb removal tool (threaded_attachment.stl).
  2. The carriage for the motor (motor_carriage.stl).
  3. A cover for the motor carriage (motor_carriage_cover.stl).
  4. An interface between the motor carriage and pole (pole_interface.stl).

Onto the control box. This consists of three components held together by 16mm M3 bolts:

  1. First the pole interface, which is intended to be held on with zip ties (control_box_interface.stl).
  2. The middle section, which holds all of the electronics (control_box_bottom.stl).
  3. The top cover (control_box_top.stl)

The final image shows everything assembled.

Control Box Assembly

control_assembly_rendered.png
control_assembly_photo.jpg
control_assembly_side.jpg
control_assembly_on_pole.jpg

Here are images showing a rendered and actual assembly of the control box. 4 16mm M3 bolts hold the three printed parts together. I also added some foam padding in the part of the box that interfaces with the pole - the idea being to reduce slipping. The box is held to the pole with zipties as shown in the final image.

Motor Box Assembly

motor.jpg
motor_assembly_top.jpg
motor_assembly_side.jpg
motor_assembly_on_pole.jpg

Onto the motor box assembly. Use the pictures as a guide.

Final Steps

The unit expected to be powered by around 12V, although you can go above and below this limit if needed and within the tolerance of your electronics. The main tolerances will be

  • The motor, too much or little voltage could lead to motor speeds that are too high or too low. Too high of speeds can cause mechanical limits of the motor (heat dissipation, bearings) to be exceeded.
  • The voltage regulator. The datasheet of the LP2950Z regulator I used has a maximum input voltage of 30V, which is way above what you should provide to the suggested motor. This voltage regulator also needs a minimum voltage of around 5.5 V to maintain 5V to the electronics - some regulators will need more.
  • The L293D motor driver maximum voltage. The maximum specified on the datasheet is 36V.

If the motor is spinning in the opposite direction the you would like, you can flip the polarity of the wires between the motor and control board. Do not flip the polarity of the wires between the battery and control board.

Alright, you are done! Time to remove some light bulbs!