Meek Wifi Switch ESP8266

Show or discuss your existing Home automation project here, so a detailed explanation!.....
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Re: Meek Wifi Switch ESP8266

Post by Bwired »

great progress!
perhaps somebody on the form can help you with a better spectrum analyses .....
Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

I have finally accomplished the fully integration of a Doppler radar into the Meek switch. As promised, I’ve uploaded a video on YouTube of the newest Meek switch in action.


The development continues and I’m almost ready to release the first small quantities of the Meek switches to the public. I’ll keep you informed :wink:
Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

Herewith a picture of the PCB designs that will make it into the production models.

As the development of these Meek switches are nearing completion, I’m shifting my focus on the expansions.
One of the most requested expansion is, by far, the Meek dimmable Wifi Enabled Smart Switch. Once I have some info to share, I will report it here.

I’m also doing my utmost to have the website available at : http://www.meek-ha.com/
In the future, I will post some manuals and programming guides for the home automation systems and, ofcourse, manuals with the Meek Switches.

Thank you for your interest in this project !
1.jpg
1.jpg (136.98 KiB) Viewed 16150 times
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: Meek Wifi Switch ESP8266

Post by AshaiRey »

Hi Meek,
Great work you are doing.
I had a look at your site/shop and see that the switches are reasonable priced to make me go for one. However ik would like to wait for the manual first to see if such a switch would be a plus for my system. So throw in that manual... :D
Bram
Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

AshaiRey wrote:Hi Meek,
Great work you are doing.
I had a look at your site/shop and see that the switches are reasonable priced to make me go for one. However ik would like to wait for the manual first to see if such a switch would be a plus for my system. So throw in that manual... :D
Still working on the internal design and also the manuals. Time is the limiting factor.
Nevertheless, each day, we’re making good progress to present you the final product.

In the meantime, some “manuals” are been uploaded to the server, for instance : http://www.meek-ha.com/manuals/meek-mt1-information/

More to follow !
Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

Just uploaded a video with regards to the development of Meek MD1 ( Meek Wi-Fi enabled Dimmer).

Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

I promised to release the code for the Meek MD1 dimmer once all options are integrated and fully operational, but due to shift in priorities and limited time, I am unable to finish the coding on a short notice.

Therefore I’ll publish the “dirty” code for the time being.
It’s still work in progress and 1 of the major things that I’m currently working on, is the synchronization between the dim-levels and Domoticz. So for instance if the dim-level is on 50% on Domoticz, on the ATmega, this correspondence’s with a value around the 380. So when I manually change this to 260, Domoticz should jump to 25%. With the code below, this is fully operational. But, the manual fine-tuning part, still needs to be coded. For instance, if I manually set the dim-level at a value of 261, Domoticz will set it back to 260. So in the coding I have to build a rounding function so it’ll ignore smaller input changes send by Domoticz.

As you can see in the code, I’m trying to code the ATmega328P as flexible as possible, so you can change setting afterwards as you wish. Also flashing the ATmega328P will be somewhat cumbersome without dedicated equipment.
That’s one of the reasons why I want a full set of options and gimmicks as much as possible in the coding. So if you wish additions or have good ideas, please do inform us and if possible, amend the coding 
One of the hardcoding will be something like “disco mode” so the lights will max out and back to minimum in a loop.
Once again, if you have additions or cool idea’s, please share it with us.
Herewith a video of the dimmer in action : https://www.youtube.com/watch?v=Y9hVDwKcEDw

Coding is borrowed from the following sources :
https://playground.arduino.cc/Main/ACPhaseControl
https://github.com/letscontrolit/ESPEas ... tender.ino

Code: Select all



/*
 * ***************************************************************************************************************************\
 * Arduino project "ESP Easy" � Copyright www.esp8266.nu
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 * You received a copy of the GNU General Public License along with this program in file 'License.txt'.
 *
 * IDE download    : https://www.arduino.cc/en/Main/Software
 * ESP8266 Package : https://github.com/esp8266/Arduino
 *
 * Source Code     : https://sourceforge.net/projects/espeasy/
 * Support         : http://www.esp8266.nu
 * Discussion      : http://www.esp8266.nu/forum/
 *
 * Additional information about licensing can be found at : http://www.gnu.org/licenses
**************************************************************************************************************************/

// This file is to be loaded onto an Arduino Pro Mini so it will act as a simple IO extender to the ESP module.
// Communication between ESP and Arduino is using the I2C bus, so only two wires needed.
// It best to run the Pro Mini on 3V3, although the 16MHz versions do not officially support this voltage level on this frequency.
// That way, you can skip levelconverters on I2C.
// Arduino Mini Pro uses A4 and A5 for I2C bus. ESP I2C can be configured but they are on GPIO-4 and GPIO-5 by default.



