How to make an old fashioned three way (three brightness) table lamp - smart?

Old fashioned light socket - using (what looks like) the same turn knob - and also have it done that way remotely - ?

This seems like the “holy grail” of automation - how can it be done and also look and act 100% like an old fashioned lamp as well?

I was going to replace the wiring as well as modify the light socket so it looks and acts the way suggested above, using what looks like the same switch in the same socket - the bulb and switch wired separately. There are three contacts for the bulb in those sockets. Anyone know the details of which are used when so I can work towards having separate wires for each with some smart relay’s on the end of the wire where the plug going into the wall would be?

Use an ohm-meter and then measure the resistance when the switch is in different positions.

@WallyR not sure how that would be applicable if the end state has the wiring for the bulb separated from the wiring for the switch (and those wires only coming together at the shelly). I did a little digging and in the traditional 3-way bulb. Power is always connected to the side (where the bulb screws in). low light is full power going to just the bottom contact, medium lighting is full power going to just the circular contact around the bottom edge, and full brightness is if power is supplied to both.

It would work if the shelly was not connected.
You would be looking for the wires that showed up with no resistance.

The wires in the switch do not go to the bulb

Unless you already have ripped the wires out, then they have to be connected with the bulb somehow.
You can use an ohm-meter to figure out where the wires are connected for each of the switchs different positions.

There are actually no wires between the bulb socket and the switch, it is one plastic and metal molded piece - the thing to figure out really isn’t which contacts to the bulb socket do what, it is actually how to separate the switch and socket for everything to be able to control the bulb both locally and remotely - in a very smnall space - a socket that looks like the original. This may take a little while :slight_smile:

ahh, so it was actually not how the switch/socket worked, but how to replace it with a look-a-like.

It looks like your options are pretty small.
My way forward would be to find one of the old bakelite lamp sockets with built-in switch, like this one.

I had one in my hands a few days ago and know that it is just wired internally, which means you can wire the socket directly and use the switch for something else.
Even though the switch look new, it is really not, but it should be somewhat easier replace with another solution.
I would probably go for a spring loaded switch with just on-off and spring loaded away from off.
They come in many forms, like black plastic, or different types of metal.
Like this one: Spring Loaded Toggle Switch at best price in Kolkata by Rayco Electro Enterprise | ID: 9409637733

If you choose one in metal, then you can also drill a hole in the stick and mount a little chain on it to make it look like an old chain switch.

The advantage of the spring loaded switch is that it only takes two wires to a Shelly Dimmer to work.
You could try to go for a rectangular rotary switch also, but I fear that you will have issues with that many extra wires through the holes of the socket to make this work.

1 Like

Thank you, very interesting!

I am revisiting this after a hiatus… Still noodling this around, I feel like resolving this in an elegant fashion is similar to inventing the perfect mousetrap… any more ideas?

This isn’t exactly what you’re asking for, but you could ditch the turn-knob and, if the lamp is metal, convert it to a touch-dimmable lamp using something like this. Note that this would use a dimmable bulb as opposed to a 3-way bulb, but you still only get 3 discrete illumination levels.

I’m currently working to add smarts to a lamp that was touch-dimmable when purchased, so has a module like that already built in.

I’m using a Wemos S3 mini which supports capacitive touch, and I’m inserting it between the lamp’s metal body and the module’s touch sensor input. So the Wemos will detect touches and then simulate them by switching on a capacitor connected to the dimmer module’s sensor input.

When I get it working I’ll post a write-up.

If you really want to have a lamp with a twist-knob 3-way dimmer, you’re going to have to wire up the socket with only low voltage (2 GPIO from an ESP) so you can detect what setting the knob is on, then you’d have to stack an additional socket on top that is wired to the mains voltage with two relays controlled by that ESP. Stacking that second socket on top of the first is where the challenge lies.

Thanks I’d be curious to see your finished project! I might just separate the light socket and the switch internally, and then have four leads going from the lamp back to the outlet where I’d do something with a shelly or the like (ugh)

Research takes a long time but after alot of digging for ideas, coming up with some thought-provoking ideas

I’ve been trying to figure out how to do this with multiple three-way lamps, so I’m very interested in any updates. I’m looking to see if I can come up with a way to use an esp32 touch capability combined with the not smart touch switch. Or maybe using this. ac dimmer.

Starting to lean towards replacing the light sockets with ones I do not have switches - And get one way bright incandescent bulbs - and using a mechanism to make the on/off and/or brightness change when you just touch any metal on the lamp…

I have a prototype set up using a RobotDYN - PWM Ac Programmable Light Dimmer, an esp8266, a touch sensor and a ceiling LED light I had sitting around. Here’s what it looks like as a prototype:

I figured I’d either put the esp8266 and RobotDYN in the base of the lamp, or is a small box along the cord. Worst case the touch sensor will sit at the point where the cord goes into the lamp. I’d like to figure out how to replace this touch sensor with something that allowed me to use the full lamp as a touch sensor.

I have a couple of these AC DC Converter that I was thinking about using to get power to run the ESP, but it’s a little scare so I might just use a phone adaptor to power the ESP.

The ESPhome code sets the light as a dimmer. The button provides a physical interface. A short touch (<1 second) will turn the light on or off. When turned on the light is set at 33% brightness. A long touch 1.5-10 seconds will increase the brightnest by 33%. When at 99% it then cycles back down to 33%. It’s simulating a 3-way bulb.

The ESPhome code for the board:

esphome:
  name: lamp-fr-bs
  friendly_name: lamp_fr_bs

esp8266:
  #board: esp01_1m
  board: nodemcu

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key

ota:
  password: !secret ota

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Lamp-Fr-Bs Fallback Hotspot"
    password: !secret wifi_password

# Enable Web server.
web_server:
  port: 80
  
captive_portal:

# restart-button
button:
  - platform: restart
    name: "restart_bedroom1-switch"

output:
  - platform: ac_dimmer
    id: dimmer1
    gate_pin: D7
    zero_cross_pin:
      number: D6
      mode:
        input: true
      inverted: yes

light:
  - platform: monochromatic
    output: dimmer1
    name: dimmer_control 
    id: dimmer_ctrl
    
binary_sensor:
  - platform: gpio
    # Contact state sensor.
    id: lamp_button
    name: Lamp Button 
    device_class: light
    pin:
      # Connected to GPIO
      number: GPIO10
      mode: INPUT_PULLUP
    filters:
      # Small filter, to debounce the spurious events.
      - delayed_on: 25ms
      # delay to handle motion turning off before coming on again
      - delayed_off: 25ms  
    #on_press:
    on_click:
    - min_length: 50ms
      max_length: 1s
      # Only turn on the mylight when motion detected.
      then:
        if:
          condition:
            - light.is_off: dimmer_ctrl
          then:
            - logger.log: "Button pushed turn on light"
            - light.turn_on: 
                id: dimmer_ctrl
                brightness: 33%
          else:
            - logger.log: "Button pushed turn on off"
            - light.turn_off: dimmer_ctrl
    - min_length: 1.5s
      max_length: 10s
        # Only turn on the mylight when motion detected.
      then:
        if:
          condition:
            - light.is_off: dimmer_ctrl
          then:
            - logger.log: "Button pushed turn on light"
            - light.turn_on: 
                id: dimmer_ctrl
                brightness: 33%
          else:
            if:
              condition:
                lambda: 'return(id(dimmer_ctrl).remote_values.get_brightness() > .90);'
              then:
                - logger.log: "Long pushed at top so set to 33%"
                - light.control: 
                    id: dimmer_ctrl
                    brightness: 33%
                    state: on
              else:
                - logger.log: "Button pushed increase brightness"
                - light.dim_relative: 
                    id: dimmer_ctrl
                    relative_brightness: 33%
                    transition_length: 0.1s

The esp8266 does the job, but every once in a while, there is a slight delay. I tried to get an esp32-wroom to work, but couldn’t figure out the configuration to make the dimmer work. I couldn’t get the light to turn on. If anyone reads this and knows how I’d need to modify the above to make it work with an esp32 please let me know.

Any thoughts on how to use the lamp itself as the touch sensor is welcomed.

This picture just shows the light on at 33% after I touched the button:

2 Likes

I like it! Ideally of course would be the old-fashioned type twist knob socket that will have three levels of brightness along with working seamlessly with remote access (control), but this may be a step twoards the next best thing. Take a search around, I think I saw someone did figure out how to make the metal of the lamp alter the

My admittedly low-tech way of doing this would be to use a smart bulb and leave the lamp on. Then put a smart button next to the lamp for local, physical control for guests.

My son think’s it over kill. He also suggested just using a smart bulb. I’m not a fan of smart bulbs as they don’t work with existing switches in the house. I always feel like smart bulbs result in a dumb house. If you don’t have your phone you’re out of luck for turning on the light. That said, the real issue for me is I need to keep the experience as close to the existing experience or my wife doesn’t like it.

If you’re not going to bother reading my entire response, I won’t bother writing it. Goodbye.