Slampher unfolded

Just a quick one for those familiar with reprogramming the Sonoff devices…. the Slampher product.. you’ll have seen me ranting about Sonoffs – the incredibly low-priced mains control boards (no – I don’t work for them – but you cannot beat their price for WIFI controlled relay units) – and I’ve just updated my software so the Sonoff green light works a little better (it’s still mighty dim). Well, I decided to tackle the Slampher unit I happen to have lying around.

Unlike Sonoff which you need to wire mains into and out of – this has a standard screw lamp socket and you just plug a bulb into it (up to 500w in theory). Provided you can handle the extra length this creates it’s a nice unit but of course as usual I wanted my own software and not theirs.

Easy – 2 small screws out – see R21 below?  Move it to R20 and now the long pushbutton is GPIO0 (I’m assuming you’re not interested in the radio remote control – just WIFI).

At that point there’s a 4 way connection (holes) just like the Sonoff – from your FTDI – ground, serial, serial 3v3.  A little white mark on the PCB 4-way connector marks 3v3 – so from there backwards … FTDI 3v3, FTDI TX, FTDI RX, FTDI GND. Hold down the button – power up and program.

Sonoff Slampher
Sonoff Slampher

August 2020 I dug out this old unit and upgraded it to the latest Tasmota 8.4.3 no problem. From now, any further updates I expect to do via OTA.

Facebooktwitterpinterestlinkedin