#include <Wire.h>
#include <avr/io.h>
#include <avr/interrupt.h>

#define DETECT 2  //zero cross detect
#define GATE 3    //TRIAC gate
#define PULSE 4   //trigger pulse width (counts)

int Meek;
int StepDown=1;
int StepUp=1;
int InputDelay=100;
int Domoticz;
int Domoticz1;
int Difference ; 
int UpperLimit = 605;
int LowerLimit = 150; 


#define I2C_MSG_IN_SIZE    4
#define I2C_MSG_OUT_SIZE   4

#define CMD_DIGITAL_WRITE  1
#define CMD_DIGITAL_READ   2
#define CMD_ANALOG_WRITE   3
#define CMD_ANALOG_READ    4
#define omhoog 8 
#define omlaag 12


volatile uint8_t sendBuffer[I2C_MSG_OUT_SIZE];

void setup()
{
  Wire.begin(0x7f);
  Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent);
  Serial.begin(9600);
  pinMode(omhoog, INPUT); 
  pinMode(omlaag, INPUT); 

// set up pins
  pinMode(DETECT, INPUT);     //zero cross detect
  digitalWrite(DETECT, HIGH); //enable pull-up resistor
  pinMode(GATE, OUTPUT);      //TRIAC gate control

  // set up Timer1 
  //(see ATMEGA 328 data sheet pg 134 for more details)
  OCR1A = 100;      //initialize the comparator
  TIMSK1 = 0x03;    //enable comparator A and overflow interrupts
  TCCR1A = 0x00;    //timer control registers set for
  TCCR1B = 0x00;    //normal operation, timer disabled

  attachInterrupt(0,zeroCrossingInterrupt, RISING);    
 
}

void zeroCrossingInterrupt(){ //zero cross detect   
  TCCR1B=0x04; //start timer with divide by 256 input
  TCNT1 = 0;   //reset timer - count from zero
}

ISR(TIMER1_COMPA_vect){ //comparator match
  digitalWrite(GATE,HIGH);  //set TRIAC gate to high
  TCNT1 = 65536-PULSE;      //trigger pulse width
}

ISR(TIMER1_OVF_vect){ //timer1 overflow
  digitalWrite(GATE,LOW); //turn off TRIAC gate
  TCCR1B = 0x00;          //disable timer stopd unintended triggers
}


void loop() {

Difference = round(UpperLimit / LowerLimit);

if (Meek>=0 && Meek<=100) {
  Domoticz = Meek;
}

if (Meek>=LowerLimit && Meek<=UpperLimit) {
  Domoticz1 = map(OCR1A , LowerLimit, UpperLimit, 0 , 100);
}

if (Meek>=1 && Meek<=100) {
OCR1A =map(Meek,1,100, LowerLimit,UpperLimit);
}

if (Meek>=1 && Meek<=100) {
  OCR1A =map(Meek,1,100, LowerLimit,UpperLimit);
}


if (Meek>=LowerLimit && Meek<=UpperLimit && Difference > (Domoticz-Domoticz1)) {
  Domoticz = Domoticz1;
}

  
if (Meek>=LowerLimit && Meek<=UpperLimit) {  
OCR1A = Meek;     }



if (Meek>=1500 && Meek<=1599){
  StepDown=(Meek-1500);} 
if (Meek>=1500 && Meek<=1599){
  StepDown=(Meek-1500);} 
if (Meek>=1600 && Meek<=1699){
  StepUp=(Meek-1600);} 
if (Meek>=1700 && Meek<=1799){
  InputDelay=(Meek-1700);}   
if (Meek>=1800 && Meek<=1899 && OCR1A>150 && OCR1A<=603 ){
  OCR1A=(OCR1A-(Meek-1800));} 
if (Meek>=1900 && Meek<=1999 && OCR1A>=150 && OCR1A<603 ){
  OCR1A=(OCR1A+(Meek-1900));} 
if (Meek==2000 && OCR1A>=150 && OCR1A<=603){
  OCR1A=(OCR1A+1);} 
if (Meek==2000 && OCR1A==604){
  OCR1A=(0);} 
if (Meek==2001 && OCR1A==0){
  OCR1A=(605);} 
if (Meek==2001 && OCR1A<=603 && OCR1A>=150){
  OCR1A=(OCR1A-1);} 

if (OCR1A>UpperLimit) {
OCR1A=UpperLimit;}

if (OCR1A>0 && OCR1A<=LowerLimit) {
OCR1A=LowerLimit;}


Serial.print("Meek = ");  
Serial.print(Meek);
Serial.print("OCR1A = ");  
Serial.print(OCR1A);
Serial.print("domoticz =");
Serial.print(Domoticz); 
Serial.print("Difference =");
Serial.print(Difference); 
Serial.print("Domoticz11111 =");
Serial.print(Domoticz1); 
delay(1000);
Serial.print('\n');



int hoog = digitalRead (omhoog);
if (hoog == 1 ){
  OCR1A=(OCR1A+1) ;

    
}


int laag = digitalRead (omlaag);
if (laag == 1 ){
  OCR1A=(OCR1A-1);
}


        
delay(InputDelay); 
  }

