ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..



  • Folks,

    I'd like to share a project I've been working on recently, an ESP32 based IoT gateway/control hub with TFT, touch and more:

    Features
    Powered by the popular ESP32 SoC
    ILI9341 based 2.4″ TFT with resistive touch, PWM dimming control
    Light sensor (LDR)
    433Mhz RFM69 ISM radio
    One WS2812B RGB LED (Neopixel)
    Piezo buzzer for audible feedback
    HTU21D/SHT21 temperature/humidity sensor
    DS1338 real-time clock with battery backup
    Four multi-purpose buttons
    Option for ATSHA204 crypto authentication device

    Front:
    alt text

    Back:
    alt text

    3D printable enclosure:
    alt text

    The project was designed to be compatible with LittlevGL, the free and open-source graphics library providing everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects, and low memory footprint.

    As an example, I have created a MQTT Christmas lights controller, Arduino example code available on Github
    alt text

    More details, schematic and code: TFT32



  • Nice project!

    Which TFT do you use?



  • I used a bare ILI9341 with resistive touch, a 2.4" TFT with 320x200 resolution. Relatively small, yet does the job well.


  • Hardware Contributor

    @martin-harizanov that's a very interesting project, and thank you for pointing out to LittlevGL I didn't know about it, it seems really great. I'm working on an ESP32 project, too, and this library will save me a lot of time !

    And yes nice lcd controller, fast and available from 2'' to 3.2'' with the same physical interface than the one you use.



  • @nca78 I am loving LittlevGL; it makes touch enable GUI development so much easier..



  • Hi,
    First time post.
    I'm looking at setting up a MySensors network at home (two buildings) and I'm very interested in your project as a general MySensors MQTT gateway to my openHAB system.

    From a hardware perspective, this is pretty much what I was looking for (ESP32 & 915MHZ interface). The only thing I would change would be to add external antenna connections to the ESP32 and the RFM69 module.

    Are making the boards publicly available? Even as unloaded blanks?
    I'm located in Australia.

    Thanks,
    Neil.



  • Hi Neil,
    I use the RFM69HW module on the TFT32, which is the high power version of the RFM69. With this setup, I was able to ping remote nodes (Moteinos with RFM69) ~300m away with no issues, but I live in a suburb with little RF noise.
    I will probably have yet another PCB revision at some point (BTW this is 6th revision already ), that will have external antenna option, plus footprint for RFM95 LoRa.

    At this point, I decided to only provide the TFT32 schematic, example code and completed boards



  • @martin-harizanov
    Hi Martin,
    Will the current software act as a MQTT gateway between mysensor boards and external software such as openhab? Basically pickup a temperature from a mysensor board and send this to a MQTT broker.

    Where do I purchase a completed board and how much are they?
    I have a 3d printer, so able to print my own enclosure. Are you making the STL available or selling this as well?

    Thanks,
    Neil.



  • @nw27

    What you describe is completely doable with TFT32, but the example I linked in the first post doesn't utilize the RFM69 (although I have an RFM69 basic example in the Github repo). The linked "Christmas tree controller" example only provides two touch GUI switches and links (in both directions) those to MQTT topics. So you can either touch the GUI and a message gets sent to the MQTT topic, or you publish 0 or 1 (off/on) to the respective topic from another application (say openhab) and the GUI gets toggled as well to represent the current state.
    I will add a sensor gateway (RFM69<-->MQTT) example at some point as well.

    There is a link to the 3D printable enclosure as STL in the TFT32 Wiki page, and also a link to the e-store on my blog, where you can grab a TFT32.
    Alternatively, you can build your own breadboard version with readily available components using the schematic, and provided sample code.



  • @Martin-Harizanov Great job Martin! I like and use the ESP32 since it was introduced.
    If I would order the TFT32 without the RFM69HW (39€) and would replace it with my RFM95 (LoRa) modules.
    The RFM69HW (only the HW version) and the RFM95 have the same pinouts right? Can you confirm that? I only use RFM95, no RFM69.



  • @heinzv No, unfortunately the RFM69HW and RFM95 have different footprints, so that won't work



  • @martin-harizanov said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    RFM69HW

    oh, that is bad luck. I had one RFM69 in mind (I think the HCW) which is pin compatible with the RFM95. Ranseyer made one PCB which can take a RFM69 or RFM95 at the same place (just in case somebody still want to use the RFM69).
    Then I can't order it. However, a great project.


  • Contest Winner

    @martin-harizanov said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    LittlevGL,

    Thanx for LittlevGL, it's something I was looking for something like this a while ago, but couldn't find it when I needed it. I started to develop my own Graphics library but this by for easier.



  • Hi Martin,
    I've placed an order for one of your TFT32 units.
    I want to use this as a MQTT gateway to mysensor devices. It would be great if the gateway supported the MQTT auto discovery protocol (homie 3 ) https://homieiot.github.io/
    It would be good if the tft32 showed the incoming/outgoing messages on the screen.

    Now i need some 915Mhz mysensor boards. I currently have no mysensor equipment.
    I'm looking for PIR movement, temp/humidity, door/window.
    Any suggestions on units?

    Thanks,
    Neil.



  • @nw27 said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    MQTT auto discovery protocol (homie 3 )

    The "homie convention" sounds interesting. I will take a look, I think standardization on this subject is long overdue.

    RE: It would be good if the tft32 showed the incoming/outgoing messages on the screen.

    That would, of course, be possible, with some modifications to the firmware. What would be more interesting, in my view, is to discover the type of message and visualize accordingly i.e. temperatures as a gauge, switches as a toggle switch etc. based on the "homie convention". Such software will require significant effort

    RE: Now i need some 915Mhz mysensor boards. I currently have no mysensor equipment. I'm looking for PIR movement, temp/humidity, door/window.

    TFT32 has a 433Mhz RFM69HW , and you mention 915Mhz. These won't be compatible. I also offer TFT32 without RFM69HW, so you can buy your own 915Mhz version and solder it.

    In general, you need battery operated nodes with 433Mhz RFM69s to be compatible with TFT32's RFM69HW@433Mhz, google for Moteino, but I believe there are RFM69 powered mysensor nodes as well.


  • Hardware Contributor

    looks nice 🙂
    your device could perhaps be better (radio performance) if there was nothing around and behind antennas, especially for a gw.
    I prefer webapp vs TFT, as it offers more design freedom and I'm often closer to my phone than to my devices like the gw.
    But I agree it can be useful in some others usecases.



  • @scalz said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    ) if there was nothing around and behind antennas, especially for a gw.
    I prefer webapp vs TFT, as it offers more design freedom and I'm often closer to my phone than to my devices like the gw.
    But I agree it can be useful in some others usecases.

    My issues with using my phone to access IoT devices at home are:

    • I can't control any of the devices at home when no internet connection is available (in a cloud IoT setup)
    • Guests/family members can't control room thermostats without access to my phone
    • It is a cost reduction by centralizing controls and simplifying actuators
    • independent from smart devices, I prefer to leave my phone away from my bedroom
    • The TFT32 can be used as an always-on reference, just look at it and you have all the information you need instead of checking it on the phone

    So basically this is why I needed this sort of a control hub.

    Regarding the RF interference, it actually works very well even so. For the future, I plan to have an external RF antenna option for the RFM69 and flip the WiFi sideways to where the buttons are. I'll probably get rid of the buttons as I don't use them.



  • @martin-harizanov
    Hi Martin,
    For the unit that I have ordered, could you please supply it with the minimal soldered connections on the RFM69 unit so that I can easily change it over for a 915Mhz version.
    I also not that you are saying RFM69HW as opposed to RFM69HCW as per the Moteino you suggested looking at.

    I was just going for the 915 because there appears to be significantly more consumer (retail) equipment on the 433MHz, including my current X10 equipment.
    I had also been told that 915MHz got in and around buildings better than 433 due to things like house wall frame spacing.
    Thanks,
    Neil.



  • @nw27 said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    RFM69HW as opposed to RFM69HCW as

    I mailed you a version with the RFM69HW unsoldered.

    RFM69, RFM69HW, RFM69HCW, and RFM69CW can all talk to each other; the 'H' indicates the 'high power' version and the 'CW' - compatible pinout i.e. smaller package. The CW version was more difficult to source at the time, so I decided to use the regular RFM69s. You can source 915Mhz RFM69 here.


  • Hardware Contributor

    Hi Martin, just a question regarding the touch screen after looking at the schematics, I'm curious about why you didn't use an XPT2046 for that ? As it costs nearly nothing, saves I/O pins and makes code a bit easier and possibly more reactive if you use interrupt, it's the ic that's used on the "pcb" version of the lcd.



  • @nca78 said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    XPT2046

    I don't use the XPT2046 or any external ICs , the ESP32 handles it. This approach "costs" 4 pins, but I wanted to keep the BOM smaller. Also, I had concerns about sharing the HSPI with XPT2046, as I use DMA and double video buffer in my projects, I wasn't sure that would work well. The VSPI is dedicated for RFM69, maybe it can be shared with XPT2046 without issues. I guess this is something to experiment with in the following PCB revision


  • Hardware Contributor

    @martin-harizanov I had no problem with shared HSPI for both lcd and touch sensor. I use Bodmer TFT eSPI (it manages both lcd and xpt2046 for touch) and it's impressively fast. I have shared with SD card too, and still no problem.
    https://github.com/Bodmer/TFT_eSPI
    But you will not save 4 i/o as you need at least a chip select for touch, and maybe interrupt pin.



  • @nca78 said in ESP32 based IoT gateway/control hub with TFT, touch, RFM69 and more..:

    Bodmer TFT eSPI

    Bodmer TFT eSPI is just a normal SPI driver, well maybe optimized a bit. The key to speed (IMHO) is to use double frame buffer and DMA for the SPI, that leaves the CPU free to process the next frame while the hardware does the SPI transfer. I am not aware of such TFT library for Arduino.


Log in to reply
 

Suggested Topics

  • 8
  • 29
  • 2
  • 1
  • 3
  • 44

21
Online

11.2k
Users

11.1k
Topics

112.5k
Posts