14 thoughts on “Slampher unfolded

  1. i have bought a Slampher but the board appears to be a different version.
    it is marked V2.0 and there is no R20 pad that i can see.
    Anyone know how to get into flashing mode ?

  2. I have been trying to flash Slampher but i have fried 3 of them, i guess the memory chip is getting fried. I have shorted the R20, moved R21 to R20 and soldered wire on the R20 all the time when flashing the memory chip will smoke. i’m using 3v3 FTDI tool. all the wiring is wired by the diagram shown. Please help or make a video on how to flash it.

    1. You are in the hands of readers in here Matt, I long since parted with my Slampher – great device but too long for our (generally not screw-fitting) light fittings.

  3. Hmm.. just programmed my latest toy; the Slampher; with the ardenst firmware. But I didn’t test the Slampher beforehand… With the new firmware, I get the states ‘half-on’ and ‘full-on’; no OFF…. Looking at the schematic here https://www.itead.cc/wiki/images/e/e1/IM151116005-Slampher-View.pdf it looks like the ‘relay’ is on GPIO 12 (‘MDTI’), same as the ardenst firmware is set to. I can’t see how it could be wrong…. Anyone use the Slampher successfully? Is it possible there’s 2 versions?

  4. Radio and long push button on the sonoff and slampher are connected to gpio 0 with normally LOW, when you press the 433mhz button or press the long push button they both momentarily send gpio 0 HIGH then LOW again so here’s what I do :

    const int Relay = 12;
    const int Led = 13;
    const int Button = 0;

    void setup() {
    pinMode(Relay, OUTPUT); // Initialize ESP pin12 as an output
    digitalWrite(Relay, 0); // Set Relay off
    pinMode(Led, OUTPUT); // Initialize ESP pin13 as an output
    pinMode(Button, INPUT_PULLUP); // Initialize ESP pin0 as an input with Pullup
    attachInterrupt (0, buttonPressed, FALLING); // attach a interrupt handler looking for a FALLING edge
    // The above calls buttonPressed function when it see’s the LOW after the pin has been HIGH

    // Interrupt Service Routine (ISR)
    void buttonPressed (){
    if (State0 == 0){ // This checks if the var State=0 and changes State0 to 1
    State0 = 1; // Until State0 = 0 again any further buttonPressed events are ignored
    }
    }

    void loop() {
    if (State0 == 1){ // The main loop constantly checks State0
    Serial.println(“buttonPressed”);
    client.publish(“out65”, “Toggle Relay”);
    toggle_Relay();
    State0 = 0; // After the relay has toggled and the debounce flash has finished
    } // state0 is returned to 0 so waiting for another buttonPressed event

    void toggle_Relay(){
    if (digitalRead(Relay)==0){ // Reads the state of the relay Off or On , 0 or 1
    digitalWrite(Relay,1); // & toggles the relay to the opposite state
    Serial.print(“Relay 1 On”);
    Serial.println();
    } else {
    digitalWrite(Relay,0);
    Serial.print(“Relay 1 Off”);
    Serial.println();
    }
    for(int i=0; i < 10; i++){ // This flashes the Led on the sonoff to confirm the relay is toggling
    digitalWrite(Led, 0); //on // and acts as a small delay to debounce the button
    delay(100);
    digitalWrite(Led, 1); //off
    delay(100);
    }
    validate_Relay();
    }

    void validate_Relay(){ // I keep the function to send the state of the relay to nr
    Relay_state = int(digitalRead(Relay)); // separate so that I can call just this function via mqtt to
    mqtt_pub1(); // confirm the state of the relay on start up or when blynk
    } // connects etc

    The rest of the code is just standard stuff, but I connect wifi and mqtt via a non blocking routine so with or without wifi or mqtt connected, like you can turn off the router, stop mosquito, node-red or turn off the Pi and the sonoff / slampher will still work with the long button or radio.

    Hope that's understandable and helpful.

  5. Ikea do a “BC to WS” adaptor but you need a tall shade or as in my case the lamp sticks up above the shade and looks stupid.
    I soldered a small smd push button to gnd and connected the other side with a bit of wire to the resistor for programming on both sonoff and slampher, works great.
    Regarding radio you don’t need to program any code on the esp for the 433mhz stuff for it to work (as long as you have arranged to send the state of the relay back to mqtt for indication etc) just pair a 433mhz push button to the sonoff and when pressed it toggles the relay, I tried a couple of 433mhz remote key pads I had lying around one worked fine the other a homeeasy one didn’t.
    I have converted three old 433mhz plug in sockets by removing the electronics and replaced them with the electronics from sonoff .. now I have 433mhz / wifi “plug in sockets” so I dont need to cut the plug off my appliances to install a sonoff unit.

    1. Toshi

      Firstly – question – I’m not sure about your reference to using the 433Mhz.. even after altering the zero ohm resistor to allow GPIO0 to be used for programming? And if the 433Mhz is separate – how can the ESP know if the light has been manually turned on by the 433Mhz signal?

      On the sonoff- yes, I was thinking that myself – take the guts of a sonoff and fit inside standard mains 433Mhz cheap boxes.. good idea. I’m just a little concerned about what they call a 10 amp relay – they’re a lot smaller than normal 10 amp relays – have you pushed it yet?

      1. RE Ikea small typo spotted (BC bayonet cap to ES edison screw)

        Relay is on GPIO12 so I just send a mqtt message to the sonoff each few seconds to validate the state of the relay, in node-red I run the result through a rbe node so the rest of the flow just see’s when the state changes (I also use the same incoming result as a watch dog to confirm the sonoff is on-line), so it does not matter if the state changes because the sonoff button is pressed or mqtt toggles the state or if the 433mhz button toggles the state.

        void validate_Relay(){
        Relay_state = int(digitalRead(Relay));
        mqtt_pub1();
        }

        Clearly I am using the arduino ide to program the sonoff / slampher

        I agree with you regarding the relay, I don’t intend to control power hungary stuff with sonoff .. I wouldn’t put more than 3 or 4 amps through that relay, I am a electrical engineer by the way.

        1. Oh I just tested this .. so there is a little bit more to this radio story, when the 433mhz button is pressed the radio module sends a signal to gpio0 so in effect its the same as pressing the long button on the sonoff , I have coded a interrupt on gpio0 input pin to detect when the long button is pressed the code then toggles the relay on gpio12 and sends the mqtt message back, so now I have paired the 433mhz button to the sonoff the same code with out any change see’s gpio0 interrupt and that is what toggles the relay and send the mqtt message, I didn’t realise that until I wondered why the relay state change appeared to be an instantaneous response in node-red each time I press he 433mhz button .
          I guess the question is when you move r12 to r20 can you still toggle the relay with the long button if not then soldering a small smd push button would be a better solution to programing the sonoff all as per you original drawing with the red link wire. [thanks for that by the way] 🙂

          1. I would guess you cannot once you’ve swapped the link – but perhaps a resistor – save it a little work as you’ve done it Toshi… so by default is the radio signal HIGH or LOW – and when you press the button what happens – ie how long does it stay in the alternative output state??? May as well encode this into my software….

  6. Oh dear. Yep, I just assumed it was a screw and of course it’s a bayonet, doh!

    I might just change the socket fitting on the light!

    1. I can’t do much with mine as I’ve just realised I don’t have a lamp that has a screw fitting with enough room to fit the thing – and that is a problem. I just wish the world would settle on one standard for lamps instead of the myriad we have right now, screw fitting, mini-screw, bayonet, mini-bayonet etc etc etc..

Comments are closed.