Announcement

Collapse
No announcement yet.

Under kitchen cabinet LED lamps with mcsMQTT control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Thank you Michael.

    I did notice just now with the old firmware I could not get to the web interface. I powered it off and on and it came back.

    Updated test MagicHome RGB controller #2 with your DHT-22 firmware. Boots up fine.

    How do you have the digital pot and on off button wired? Did you use the RX (3), TX (1), ground? And the button (0)?

    Yes this and the other will be controlling one LED channel (SMD5050 LEDs).

    It is showing Device: LED_CONTROLLER_20

    Click image for larger version

Name:	RGB2.jpg
Views:	122
Size:	49.3 KB
ID:	1269139

    xxx
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
    HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

    HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    Comment


      Yes, RX, TX pads are used for the rotary encoder. The encoder button to IO0 pad. Completed project box with connectors, control and IR shown. I see your screen has the Temp and Humidity boxes, but timeout so I assume you do not have the sensor installed.Click image for larger version

Name:	LEDstripDone.jpg
Views:	112
Size:	43.9 KB
ID:	1269143

      Comment


        Connected a DHT22 and now seeing the temperature and humidity. Was going to try the IR reciever next with the IR firmware.

        So are you using ground for middle wire on rotary encoder? What is the second button wire? Ground too?

        Click image for larger version

