Tuesday, April 26, 2016

Configuring and trigger GPIO on FreeRTOS



On my MQTT broker I wanted to have also a visual view of incoming packets along with monitoring the WiFi connection.

To do that I need to control the RGB led connected on my Witty module.

Controlling the GPIO assume two steps:

1. Configuring the GPIO

        #include "gpio.h"
        #define LED13_GPIO 13

    GPIO_ConfigTypeDef led13;
    led13.GPIO_Pin = GPIO_Pin_13;
    led13.GPIO_Mode = GPIO_Mode_Output;
    led13.GPIO_Pullup = GPIO_PullUp_DIS;
    led13.GPIO_IntrType = GPIO_PIN_INTR_DISABLE;

    gpio_config(&led13);

2. Triggering the GPIO 

    GPIO_OUTPUT_SET(LED13_GPIO,1); 
    vTaskDelay(100 / portTICK_RATE_MS);

    GPIO_OUTPUT_SET(LED13_GPIO,0);

Saturday, April 23, 2016

Witty ESP8266 module RGB LED removal

As you already know the Witty ESP8266 module has an SMD RGB LED on board. 

The LED colors are connected to some GPIO pins.

RED is connected to GPIO 15
GREEN is connected to GPIO 12 
BLUE is connected to GPIO 13

For a project I want to use the GPIOs 12,13,14,15 for a different functionality so I need to remove the LED from the board.


SMD LED for Witty ESP8266 board

In the above picture the pins 2,4,6 are connected together to the GND. 

Instead of removing the SMD LED I cut the common ground as you can see in the following picture.

Later if I need the LED functionality I can redo it very easy.





I've tested the board, and no sign of LED on board. Perfect.





Friday, April 22, 2016

Architecture of my Homy IoT platform

Since I received a lot of questions about the my IoT home control system, here is a description of it.

All the ESPs are sending  MQTT messages to an MQTT broker (I have an ESP8266 acting as a broker) inside the house. The MQTT broker is also bridging all the data to another MQTT broker instance that I have in a cloud.  From now there are two cases:

1. If I am in my WiFi coverage, my mobile app is connecting over the websokets to the MQTT broker and sees all the devices, control them etc.

2. If I am not in my Wifi coverage my mobile app is connecting to the cloud MQTT broker over websockets and sees all the devices, control them etc.

I've chosen to have connection between the mobile application and both MQTT brokers, instead to have one connection to the cloud broker, because if you are at home and your internet connection is down you can not control any device. Having a connection directly to your home MQTT broker is covering this scenario.

The mobile application first is connecting to the local MQTT broker and if is not succeed ( means you are not at home) it connecting to the cloud MQTT broker. This is done automatically and is transparent to the user.

As you can see no port forwarding, nothing to do in your router.

My IoT home control system

Thursday, April 21, 2016

Mqtt broker on ESP8266 #3

Good news today !! In my previous post I've said that I'll add the noPoll for websockets, but I've decided that will be better to write my own websocket part. And it works !!! 

So, to recap what I have for now on this ESP8266 module:


  • MQTT broker functionality
  • Bridging data to/from and another MQTT broker ( usually a cloud MQTT instance)
  • websockets connectivity ( I can now connect with my Homy application directly to the ESP8266 acting as an MQTT broker)

To do list:

  • webconfig interface.  Done!

Previous posts: