NodeManager: TTP229 does not send Passcode



  • Hello!
    Can you please tell me why the node with the TCP229 does not send the Passcode to my gateway.
    I see that this node sends the battery level, creates a topic in the mqtt. I see in the debugger in the console that the buttons are being pressed, but nothing happens after that. Unfortunately, for TTP229 devices there is little information in the documentation of the NodeManager and I do not understand what needs to be done to make everything work correctly.
    Here is my current code.

    // General settings
    #define SKETCH_NAME "KeyPad Node"
    #define SKETCH_VERSION "1.0.1"
    #define MY_DEBUG
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    #define MY_NODE_ID 55
    #define MY_RF24_SPI_SPEED (2*1000000ul)
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    #define MY_SPLASH_SCREEN_DISABLED
    
    /**********************************
     * MySensors gateway configuration
     */
     
    #define MY_MQTT_CLIENT_ID "KeyPad"
    
    /***********************************
     * NodeManager modules for supported sensors
     */
    
    #define USE_BATTERY
    #define USE_TTP
    
    /***********************************
     * NodeManager built-in features
     */
    
    // Enable/disable NodeManager's features
    #define FEATURE_DEBUG ON
    #define FEATURE_POWER_MANAGER OFF
    #define FEATURE_INTERRUPTS ON
    #define FEATURE_CONDITIONAL_REPORT OFF
    #define FEATURE_EEPROM OFF
    #define FEATURE_SLEEP ON
    #define FEATURE_RECEIVE ON
    #define FEATURE_TIME OFF
    #define FEATURE_RTC OFF
    #define FEATURE_SD OFF
    #define FEATURE_HOOKING OFF
    
    /***********************************
     * Load NodeManager Library
     */
    
    #include "NodeManagerLibrary.h"
    NodeManager node;
    
    /***********************************
     * Add your sensors below
     */
    
    // built-in sensors
    SensorBattery battery(node);
    SensorTTP ttp(node);
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);
    
      /*
      * Configure your sensors below
      */
    node.setReportIntervalSeconds(10);
    ttp.setPasscodeLength(4);
    node.setSleepMinutes(5);
    battery.setReportIntervalMinutes(10);
      /*
      * Configure your sensors above
      */
      node.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      node.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      node.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      node.loop();
    }
    
    #if FEATURE_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      node.receive(message);
    }
    #endif
    
    #if FEATURE_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      node.receiveTime(ts);
    }
    #endif
    

    Thank you in advance for your help!



  • The node manager TTP229 function Sensor;;TTP _fetchData() is set up for active HIGH signals, It seems that the 16-key ebay modules i have on hand use a active LOW as default.

    So two solutions either add a jumper on the keyboard module to make the signals active HIGH, or alter the function in _fetchData() to use active LOW signal.

    Also note that currently this function only reads keys 1 to 8, and the standard board also only outputs 1 to 8 so to read all 16 then both the module and the code needs modification.

    0_1527423341166_ttp229-16way Active High.png



  • @hard-shovel Many thanks for your advice!
    I still have one more incomprehensible moment. TTP229 is connected via a two-wire line, and in the settings you need to specify _dv_pin and _rst_pin. What pins should I specify in the settings?



  • The SdoPin and the DvPin need to be the same pin number as the SdoPin is used to read the serial data, and the DvPin is used to trigger the interrupt when a key is pressed so that the Arduino then reads the keyboard data.
    As this needs to be interrupt signal on a Arduino Mini, uno or nano 328P biased chip you only have the interrupts available on pins 2 and 3

    The reset RstPin is not used the the module in the photo, so this can be set to any unused pin, but is not connected to the module.

    I tested with the following code added to the before section

    /***********************************
     * SensorTTP Settings added to the before section.
     */
      // set the passcode length. Passcode will be sent to the controller only after this number of digits have been pressed (default: 4)
      ttp.setPasscodeLength(4);
      // set the clock pin (default: 6)
      ttp.setClockPin(5);       // can be any unsed arduino pin, Marked SCL on ttp229 keyboard module
      // set the SDO pin (default: 5)
      ttp.setSdoPin(2);         // Use arduino pins 2 or 3, Marked SDO on ttp229 keyboard module
      // set the DV pin (default: 3)
      ttp.setDvPin(2);          // Use arduino pins 2 or 3, Marked SDO on ttp229 keyboard module
      // set the RST pin (default: 4)
      //ttp.setRstPin(4);       // can be any unsed arduino pin, not connected to ttp229 keyboard module
      /*
      * Configure your sensors above
      */
      node.before();
    

    So adding this code and applying the yellow jumper, the node should send four digit passcodes using keys 1 to 8



  • @hard-shovel Thank you for your explanations!
    Tomorrow I'll try it.



  • Hi @hard-shovel !

    Unfortunately, your advice did not help me. I see in the debugger that an interrupt is continually being processed, but reading the buttons does not happen :(.



  • @igork Hi
    I am not sure of your problem.
    Attached is my test code for the 8 key version.
    This uses the nodemanager 1.7 downloaded yesterday.

    On the keyboard make sure that you have a jumper in the second pair of pins on the lower row.
    Connect SCL on module to pin 5, Connect SDO to pin 2.

    0_1527509625474_IMG_4074.JPG

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2016 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
    
     DESCRIPTION
    
    NodeManager is intended to take care on your behalf of all those common tasks that a 
    MySensors node has to accomplish, speeding up the development cycle of your projects. 
    Consider it as a sort of frontend for your MySensors projects. When you need to add 
    a sensor (which requires just uncommeting a single line),
    NodeManager will take care of importing the required library, presenting the sensor 
    to the gateway/controller, executing periodically the main function of the sensor 
    (e.g. measure a temperature, detect a motion, etc.), allowing you to interact with 
    the sensor and even configuring it remotely.
    
    Documentation available on: https://github.com/mysensors/NodeManager
    NodeManager provides built-in implementation of a number of sensors through ad-hoc 
    classes. 
    
    To use a buil-in sensor:
    * Install the required library if any
    * Enable the corresponding module (uncomment it) in the main sketch
    * Declare the sensor (uncomment it) in the main sketch
    
    Once created, the sensor will automatically present one or more child to the gateway 
    and controller. A list of buil-in sensors, module to enable, required dependencies 
    and the number of child automatically created is presented below:
    
    Sensor Name              |#Child | Module to enable   | Description                                                                                       | Dependencies
    -------------------------|-------|--------------------|---------------------------------------------------------------------------------------------------|----------------------------------------------------------
    SensorBattery            | 1     | USE_BATTERY        | Built-in sensor for automatic battery reporting                                                   | - 
    SensorSignal             | 1     | USE_SIGNAL         | Built-in sensor for automatic signal level reporting                                              | -
    SensorConfiguration      | 1     | USE_CONFIGURATION  | Built-in sensor for OTA remote configuration of any registered sensor                             | -
    SensorAnalogInput        | 1     | USE_ANALOG_INPUT   | Generic analog sensor, return a pin's analog value or its percentage                              | -
    SensorLDR                | 1     | USE_ANALOG_INPUT   | LDR sensor, return the light level of an attached light resistor in percentage                    | -
    SensorRain               | 1     | USE_ANALOG_INPUT   | Rain sensor, return the percentage of rain from an attached analog sensor                         | -
    SensorSoilMoisture       | 1     | USE_ANALOG_INPUT   | Soil moisture sensor, return the percentage of moisture from an attached analog sensor            | -
    SensorThermistor         | 1     | USE_THERMISTOR     | Thermistor sensor, return the temperature based on the attached thermistor                        | -
    SensorML8511             | 1     | USE_ML8511         | ML8511 sensor, return UV intensity                                                                | -
    SensorACS712             | 1     | USE_ACS712         | ACS712 sensor, measure the current going through the attached module                              | -
    SensorDigitalInput       | 1     | USE_DIGITAL_INPUT  | Generic digital sensor, return a pin's digital value                                              | -
    SensorDigitalOutput      | 1     | USE_DIGITAL_OUTPUT | Generic digital output sensor, allows setting the digital output of a pin to the requested value  | -
    SensorRelay              | 1     | USE_DIGITAL_OUTPUT | Relay sensor, allows activating the relay                                                         | -
    SensorLatchingRelay1Pin  | 1     | USE_DIGITAL_OUTPUT | Latching Relay sensor, allows toggling the relay with a pulse on the configured pin               | -
    SensorLatchingRelay2Pins | 1     | USE_DIGITAL_OUTPUT | Latching Relay sensor, allows turing the relay on and off with a pulse on the configured pins     | -
    SensorDHT11              | 2     | USE_DHT            | DHT11 sensor, return temperature/humidity based on the attached DHT sensor                        | https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT
    SensorDHT22              | 2     | USE_DHT            | DHT22 sensor, return temperature/humidity based on the attached DHT sensor                        | https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT
    SensorSHT21              | 2     | USE_SHT21          | SHT21 sensor, return temperature/humidity based on the attached SHT21 sensor                      | https://github.com/SodaqMoja/Sodaq_SHT2x
    SensorHTU21D             | 2     | USE_SHT21          | HTU21D sensor, return temperature/humidity based on the attached HTU21D sensor                    | https://github.com/SodaqMoja/Sodaq_SHT2x
    SensorInterrupt          | 1     | USE_INTERRUPT      | Generic interrupt-based sensor, wake up the board when a pin changes status                       | -
    SensorDoor               | 1     | USE_INTERRUPT      | Door sensor, wake up the board and report when an attached magnetic sensor has been opened/closed | -
    SensorMotion             | 1     | USE_INTERRUPT      | Motion sensor, wake up the board and report when an attached PIR has triggered                    | -
    SensorDs18b20            | 1+    | USE_DS18B20        | DS18B20 sensor, return the temperature based on the attached sensor                               | https://github.com/milesburton/Arduino-Temperature-Control-Library
    SensorBH1750             | 1     | USE_BH1750         | BH1750 sensor, return light level in lux                                                          | https://github.com/claws/BH1750
    SensorMLX90614           | 2     | USE_MLX90614       | MLX90614 contactless temperature sensor, return ambient and object temperature                    | https://github.com/adafruit/Adafruit-MLX90614-Library
    SensorBME280             | 4     | USE_BME280         | BME280 sensor, return temperature/humidity/pressure based on the attached BME280 sensor           | https://github.com/adafruit/Adafruit_BME280_Library
    SensorBMP085             | 3     | USE_BMP085_180     | BMP085 sensor, return temperature and pressure                                                    | https://github.com/adafruit/Adafruit-BMP085-Library
    SensorBMP180             | 3     | USE_BMP085_180     | BMP180 sensor, return temperature and pressure                                                    | https://github.com/adafruit/Adafruit-BMP085-Library
    SensorBMP280             | 3     | USE_BMP280         | BMP280 sensor, return temperature/pressure based on the attached BMP280 sensor                    | https://github.com/adafruit/Adafruit_BMP280_Library
    SensorSonoff             | 1     | USE_SONOFF         | Sonoff wireless smart switch                                                                      | https://github.com/thomasfredericks/Bounce2
    SensorHCSR04             | 1     | USE_HCSR04         | HC-SR04 sensor, return the distance between the sensor and an object                              | https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/NewPing
    SensorMCP9808            | 1     | USE_MCP9808        | MCP9808 sensor, measure the temperature through the attached module                               | https://github.com/adafruit/Adafruit_MCP9808_Library
    SensorMQ                 | 1     | USE_MQ             | MQ sensor, return ppm of the target gas                                                           | -
    SensorMHZ19              | 1     | USE_MHZ19          | MH-Z19 CO2 sensor via UART (SoftwareSerial, default on pins 6(Rx) and 7(Tx)                       | -
    SensorAM2320             | 2     | USE_AM2320         | AM2320 sensors, return temperature/humidity based on the attached AM2320 sensor                   | https://github.com/thakshak/AM2320
    SensorTSL2561            | 1     | USE_TSL2561        | TSL2561 sensor, return light in lux                                                               | https://github.com/adafruit/TSL2561-Arduino-Library
    SensorPT100              | 1     | USE_PT100          | DFRobot Driver high temperature sensor, return the temperature from the attached PT100 sensor     | -
    SensorDimmer             | 1     | USE_DIMMER         | Generic dimmer sensor used to drive a pwm output                                                  | -
    SensorRainGauge          | 1     | USE_PULSE_METER    | Rain gauge sensor                                                                                 | -
    SensorPowerMeter         | 1     | USE_PULSE_METER    | Power meter pulse sensor                                                                          | -
    SensorWaterMeter         | 1     | USE_PULSE_METER    | Water meter pulse sensor                                                                          | -
    SensorPlantowerPMS       | 3     | USE_PMS            | Plantower PMS particulate matter sensors (reporting PM<=1.0, PM<=2.5 and PM<=10.0 in µg/m³)       | https://github.com/fu-hsi/pms
    SensorVL53L0X            | 1     | USE_VL53L0X        | VL53L0X laser time-of-flight distance sensor via I²C, sleep pin supported (optional)              | https://github.com/pololu/vl53l0x-arduino
    DisplaySSD1306           | 1     | USE_SSD1306        | SSD1306 128x64 OLED display (I²C); By default displays values of all sensors and children         | https://github.com/greiman/SSD1306Ascii.git
    SensorSHT31              | 2     | USE_SHT31          | SHT31 sensor, return temperature/humidity based on the attached SHT31 sensor                      | https://github.com/adafruit/Adafruit_SHT31
    SensorSI7021             | 2     | USE_SI7021         | SI7021 sensor, return temperature/humidity based on the attached SI7021 sensor                    | https://github.com/sparkfun/SparkFun_Si701_Breakout_Arduino_Library
    SensorChirp              | 3     | USE_CHIRP          | Chirp soil moisture sensor (includes temperature and light sensors)                               | https://github.com/Apollon77/I2CSoilMoistureSensor
    DisplayHD44780           | 1     | USE_HD44780        | Supports most Hitachi HD44780 based LCDs, by default displays values of all sensors and children  | https://github.com/cyberang3l/NewLiquidCrystal
    SensorTTP                | 1     | USE_TTP            | TTP226/TTP229 Touch control sensor                                                                | -
    SensorServo              | 1     | USE_SERVO          | Control a generic Servo motor sensor                                                              | -
    SensorAPDS9960           | 1     | USE_APDS9960       | SparkFun RGB and Gesture Sensor                                                                   | https://github.com/sparkfun/APDS-9960_RGB_and_Gesture_Sensor
    SensorNeopixel           | 1     | USE_NEOPIXEL       | Control a Neopixel LED                                                                            | https://github.com/adafruit/Adafruit_NeoPixel
    
    NodeManager provides useful built-in features which can be disabled if you need 
    to save some storage for your code. To enable/disable a buil-in feature:
    * Install the required library if any
    * Enable the corresponding feature by setting it to ON in the main sketch. To 
    disable it, set it to OFF
    * When a feature is enabled additional functions may be made available. Have a look 
    at the API documentation for details
    
    A list of buil-in features and the required dependencies is presented below:
    
    Feature                     | Default | Description                                                                                      | Dependencies
    ----------------------------|---------|--------------------------------------------------------------------------------------------------|----------------------------------------------------------
    FEATURE_DEBUG               | ON      | NodeManager's debug output on serial console                                                     | - 
    FEATURE_POWER_MANAGER       | ON      | allow powering on your sensors only while the node is awake                                      | - 
    FEATURE_INTERRUPTS          | ON      | allow managing interrupt-based sensors like a PIR or a door sensor                               | - 
    FEATURE_CONDITIONAL_REPORT  | ON      | allow reporting a measure only when different from the previous or above/below a given threshold | - 
    FEATURE_EEPROM              | ON      | allow keeping track of some information in the EEPROM                                            | - 
    FEATURE_SLEEP               | ON      | allow managing automatically the complexity behind battery-powered sleeping sensors              | - 
    FEATURE_RECEIVE             | ON      | allow the node to receive messages; can be used by the remote API or for triggering the sensors  | - 
    FEATURE_TIME                | OFF     | allow keeping the current system time in sync with the controller                                | https://github.com/PaulStoffregen/Time
    FEATURE_RTC                 | OFF     | allow keeping the current system time in sync with an attached RTC device (requires FEATURE_TIME)| https://github.com/JChristensen/DS3232RTC
    FEATURE_SD                  | OFF     | allow reading from and writing to SD cards                                                       | -
    FEATURE_HOOKING             | OFF     | allow custom code to be hooked in the out of the box sensors                                     | -
    **/
    
    /**********************************
     * MySensors node configuration
     */
    
    // General settings
    #define SKETCH_NAME "NodeManager Keyboard"
    #define SKETCH_VERSION "1.0"
    #define MY_DEBUG
    //#define MY_NODE_ID 99
    #define MY_NODE_ID 55         // IgorK keypad
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    //#define MY_RF24_ENABLE_ENCRYPTION
    //#define MY_RF24_CHANNEL 125
    /**
     * RF channel for the sensor net, 0-125.
     * Frequence: 2400 Mhz - 2525 Mhz Channels: 126
     * http://www.mysensors.org/radio/nRF24L01Plus.pdf
     * 0 => 2400 Mhz (RF24 channel 1)
     * 1 => 2401 Mhz (RF24 channel 2)
     * 76 => 2476 Mhz (RF24 channel 77)
     * 83 => 2483 Mhz (RF24 channel 84)
     * 124 => 2524 Mhz (RF24 channel 125)
     * 125 => 2525 Mhz (RF24 channel 126)
     * In some countries there might be limitations, in Germany for example only the range 2400,0 - 2483,5 Mhz is allowed
     * http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Frequenzen/Allgemeinzuteilungen/2013_10_WLAN_2,4GHz_pdf.pdf
     */
    // Set the NRF24 Radio Channel,   Default is chanel 76 
    #define MY_RF24_CHANNEL  76   // na 0x4C Default is chanel 76
    //#define MY_RF24_CHANNEL  83   // na 0x53 use 83 for test channel
    //#define MY_RF24_CHANNEL  24   // na 0x18 use channel 24 for Upstairs
    //#define MY_RF24_CHANNEL  25   // na 0x19 use 25 for Ethernet 2 test channel
    //#define MY_RF24_CHANNEL  86   // na 0x56 use channel 86 for Downstairs 
    //#define MY_RF24_CHANNEL  124   // na 0x7C use channel 124 for Wifi-2 
    
    //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
    //#define MY_DEBUG_VERBOSE_RF24
    //#define MY_RF24_DATARATE RF24_250KBPS
    
    
    // RFM69 radio settings
    //#define MY_RADIO_RFM69
    //#define MY_RFM69_FREQUENCY RFM69_433MHZ
    //#define MY_IS_RFM69HW
    //#define MY_RFM69_NEW_DRIVER
    //#define MY_RFM69_ENABLE_ENCRYPTION
    //#define MY_RFM69_NETWORKID 100
    //#define MY_DEBUG_VERBOSE_RFM69
    //#define MY_RF69_IRQ_PIN D1
    //#define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
    //#define MY_RF69_SPI_CS D2
    //#define MY_RFM69_ATC_MODE_DISABLED
    
    // RFM95 radio settings
    //#define MY_RADIO_RFM95
    //#define MY_RFM95_FREQUENCY (RFM95_868MHZ)
    //#define MY_DEBUG_VERBOSE_RFM95
    //#define MY_RFM95_MAX_POWER_LEVEL_DBM (20)
    //#define MY_RFM95_IRQ_PIN D1
    //#define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
    //#define MY_RFM95_CS_PIN D8
    
    // RS485 serial transport settings
    //#define MY_RS485
    //#define MY_RS485_BAUD_RATE 9600
    //#define MY_RS485_DE_PIN 2
    //#define MY_RS485_MAX_MESSAGE_LENGTH 40
    //#define MY_RS485_HWSERIAL Serial1
    
    // Message signing settings
    //#define MY_SIGNING_SOFT
    //#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
    //#define MY_SIGNING_REQUEST_SIGNATURES
    //#define MY_SIGNING_ATSHA204
    //#define MY_SIGNING_ATSHA204_PIN 4
    //#define MY_SIGNING_REQUEST_SIGNATURES
    
    // OTA Firmware update settings
    //#define MY_OTA_FIRMWARE_FEATURE
    //#define OTA_WAIT_PERIOD 300
    //#define FIRMWARE_MAX_REQUESTS 2
    //#define MY_OTA_RETRY 2
    
    // Advanced settings
    #define MY_BAUD_RATE 9600
    //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
    #define MY_SPLASH_SCREEN_DISABLED
    //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
    //#define MY_SIGNAL_REPORT_ENABLED
    
    // Optimizations when running on 2032 Coin Cell. Also set node.setSleepBetweenSend(500) and run the board at 1Mhz
    //#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    //#define MY_TRANSPORT_WAIT_READY_MS  5000
    //#define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 2000
    //#define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    
    /**********************************
     * MySensors gateway configuration
     */
     
    // Common gateway settings
    //#define MY_REPEATER_FEATURE
    
    // Serial gateway settings
    //#define MY_GATEWAY_SERIAL
    
    // Ethernet gateway settings
    //#define MY_GATEWAY_W5100
    
    // ESP8266 gateway settings
    //#define MY_GATEWAY_ESP8266
    //#define MY_ESP8266_SSID ""
    //#define MY_ESP8266_PASSWORD ""
    
    // Gateway networking settings
    //#define MY_IP_ADDRESS 192,168,178,87
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
    //#define MY_PORT 5003
    //#define MY_GATEWAY_MAX_CLIENTS 2
    //#define MY_USE_UDP
    
    // Gateway MQTT settings
    //#define MY_GATEWAY_MQTT_CLIENT
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
    //#define MY_PORT 1883
    //#define MY_MQTT_USER "username"
    //#define MY_MQTT_PASSWORD "password"
    //#define MY_MQTT_CLIENT_ID "mysensors-1"
    #define MY_MQTT_CLIENT_ID "KeyPad"    // IgorK keypad
    //#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
    //#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
    
    // Gateway inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    //#define MY_INCLUSION_BUTTON_FEATURE
    //#define MY_INCLUSION_MODE_DURATION 60
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Gateway Leds settings
    //#define MY_DEFAULT_ERR_LED_PIN 4
    //#define MY_DEFAULT_RX_LED_PIN  5
    //#define MY_DEFAULT_TX_LED_PIN  6
    
    /***********************************
     * NodeManager modules for supported sensors
     */
    
    //#define USE_BATTERY
    //#define USE_SIGNAL
    //#define USE_CONFIGURATION
    //#define USE_ANALOG_INPUT
    //#define USE_THERMISTOR
    //#define USE_ML8511
    //#define USE_ACS712
    //#define USE_DIGITAL_INPUT
    //#define USE_DIGITAL_OUTPUT
    //#define USE_DHT
    //#define USE_SHT21
    //#define USE_INTERRUPT
    //#define USE_DS18B20
    //#define USE_BH1750
    //#define USE_MLX90614
    //#define USE_BME280
    //#define USE_BMP085_180
    //#define USE_BMP280
    //#define USE_SONOFF
    //#define USE_HCSR04
    //#define USE_MCP9808
    //#define USE_MQ
    //#define USE_MHZ19
    //#define USE_AM2320
    //#define USE_TSL2561
    //#define USE_PT100
    //#define USE_DIMMER
    //#define USE_PULSE_METER
    //#define USE_PMS
    //#define USE_VL53L0X
    //#define USE_SSD1306
    //#define USE_SHT31
    //#define USE_SI7021
    //#define USE_CHIRP
    //#define USE_HD44780
    //#define USE_TTP
    #define USE_TTP     // IgorK keypad
    //#define USE_SERVO
    //#define USE_APDS9960
    //#define USE_NEOPIXEL
    
    /***********************************
     * NodeManager built-in features
     */
    
    // Enable/disable NodeManager's features
    #define FEATURE_DEBUG ON                  // as IgorK keypad
    //#define FEATURE_POWER_MANAGER OFF
    #define FEATURE_POWER_MANAGER ON          // IgorK keypad
    #define FEATURE_INTERRUPTS ON             // as IgorK keypad
    #define FEATURE_CONDITIONAL_REPORT OFF    // as IgorK keypad
    #define FEATURE_EEPROM OFF                // as IgorK keypad
    #define FEATURE_SLEEP ON                  // as IgorK keypad
    #define FEATURE_RECEIVE ON                // as IgorK keypad
    #define FEATURE_TIME OFF                  // as IgorK keypad
    #define FEATURE_RTC OFF                   // as IgorK keypad
    #define FEATURE_SD OFF                    // as IgorK keypad
    #define FEATURE_HOOKING OFF               // as IgorK keypad
    
    /***********************************
     * Load NodeManager Library
     */
    
    #include "NodeManagerLibrary.h"
    NodeManager node;
    
    /***********************************
     * Add your sensors below
     */
    
    // built-in sensors
    //SensorBattery battery(node);
    //SensorConfiguration configuration(node);
    //SensorSignal signal(node);
    //PowerManager power(5,6);
    
    // Attached sensors
    //SensorAnalogInput analog(node,A0);
    //SensorLDR ldr(node,A0);
    //SensorRain rain(node,A0);
    //SensorSoilMoisture soil(node,A0);
    //SensorThermistor thermistor(node,A0);
    //SensorML8511 ml8511(node,A0);
    //SensorACS712 acs712(node,A0);
    //SensorDigitalInput digitalIn(node,6);
    //SensorDigitalOutput digitalOut(node,6);
    //SensorRelay relay(node,6);
    //SensorLatchingRelay1Pin latching1pin(node,6);
    //SensorLatchingRelay2Pins latching2pins(node,6,7);
    //SensorDHT11 dht11(node,6);
    //SensorDHT22 dht22(node,6);
    //SensorSHT21 sht21(node);
    //SensorHTU21D htu21(node);
    //SensorInterrupt interrupt(node,3);
    //SensorDoor door(node,3);
    //SensorMotion motion(node,3);
    //SensorDs18b20 ds18b20(node,6);
    //SensorBH1750 bh1750(node);
    //SensorMLX90614 mlx90614(node);
    //SensorBME280 bme280(node);
    //SensorBMP085 bmp085(node);
    //SensorBMP180 bmp180(node);
    //SensorBMP280 bmp280(node);
    //SensorSonoff sonoff(node);
    //SensorHCSR04 hcsr04(node,6);
    //SensorMCP9808 mcp9808(node);
    //SensorMQ mq(node,A0);
    //SensorMHZ19 mhz19(node,6,7);
    //SensorAM2320 am2320(node);
    //SensorTSL2561 tsl2561(node);
    //SensorPT100 pt100(node,6);
    //SensorDimmer dimmer(node,3);
    //SensorRainGauge rainGauge(node,3);
    //SensorPowerMeter powerMeter(node,3);
    //SensorWaterMeter waterMeter(node,3);
    //SensorPlantowerPMS pms(node,6,7);
    //SensorVL53L0X vl53l0x(node,3);
    //DisplaySSD1306 ssd1306(node);
    //SensorSHT31 sht31(node);
    //SensorSI7021 si7021(node);
    //SensorChirp chirp(node);
    //DisplayHD44780 hd44780(node);
    //SensorTTP ttp(node);
    SensorTTP ttp(node);                  // IgorK keypad
    //SensorServo servo(node,6);
    //SensorAPDS9960 apds9960(node,3);
    //SensorNeopixel neopixel(node,6);
    
    
    
    
    /***********************************
     * Main Sketch
     */
    
    // before
    void before() {
      // setup the serial port baud rate
      Serial.begin(MY_BAUD_RATE);
      /*
      * Configure your sensors below
      */
      // report measures of every attached sensors every 10 seconds
      //node.setReportIntervalSeconds(10);
      // report measures of every attached sensors every 10 minutes
      //node.setReportIntervalMinutes(10);
      // set the node to sleep in 30 seconds cycles
      //node.setSleepSeconds(30);
      // set the node to sleep in 5 minutes cycles
      //node.setSleepMinutes(5);
      // report battery level every 10 minutes
      //battery.setReportIntervalMinutes(10);
      // set an offset to -1 to a thermistor sensor
      //thermistor.setOffset(-1);
      // change the id of a the first child of a sht21 sensor
      //sht21.children.get(1)->setChildId(5);
      // report only when the analog value is above 40%
      //analog.children.get(1)->setMinThreshold(40);
      // power all the nodes through dedicated pins
      //node.setPowerManager(power);
    
      
    /***********************************
     * SensorTTP Settings
     */
      // set the passcode length. Passcode will be sent to the controller only after this number of digits have been pressed (default: 4)
      ttp.setPasscodeLength(4);
      // set the clock pin (default: 6)
      ttp.setClockPin(5);       // can be any unsed arduino pin, Marked SCL on ttp229 keyboard module
      // set the SDO pin (default: 5)
      ttp.setSdoPin(2);         // Use arduino pins 2 or 3, Marked SDO on ttp229 keyboard module
      // set the DV pin (default: 3)
      ttp.setDvPin(2);          // Use arduino pins 2 or 3, Marked SDO on ttp229 keyboard module
      // set the RST pin (default: 4)
      //ttp.setRstPin(4);       // can be any unsed arduino pin, not connected to ttp229 keyboard module
      /*
      * Configure your sensors above
      */
      node.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      node.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      node.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      node.loop();
    }
    
    #if FEATURE_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      node.receive(message);
    }
    #endif
    
    #if FEATURE_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      node.receiveTime(ts);
    }
    #endif
    
    

    [0_1527509798850_NodeManager_Keyboard.rar](Uploading 100%)



  • using the above code you should get debug similar to below when pressing keys 1234 and then keys 5678.

    0 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0-alpha
    49 MCO:BGN:BFR
    NodeManager v1.7
    LIB V=2.3.0-alpha R=N E=- T=N A=A S=- B=-
    TTP I=1 P=36 T=47
    RADIO...88 TSM:INIT
    167 TSF:WUR:MS=0
    192 TSM:INIT:TSP OK
    212 TSM:INIT:STATID=55
    237 TSF:SID:OK,ID=55
    260 TSM:FPAR
    309 TSF:MSG:SEND,55-55-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2383 !TSM:FPAR:NO REPLY
    2408 TSM:FPAR
    2457 TSF:MSG:SEND,55-55-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    3528 TSF:MSG:READ,0-0-55,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    3586 TSF:MSG:FPAR OK,ID=0,D=1
    4534 TSM:FPAR:OK
    4550 TSM:ID
    4564 TSM:ID:OK
    4579 TSM:UPL
    4595 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    4706 TSF:MSG:READ,0-0-55,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    4765 TSF:MSG:PONG RECV,HP=1
    4794 TSM:UPL:OK
    4810 TSM:READY:ID=55,PAR=0,DIS=1
    4847 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    4923 TSF:MSG:READ,0-0-55,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    4988 TSF:MSG:SEND,55-55-0-0,s=255,c=0,t=17,pt=0,l=11,sg=0,ft=0,st=OK:2.3.0-alpha
    5074 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    OK
    7149 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=11,pt=0,l=20,sg=0,ft=0,st=OK:NodeManager Keyboard
    7245 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    PRES I=1 T=36 D=TTP
    7323 TSF:MSG:SEND,55-55-0-0,s=1,c=0,t=36,pt=0,l=3,sg=0,ft=0,st=OK:TTP
    READY
    
    7415 MCO:REG:REQ
    7444 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    7518 TSF:MSG:READ,0-0-55,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    7577 MCO:PIM:NODE REG=1
    7602 MCO:BGN:STP
    MY I=55 M=1
    INT P=3 M=255
    INT P=2 M=3
    7622 MCO:BGN:INIT OK,TSP=1
    INT P=2, V=1
    TTP I=1 D=1
    1
    INT P=2, V=1
    TTP I=1 D=2
    2
    INT P=2, V=1
    INT P=2, V=1
    TTP I=1 D=3
    3
    INT P=2, V=1
    INT P=2, V=1
    TTP I=1 D=4
    4
    TTP I=1 V=1234
    SEND D=0 I=1 C=0 T=47 S= I=0 F=0.00
    18980 TSF:MSG:SEND,55-55-0-0,s=1,c=1,t=47,pt=5,l=4,sg=0,ft=0,st=OK:1234
    169654 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    169715 TSF:MSG:BC
    170510 TSF:MSG:SEND,55-55-0-0,s=255,c=3,t=21,pt=1,l=1,sg=0,ft=0,st=OK:0
    INT P=2, V=1
    TTP I=1 D=5
    1
    INT P=2, V=1
    TTP I=1 D=6
    2
    INT P=2, V=1
    INT P=2, V=1
    TTP I=1 D=7
    3
    INT P=2, V=1
    INT P=2, V=1
    TTP I=1 D=8
    4
    TTP I=1 V=5678
    SEND D=0 I=1 C=0 T=47 S= I=0 F=0.00
    209813 TSF:MSG:SEND,55-55-0-0,s=1,c=1,t=47,pt=5,l=4,sg=0,ft=0,st=OK:5678
    

  • Contest Winner

    @hard-shovel @igork hi guys, I've just come across this thread. Not sure if you got the problem solved, if not, please let me know or open an issue on the NodeManager's github page. Thanks!


 

306
Online

8.0k
Users

8.8k
Topics

94.4k
Posts