void receiveEvent(int count)
{
  if (count == I2C_MSG_IN_SIZE)
  {
    byte cmd = Wire.read();
    byte port = Wire.read();
    int value = Wire.read();
    value += Wire.read()*256;
    switch(cmd)
      {
        case CMD_DIGITAL_WRITE:
          pinMode(port,OUTPUT);
          digitalWrite(port,value);
          break;
        case CMD_DIGITAL_READ:
          pinMode(port,INPUT_PULLUP);
          clearSendBuffer();
          sendBuffer[0] = digitalRead(port);
          break;
        case CMD_ANALOG_WRITE:
          //analogWrite(port,value);
          Meek=(value);
          break;
        case CMD_ANALOG_READ:
          clearSendBuffer();
          int valueRead = Domoticz;
          sendBuffer[0] = valueRead & 0xff;
          sendBuffer[1] = valueRead >> 8;
          break;
      }
  }
}

void clearSendBuffer()
{
  for(byte x=0; x < sizeof(sendBuffer); x++)
    sendBuffer[x]=0;
}

void requestEvent()
{
  Wire.write((const uint8_t*)sendBuffer,sizeof(sendBuffer));
}




Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

Herewith a pictures of the latest revisions Meek MP1 switches.
MeekMP1.jpg
MeekMP1.jpg (41.23 KiB) Viewed 13516 times
We’re currently assembling these to distribute them to a select group of tester.

The Meek MP1 is a :
• Wi-Fi enabled light switch
• With a Doppler presence detector
• Audi visual feedback with a RGB addressable LED and a RTTTL Speaker
• Fully programmable timers a functions

This switch operates out of the box even without a Wi-Fi connection.

Once connected to Wi-Fi you can control it with any device that has a browser (Phone, TV, Smart Watch,…) or by speech recognition enabled devices (Google Home, Alexa, Siri,..).

Ongoing, we’re expanding the functions of these devices.
For instance :
• Alarm Function ; you can “arm” the device, so whenever a movement is detected, the Meek MP1 will sound and alarm and blink the light continuously until the user disarms it.
• Doorbell ; (we will develop a doorbell in the future) if you have “Smart Doorbell”, whenever the doorbell is pressed, the Switch will mimic a doorbell and blink the lights.
• Night Modus : the presence detection will only switch the lights, if it’s in the Night Modus.

As we’re developing several other Meek devices, that will seemingly interact with each other, to truly create a smart house !

The possibilities are endless as the community is able to contribute and able to add extra functionality to our devices !
Meek
Starting Member
Starting Member
Posts: 17
Joined: Tue Oct 17, 2017 11:22 am
Contact:

Re: Meek Wifi Switch ESP8266

Post by Meek »

A brief update: attached you’ll finds a few pictures of the final versions that are currently been tested:
meek270918.jpg
meek270918.jpg (32.9 KiB) Viewed 12223 times
As announced earlier, we have the intension to release the switches end September in small quantities.
The first available versions will be the :
• Meek MT1 (Meek Touch with 1 Touch input/output)
• Meek MP1 (Meek Presence with 1 Touch input/output)

In October, we’ll add the :
• Meek MT2 (Meek Touch with 2 Touch input/output)
• Meek MT3 (Meek Touch with 3 Touch input/output)


In the 4’th quarter, the Meek MM1 (Meek Motor for “mechanical home ventilation systems”) will be added to the product range.

The development of the Meek Wi-Fi Dimmer “Meek MD1” still continues and in our test environment, it’s already showing pretty good results!
On the hardware side it’s nearly completed but we still need to deploy some enhancements on the software side to ensure flawless operations in various conditions. We expect them to be commercially available in 2019.

Our website ( http://www.meek-ha.com )is also undergoing some transformation with information about the switches itself but also how to integrate them in various automations systems.

Just to tickle the imagination and show the endless possibilities with these devices, as proof of concept, we’ve imbedded a light sensor in the switch.

In the near future we will bring you more groundbreaking and exiting new devices!
Post Reply

Return to “Home Automation Projects”