Name:	DHT22.jpg
Views:	111
Size:	6.3 KB
ID:	1269145

        xxx
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
        HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

        HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

        Comment


          My encoder has 5 pins. The center post is + (3.3V pad), the two directional pins go to RX and TX pad. The SW pin and GND pin are the pushbutton to IO0 and Gnd pads.

          Comment


            Thank you Michael.
            - Pete

            Auto mator
            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
            HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

            HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
            HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

            X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

            Comment


              Michael McSharry

              Are you using the same IR remote for multiple magic home controllers?
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
              Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
              HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

              HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
              HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

              Comment


                Same 24 button one that came with the little controller. Just cut the three wires shorter to fit the case. Pulled out the plastic cover over the battery to activate it.

                Comment


                  Using the same encoder as John used above with 3 pins on one side and 2 pins on the other side.

                  Connected as follows.

                  My encoder has 5 pins. The center post is + (3.3V pad), the two directional pins go to RX and TX pad. The SW pin and GND pin are the pushbutton to IO0 and Gnd pads.

                  The on and off button works fine. Turning the knob doesn't do anything. Confirming this watching the GUI and watching the single color LED strip.

                  Above in post #74 John mentioned:

                  This is the rotary encoder I used, already had for a Squeezebox project, has five pins, 3 on side you can see here and two opposite for the push button, the 3 pins are simple again center to ground and 2 others to a gpio each, it all gets set up in the Espurna code. The hardware was really simple

                  This is what I see in debug when pressing switch. I do not see anything in debug when turning the knob.

                  [108345] [RELAY] #0 scheduled OFF in 0 ms
                  [108358] [RELAY] #0 set to OFF
                  [108467] [MQTT] Sending Kitchen-LED1/data => {"button/0":2,"channel/0":0,"channel/1":0,"channel/2":0,"channel/3":0,"brightness":119,"relay/0":0,"time":"2018-12-25 00:01:19"
                  [108505] [MQTT] Publish ACK for PID 20
                  [109365] [RELAY] Setting relay mask: 0
                  [118227] [BUTTON] Button #0 event 1
                  [118728] [BUTTON] Button #0 event 2
                  [118731] [RELAY] #0 scheduled ON in 0 ms
                  [118745] [RELAY] #0 set to ON
                  [118855] [MQTT] Sending Kitchen-LED1/data => {"button/0":2,"channel/0":119,"channel/1":119,"channel/2":119,"channel/3":119,"brightness":119,"relay/0":1,"time":"2018-12-25 00:01:30","mac":"DC:4F:22:C5:A1:0C","host":"ESPURNA-KitchenLED1","ip":"192.168.244.224","id":657915012} (PID 21)
                  [118920] [MQTT] Publish ACK for PID 21
                  [119753] [RELAY] Setting relay mask: 1

                  - Pete

                  Auto mator
                  Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                  Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                  HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                  HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                  HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                  X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                  Comment


                    These are the rotary encoders I used. There are no markings on it and appear to be the one's that John got from Amazon.

                    Description on adafruit site:

                    This rotary encoder is the best of the best, its a high quality 24-pulse encoder, with detents and a nice feel. It is panel mountable for placement in a box, or you can plug it into a breadboard (just cut/bend the two mechanical side tabs.) We also include a nice soft-touch knob with an arrow in it, fits perfectly and looks great. This encoder also has a push-button built into it so you can press onto the knob to close a separate switch. One side has a 3 pin connector (ground and two coding pins) and the other side has two pins for a normally-open switch.


                    Click image for larger version  Name:	RE.jpg Views:	1 Size:	54.6 KB ID:	1269367

                    I did see an encoder similiar to the one you are using.

                    It has a PC board connected to it and 5 pins on one side of the board and uses 5VDC for center lead and is in description.

                    Staying out of the kitchen and wife's way this morning and virtually in the UK now doing some server stuff there...
                    • Location: London, ENG GB
                    • ISP: SKY UK Limited
                    The LED controller near the stove is showing: (2 feet or so from the oven)

                    [597938] [MQTT] Sending Kitchen-LED2/temperature => 80.6 (PID 1)
                    [597942] [MQTT] Sending Kitchen-LED2/humidity => 29 (PID 1)

                    Just outside of the kitchen it is 70.

                    Click image for larger version  Name:	5VDC encoder.jpg Views:	1 Size:	103.9 KB ID:	1269371
                    Guessing if I disconnect the 3.3VDC center and connect ground to center then the firmware will not work.

                    Took it off line and using the controller with temperature sensor but no digital pot connected to it.

                    xxx
                    - Pete

                    Auto mator
                    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                    HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                    HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                    Comment


                      The lower knob pictured in the above post looks to be the same as what I have. I believe when I did voltage check on the CLK / DT pins it was around 3 volts. I did not look with scope as the knob was turned. The setup I used in the firmware was previously posted in this thread #135. I changed only the pins being used from the desk lamp where the stock frimware had used the encoder. I did not do anything with programming of any pull-up vs. pull-down resistors. John has looked into it more than me so he should be able to provide better guidance.

                      Looking at MQTT transmissions I see brightness parameter changing as the knob is moved.

                      Comment


                        Apologies Michael.

                        I missed this part of the thread.

                        It looks as if my rotary encoder is different that what Pete/John is using or the stock firmware I loaded is expecting something different.

                        I have +, CLK, and DT plus the Gnd and SW pins on my encoder. I connected + to 3.3V pad. I connected CLK and DT to TX and RX pads. I also swapped between the two. No effect on brightness or any other LED channel when the encoder is spun.


                        So your edited firmware did not utilize John's posted adds above (zipped) hardware.h and platformio.ini files?

                        But you mention the logic should be the same such that I can put a ground wire to the center post instead of the 3.3VDC and it should work ?
                        - Pete

                        Auto mator
                        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                        HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                        HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                        Comment


                          I had not previously looked at John's mods. I looked now. While there was many differences which is likely due to when he started vs. the version that I pulled last week. He defined 3 encoders. The 1 channel one looks to have the same definitions as I used expect he has a rate of 4 vs. 1 in my case.
                          Code:
                                     // Encoder
                                      // If mode is ENCODER_MODE_RATIO, the value ratio between both channels is changed
                                      // when the button is not pressed, and the overall brightness when pressed
                                      // If mode is ENCODER_MODE_CHANNEL, the first channel value is changed
                                      // when the button is not pressed, and the second channel when pressed
                                      // If no ENCODERX_BUTTON_PIN defined it will only change the value of the first defined channel
                                      #define ENCODER_SUPPORT     1
                                      #define ENCODER1_PIN1       1
                                      #define ENCODER1_PIN2       3
                                      //#define ENCODER1_BUTTON_PIN 0   // active low by default, with software pullup
                                      #define ENCODER1_CHANNEL1   0   // please note this value is 0-based (LIGHT_CH1 above)
                                      //#define ENCODER1_CHANNEL2   1   // please note this value is 0-based (LIGHT_CH2 above)
                                      //#define ENCODER1_MODE       ENCODER_MODE_RATIO
                          What the firmware should be looking at are the number of high/low transitions over a given period of time. As long as your device is able to achieve both states as it is spun then it should not matter. If GPIO 1 & 3 are pulled up and you bring them to ground in the encoder center pole then I would expect it to work. Of course I have never worked with an encoder before so I many be wrong on its working principle.

                          What may be different is what channel gets updated if only 1 channel light control is defined. In my case R, G, B and brightness are all updated and I changed the encoder logic so that is only updates the brightness. If brightness is not controlled on 1 channel setup then turning the knob would have no effect.

                          After working with Tasmota and Espurna it is clear to me that Espurna is geared to those would work at the source code level to define the configuration at build time. Tasmota is oriented to the end user where MQTT or console is used to configure at run time.

                          Comment


                            Thank you Michael.

                            Worked connecting the center post to ground.

                            Yes here using one channel and the pot just controls the brightness and it works great.

                            Turning the pot shows the following in debug. (skipping a few lines). on an

                            [190438] [MQTT] Sending Kitchen-LED1/data => {"channel/0":32,"channel/1":32,"channel/2":32,"channel/3":32,"brightness":32,"time":"2018-12-25 22:57:29"

                            [192028] [MQTT] Sending Kitchen-LED1/data => {"channel/0":62,"channel/1":62,"channel/2":62,"channel/3":62,"brightness":62,"time":"2018-12-25 22:57:31"

                            I installed the DHT22 inside of the case and noticed that it is a bit warmer than outside of the case such that I probably will move it to the side of the case.

                            After working with Tasmota and Espurna it is clear to me that Espurna is geared to those would work at the source code level to define the configuration at build time. Tasmota is oriented to the end user where MQTT or console is used to configure at run time.

                            Understood.

                            Personally as mentioned earlier I like the base feature set of Espurna over that of Tasmota.

                            I have switched all of the SonOff WiFi basics now to using Espurna except the the GDO stuff.

                            BTW tinkering a bit with Thingspeak. Very nice stuff.
                            - Pete

                            Auto mator
                            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                            HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                            HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                            HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                            X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                            Comment


                              Only thing so far that I have noticed is that the Espurna Magic Home controller drops off of the network after a few hours and I have to power it off and on to get back to the network.

                              I can bring the web interface back by pinging the device.

                              ping 192.168.244.224
                              PING 192.168.244.224 (192.168.244.224) 56(84) bytes of data.
                              64 bytes from 192.168.244.224: icmp_seq=1 ttl=128 time=4.69 ms
                              64 bytes from 192.168.244.224: icmp_seq=2 ttl=128 time=3.49 ms
                              64 bytes from 192.168.244.224: icmp_seq=3 ttl=128 time=5.18 ms
                              64 bytes from 192.168.244.224: icmp_seq=4 ttl=128 time=16.0 ms

                              Once in typed crash to debug. (RSSI -70)

                              [112167] [WEBSOCKET] Requested action: dbgcmd
                              [112171] [DEBUG] Latest crash was at 49017140 ms after boot
                              [112172] [DEBUG] Reason of restart: 2
                              [112175] [DEBUG] Exception cause: 3
                              [112177] [DEBUG] epc1=0x4010011d epc2=0x00000000 epc3=0x40000f68
                              [112180] [DEBUG] excvaddr=0x40037068 depc=0x00000000
                              [112184] [DEBUG] sp=0x3fff1fd0 end=0x3fff2130
                              [112188] [DEBUG] >>>stack>>>
                              [DEBUG] 3fff1fd0: 00000000 3fff2060 402379a1 3ffef470
                              [DEBUG] 3fff1fe0: 3fff2228 000008bf 000008bf 4010020c
                              [DEBUG] 3fff1ff0: 3fff0d4c 00000000 3fff2b04 4010068c
                              [DEBUG] 3fff2000: 3fff2040 00000000 3fff0d4c 40107608
                              [DEBUG] 3fff2010: 402370ba 3fff2b04 3fff2b04 4023961f
                              [DEBUG] 3fff2020: 00000008
                              [DEBUG] 00000000 00000000 3fff2070: 3fff0680 3fffdad0
                              [DEBUG] 00000000
                              [DEBUG]
                              [DEBUG] 3fff20c0: 40227a44
                              [DEBUG] 4022d348
                              [DEBUG]

                              Noticed the same with the H801 RGB controller. (RSSI ==> -61)

                              047893] [WEBSOCKET] #1 connected, ip: 192.168.244.233, url: /ws
                              [060006] [MAIN] System OK
                              [065210] [WEBSOCKET] Requested action: dbgcmd
                              [065218] [DEBUG] Latest crash was at 848492 ms after boot
                              [065220] [DEBUG] Reason of restart: 2
                              [065223] [DEBUG] Exception cause: 3
                              [065226] [DEBUG] epc1=0x4010011d epc2=0x00000000 epc3=0x40000f68
                              [065229] [DEBUG] excvaddr=0x40037da8 depc=0x00000000
                              [065233] [DEBUG] >>>stack>>>
                              [DEBUG] 3fff2070: 00000000 3fff2100 40234c21 3ffef4f0
                              [DEBUG] 3fff2080: 3fff22c8 00000a53 00000a53 4010020c
                              [DEBUG] 3fff2090: 3fff0e2c 00000000 3fff2ba4 4010068c
                              [DEBUG] 3fff20a0: 3fff20e0 00000000 3fff0e2c 40107440
                              [DEBUG] 3fff20b0: 4023433a 3fff2ba4 3fff2ba4 402368a7
                              [DEBUG] 3fff20c0: 4023516e 3fff2ba4 3fff2ba4 3fff57a8
                              [DEBUG] 3fff20d0: 40216bc1 3fff0f0c 00000001 fffffffe
                              [DEBUG] 3fff20e0: ffffff00 3fffc6fc 00000000 0000000a
                              [DEBUG] 3fff20f0: 3fff0c70 3fffdad0 3fff11a8 00000030
                              [DEBUG] 3fff2100: 00000000 00000000 3fff11b0 00000000
                              [DEBUG] 3fff2110: 3fff0bf4 3fff2160 4022a5b8 3fff11b0
                              [DEBUG] 3fff2120: 4023433a 00000008 00000064 4022a630
                              [DEBUG] 3fff2130: 40104832 0fcd3838 00000001 4022a670
                              [DEBUG] 3fff2140: 401048ee 3ffef258 0fcd3838 00000000
                              [DEBUG] 3fff2150: 40104ac0 00000000 3fff0f0c 40224961
                              [DEBUG] 3fff2160: 3ffef270 3fff2220 3fff11b0 3fff11a8
                              [DEBUG] 3fff2170: 3fffdad0 3fff0c70 3fff0f0c 40224d5d
                              [DEBUG] 3fff2180: 402020ce 0000000a 00000003 40224e40
                              [DEBUG] 3fff2190: 3fffdad0 3fff08f8 3fff0845 40210822
                              [DEBUG] 3fff21a0: 00000000 3fff0c70 00000003 40204670
                              [DEBUG] 3fff21b0: 3fffdad0 00000000 3fff11a2 4022a604
                              [DEBUG] 3fff21c0: feefeffe feefeffe 3fff11b0 401006fc
                              [DEBUG] <<<stack<<<
                              [065646] +OK

                              - Pete

                              Auto mator
                              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                              Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                              HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                              HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                              HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                              Comment


                                Found out if I ping them I can bring them back without powering off the devices.
                                - Pete

                                Auto mator
                                Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
                                Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
                                HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

                                HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                                HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                                X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                                Comment

                                Working...
                                X